decocms 4.565.1 → 4.566.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 (389) hide show
  1. package/dist/client/assets/{AlertCircle-BavhHXrm.js → AlertCircle-vm4sk-x9.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CpdR-UAM.js → AreaChart-D7_hgduK.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-NHzfDSKs.js → ArrowLeft-DDdp1fkC.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-D6obKkNl.js → ArrowUp-DD_r1Y_T.js} +1 -1
  5. package/dist/client/assets/{CartesianChart-BuCntSQu.js → CartesianChart-DZaqdCN6.js} +1 -1
  6. package/dist/client/assets/{CategoricalChart-9YwAdaOL.js → CategoricalChart-Dannm-85.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-BZC8qNjY.js → CheckCircle-CO-Sp-gI.js} +1 -1
  8. package/dist/client/assets/{ChevronSelectorVertical-XtqZtaGN.js → ChevronSelectorVertical-BsQHRlTg.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-CP2Q1tno.js → ChevronUp-DzfCpOxS.js} +1 -1
  10. package/dist/client/assets/{CreditCard01-DSR9reUx.js → CreditCard01-Dg0W_VbM.js} +1 -1
  11. package/dist/client/assets/{Globe04-DsEVRQ8J.js → Globe04-CbE4fQfn.js} +1 -1
  12. package/dist/client/assets/{Key01-CACSt4gn.js → Key01-DnFTUPGs.js} +1 -1
  13. package/dist/client/assets/{LinkBroken01-Dhqzd5Xp.js → LinkBroken01-BrWXpfvW.js} +1 -1
  14. package/dist/client/assets/{Minus-CF20rGao.js → Minus-CGC-Ky2T.js} +1 -1
  15. package/dist/client/assets/{Monitor01-CTh24U4S.js → Monitor01-DPIeBRgo.js} +1 -1
  16. package/dist/client/assets/{Play-Dl9rHUIQ.js → Play-B9PgWZlg.js} +1 -1
  17. package/dist/client/assets/{Plus-CcxRdpHl.js → Plus-CZbPbPr7.js} +1 -1
  18. package/dist/client/assets/{ReferenceLine-DG_YV7QB.js → ReferenceLine-ZH8D8bPO.js} +1 -1
  19. package/dist/client/assets/{SearchMd-BvpUvADB.js → SearchMd-DseifSbW.js} +1 -1
  20. package/dist/client/assets/{ShoppingBag01-B2TVYCJe.js → ShoppingBag01-TG8T0GTy.js} +1 -1
  21. package/dist/client/assets/{Sun-CwYfSEKK.js → Sun-CBOZY0wW.js} +1 -1
  22. package/dist/client/assets/{SwitchHorizontal01-C6F9FLuz.js → SwitchHorizontal01-CTmes_jp.js} +1 -1
  23. package/dist/client/assets/{Tool01-BpRvGDMW.js → Tool01-BhHpHR3H.js} +1 -1
  24. package/dist/client/assets/{Tooltip-DyscjpNm.js → Tooltip-ClzMOV5r.js} +1 -1
  25. package/dist/client/assets/{Trash01-rMYgPi4D.js → Trash01-HGp7pYgQ.js} +1 -1
  26. package/dist/client/assets/{Upload01-CTvUgusS.js → Upload01-B2W5ZMg1.js} +1 -1
  27. package/dist/client/assets/{UserSquare-CeUdUVlp.js → UserSquare-6Sdby0FR.js} +1 -1
  28. package/dist/client/assets/{Users01-CgIFV9B4.js → Users01-DQRKjdTI.js} +1 -1
  29. package/dist/client/assets/{XClose-B8ZWakSs.js → XClose-DeFo1VOD.js} +1 -1
  30. package/dist/client/assets/{Zap-BheFKoJA.js → Zap-DalPfKev.js} +1 -1
  31. package/dist/client/assets/{access-gate-DetE2JQz.js → access-gate-QW6XL1k3.js} +1 -1
  32. package/dist/client/assets/{add-connection-dialog-HS2-iXa_.js → add-connection-dialog-DSHTc4iD.js} +1 -1
  33. package/dist/client/assets/agent-app-BOWDvrpS.js +1 -0
  34. package/dist/client/assets/{agent-assets-BVfyM3W2.js → agent-assets-DHBXzTkB.js} +1 -1
  35. package/dist/client/assets/{agent-automation-CFoval4K.js → agent-automation-CkV5B9AK.js} +1 -1
  36. package/dist/client/assets/{agent-automations-PQlm_1-3.js → agent-automations-M5aYunrZ.js} +1 -1
  37. package/dist/client/assets/{agent-calendar-JHkSgIaW.js → agent-calendar-DFReqWL3.js} +1 -1
  38. package/dist/client/assets/{agent-capabilities-D5dRez_U.js → agent-capabilities-D6AEfG_r.js} +1 -1
  39. package/dist/client/assets/{agent-connect-sources-DpIMd_nf.js → agent-connect-sources-BAUjcdOy.js} +1 -1
  40. package/dist/client/assets/agent-deck-Bx7kJg98.js +1 -0
  41. package/dist/client/assets/{agent-e2e-Co6-h6xW.js → agent-e2e-vXEqRzNY.js} +1 -1
  42. package/dist/client/assets/agent-experiments-DMJmKtxn.js +1 -0
  43. package/dist/client/assets/{agent-file-D2ltAo8E.js → agent-file-ByXLEOEk.js} +1 -1
  44. package/dist/client/assets/{agent-hosting-_jnJiyJB.js → agent-hosting-DN3p71Ic.js} +1 -1
  45. package/dist/client/assets/{agent-icon-WM9Nds86.js → agent-icon-CTjv6Gf3.js} +1 -1
  46. package/dist/client/assets/agent-library-_YpYk3se.js +1 -0
  47. package/dist/client/assets/agent-library-file-BGthAKoz.js +1 -0
  48. package/dist/client/assets/agent-overview-CunpO2WP.js +1 -0
  49. package/dist/client/assets/{agent-releases-Cs9chBHo.js → agent-releases-HbfAzMUb.js} +1 -1
  50. package/dist/client/assets/agent-settings-Cf2re97I.js +1 -0
  51. package/dist/client/assets/{agent-site-editor-CUzXKk_L.js → agent-site-editor-ZQQDb3Rx.js} +1 -1
  52. package/dist/client/assets/agent-site-editor-code-CBnPLDwR.js +2 -0
  53. package/dist/client/assets/agent-site-editor-content-BMrNzhJ0.js +1 -0
  54. package/dist/client/assets/agent-site-editor-preview-GFFDvuZl.js +1 -0
  55. package/dist/client/assets/agent-view-BoMty4cJ.js +1 -0
  56. package/dist/client/assets/{agent-view-guard-BxS78jGZ.js → agent-view-guard-CvY79irZ.js} +1 -1
  57. package/dist/client/assets/{ai-providers-Bg6XVNeS.js → ai-providers-hi0gzVEm.js} +1 -1
  58. package/dist/client/assets/{alert-U9tZtWPC.js → alert-CBNKTKcv.js} +1 -1
  59. package/dist/client/assets/{analytics-sections-_Da0sWct.js → analytics-sections-DLAuNCzk.js} +1 -1
  60. package/dist/client/assets/api-keys-3ZWG2OME.js +1 -0
  61. package/dist/client/assets/{api-keys-Bj6cZbJj.js → api-keys-BFyU3rHn.js} +1 -1
  62. package/dist/client/assets/{app-editor-DsNvlfaV.js → app-editor-D6EIgj3g.js} +1 -1
  63. package/dist/client/assets/{asset-utils-B5Sq3qKL.js → asset-utils-DC1EoBVm.js} +1 -1
  64. package/dist/client/assets/{auth-A_dHVlLy.js → auth-BZ5Ef56k.js} +1 -1
  65. package/dist/client/assets/{auth-catchall-C9DBUwY3.js → auth-catchall-DvKB5Itg.js} +1 -1
  66. package/dist/client/assets/{auth-entry-B2MqWpcF.js → auth-entry-BPV6B4VL.js} +1 -1
  67. package/dist/client/assets/{auth-split-layout-CwJlT6Oq.js → auth-split-layout-DhnEMT3K.js} +1 -1
  68. package/dist/client/assets/{authenticate-and-persist-oauth-Ci98CWsZ.js → authenticate-and-persist-oauth-DwlAs1ZZ.js} +1 -1
  69. package/dist/client/assets/{automation-list-row-5R79B6L2.js → automation-list-row-CWJ60M-N.js} +1 -1
  70. package/dist/client/assets/{automation-runs-muPpbYEP.js → automation-runs-otqJFTtW.js} +1 -1
  71. package/dist/client/assets/{automations-C7djfZR5.js → automations-ByVN628t.js} +1 -1
  72. package/dist/client/assets/{autosend-BLwaDfuL.js → autosend-FOyswNSR.js} +1 -1
  73. package/dist/client/assets/{badge-C8SoiSYZ.js → badge-D4fF-8ns.js} +1 -1
  74. package/dist/client/assets/{block-document-C7XO3wXa.js → block-document-DZDOtPeq.js} +1 -1
  75. package/dist/client/assets/{blocks-preview-workspace-context-Ct_L2Frv.js → blocks-preview-workspace-context-B7BEJFAh.js} +1 -1
  76. package/dist/client/assets/{blocks-tab-states-DjNiCspc.js → blocks-tab-states-DAhg2Ye6.js} +1 -1
  77. package/dist/client/assets/{blog-schema-Buyn-oQb.js → blog-schema-C6fspqby.js} +1 -1
  78. package/dist/client/assets/{buckets-D-SuQdJV.js → buckets-Ck5_X87E.js} +1 -1
  79. package/dist/client/assets/{build-improve-prompt-doc-BiW3JFW6.js → build-improve-prompt-doc-C7YK4Pu4.js} +1 -1
  80. package/dist/client/assets/{calendar-B-_EB2yo.js → calendar-C6M3LMV4.js} +1 -1
  81. package/dist/client/assets/{capability-load-error-DTfH6BCq.js → capability-load-error-C2BQaZ2o.js} +1 -1
  82. package/dist/client/assets/{category-editor-BEQyGteX.js → category-editor-QazjTrf0.js} +1 -1
  83. package/dist/client/assets/{chart-BgKVrBIO.js → chart-g5ZZsRJb.js} +1 -1
  84. package/dist/client/assets/{chat-context-DGEoSZ8g.js → chat-context-C4aI-9Gh.js} +1 -1
  85. package/dist/client/assets/{chat-draft-Hfl-Vt7X.js → chat-draft-v_nDJXuK.js} +1 -1
  86. package/dist/client/assets/{checkbox-2hVfC1K9.js → checkbox-BpYZyZtV.js} +1 -1
  87. package/dist/client/assets/{choose-editor-DoJJP7Y2.js → choose-editor-D5eTMtDH.js} +1 -1
  88. package/dist/client/assets/{cli-auth-success-BhPPAawt.js → cli-auth-success-CAUQEN95.js} +1 -1
  89. package/dist/client/assets/{client-icons-D56oac-S.js → client-icons-D2cDT816.js} +1 -1
  90. package/dist/client/assets/{cms-settings-editor-DS_lS8up.js → cms-settings-editor-5skFaLht.js} +1 -1
  91. package/dist/client/assets/{cms-store-drafts-BOzxBdUW.js → cms-store-drafts-VPkfiqMe.js} +1 -1
  92. package/dist/client/assets/{collapsible-CBkOKy_V.js → collapsible-BgpbICto.js} +1 -1
  93. package/dist/client/assets/{collection-detail-BwgBO9rx.js → collection-detail-CEsMpM_C.js} +1 -1
  94. package/dist/client/assets/{collection-display-button-B1FWTXCr.js → collection-display-button-PZqoRcbJ.js} +1 -1
  95. package/dist/client/assets/{collection-search-DLMLNhxJ.js → collection-search-CH54VXGp.js} +1 -1
  96. package/dist/client/assets/{collection-table-wrapper-OFbnOu-w.js → collection-table-wrapper-bVMovNDL.js} +1 -1
  97. package/dist/client/assets/{collection-tabs-Tp4T2q9Y.js → collection-tabs-DF52b4Gj.js} +1 -1
  98. package/dist/client/assets/{combobox-Bv4H0UoH.js → combobox-Bfj0PjLE.js} +1 -1
  99. package/dist/client/assets/{command-Dnw2pasR.js → command-CsBJ3GOI.js} +1 -1
  100. package/dist/client/assets/{companion-mcps-section-68jW8mRF.js → companion-mcps-section-YQlM2-Os.js} +1 -1
  101. package/dist/client/assets/{config-LiKo2fo2.js → config-BMlT5DPg.js} +1 -1
  102. package/dist/client/assets/{connect-layout-ByOzPiGU.js → connect-layout-DLqiwduY.js} +1 -1
  103. package/dist/client/assets/{connect-BFbtHYxe.js → connect-qXBtQ-OH.js} +1 -1
  104. package/dist/client/assets/{connect-source-dialog-B7Ld_9Px.js → connect-source-dialog-Bsqg8dUA.js} +1 -1
  105. package/dist/client/assets/{connection-q83jFl6d.js → connection-95gHZiW5.js} +1 -1
  106. package/dist/client/assets/{connection-card-BChC3QcL.js → connection-card-CMMSZX4x.js} +1 -1
  107. package/dist/client/assets/{connection-detail-B9GtoOQz.js → connection-detail-BaU7wg0S.js} +1 -1
  108. package/dist/client/assets/{connection-form-helpers-B8GujYbR.js → connection-form-helpers-BJkokVuQ.js} +1 -1
  109. package/dist/client/assets/{connection-slug-e_XZGcMc.js → connection-slug-CVtaxOKz.js} +1 -1
  110. package/dist/client/assets/{connections-BmZaBZ7X.js → connections-BtILN1R8.js} +1 -1
  111. package/dist/client/assets/{content-tab-DEygOE9A.js → content-tab-DQG8vdsL.js} +3 -3
  112. package/dist/client/assets/{context-DixWzk5F.js → context-4QFXsbD6.js} +1 -1
  113. package/dist/client/assets/{context-menu-sQTRwOW7.js → context-menu-1fzYZhm_.js} +1 -1
  114. package/dist/client/assets/{context-shell-u2FWmfVw.js → context-shell-CCkAMmWr.js} +3 -3
  115. package/dist/client/assets/{core.esm-Dg3ste3x.js → core.esm-DYzatWGk.js} +1 -1
  116. package/dist/client/assets/{create-organization-dialog-Ddfg1y7k.js → create-organization-dialog-DCgZG2cL.js} +1 -1
  117. package/dist/client/assets/{device-hint-CyVF9iUZ.js → device-hint-CFx01Kw_.js} +1 -1
  118. package/dist/client/assets/{discover-CsUnTSVq.js → discover-CoCxl4Q9.js} +1 -1
  119. package/dist/client/assets/{domain-settings-Bv-_QfjI.js → domain-settings-DuCeTo5C.js} +1 -1
  120. package/dist/client/assets/{drawer-Cr3trfMB.js → drawer-B5at6I_u.js} +1 -1
  121. package/dist/client/assets/{editor-CtNrPORw.js → editor-DD0jwUtP.js} +1 -1
  122. package/dist/client/assets/{editor-classes-DGhQ0khm.js → editor-classes-Dnkv0ExO.js} +1 -1
  123. package/dist/client/assets/{empty-state-CQDiVxjd.js → empty-state-D3yjfo9M.js} +1 -1
  124. package/dist/client/assets/{empty-state-CPzwuwQF.js → empty-state-Df2e2-7k.js} +1 -1
  125. package/dist/client/assets/{experiments-tab-choice-DYELyAgl.js → experiments-tab-choice-DbCV3Tta.js} +1 -1
  126. package/dist/client/assets/{extract-connection-data-BrWbQJSD.js → extract-connection-data-Bw93eWWI.js} +1 -1
  127. package/dist/client/assets/{feature-gate-BYSpD9vV.js → feature-gate-CWwTIDAD.js} +1 -1
  128. package/dist/client/assets/{feature-paywall-Vs4R367Q.js → feature-paywall-CAaY2lMU.js} +1 -1
  129. package/dist/client/assets/{feedback-BvXufGHE.js → feedback-ByVb71jj.js} +1 -1
  130. package/dist/client/assets/{file-explorer-BnhpA6z2.js → file-explorer-zWsChJTW.js} +1 -1
  131. package/dist/client/assets/{file-preview-DUdl3Yo6.js → file-preview-B5EKno-W.js} +1 -1
  132. package/dist/client/assets/{file-share-button-CVNjiAGQ.js → file-share-button-C7-QuaCd.js} +1 -1
  133. package/dist/client/assets/{file-type-icon-BbCX4o-i.js → file-type-icon-BsiKabia.js} +1 -1
  134. package/dist/client/assets/{folder-icon-COq_f1Ug.js → folder-icon-DkUbY_Ow.js} +1 -1
  135. package/dist/client/assets/{form-CX9Y8rXx.js → form-C_M4QV9P.js} +1 -1
  136. package/dist/client/assets/{general-C2M6kUiq.js → general-BjfnjzGy.js} +1 -1
  137. package/dist/client/assets/{github-icon-D5WAOakM.js → github-icon-BZYLnrQK.js} +1 -1
  138. package/dist/client/assets/{home-BomzyME8.js → home-DQQdj4Ea.js} +1 -1
  139. package/dist/client/assets/{home-overview-M5WdT7OK.js → home-overview-CvCaFo1b.js} +1 -1
  140. package/dist/client/assets/{hosted-reconcile-CFgAFv0C.js → hosted-reconcile-DVCi8vCY.js} +1 -1
  141. package/dist/client/assets/{icon-button-nqkgw44k.js → icon-button-FgAeY2VI.js} +1 -1
  142. package/dist/client/assets/{index-C7fe-3-1.js → index--p_IIMqb.js} +1 -1
  143. package/dist/client/assets/{index-DX6T00mS.js → index-4rp3iqoc.js} +1 -1
  144. package/dist/client/assets/{index-DsP4hX0b.js → index-BVwTm9yy.js} +1 -1
  145. package/dist/client/assets/{index-D9_88oYJ.js → index-BqJ-zbRp.js} +1 -1
  146. package/dist/client/assets/{index-D8pFT62M.js → index-C0YexCRj.js} +3 -3
  147. package/dist/client/assets/{index-CTGLhdnQ.js → index-CA5MpDJ2.js} +1 -1
  148. package/dist/client/assets/{index-GzXknTmE.js → index-CAMi4lK6.js} +1 -1
  149. package/dist/client/assets/{index-B-SSEV3y.js → index-CZvihk7A.js} +1 -1
  150. package/dist/client/assets/{index-CLm0YAEW.js → index-CdLJWnRN.js} +1 -1
  151. package/dist/client/assets/{index-wPGh-4Qn.js → index-D-aBBLRs.js} +1 -1
  152. package/dist/client/assets/{index-CH6fvsN5.js → index-DB7GDsnk.js} +1 -1
  153. package/dist/client/assets/{index-BJboiqe7.js → index-Deyc3saa.js} +1 -1
  154. package/dist/client/assets/{index-C_uBCqyj.js → index-Do6PllqG.js} +1 -1
  155. package/dist/client/assets/{index-C6icdhcm.js → index-DqGr7Hc1.js} +1 -1
  156. package/dist/client/assets/{index-BI_4p3rJ.js → index-hzDwssoq.js} +1 -1
  157. package/dist/client/assets/{index-redirect-DNhgvlnT.js → index-redirect-Bu_aNRdm.js} +1 -1
  158. package/dist/client/assets/{index-DAtb5cig.js → index-vlmYuijH.js} +1 -1
  159. package/dist/client/assets/{infiniteQueryObserver-BCA8pHQ9.js → infiniteQueryObserver-BMqABh4H.js} +1 -1
  160. package/dist/client/assets/{infra-billing-tTGuSBOr.js → infra-billing-TR3zcfyD.js} +1 -1
  161. package/dist/client/assets/{input-CS6hOcXP.js → input--UVdiTAB.js} +3 -3
  162. package/dist/client/assets/{input-DzvNX6KE.js → input-Br1caJ_d.js} +1 -1
  163. package/dist/client/assets/{integration-icon-oVgUnqWm.js → integration-icon-D6ksbVbr.js} +1 -1
  164. package/dist/client/assets/{jira-icon-DpVhNd3p.js → jira-icon-Dw9qRy7z.js} +1 -1
  165. package/dist/client/assets/{label-DyJSQ7-Z.js → label-CnHmgvIU.js} +1 -1
  166. package/dist/client/assets/{layout-uNVzsDnw.js → layout-DNHVxHcF.js} +1 -1
  167. package/dist/client/assets/{legacy-agents-deep-DX51gRsB.js → legacy-agents-deep-phbsWihE.js} +1 -1
  168. package/dist/client/assets/{legacy-main-redirect-acRLIQQu.js → legacy-main-redirect-COYA2M-b.js} +1 -1
  169. package/dist/client/assets/library-PQWanCvO.js +1 -0
  170. package/dist/client/assets/{library-tab-Daw4myox.js → library-tab-Dizgrk4k.js} +1 -1
  171. package/dist/client/assets/{login-Cayh2Ab3.js → login-C_kb8goZ.js} +1 -1
  172. package/dist/client/assets/{markdown-h9PNnEh6.js → markdown-CN4Sgkcu.js} +1 -1
  173. package/dist/client/assets/{mcp-app-renderer-CQuQ-XsR.js → mcp-app-renderer-B7qZoNog.js} +1 -1
  174. package/dist/client/assets/{mcp-oauth-B7rGQlv9.js → mcp-oauth-BTwGti_Q.js} +1 -1
  175. package/dist/client/assets/{mcp-oauth-BJRs38bR.js → mcp-oauth-tf6SdsCd.js} +1 -1
  176. package/dist/client/assets/{members-CdshZLmo.js → members-kEy-UuPd.js} +1 -1
  177. package/dist/client/assets/{memory-DJgsUgS2.js → memory-K-xVpveK.js} +1 -1
  178. package/dist/client/assets/{mock-board-B2foCBkp.js → mock-board-CYPKmuLz.js} +3 -3
  179. package/dist/client/assets/{monaco-editor-Cjb9-6hs.js → monaco-editor-DRELyy_D.js} +1 -1
  180. package/dist/client/assets/{monitoring-cw60w70o.js → monitoring-QNe1nTpU.js} +1 -1
  181. package/dist/client/assets/{monitoring-stats-row-DUQcmnd2.js → monitoring-stats-row-BJ3mVu8v.js} +1 -1
  182. package/dist/client/assets/{multi-select-PFXUkRJa.js → multi-select-ZlDR0NXs.js} +1 -1
  183. package/dist/client/assets/{mustache-DYLtwKk5.js → mustache-CMDiec2Z.js} +1 -1
  184. package/dist/client/assets/{named-rule-view-CMSveLhT.js → named-rule-view-vbAzCqnU.js} +1 -1
  185. package/dist/client/assets/{new-project-dialog-CkpxzAtO.js → new-project-dialog-C0bl_2Ba.js} +1 -1
  186. package/dist/client/assets/{oauth-callback-ai-provider-BNpWukqC.js → oauth-callback-ai-provider-C5tN-P7D.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-BN5rMV5w.js → oauth-callback-seyUpLHE.js} +1 -1
  188. package/dist/client/assets/{oauth-consent-CFvEz3rr.js → oauth-consent-Csxt2TlH.js} +1 -1
  189. package/dist/client/assets/{onboarding-CcWFl6rw.js → onboarding-CLe1nQhR.js} +1 -1
  190. package/dist/client/assets/{openai-conversation-BwEhAFIx.js → openai-conversation-BrNIC0gU.js} +1 -1
  191. package/dist/client/assets/{optimistic-project-sidebar-views-Bbojv3r5.js → optimistic-project-sidebar-views-CxAVgylL.js} +1 -1
  192. package/dist/client/assets/{order-monitor-day-Bsfg1ZCB.js → order-monitor-day-pxrX3JmM.js} +1 -1
  193. package/dist/client/assets/{organization-choice-DzLKhvgC.js → organization-choice-BpSAzd2p.js} +1 -1
  194. package/dist/client/assets/{orgs-DzDCfdd2.js → orgs-p1XKp1ZG.js} +1 -1
  195. package/dist/client/assets/{own-accounts-section-DxED_LsY.js → own-accounts-section-CbvkYG1v.js} +1 -1
  196. package/dist/client/assets/{pair-BqxIn6Y_.js → pair-D-1ihySL.js} +1 -1
  197. package/dist/client/assets/{parse-sections-Cu3Ael-d.js → parse-sections-DAzG_Y-i.js} +3 -3
  198. package/dist/client/assets/{plan-BwTvKeoR.js → plan-Ct48TCKI.js} +1 -1
  199. package/dist/client/assets/{plan-ladder-Nrfbc5fv.js → plan-ladder-EgyMICws.js} +1 -1
  200. package/dist/client/assets/{plan-usage-card-BTqlywv2.js → plan-usage-card-55U4oLof.js} +1 -1
  201. package/dist/client/assets/{popover-Bc0Osxls.js → popover-ChvCIlNB.js} +1 -1
  202. package/dist/client/assets/{post-calendar-Cj1rSs4t.js → post-calendar-B-eIxloA.js} +1 -1
  203. package/dist/client/assets/{post-editor-CB2rddqd.js → post-editor-DCSvvVMs.js} +1 -1
  204. package/dist/client/assets/{preview-content-CB9eYnQK.js → preview-content-DV3ORZ_c.js} +1 -1
  205. package/dist/client/assets/{preview-dialog-DB7-jTmO.js → preview-dialog-BREniLg2.js} +1 -1
  206. package/dist/client/assets/{preview-panel-B_W92FeD.js → preview-panel-UEmA70eG.js} +1 -1
  207. package/dist/client/assets/{preview-tab-6TAM9aA1.js → preview-tab-BrupxuLJ.js} +3 -3
  208. package/dist/client/assets/{product-picker-dialog-BkNY0_GA.js → product-picker-dialog-C9QNyiBq.js} +1 -1
  209. package/dist/client/assets/{profile-Ctw12CJ6.js → profile-DCr1-Qvc.js} +1 -1
  210. package/dist/client/assets/{project-app-view-BUgKvzjP.js → project-app-view-rhGgr5Sc.js} +1 -1
  211. package/dist/client/assets/{project-apps-OqNLxpWb.js → project-apps-DgmZ54eE.js} +1 -1
  212. package/dist/client/assets/{project-icon-D_-oKizr.js → project-icon-CmV5zxWN.js} +1 -1
  213. package/dist/client/assets/{project-index-Dqo3lK4y.js → project-index-ComZIF5j.js} +1 -1
  214. package/dist/client/assets/project-reports-CVQtK-Va.js +1 -0
  215. package/dist/client/assets/{project-sidebar-views-BIhw1vTs.js → project-sidebar-views-CDN0Y7nM.js} +1 -1
  216. package/dist/client/assets/project-tasks-CtZ4MN1R.js +1 -0
  217. package/dist/client/assets/{projects-BTc2uvLZ.js → projects-BH7yFrNo.js} +1 -1
  218. package/dist/client/assets/{projects-empty-state-BO8xkUWT.js → projects-empty-state-D7JOaHzT.js} +1 -1
  219. package/dist/client/assets/{prompts-DuFnMTdK.js → prompts-BE2oz-mN.js} +1 -1
  220. package/dist/client/assets/record-editor-SI7Q-pVr.js +1 -0
  221. package/dist/client/assets/{redirect-editor-DVXp876P.js → redirect-editor-BbsrbYSo.js} +1 -1
  222. package/dist/client/assets/reports-C-TsCVxa.js +1 -0
  223. package/dist/client/assets/{reports-Dv36rH_a.js → reports-CqsqZ5NG.js} +1 -1
  224. package/dist/client/assets/{reports-onboarding-BaBC6lkq.js → reports-onboarding-DN1rE25Z.js} +1 -1
  225. package/dist/client/assets/{reports-tab-Dixc59hm.js → reports-tab-BkEWE3Wb.js} +2 -2
  226. package/dist/client/assets/repositories-CE7fOdIh.js +1 -0
  227. package/dist/client/assets/{repositories-CBz0Kfvj.js → repositories-D5p56rp8.js} +1 -1
  228. package/dist/client/assets/{repository-binding-BgpHTQa3.js → repository-binding-zAuhrRNl.js} +1 -1
  229. package/dist/client/assets/{repository-picker-DxnB6y8P.js → repository-picker-C8xivTfl.js} +1 -1
  230. package/dist/client/assets/{require-capability-rIoksLSL.js → require-capability-DcSbNfND.js} +1 -1
  231. package/dist/client/assets/{required-auth-layout-BPTXO06k.js → required-auth-layout-CQCCkUAY.js} +1 -1
  232. package/dist/client/assets/{reset-password-Bbozq7HR.js → reset-password-qF03il-Y.js} +1 -1
  233. package/dist/client/assets/{resizable-DHZRSfuo.js → resizable-BbH6Rq9j.js} +1 -1
  234. package/dist/client/assets/{resolve-tab-icon-CQ5UCjTa.js → resolve-tab-icon-DT-C34an.js} +1 -1
  235. package/dist/client/assets/{review-settings-Ca5wNyAg.js → review-settings-zQhgda-0.js} +1 -1
  236. package/dist/client/assets/{role-color-DaNs5ahF.js → role-color-Ce0vE_lJ.js} +1 -1
  237. package/dist/client/assets/{roles-DWA1nSJR.js → roles-CS8RSWSS.js} +1 -1
  238. package/dist/client/assets/route-BCTRYX9A.js +1 -0
  239. package/dist/client/assets/{route-Br6B1RCL.js → route-Ci6YieJ3.js} +1 -1
  240. package/dist/client/assets/{route-Bn0Zg4Y6.js → route-CmtRblLz.js} +1 -1
  241. package/dist/client/assets/{sandbox-lifecycle-context-KNW6PNmy.js → sandbox-lifecycle-context-NUpZmc9C.js} +1 -1
  242. package/dist/client/assets/{schema-CTKQWjpO.js → schema-CbQkhAdU.js} +1 -1
  243. package/dist/client/assets/{schema-Czvp_Lwx.js → schema-DfRf1jxZ.js} +1 -1
  244. package/dist/client/assets/{scroll-area-mSNTFn2P.js → scroll-area-C8lIzaxm.js} +1 -1
  245. package/dist/client/assets/{search-input-BFuc9oQg.js → search-input-D2E1z19V.js} +1 -1
  246. package/dist/client/assets/{search-toggle-CQD7JD66.js → search-toggle-CZItDB1R.js} +1 -1
  247. package/dist/client/assets/{secret-picker-DQnAib0F.js → secret-picker-DGsGo-lH.js} +1 -1
  248. package/dist/client/assets/{secrets-DBF3k11O.js → secrets-Dac8hncd.js} +1 -1
  249. package/dist/client/assets/{section-array-field-DvmsCB7P.js → section-array-field-3fy_eFLn.js} +1 -1
  250. package/dist/client/assets/{sections-BBJqTxGW.js → sections-BSqM_8t2.js} +1 -1
  251. package/dist/client/assets/{sections-editor-CxLQrocH.js → sections-editor-UNPiBRIi.js} +1 -1
  252. package/dist/client/assets/{select-o79Ct_ay.js → select-C67xaSM-.js} +1 -1
  253. package/dist/client/assets/{select-model-Bb6eOMs-.js → select-model-B7BkbJ8q.js} +1 -1
  254. package/dist/client/assets/{seo-editor-BE13UypD.js → seo-editor-D6BbHFAR.js} +1 -1
  255. package/dist/client/assets/{separator-DMd7UEiq.js → separator-BJXdAG6q.js} +1 -1
  256. package/dist/client/assets/settings-tab-BKHHd0_C.js +1 -0
  257. package/dist/client/assets/{sheet-DzHWnq_T.js → sheet-D1FdDYgh.js} +1 -1
  258. package/dist/client/assets/{shell-layout-DP24kzbV.js → shell-layout-q9TPgR4S.js} +1 -1
  259. package/dist/client/assets/{site-draft-actions-CecQb3Ga.js → site-draft-actions-DEdhulne.js} +1 -1
  260. package/dist/client/assets/{site-draft-view-dNLIex4F.js → site-draft-view-Du5u3dh2.js} +1 -1
  261. package/dist/client/assets/site-editor-BSjvpXJX.js +1 -0
  262. package/dist/client/assets/{site-editor-toast-Aeb7soFG.js → site-editor-toast-BQb3pwds.js} +1 -1
  263. package/dist/client/assets/{skills-D2_FfMjv.js → skills-BO__rEmW.js} +1 -1
  264. package/dist/client/assets/{slider-Dh1rUkk7.js → slider-COwHhiq0.js} +1 -1
  265. package/dist/client/assets/{sortable.esm-BeVlNSdK.js → sortable.esm-BoEIu5W0.js} +1 -1
  266. package/dist/client/assets/{sso-BfMn38Ls.js → sso-DzouQIR7.js} +1 -1
  267. package/dist/client/assets/{suggestion-D7zzeZOU.js → suggestion-0IJfbUde.js} +1 -1
  268. package/dist/client/assets/{switch-BaIjfvqD.js → switch-By9JubUf.js} +1 -1
  269. package/dist/client/assets/{synced-repos-BP9uEFMS.js → synced-repos-D6Z7ziCu.js} +1 -1
  270. package/dist/client/assets/{tab-icon-glyph-CVcm827m.js → tab-icon-glyph-BIJxIcux.js} +1 -1
  271. package/dist/client/assets/{table-_XF-prXn.js → table-BiZFGesF.js} +1 -1
  272. package/dist/client/assets/{tabs-CzXyAmJC.js → tabs-Bb2xgzcm.js} +1 -1
  273. package/dist/client/assets/{task-board-HVkUhR2P.js → task-board-4SvjUpMb.js} +1 -1
  274. package/dist/client/assets/{task-route-B3pI7dth.js → task-route-DVEP01nU.js} +1 -1
  275. package/dist/client/assets/{task-status-yRMe4nbp.js → task-status-DcO-XRPI.js} +1 -1
  276. package/dist/client/assets/{taskboard-analytics-Du7Elnb7.js → taskboard-analytics-BSun1TbW.js} +1 -1
  277. package/dist/client/assets/{tasks-BzhoYnpL.js → tasks--l87WFyL.js} +1 -1
  278. package/dist/client/assets/tasks-CXuVo5e-.js +1 -0
  279. package/dist/client/assets/{textarea-B05kUdob.js → textarea-Duz08Iqx.js} +1 -1
  280. package/dist/client/assets/{thread-analytics-BfeByGR2.js → thread-analytics-oUI0Ldjh.js} +1 -1
  281. package/dist/client/assets/{thread-intent-BIRE7Qtk.js → thread-intent-BGQF0i18.js} +1 -1
  282. package/dist/client/assets/{thread-route-Cn39v6pB.js → thread-route-Cjav7kKF.js} +1 -1
  283. package/dist/client/assets/{thread-route-CZ8MMB_J.js → thread-route-D3Npgdwy.js} +1 -1
  284. package/dist/client/assets/{thread-sheet-body-D65WuUvv.js → thread-sheet-body--mz7LDhh.js} +1 -1
  285. package/dist/client/assets/{time-range-picker-DzKmFLJB.js → time-range-picker-Dcl7u7UC.js} +1 -1
  286. package/dist/client/assets/{toggle-group-HpKtAH98.js → toggle-group-CCnoRxJ5.js} +1 -1
  287. package/dist/client/assets/{tool-namespace-DxYdT3r_.js → tool-namespace-0JnTVTOi.js} +1 -1
  288. package/dist/client/assets/{tool-set-selector-CnBqlG8R.js → tool-set-selector-Cs7GdO0i.js} +1 -1
  289. package/dist/client/assets/{toolbar-icon-button-TYsxy9yJ.js → toolbar-icon-button-CpfF_t2h.js} +1 -1
  290. package/dist/client/assets/{tooltip-BgCnMV2H.js → tooltip-B4vnoW3c.js} +1 -1
  291. package/dist/client/assets/{tooltipContext-BRYDLqxt.js → tooltipContext-Di8C4u-8.js} +1 -1
  292. package/dist/client/assets/{track-BDp_1Hit.js → track-Byem6YG_.js} +1 -1
  293. package/dist/client/assets/{types-D8M__V__.js → types-Cvkdtetr.js} +1 -1
  294. package/dist/client/assets/{url-slug-Bsw_pMhA.js → url-slug-T5nyiyN7.js} +1 -1
  295. package/dist/client/assets/{usage-stats-DJLHvs3H.js → usage-stats-D9-LtkOq.js} +1 -1
  296. package/dist/client/assets/{use-ai-providers-F8TOugyU.js → use-ai-providers-DKBQ22lC.js} +1 -1
  297. package/dist/client/assets/{use-apply-named-rule-BRkF3nZ-.js → use-apply-named-rule-hAr6r48R.js} +1 -1
  298. package/dist/client/assets/use-ask-in-chat-CMwCc1F-.js +1 -0
  299. package/dist/client/assets/{use-automations-EsbplC7e.js → use-automations-pTfMxWF2.js} +1 -1
  300. package/dist/client/assets/{use-autosave-BG4nXiOR.js → use-autosave-CwoAt-Cr.js} +1 -1
  301. package/dist/client/assets/use-blocks-v8-project-FZUFv9Vq.js +1 -0
  302. package/dist/client/assets/{use-chat-layout-state-CQ-6yLaB.js → use-chat-layout-state-DMTZvG3v.js} +1 -1
  303. package/dist/client/assets/{use-cms-publish-actions-CiGJc3Qg.js → use-cms-publish-actions-C7a0pDGH.js} +1 -1
  304. package/dist/client/assets/{use-connect-companion-ClTD8ccL.js → use-connect-companion-Bw9DztfC.js} +1 -1
  305. package/dist/client/assets/{use-connection-DCYGUl-Y.js → use-connection-Cd0tT7Hz.js} +1 -1
  306. package/dist/client/assets/{use-content-sync-CoOj2Ul7.js → use-content-sync-B7G_IDZR.js} +1 -1
  307. package/dist/client/assets/{use-copy-L2-IdJ_Y.js → use-copy-L2uJJmEn.js} +1 -1
  308. package/dist/client/assets/{use-date-fns-locale-DPCm9If2.js → use-date-fns-locale-BWR3I0yD.js} +1 -1
  309. package/dist/client/assets/{use-debounced-autosave-DWtRBliW.js → use-debounced-autosave-D6uv4Ht0.js} +1 -1
  310. package/dist/client/assets/{use-debounced-value-Dn9biZK4.js → use-debounced-value-yze9Agx0.js} +1 -1
  311. package/dist/client/assets/{use-deco-credits-dZ-Tevsi.js → use-deco-credits-CpL6RZMd.js} +1 -1
  312. package/dist/client/assets/{use-decopilot-events-CKMPTK-j.js → use-decopilot-events-Emf31ERY.js} +1 -1
  313. package/dist/client/assets/{use-delete-connection-DxUOloiw.js → use-delete-connection-BOGW-gWO.js} +1 -1
  314. package/dist/client/assets/{use-deployment-admin-_7fnOeiD.js → use-deployment-admin-C05Wl5hm.js} +1 -1
  315. package/dist/client/assets/{use-entitlements-BB4qLcGz.js → use-entitlements-DyCdoeJS.js} +1 -1
  316. package/dist/client/assets/{use-fast-preview-draft-url-D8KiT4ue.js → use-fast-preview-draft-url-CUn670We.js} +1 -1
  317. package/dist/client/assets/{use-file-configs-c0RGBFjk.js → use-file-configs-C2_msq8y.js} +1 -1
  318. package/dist/client/assets/{use-id-selection-CmywK9L9.js → use-id-selection-DAVcESqY.js} +1 -1
  319. package/dist/client/assets/{use-inbox-feed-BHnwr1_f.js → use-inbox-feed-CDj71yb0.js} +1 -1
  320. package/dist/client/assets/{use-infinite-scroll-CM4CmzMp.js → use-infinite-scroll-D1VEiyLA.js} +1 -1
  321. package/dist/client/assets/{use-join-requests-DbFDM92p.js → use-join-requests-Cn6BUpqb.js} +1 -1
  322. package/dist/client/assets/{use-main-panel-tabs-Xv2NwPm3.js → use-main-panel-tabs-C43j023G.js} +1 -1
  323. package/dist/client/assets/{use-mcp-auth-status-irD2t1-7.js → use-mcp-auth-status-B0TiKwJF.js} +1 -1
  324. package/dist/client/assets/{use-mcp-client-CqE4Ghrf.js → use-mcp-client-DBEWWTcM.js} +1 -1
  325. package/dist/client/assets/{use-mcp-prompts-SlwHiJ8X.js → use-mcp-prompts-CQ9PPuTj.js} +1 -1
  326. package/dist/client/assets/{use-mcp-tools-BwZkbv7p.js → use-mcp-tools-BCKxSU46.js} +1 -1
  327. package/dist/client/assets/{use-mobile-EwBUtNij.js → use-mobile-CRjTpdEZ.js} +1 -1
  328. package/dist/client/assets/{use-move-blocks-DIQrtI4I.js → use-move-blocks-Dn5Uj2rh.js} +1 -1
  329. package/dist/client/assets/{use-navigate-to-agent-ByCAg0It.js → use-navigate-to-agent-B9-xP8hn.js} +1 -1
  330. package/dist/client/assets/{use-org-fs-CZ6M3p96.js → use-org-fs-CAEafaQy.js} +1 -1
  331. package/dist/client/assets/{use-org-repo-syncs-DSYvITnH.js → use-org-repo-syncs-D7vGRv_1.js} +1 -1
  332. package/dist/client/assets/{use-org-sso-BQNy4M1M.js → use-org-sso-DcHAsgmH.js} +1 -1
  333. package/dist/client/assets/{use-organization-settings-B6zxeTvg.js → use-organization-settings-Df-csuDo.js} +1 -1
  334. package/dist/client/assets/{use-project-scope-BmxYOSqD.js → use-project-scope-DwEcCTYT.js} +1 -1
  335. package/dist/client/assets/{use-recent-apps-CMc3bDPy.js → use-recent-apps-Bewb5o_E.js} +1 -1
  336. package/dist/client/assets/{use-reports-diagnostic-Bz_fmb8r.js → use-reports-diagnostic-B92d9OS0.js} +1 -1
  337. package/dist/client/assets/{use-sandbox-events-Bcmjy8_y.js → use-sandbox-events-BxZfdvM3.js} +1 -1
  338. package/dist/client/assets/{use-secrets-D3u_mrII.js → use-secrets-4gWR8BJM.js} +1 -1
  339. package/dist/client/assets/{use-section-preview-base-RT0rIB3U.js → use-section-preview-base-nthVDFUD.js} +1 -1
  340. package/dist/client/assets/{use-sidebar-collapsed-BWIgVYHH.js → use-sidebar-collapsed-B_25RrQb.js} +1 -1
  341. package/dist/client/assets/{use-tags-C_S8Ff1f.js → use-tags-BPdkrSTc.js} +1 -1
  342. package/dist/client/assets/{use-task-board-analytics-BCLzvxv7.js → use-task-board-analytics-DWzCS1h7.js} +1 -1
  343. package/dist/client/assets/{use-task-board-events-BQW5hXik.js → use-task-board-events-C0AmYx3j.js} +1 -1
  344. package/dist/client/assets/{use-task-board-item-prs-B6Z2gJgd.js → use-task-board-item-prs-BwjTfRBq.js} +1 -1
  345. package/dist/client/assets/{use-task-board-items-B3aJ_5y5.js → use-task-board-items-Bueh6O2r.js} +1 -1
  346. package/dist/client/assets/{use-task-board-prompts-Dr1CEZWZ.js → use-task-board-prompts-BeKRCQFj.js} +1 -1
  347. package/dist/client/assets/{use-task-metadata-CdWilbXi.js → use-task-metadata-CpevmR5K.js} +1 -1
  348. package/dist/client/assets/{use-thread-outputs-B4Zce4lE.js → use-thread-outputs-D4glxnBY.js} +1 -1
  349. package/dist/client/assets/{use-voice-input-ADzQEEIx.js → use-voice-input-CXfzcEw1.js} +1 -1
  350. package/dist/client/assets/useInfiniteQuery-Bq3XzHMD.js +1 -0
  351. package/dist/client/assets/{useQueries-sl3HeH6v.js → useQueries-BZNL1IMW.js} +1 -1
  352. package/dist/client/assets/useSuspenseInfiniteQuery-B3WDnHYO.js +1 -0
  353. package/dist/client/assets/{users-ChLpJ4P2.js → users-Cdd9D-dR.js} +1 -1
  354. package/dist/client/assets/{utils-ymd1FJWf.js → utils-CtoE4BzT.js} +1 -1
  355. package/dist/client/assets/{variant-calendar-Cs7cI_1m.js → variant-calendar-DMEwLCMH.js} +1 -1
  356. package/dist/client/assets/{variant-matcher-override-1piR_ouW.js → variant-matcher-override-BCR-xrVe.js} +1 -1
  357. package/dist/client/assets/{view-header-DjtjUnvm.js → view-header-KJ6rsezd.js} +1 -1
  358. package/dist/client/assets/{virtual-mcp-BwBYFvbj.js → virtual-mcp-wrwCllE9.js} +1 -1
  359. package/dist/client/assets/{watch-sse-pool-BoqhatUL.js → watch-sse-pool-BNZW-YJq.js} +1 -1
  360. package/dist/client/index.html +1 -1
  361. package/dist/server/cli.js +63 -63
  362. package/dist/server/server.js +587 -587
  363. package/package.json +1 -1
  364. package/dist/client/assets/agent-app-Cj5VRE9N.js +0 -1
  365. package/dist/client/assets/agent-deck-C8zPFh-t.js +0 -1
  366. package/dist/client/assets/agent-experiments-DTpS9tX-.js +0 -1
  367. package/dist/client/assets/agent-library-D7usyBbZ.js +0 -1
  368. package/dist/client/assets/agent-library-file-BctrjiTr.js +0 -1
  369. package/dist/client/assets/agent-overview-0_ctMLbb.js +0 -1
  370. package/dist/client/assets/agent-settings-V07gT5Cf.js +0 -1
  371. package/dist/client/assets/agent-site-editor-code-CwFZJgDv.js +0 -2
  372. package/dist/client/assets/agent-site-editor-content-B-zSDz5I.js +0 -1
  373. package/dist/client/assets/agent-site-editor-preview-DtjBE5NW.js +0 -1
  374. package/dist/client/assets/agent-view-VjGFcOmA.js +0 -1
  375. package/dist/client/assets/api-keys-B1FZ7y5P.js +0 -1
  376. package/dist/client/assets/library-CxZb-jUS.js +0 -1
  377. package/dist/client/assets/project-reports-wHT0lgrT.js +0 -1
  378. package/dist/client/assets/project-tasks-CsGsl0Ue.js +0 -1
  379. package/dist/client/assets/record-editor-DwEzP7FO.js +0 -1
  380. package/dist/client/assets/reports-CM-guqFW.js +0 -1
  381. package/dist/client/assets/repositories-B1FKGPtG.js +0 -1
  382. package/dist/client/assets/route-CFGDEN28.js +0 -1
  383. package/dist/client/assets/settings-tab-DNa3VCcv.js +0 -1
  384. package/dist/client/assets/site-editor-Z3fmTiRV.js +0 -1
  385. package/dist/client/assets/tasks-BtYoq0Uy.js +0 -1
  386. package/dist/client/assets/use-ask-in-chat-C9KFi3ct.js +0 -1
  387. package/dist/client/assets/use-blocks-v8-project-BOjb1YoC.js +0 -1
  388. package/dist/client/assets/useInfiniteQuery-C3wEWRY0.js +0 -1
  389. package/dist/client/assets/useSuspenseInfiniteQuery-mTZwKUMV.js +0 -1
@@ -1 +1 @@
1
- import{r as d,cz as T,cv as ce,j as b,cB as _,cO as ae,eo as O,cC as C,cI as P,cD as ie,c as F,m as $}from"./index-D8pFT62M.js";import{c as de}from"./index-BdQq_4o_.js";function ue(r,e){return d.useReducer((o,l)=>e[o][l]??o,r)}var U="ScrollArea",[q]=ae(U),[fe,v]=q(U),G=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,type:l="hover",dir:t,scrollHideDelay:n=600,...s}=r,[a,c]=d.useState(null),[u,i]=d.useState(null),[h,f]=d.useState(null),[S,w]=d.useState(null),[A,Y]=d.useState(null),[x,L]=d.useState(0),[M,D]=d.useState(0),[j,y]=d.useState(!1),[N,W]=d.useState(!1),m=T(e,R=>c(R)),p=ce(t);return b.jsx(fe,{scope:o,type:l,dir:p,scrollHideDelay:n,scrollArea:a,viewport:u,onViewportChange:i,content:h,onContentChange:f,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:j,onScrollbarXEnabledChange:y,scrollbarY:A,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:L,onCornerHeightChange:D,children:b.jsx(_.div,{dir:p,...s,ref:m,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...r.style}})})});G.displayName=U;var J="ScrollAreaViewport",K=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,children:l,nonce:t,...n}=r,s=v(J,o),a=d.useRef(null),c=T(e,a,s.onViewportChange);return b.jsxs(b.Fragment,{children:[b.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),b.jsx(_.div,{"data-radix-scroll-area-viewport":"",...n,ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...r.style},children:b.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});K.displayName=J;var g="ScrollAreaScrollbar",Q=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=v(g,r.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:s}=t,a=r.orientation==="horizontal";return d.useEffect(()=>(a?n(!0):s(!0),()=>{a?n(!1):s(!1)}),[a,n,s]),t.type==="hover"?b.jsx(he,{...l,ref:e,forceMount:o}):t.type==="scroll"?b.jsx(be,{...l,ref:e,forceMount:o}):t.type==="auto"?b.jsx(Z,{...l,ref:e,forceMount:o}):t.type==="always"?b.jsx(B,{...l,ref:e}):null});Q.displayName=g;var he=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=v(g,r.__scopeScrollArea),[n,s]=d.useState(!1);return d.useEffect(()=>{const a=t.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},i=()=>{c=window.setTimeout(()=>s(!1),t.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",i),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",i)}}},[t.scrollArea,t.scrollHideDelay]),b.jsx(O,{present:o||n,children:b.jsx(Z,{"data-state":n?"visible":"hidden",...l,ref:e})})}),be=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=v(g,r.__scopeScrollArea),n=r.orientation==="horizontal",s=X(()=>c("SCROLL_END"),100),[a,c]=ue("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return d.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,t.scrollHideDelay,c]),d.useEffect(()=>{const u=t.viewport,i=n?"scrollLeft":"scrollTop";if(u){let h=u[i];const f=()=>{const S=u[i];h!==S&&(c("SCROLL"),s()),h=S};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[t.viewport,n,c,s]),b.jsx(O,{present:o||a!=="hidden",children:b.jsx(B,{"data-state":a==="hidden"?"hidden":"visible",...l,ref:e,onPointerEnter:C(r.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:C(r.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Z=d.forwardRef((r,e)=>{const o=v(g,r.__scopeScrollArea),{forceMount:l,...t}=r,[n,s]=d.useState(!1),a=r.orientation==="horizontal",c=X(()=>{if(o.viewport){const u=o.viewport.offsetWidth<o.viewport.scrollWidth,i=o.viewport.offsetHeight<o.viewport.scrollHeight;s(a?u:i)}},10);return E(o.viewport,c),E(o.content,c),b.jsx(O,{present:l||n,children:b.jsx(B,{"data-state":n?"visible":"hidden",...t,ref:e})})}),B=d.forwardRef((r,e)=>{const{orientation:o="vertical",...l}=r,t=v(g,r.__scopeScrollArea),n=d.useRef(null),s=d.useRef(0),[a,c]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ne(a.viewport,a.content),i={...l,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>n.current=f,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:f=>s.current=f};function h(f,S){return ge(f,s.current,a,S)}return o==="horizontal"?b.jsx(Se,{...i,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollLeft,S=k(f,a,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollLeft=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollLeft=h(f,t.dir))}}):o==="vertical"?b.jsx(me,{...i,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollTop,S=k(f,a);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollTop=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollTop=h(f))}}):null}),Se=d.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=v(g,r.__scopeScrollArea),[s,a]=d.useState(),c=d.useRef(null),u=T(e,c,n.onScrollbarXChange);return d.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(re,{"data-orientation":"horizontal",...t,ref:u,sizes:o,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(o)+"px",...r.style},onThumbPointerDown:i=>r.onThumbPointerDown(i.x),onDragScroll:i=>r.onDragScroll(i.x),onWheelScroll:(i,h)=>{if(n.viewport){const f=n.viewport.scrollLeft+i.deltaX;r.onWheelScroll(f),se(f,h)&&i.preventDefault()}},onResize:()=>{c.current&&n.viewport&&s&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:z(s.paddingLeft),paddingEnd:z(s.paddingRight)}})}})}),me=d.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=v(g,r.__scopeScrollArea),[s,a]=d.useState(),c=d.useRef(null),u=T(e,c,n.onScrollbarYChange);return d.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(re,{"data-orientation":"vertical",...t,ref:u,sizes:o,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(o)+"px",...r.style},onThumbPointerDown:i=>r.onThumbPointerDown(i.y),onDragScroll:i=>r.onDragScroll(i.y),onWheelScroll:(i,h)=>{if(n.viewport){const f=n.viewport.scrollTop+i.deltaY;r.onWheelScroll(f),se(f,h)&&i.preventDefault()}},onResize:()=>{c.current&&n.viewport&&s&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:z(s.paddingTop),paddingEnd:z(s.paddingBottom)}})}})}),[ve,ee]=q(g),re=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:i,onResize:h,...f}=r,S=v(g,o),[w,A]=d.useState(null),Y=T(e,m=>A(m)),x=d.useRef(null),L=d.useRef(""),M=S.viewport,D=l.content-l.viewport,j=P(i),y=P(c),N=X(h,10);function W(m){if(x.current){const p=m.clientX-x.current.left,R=m.clientY-x.current.top;u({x:p,y:R})}}return d.useEffect(()=>{const m=p=>{const R=p.target;w?.contains(R)&&j(p,D)};return document.addEventListener("wheel",m,{passive:!1}),()=>document.removeEventListener("wheel",m,{passive:!1})},[M,w,D,j]),d.useEffect(y,[l,y]),E(w,N),E(S.content,N),b.jsx(ve,{scope:o,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(s),onThumbPositionChange:y,onThumbPointerDown:P(a),children:b.jsx(_.div,{...f,ref:Y,style:{position:"absolute",...f.style},onPointerDown:C(r.onPointerDown,m=>{m.button===0&&(m.target.setPointerCapture(m.pointerId),x.current=w.getBoundingClientRect(),L.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(m))}),onPointerMove:C(r.onPointerMove,W),onPointerUp:C(r.onPointerUp,m=>{const p=m.target;p.hasPointerCapture(m.pointerId)&&p.releasePointerCapture(m.pointerId),document.body.style.webkitUserSelect=L.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),H="ScrollAreaThumb",oe=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=ee(H,r.__scopeScrollArea);return b.jsx(O,{present:o||t.hasThumb,children:b.jsx(pe,{ref:e,...l})})}),pe=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,style:l,...t}=r,n=v(H,o),s=ee(H,o),{onThumbPositionChange:a}=s,c=T(e,h=>s.onThumbChange(h)),u=d.useRef(void 0),i=X(()=>{u.current&&(u.current(),u.current=void 0)},100);return d.useEffect(()=>{const h=n.viewport;if(h){const f=()=>{if(i(),!u.current){const S=xe(h,a);u.current=S,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[n.viewport,i,a]),b.jsx(_.div,{"data-state":s.hasThumb?"visible":"hidden",...t,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(r.onPointerDownCapture,h=>{const S=h.target.getBoundingClientRect(),w=h.clientX-S.left,A=h.clientY-S.top;s.onThumbPointerDown({x:w,y:A})}),onPointerUp:C(r.onPointerUp,s.onThumbPointerUp)})});oe.displayName=H;var V="ScrollAreaCorner",te=d.forwardRef((r,e)=>{const o=v(V,r.__scopeScrollArea),l=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&l?b.jsx(we,{...r,ref:e}):null});te.displayName=V;var we=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,...l}=r,t=v(V,o),[n,s]=d.useState(0),[a,c]=d.useState(0),u=!!(n&&a);return E(t.scrollbarX,()=>{const i=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(i),c(i)}),E(t.scrollbarY,()=>{const i=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(i),s(i)}),u?b.jsx(_.div,{...l,ref:e,style:{width:n,height:a,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...r.style}}):null});function z(r){return r?parseInt(r,10):0}function ne(r,e){const o=r/e;return isNaN(o)?0:o}function I(r){const e=ne(r.viewport,r.content),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,l=(r.scrollbar.size-o)*e;return Math.max(l,18)}function ge(r,e,o,l="ltr"){const t=I(o),n=t/2,s=e||n,a=t-s,c=o.scrollbar.paddingStart+s,u=o.scrollbar.size-o.scrollbar.paddingEnd-a,i=o.content-o.viewport,h=l==="ltr"?[0,i]:[i*-1,0];return le([c,u],h)(r)}function k(r,e,o="ltr"){const l=I(e),t=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=e.scrollbar.size-t,s=e.content-e.viewport,a=n-l,c=o==="ltr"?[0,s]:[s*-1,0],u=de(r,c);return le([0,s],[0,a])(u)}function le(r,e){return o=>{if(r[0]===r[1]||e[0]===e[1])return e[0];const l=(e[1]-e[0])/(r[1]-r[0]);return e[0]+l*(o-r[0])}}function se(r,e){return r>0&&r<e}var xe=(r,e=()=>{})=>{let o={left:r.scrollLeft,top:r.scrollTop},l=0;return(function t(){const n={left:r.scrollLeft,top:r.scrollTop},s=o.left!==n.left,a=o.top!==n.top;(s||a)&&e(),o=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(r,e){const o=P(r),l=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(l.current),[]),d.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(o,e)},[o,e])}function E(r,e){const o=P(e);ie(()=>{let l=0;if(r){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(o)});return t.observe(r),()=>{window.cancelAnimationFrame(l),t.unobserve(r)}}},[r,o])}var Pe=G,Ce=K,Re=te;function _e(r){const e=F.c(21);let o,l,t,n,s;e[0]!==r?({className:l,children:o,hideScrollbar:n,viewportRef:s,...t}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n,e[5]=s):(o=e[1],l=e[2],t=e[3],n=e[4],s=e[5]);const a=n===void 0?!1:n;let c;e[6]!==l?(c=$("relative h-full w-full",l),e[6]=l,e[7]=c):c=e[7];let u;e[8]!==o?(u=b.jsx("div",{className:"flex min-w-0 flex-col",children:o}),e[8]=o,e[9]=u):u=e[9];let i;e[10]!==u||e[11]!==s?(i=b.jsx(Ce,{ref:s,"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] transition-[color,box-shadow] focus-ring",children:u}),e[10]=u,e[11]=s,e[12]=i):i=e[12];let h;e[13]!==a?(h=b.jsx(Ee,{hideScrollbar:a}),e[13]=a,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(Re,{}),e[15]=f):f=e[15];let S;return e[16]!==t||e[17]!==c||e[18]!==i||e[19]!==h?(S=b.jsxs(Pe,{"data-slot":"scroll-area",className:c,...t,children:[i,h,f]}),e[16]=t,e[17]=c,e[18]=i,e[19]=h,e[20]=S):S=e[20],S}function Ee(r){const e=F.c(15);let o,l,t,n;e[0]!==r?({className:o,orientation:t,hideScrollbar:n,...l}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n):(o=e[1],l=e[2],t=e[3],n=e[4]);const s=t===void 0?"vertical":t,a=n===void 0?!1:n,c=s==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",i=a&&"hidden";let h;e[5]!==o||e[6]!==c||e[7]!==u||e[8]!==i?(h=$("select-none touch-none p-px transition-colors",c,u,i,o),e[5]=o,e[6]=c,e[7]=u,e[8]=i,e[9]=h):h=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(oe,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let S;return e[11]!==s||e[12]!==l||e[13]!==h?(S=b.jsx(Q,{"data-slot":"scroll-area-scrollbar",orientation:s,className:h,...l,children:f}),e[11]=s,e[12]=l,e[13]=h,e[14]=S):S=e[14],S}export{_e as S};
1
+ import{r as d,cz as T,cv as ce,j as b,cB as _,cO as ae,eo as O,cC as C,cI as P,cD as ie,c as F,m as $}from"./index-C0YexCRj.js";import{c as de}from"./index-BdQq_4o_.js";function ue(r,e){return d.useReducer((o,l)=>e[o][l]??o,r)}var U="ScrollArea",[q]=ae(U),[fe,v]=q(U),G=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,type:l="hover",dir:t,scrollHideDelay:n=600,...s}=r,[a,c]=d.useState(null),[u,i]=d.useState(null),[h,f]=d.useState(null),[S,w]=d.useState(null),[A,Y]=d.useState(null),[x,L]=d.useState(0),[M,D]=d.useState(0),[j,y]=d.useState(!1),[N,W]=d.useState(!1),m=T(e,R=>c(R)),p=ce(t);return b.jsx(fe,{scope:o,type:l,dir:p,scrollHideDelay:n,scrollArea:a,viewport:u,onViewportChange:i,content:h,onContentChange:f,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:j,onScrollbarXEnabledChange:y,scrollbarY:A,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:L,onCornerHeightChange:D,children:b.jsx(_.div,{dir:p,...s,ref:m,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...r.style}})})});G.displayName=U;var J="ScrollAreaViewport",K=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,children:l,nonce:t,...n}=r,s=v(J,o),a=d.useRef(null),c=T(e,a,s.onViewportChange);return b.jsxs(b.Fragment,{children:[b.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),b.jsx(_.div,{"data-radix-scroll-area-viewport":"",...n,ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...r.style},children:b.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});K.displayName=J;var g="ScrollAreaScrollbar",Q=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=v(g,r.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:s}=t,a=r.orientation==="horizontal";return d.useEffect(()=>(a?n(!0):s(!0),()=>{a?n(!1):s(!1)}),[a,n,s]),t.type==="hover"?b.jsx(he,{...l,ref:e,forceMount:o}):t.type==="scroll"?b.jsx(be,{...l,ref:e,forceMount:o}):t.type==="auto"?b.jsx(Z,{...l,ref:e,forceMount:o}):t.type==="always"?b.jsx(B,{...l,ref:e}):null});Q.displayName=g;var he=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=v(g,r.__scopeScrollArea),[n,s]=d.useState(!1);return d.useEffect(()=>{const a=t.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},i=()=>{c=window.setTimeout(()=>s(!1),t.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",i),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",i)}}},[t.scrollArea,t.scrollHideDelay]),b.jsx(O,{present:o||n,children:b.jsx(Z,{"data-state":n?"visible":"hidden",...l,ref:e})})}),be=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=v(g,r.__scopeScrollArea),n=r.orientation==="horizontal",s=X(()=>c("SCROLL_END"),100),[a,c]=ue("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return d.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,t.scrollHideDelay,c]),d.useEffect(()=>{const u=t.viewport,i=n?"scrollLeft":"scrollTop";if(u){let h=u[i];const f=()=>{const S=u[i];h!==S&&(c("SCROLL"),s()),h=S};return u.addEventListener("scroll",f),()=>u.removeEventListener("scroll",f)}},[t.viewport,n,c,s]),b.jsx(O,{present:o||a!=="hidden",children:b.jsx(B,{"data-state":a==="hidden"?"hidden":"visible",...l,ref:e,onPointerEnter:C(r.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:C(r.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Z=d.forwardRef((r,e)=>{const o=v(g,r.__scopeScrollArea),{forceMount:l,...t}=r,[n,s]=d.useState(!1),a=r.orientation==="horizontal",c=X(()=>{if(o.viewport){const u=o.viewport.offsetWidth<o.viewport.scrollWidth,i=o.viewport.offsetHeight<o.viewport.scrollHeight;s(a?u:i)}},10);return E(o.viewport,c),E(o.content,c),b.jsx(O,{present:l||n,children:b.jsx(B,{"data-state":n?"visible":"hidden",...t,ref:e})})}),B=d.forwardRef((r,e)=>{const{orientation:o="vertical",...l}=r,t=v(g,r.__scopeScrollArea),n=d.useRef(null),s=d.useRef(0),[a,c]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ne(a.viewport,a.content),i={...l,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:f=>n.current=f,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:f=>s.current=f};function h(f,S){return ge(f,s.current,a,S)}return o==="horizontal"?b.jsx(Se,{...i,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollLeft,S=k(f,a,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollLeft=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollLeft=h(f,t.dir))}}):o==="vertical"?b.jsx(me,{...i,ref:e,onThumbPositionChange:()=>{if(t.viewport&&n.current){const f=t.viewport.scrollTop,S=k(f,a);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:f=>{t.viewport&&(t.viewport.scrollTop=f)},onDragScroll:f=>{t.viewport&&(t.viewport.scrollTop=h(f))}}):null}),Se=d.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=v(g,r.__scopeScrollArea),[s,a]=d.useState(),c=d.useRef(null),u=T(e,c,n.onScrollbarXChange);return d.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(re,{"data-orientation":"horizontal",...t,ref:u,sizes:o,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(o)+"px",...r.style},onThumbPointerDown:i=>r.onThumbPointerDown(i.x),onDragScroll:i=>r.onDragScroll(i.x),onWheelScroll:(i,h)=>{if(n.viewport){const f=n.viewport.scrollLeft+i.deltaX;r.onWheelScroll(f),se(f,h)&&i.preventDefault()}},onResize:()=>{c.current&&n.viewport&&s&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:z(s.paddingLeft),paddingEnd:z(s.paddingRight)}})}})}),me=d.forwardRef((r,e)=>{const{sizes:o,onSizesChange:l,...t}=r,n=v(g,r.__scopeScrollArea),[s,a]=d.useState(),c=d.useRef(null),u=T(e,c,n.onScrollbarYChange);return d.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),b.jsx(re,{"data-orientation":"vertical",...t,ref:u,sizes:o,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(o)+"px",...r.style},onThumbPointerDown:i=>r.onThumbPointerDown(i.y),onDragScroll:i=>r.onDragScroll(i.y),onWheelScroll:(i,h)=>{if(n.viewport){const f=n.viewport.scrollTop+i.deltaY;r.onWheelScroll(f),se(f,h)&&i.preventDefault()}},onResize:()=>{c.current&&n.viewport&&s&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:z(s.paddingTop),paddingEnd:z(s.paddingBottom)}})}})}),[ve,ee]=q(g),re=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:i,onResize:h,...f}=r,S=v(g,o),[w,A]=d.useState(null),Y=T(e,m=>A(m)),x=d.useRef(null),L=d.useRef(""),M=S.viewport,D=l.content-l.viewport,j=P(i),y=P(c),N=X(h,10);function W(m){if(x.current){const p=m.clientX-x.current.left,R=m.clientY-x.current.top;u({x:p,y:R})}}return d.useEffect(()=>{const m=p=>{const R=p.target;w?.contains(R)&&j(p,D)};return document.addEventListener("wheel",m,{passive:!1}),()=>document.removeEventListener("wheel",m,{passive:!1})},[M,w,D,j]),d.useEffect(y,[l,y]),E(w,N),E(S.content,N),b.jsx(ve,{scope:o,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(s),onThumbPositionChange:y,onThumbPointerDown:P(a),children:b.jsx(_.div,{...f,ref:Y,style:{position:"absolute",...f.style},onPointerDown:C(r.onPointerDown,m=>{m.button===0&&(m.target.setPointerCapture(m.pointerId),x.current=w.getBoundingClientRect(),L.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(m))}),onPointerMove:C(r.onPointerMove,W),onPointerUp:C(r.onPointerUp,m=>{const p=m.target;p.hasPointerCapture(m.pointerId)&&p.releasePointerCapture(m.pointerId),document.body.style.webkitUserSelect=L.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),H="ScrollAreaThumb",oe=d.forwardRef((r,e)=>{const{forceMount:o,...l}=r,t=ee(H,r.__scopeScrollArea);return b.jsx(O,{present:o||t.hasThumb,children:b.jsx(pe,{ref:e,...l})})}),pe=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,style:l,...t}=r,n=v(H,o),s=ee(H,o),{onThumbPositionChange:a}=s,c=T(e,h=>s.onThumbChange(h)),u=d.useRef(void 0),i=X(()=>{u.current&&(u.current(),u.current=void 0)},100);return d.useEffect(()=>{const h=n.viewport;if(h){const f=()=>{if(i(),!u.current){const S=xe(h,a);u.current=S,a()}};return a(),h.addEventListener("scroll",f),()=>h.removeEventListener("scroll",f)}},[n.viewport,i,a]),b.jsx(_.div,{"data-state":s.hasThumb?"visible":"hidden",...t,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(r.onPointerDownCapture,h=>{const S=h.target.getBoundingClientRect(),w=h.clientX-S.left,A=h.clientY-S.top;s.onThumbPointerDown({x:w,y:A})}),onPointerUp:C(r.onPointerUp,s.onThumbPointerUp)})});oe.displayName=H;var V="ScrollAreaCorner",te=d.forwardRef((r,e)=>{const o=v(V,r.__scopeScrollArea),l=!!(o.scrollbarX&&o.scrollbarY);return o.type!=="scroll"&&l?b.jsx(we,{...r,ref:e}):null});te.displayName=V;var we=d.forwardRef((r,e)=>{const{__scopeScrollArea:o,...l}=r,t=v(V,o),[n,s]=d.useState(0),[a,c]=d.useState(0),u=!!(n&&a);return E(t.scrollbarX,()=>{const i=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(i),c(i)}),E(t.scrollbarY,()=>{const i=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(i),s(i)}),u?b.jsx(_.div,{...l,ref:e,style:{width:n,height:a,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...r.style}}):null});function z(r){return r?parseInt(r,10):0}function ne(r,e){const o=r/e;return isNaN(o)?0:o}function I(r){const e=ne(r.viewport,r.content),o=r.scrollbar.paddingStart+r.scrollbar.paddingEnd,l=(r.scrollbar.size-o)*e;return Math.max(l,18)}function ge(r,e,o,l="ltr"){const t=I(o),n=t/2,s=e||n,a=t-s,c=o.scrollbar.paddingStart+s,u=o.scrollbar.size-o.scrollbar.paddingEnd-a,i=o.content-o.viewport,h=l==="ltr"?[0,i]:[i*-1,0];return le([c,u],h)(r)}function k(r,e,o="ltr"){const l=I(e),t=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=e.scrollbar.size-t,s=e.content-e.viewport,a=n-l,c=o==="ltr"?[0,s]:[s*-1,0],u=de(r,c);return le([0,s],[0,a])(u)}function le(r,e){return o=>{if(r[0]===r[1]||e[0]===e[1])return e[0];const l=(e[1]-e[0])/(r[1]-r[0]);return e[0]+l*(o-r[0])}}function se(r,e){return r>0&&r<e}var xe=(r,e=()=>{})=>{let o={left:r.scrollLeft,top:r.scrollTop},l=0;return(function t(){const n={left:r.scrollLeft,top:r.scrollTop},s=o.left!==n.left,a=o.top!==n.top;(s||a)&&e(),o=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(r,e){const o=P(r),l=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(l.current),[]),d.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(o,e)},[o,e])}function E(r,e){const o=P(e);ie(()=>{let l=0;if(r){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(o)});return t.observe(r),()=>{window.cancelAnimationFrame(l),t.unobserve(r)}}},[r,o])}var Pe=G,Ce=K,Re=te;function _e(r){const e=F.c(21);let o,l,t,n,s;e[0]!==r?({className:l,children:o,hideScrollbar:n,viewportRef:s,...t}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n,e[5]=s):(o=e[1],l=e[2],t=e[3],n=e[4],s=e[5]);const a=n===void 0?!1:n;let c;e[6]!==l?(c=$("relative h-full w-full",l),e[6]=l,e[7]=c):c=e[7];let u;e[8]!==o?(u=b.jsx("div",{className:"flex min-w-0 flex-col",children:o}),e[8]=o,e[9]=u):u=e[9];let i;e[10]!==u||e[11]!==s?(i=b.jsx(Ce,{ref:s,"data-slot":"scroll-area-viewport",className:"h-full w-full overflow-auto rounded-[inherit] transition-[color,box-shadow] focus-ring",children:u}),e[10]=u,e[11]=s,e[12]=i):i=e[12];let h;e[13]!==a?(h=b.jsx(Ee,{hideScrollbar:a}),e[13]=a,e[14]=h):h=e[14];let f;e[15]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(Re,{}),e[15]=f):f=e[15];let S;return e[16]!==t||e[17]!==c||e[18]!==i||e[19]!==h?(S=b.jsxs(Pe,{"data-slot":"scroll-area",className:c,...t,children:[i,h,f]}),e[16]=t,e[17]=c,e[18]=i,e[19]=h,e[20]=S):S=e[20],S}function Ee(r){const e=F.c(15);let o,l,t,n;e[0]!==r?({className:o,orientation:t,hideScrollbar:n,...l}=r,e[0]=r,e[1]=o,e[2]=l,e[3]=t,e[4]=n):(o=e[1],l=e[2],t=e[3],n=e[4]);const s=t===void 0?"vertical":t,a=n===void 0?!1:n,c=s==="vertical"&&"h-full w-2.5 border-l border-l-transparent",u=s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",i=a&&"hidden";let h;e[5]!==o||e[6]!==c||e[7]!==u||e[8]!==i?(h=$("select-none touch-none p-px transition-colors",c,u,i,o),e[5]=o,e[6]=c,e[7]=u,e[8]=i,e[9]=h):h=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=b.jsx(oe,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"}),e[10]=f):f=e[10];let S;return e[11]!==s||e[12]!==l||e[13]!==h?(S=b.jsx(Q,{"data-slot":"scroll-area-scrollbar",orientation:s,className:h,...l,children:f}),e[11]=s,e[12]=l,e[13]=h,e[14]=S):S=e[14],S}export{_e as S};
@@ -1 +1 @@
1
- import{c as f,j as a,cp as j,h as I,cq as S,cr as g}from"./index-D8pFT62M.js";import{i as v}from"./SearchMd-BvpUvADB.js";function y(x){const e=f.c(14),{value:o,onChange:l,placeholder:h,onKeyDown:c,className:i,isSearching:p,disabled:u}=x,m=h===void 0?"Search...":h;let s;e[0]!==p?(s=a.jsx(j,{className:"pr-0",children:p?a.jsx(I,{className:"size-4"}):a.jsx(v,{})}),e[0]=p,e[1]=s):s=e[1];let t;e[2]!==l?(t=d=>l(d.target.value),e[2]=l,e[3]=t):t=e[3];let n;e[4]!==u||e[5]!==c||e[6]!==m||e[7]!==t||e[8]!==o?(n=a.jsx(S,{type:"text",value:o,onChange:t,onKeyDown:c,placeholder:m,disabled:u}),e[4]=u,e[5]=c,e[6]=m,e[7]=t,e[8]=o,e[9]=n):n=e[9];let r;return e[10]!==i||e[11]!==s||e[12]!==n?(r=a.jsxs(g,{size:"sm",className:i,children:[s,n]}),e[10]=i,e[11]=s,e[12]=n,e[13]=r):r=e[13],r}export{y as S};
1
+ import{c as f,j as a,cp as j,h as I,cq as S,cr as g}from"./index-C0YexCRj.js";import{i as v}from"./SearchMd-DseifSbW.js";function y(x){const e=f.c(14),{value:o,onChange:l,placeholder:h,onKeyDown:c,className:i,isSearching:p,disabled:u}=x,m=h===void 0?"Search...":h;let s;e[0]!==p?(s=a.jsx(j,{className:"pr-0",children:p?a.jsx(I,{className:"size-4"}):a.jsx(v,{})}),e[0]=p,e[1]=s):s=e[1];let t;e[2]!==l?(t=d=>l(d.target.value),e[2]=l,e[3]=t):t=e[3];let n;e[4]!==u||e[5]!==c||e[6]!==m||e[7]!==t||e[8]!==o?(n=a.jsx(S,{type:"text",value:o,onChange:t,onKeyDown:c,placeholder:m,disabled:u}),e[4]=u,e[5]=c,e[6]=m,e[7]=t,e[8]=o,e[9]=n):n=e[9];let r;return e[10]!==i||e[11]!==s||e[12]!==n?(r=a.jsxs(g,{size:"sm",className:i,children:[s,n]}),e[10]=i,e[11]=s,e[12]=n,e[13]=r):r=e[13],r}export{y as S};
@@ -1 +1 @@
1
- import{c as K,r as C,m as B,j as a,b2 as M}from"./index-D8pFT62M.js";import{i as I}from"./SearchMd-BvpUvADB.js";import{I as O}from"./icon-button-nqkgw44k.js";function G(S){const e=K.c(34),{value:t,onChange:s,label:E,placeholder:D,clearLabel:F,expanded:o,className:j}=S,w=E===void 0?"Search":E,d=D===void 0?"Search…":D,_=F===void 0?"Clear search":F,[L,p]=C.useState(t!==""),[R,z]=C.useState(!1),[V,$]=C.useState(t);if(t!==V&&($(t),t===""&&!R&&p(!1)),!L&&!o){let l,g;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>p(!0),g=a.jsx(I,{}),e[0]=l,e[1]=g):(l=e[0],g=e[1]);let v;return e[2]!==w?(v=a.jsx(O,{label:w,tooltipSide:"bottom",variant:"outline",onClick:l,children:g}),e[2]=w,e[3]=v):v=e[3],v}const k=o?"h-10 w-full px-3":"h-7 w-32 animate-search-expand px-2.5 sm:w-44";let n;e[4]!==j||e[5]!==k?(n=B("inline-flex shrink-0 items-center gap-1.5 overflow-hidden rounded-full bg-card text-card-foreground shadow-edge",k,j),e[4]=j,e[5]=k,e[6]=n):n=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(I,{className:"size-4 shrink-0 text-muted-foreground"}),e[7]=x):x=e[7];const y=!o;let r;e[8]!==s?(r=l=>s(l.target.value),e[8]=s,e[9]=r):r=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>z(!0),e[10]=h):h=e[10];let i;e[11]!==t?(i=()=>{z(!1),t===""&&p(!1)},e[11]=t,e[12]=i):i=e[12];let c;e[13]!==s?(c=l=>{l.key==="Escape"&&s("")},e[13]=s,e[14]=c):c=e[14];const N=o?"text-sm":"text-xs";let f;e[15]!==N?(f=B("w-full min-w-0 bg-transparent outline-none placeholder:text-muted-foreground",N),e[15]=N,e[16]=f):f=e[16];let u;e[17]!==d||e[18]!==i||e[19]!==c||e[20]!==f||e[21]!==y||e[22]!==r||e[23]!==t?(u=a.jsx("input",{autoFocus:y,value:t,onChange:r,onFocus:h,onBlur:i,onKeyDown:c,placeholder:d,"aria-label":d,className:f}),e[17]=d,e[18]=i,e[19]=c,e[20]=f,e[21]=y,e[22]=r,e[23]=t,e[24]=u):u=e[24];let m;e[25]!==_||e[26]!==o||e[27]!==s||e[28]!==t?(m=t!==""&&a.jsx("button",{type:"button","aria-label":_,onMouseDown:P,onClick:()=>{s(""),o||p(!1)},className:"shrink-0 text-muted-foreground hover:text-foreground",children:a.jsx(M,{className:"size-3.5"})}),e[25]=_,e[26]=o,e[27]=s,e[28]=t,e[29]=m):m=e[29];let b;return e[30]!==u||e[31]!==m||e[32]!==n?(b=a.jsxs("div",{className:n,children:[x,u,m]}),e[30]=u,e[31]=m,e[32]=n,e[33]=b):b=e[33],b}function P(S){return S.preventDefault()}export{G as S};
1
+ import{c as K,r as C,m as B,j as a,b2 as M}from"./index-C0YexCRj.js";import{i as I}from"./SearchMd-DseifSbW.js";import{I as O}from"./icon-button-FgAeY2VI.js";function G(S){const e=K.c(34),{value:t,onChange:s,label:E,placeholder:D,clearLabel:F,expanded:o,className:j}=S,w=E===void 0?"Search":E,d=D===void 0?"Search…":D,_=F===void 0?"Clear search":F,[L,p]=C.useState(t!==""),[R,z]=C.useState(!1),[V,$]=C.useState(t);if(t!==V&&($(t),t===""&&!R&&p(!1)),!L&&!o){let l,g;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>p(!0),g=a.jsx(I,{}),e[0]=l,e[1]=g):(l=e[0],g=e[1]);let v;return e[2]!==w?(v=a.jsx(O,{label:w,tooltipSide:"bottom",variant:"outline",onClick:l,children:g}),e[2]=w,e[3]=v):v=e[3],v}const k=o?"h-10 w-full px-3":"h-7 w-32 animate-search-expand px-2.5 sm:w-44";let n;e[4]!==j||e[5]!==k?(n=B("inline-flex shrink-0 items-center gap-1.5 overflow-hidden rounded-full bg-card text-card-foreground shadow-edge",k,j),e[4]=j,e[5]=k,e[6]=n):n=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=a.jsx(I,{className:"size-4 shrink-0 text-muted-foreground"}),e[7]=x):x=e[7];const y=!o;let r;e[8]!==s?(r=l=>s(l.target.value),e[8]=s,e[9]=r):r=e[9];let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>z(!0),e[10]=h):h=e[10];let i;e[11]!==t?(i=()=>{z(!1),t===""&&p(!1)},e[11]=t,e[12]=i):i=e[12];let c;e[13]!==s?(c=l=>{l.key==="Escape"&&s("")},e[13]=s,e[14]=c):c=e[14];const N=o?"text-sm":"text-xs";let f;e[15]!==N?(f=B("w-full min-w-0 bg-transparent outline-none placeholder:text-muted-foreground",N),e[15]=N,e[16]=f):f=e[16];let u;e[17]!==d||e[18]!==i||e[19]!==c||e[20]!==f||e[21]!==y||e[22]!==r||e[23]!==t?(u=a.jsx("input",{autoFocus:y,value:t,onChange:r,onFocus:h,onBlur:i,onKeyDown:c,placeholder:d,"aria-label":d,className:f}),e[17]=d,e[18]=i,e[19]=c,e[20]=f,e[21]=y,e[22]=r,e[23]=t,e[24]=u):u=e[24];let m;e[25]!==_||e[26]!==o||e[27]!==s||e[28]!==t?(m=t!==""&&a.jsx("button",{type:"button","aria-label":_,onMouseDown:P,onClick:()=>{s(""),o||p(!1)},className:"shrink-0 text-muted-foreground hover:text-foreground",children:a.jsx(M,{className:"size-3.5"})}),e[25]=_,e[26]=o,e[27]=s,e[28]=t,e[29]=m):m=e[29];let b;return e[30]!==u||e[31]!==m||e[32]!==n?(b=a.jsxs("div",{className:n,children:[x,u,m]}),e[30]=u,e[31]=m,e[32]=n,e[33]=b):b=e[33],b}function P(S){return S.preventDefault()}export{G as S};
@@ -1 +1 @@
1
- import{c as x,ax as d,b as j,j as i}from"./index-D8pFT62M.js";import{t as E}from"./Users01-CgIFV9B4.js";const R=/^[A-Za-z0-9_.-]+$/;function b(f){const e=x.c(15),{field:p,secretById:t}=f,s=j(),n=p.value||"";if(!n)return null;let l;e[0]!==n||e[1]!==t?(l=t.get(n),e[0]=n,e[1]=t,e[2]=l):l=e[2];const c=l;if(!c){let a;e[3]!==n||e[4]!==s?(a=s("sandbox.envVarsField.missingSecret",{id:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5];let u;return e[6]!==a?(u=i.jsx("span",{className:"text-destructive",children:a}),e[6]=a,e[7]=u):u=e[7],u}let o;e[8]!==c.scope?(o=i.jsx(N,{scope:c.scope}),e[8]=c.scope,e[9]=o):o=e[9];let r;e[10]!==c.name?(r=i.jsx("span",{className:"truncate font-mono",children:c.name}),e[10]=c.name,e[11]=r):r=e[11];let m;return e[12]!==o||e[13]!==r?(m=i.jsxs("span",{className:"inline-flex items-center gap-1.5 truncate",children:[o,r]}),e[12]=o,e[13]=r,e[14]=m):m=e[14],m}function N(f){const e=x.c(2),{scope:p}=f,t=p==="user"?d:E;let s;return e[0]!==t?(s=i.jsx(t,{className:"size-3 text-muted-foreground"}),e[0]=t,e[1]=s):s=e[1],s}export{b as S,R as a,N as b};
1
+ import{c as x,ax as d,b as j,j as i}from"./index-C0YexCRj.js";import{t as E}from"./Users01-DQRKjdTI.js";const R=/^[A-Za-z0-9_.-]+$/;function b(f){const e=x.c(15),{field:p,secretById:t}=f,s=j(),n=p.value||"";if(!n)return null;let l;e[0]!==n||e[1]!==t?(l=t.get(n),e[0]=n,e[1]=t,e[2]=l):l=e[2];const c=l;if(!c){let a;e[3]!==n||e[4]!==s?(a=s("sandbox.envVarsField.missingSecret",{id:n}),e[3]=n,e[4]=s,e[5]=a):a=e[5];let u;return e[6]!==a?(u=i.jsx("span",{className:"text-destructive",children:a}),e[6]=a,e[7]=u):u=e[7],u}let o;e[8]!==c.scope?(o=i.jsx(N,{scope:c.scope}),e[8]=c.scope,e[9]=o):o=e[9];let r;e[10]!==c.name?(r=i.jsx("span",{className:"truncate font-mono",children:c.name}),e[10]=c.name,e[11]=r):r=e[11];let m;return e[12]!==o||e[13]!==r?(m=i.jsxs("span",{className:"inline-flex items-center gap-1.5 truncate",children:[o,r]}),e[12]=o,e[13]=r,e[14]=m):m=e[14],m}function N(f){const e=x.c(2),{scope:p}=f,t=p==="user"?d:E;let s;return e[0]!==t?(s=i.jsx(t,{className:"size-3 text-muted-foreground"}),e[0]=t,e[1]=s):s=e[1],s}export{b as S,R as a,N as b};
@@ -1 +1 @@
1
- import{c as j,b as N,j as s,n as C,hk as k,R as F,r as y,bB as B,B as D,ax as L,ag as E,D as O,v as R,w as A,x as I,aT as q,I as _,y as V,t as z,g2 as H}from"./index-D8pFT62M.js";import{i as G}from"./AlertCircle-BavhHXrm.js";import{s as J}from"./Plus-CcxRdpHl.js";import{t as K}from"./Users01-CgIFV9B4.js";import{E as M}from"./empty-state-CPzwuwQF.js";import{L as w}from"./label-DyJSQ7-Z.js";import{S as Q,b as U,a as W,d as X,c as P}from"./select-o79Ct_ay.js";import{T as Y}from"./textarea-B05kUdob.js";import{u as Z,a as ee}from"./use-secrets-D3u_mrII.js";import{R as te}from"./require-capability-rIoksLSL.js";import"./index-BdQq_4o_.js";import"./index-CLm0YAEW.js";import"./ChevronUp-CP2Q1tno.js";import"./access-gate-DetE2JQz.js";import"./capability-load-error-DTfH6BCq.js";function se(t){const e=j.c(6),{error:r}=t,i=N();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(G,{size:16}),e[0]=c):c=e[0];let n;e[1]!==r.message||e[2]!==i?(n=i("settings.secrets.failedToLoadError",{error:r.message}),e[1]=r.message,e[2]=i,e[3]=n):n=e[3];let l;return e[4]!==n?(l=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,s.jsx("span",{className:"text-sm font-medium",children:n})]}),e[4]=n,e[5]=l):l=e[5],l}function re(t){const e=j.c(8),{scope:r}=t,i=N(),c=r==="user"?L:K;let n;e[0]!==r||e[1]!==i?(n=i(r==="user"?"settings.secrets.scopePrivate":"settings.secrets.scopeOrganization"),e[0]=r,e[1]=i,e[2]=n):n=e[2];const l=n;let a;e[3]!==c?(a=s.jsx(c,{size:12}),e[3]=c,e[4]=a):a=e[4];let m;return e[5]!==l||e[6]!==a?(m=s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[a,l]}),e[5]=l,e[6]=a,e[7]=m):m=e[7],m}function $(t){const e=j.c(20),{secret:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:s.jsx(E,{size:16,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let c;e[1]!==r.name?(c=s.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=c):c=e[2];let n;e[3]!==r.scope?(n=s.jsx(re,{scope:r.scope}),e[3]=r.scope,e[4]=n):n=e[4];let l;e[5]!==c||e[6]!==n?(l=s.jsxs("div",{className:"flex items-center gap-2",children:[c,n]}),e[5]=c,e[6]=n,e[7]=l):l=e[7];let a;e[8]!==r.description?(a=r.description?s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=a):a=e[9];let m;e[10]!==l||e[11]!==a?(m=s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[i,s.jsxs("div",{className:"min-w-0",children:[l,a]})]}),e[10]=l,e[11]=a,e[12]=m):m=e[12];let d;e[13]!==r.createdAt?(d=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=d):d=e[14];let u;e[15]!==d?(u=s.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:d}),e[15]=d,e[16]=u):u=e[16];let x;return e[17]!==m||e[18]!==u?(x=s.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[m,u]}),e[17]=m,e[18]=u,e[19]=x):x=e[19],x}function ne(t){const e=j.c(9),{action:r}=t,i=N();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(E,{}),e[0]=c):c=e[0];let n;e[1]!==i?(n=i("settings.secrets.emptyTitle"),e[1]=i,e[2]=n):n=e[2];let l;e[3]!==i?(l=i("settings.secrets.emptyDescription"),e[3]=i,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==n||e[7]!==l?(a=s.jsx(H,{children:s.jsx(M,{size:"inline",icon:c,title:n,description:l,children:r})}),e[5]=r,e[6]=n,e[7]=l,e[8]=a):a=e[8],a}function T({open:t,onOpenChange:e}){const r=N(),[i,c]=y.useState("organization"),[n,l]=y.useState(""),[a,m]=y.useState(""),[d,u]=y.useState(""),x=ee();function g(){c("organization"),l(""),m(""),u("")}function p(){g(),e(!1)}async function S(o){if(o.preventDefault(),!(!n.trim()||!a))try{await x.mutateAsync({scope:i,name:n.trim(),value:a,description:d.trim()||void 0}),z.success(r("settings.secrets.secretCreated",{name:n.trim()})),p()}catch(f){z.error(f instanceof Error?f.message:r("settings.secrets.failedToCreateSecret"))}}return s.jsx(O,{open:t,onOpenChange:o=>{o?e(o):p()},children:s.jsxs(R,{className:"sm:max-w-lg",children:[s.jsxs(A,{children:[s.jsx(I,{children:r("settings.secrets.newSecretTitle")}),s.jsx(q,{children:r("settings.secrets.newSecretDescription")})]}),s.jsxs("form",{onSubmit:S,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-scope",children:r("settings.secrets.scopeLabel")}),s.jsxs(Q,{value:i,onValueChange:o=>c(o),children:[s.jsx(U,{id:"secret-scope",children:s.jsx(W,{})}),s.jsxs(X,{children:[s.jsx(P,{value:"organization",children:r("settings.secrets.scopeOrganizationDescription")}),s.jsx(P,{value:"user",children:r("settings.secrets.scopePrivateDescription")})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-name",children:r("settings.secrets.nameLabel")}),s.jsx(_,{id:"secret-name",value:n,onChange:o=>l(o.target.value),placeholder:r("settings.secrets.namePlaceholder"),autoComplete:"off",required:!0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:r("settings.secrets.nameHelp")})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-value",children:r("settings.secrets.valueLabel")}),s.jsx(_,{id:"secret-value",type:"password",value:a,onChange:o=>m(o.target.value),autoComplete:"new-password",required:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-description",children:r("settings.secrets.descriptionLabel")}),s.jsx(Y,{id:"secret-description",value:d,onChange:o=>u(o.target.value),rows:2,placeholder:r("settings.secrets.descriptionPlaceholder")})]}),s.jsxs(V,{children:[s.jsx(D,{type:"button",variant:"outline",onClick:p,disabled:x.isPending,children:r("settings.secrets.cancelButton")}),s.jsx(D,{type:"submit",disabled:x.isPending||!n.trim()||!a,children:x.isPending?r("settings.secrets.creatingButton"):r("settings.secrets.createButton")})]})]})]})})}function ie(){const t=j.c(34),e=N(),r=Z(),[i,c]=y.useState(!1);let n,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>c(!0),l=s.jsx(J,{size:14}),t[0]=n,t[1]=l):(n=t[0],l=t[1]);let a;t[2]!==e?(a=e("settings.secrets.newSecret"),t[2]=e,t[3]=a):a=t[3];let m;t[4]!==a?(m=s.jsx(C.Actions,{children:s.jsxs(D,{size:"sm",onClick:n,children:[l,a]})}),t[4]=a,t[5]=m):m=t[5];const d=m;if(r.length===0){let o;t[6]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ne,{action:!1}),t[6]=o):o=t[6];let f;t[7]!==i?(f=s.jsx(T,{open:i,onOpenChange:c}),t[7]=i,t[8]=f):f=t[8];let h;return t[9]!==d||t[10]!==f?(h=s.jsxs(s.Fragment,{children:[d,o,f]}),t[9]=d,t[10]=f,t[11]=h):h=t[11],h}let u,x,g;if(t[12]!==d||t[13]!==r||t[14]!==e){const o=r.filter(oe),f=r.filter(ae),h=r.length===1?"settings.secrets.secretsCountSingular":"settings.secrets.secretsCountPlural";let b;t[18]!==r.length||t[19]!==e||t[20]!==h?(b=e(h,{count:r.length}),t[18]=r.length,t[19]=e,t[20]=h,t[21]=b):b=t[21];let v;t[22]!==b?(v=s.jsx("p",{className:"text-sm text-muted-foreground",children:b}),t[22]=b,t[23]=v):v=t[23],t[24]!==d||t[25]!==v?(u=s.jsxs("div",{className:"flex items-center justify-between",children:[v,d]}),t[24]=d,t[25]=v,t[26]=u):u=t[26],x=o.length>0?s.jsxs("section",{className:"surface p-5",children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:e("settings.secrets.sectionOrganization")}),s.jsx("div",{children:o.map(le)})]}):null,g=f.length>0?s.jsxs("section",{className:"surface p-5",children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:e("settings.secrets.sectionPrivate")}),s.jsx("div",{children:f.map(ce)})]}):null,t[12]=d,t[13]=r,t[14]=e,t[15]=u,t[16]=x,t[17]=g}else u=t[15],x=t[16],g=t[17];let p;t[27]!==i?(p=s.jsx(T,{open:i,onOpenChange:c}),t[27]=i,t[28]=p):p=t[28];let S;return t[29]!==u||t[30]!==x||t[31]!==g||t[32]!==p?(S=s.jsxs(s.Fragment,{children:[u,x,g,p]}),t[29]=u,t[30]=x,t[31]=g,t[32]=p,t[33]=S):S=t[33],S}function ce(t){return s.jsx($,{secret:t},t.id)}function le(t){return s.jsx($,{secret:t},t.id)}function ae(t){return t.scope==="user"}function oe(t){return t.scope==="organization"}function me(){const t=j.c(7),e=N();let r;t[0]!==e?(r=e("settings.nav.secrets"),t[0]=e,t[1]=r):r=t[1];let i;t[2]!==r?(i=s.jsx(C.Title,{children:r}),t[2]=r,t[3]=i):i=t[3];let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(F,{fallback:de,children:s.jsx(y.Suspense,{fallback:s.jsx(B,{className:"h-32 w-full"}),children:s.jsx(ie,{})})}),t[4]=c):c=t[4];let n;return t[5]!==i?(n=s.jsx(C,{children:s.jsx(C.Content,{children:s.jsx(C.Container,{children:s.jsxs(k,{children:[i,c]})})})}),t[5]=i,t[6]=n):n=t[6],n}function de(t){const{error:e}=t;return s.jsx(se,{error:e??new Error("Failed to load secrets")})}function _e(){const t=j.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{capability:"secrets:manage",area:"secrets",children:s.jsx(me,{})}),t[0]=e):e=t[0],e}export{_e as default};
1
+ import{c as j,b as N,j as s,n as C,hk as k,R as F,r as y,bB as B,B as D,ax as L,ag as E,D as O,v as R,w as A,x as I,aT as q,I as _,y as V,t as z,g2 as H}from"./index-C0YexCRj.js";import{i as G}from"./AlertCircle-vm4sk-x9.js";import{s as J}from"./Plus-CZbPbPr7.js";import{t as K}from"./Users01-DQRKjdTI.js";import{E as M}from"./empty-state-Df2e2-7k.js";import{L as w}from"./label-CnHmgvIU.js";import{S as Q,b as U,a as W,d as X,c as P}from"./select-C67xaSM-.js";import{T as Y}from"./textarea-Duz08Iqx.js";import{u as Z,a as ee}from"./use-secrets-4gWR8BJM.js";import{R as te}from"./require-capability-DcSbNfND.js";import"./index-BdQq_4o_.js";import"./index-CdLJWnRN.js";import"./ChevronUp-DzfCpOxS.js";import"./access-gate-QW6XL1k3.js";import"./capability-load-error-C2BQaZ2o.js";function se(t){const e=j.c(6),{error:r}=t,i=N();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(G,{size:16}),e[0]=c):c=e[0];let n;e[1]!==r.message||e[2]!==i?(n=i("settings.secrets.failedToLoadError",{error:r.message}),e[1]=r.message,e[2]=i,e[3]=n):n=e[3];let l;return e[4]!==n?(l=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[c,s.jsx("span",{className:"text-sm font-medium",children:n})]}),e[4]=n,e[5]=l):l=e[5],l}function re(t){const e=j.c(8),{scope:r}=t,i=N(),c=r==="user"?L:K;let n;e[0]!==r||e[1]!==i?(n=i(r==="user"?"settings.secrets.scopePrivate":"settings.secrets.scopeOrganization"),e[0]=r,e[1]=i,e[2]=n):n=e[2];const l=n;let a;e[3]!==c?(a=s.jsx(c,{size:12}),e[3]=c,e[4]=a):a=e[4];let m;return e[5]!==l||e[6]!==a?(m=s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[a,l]}),e[5]=l,e[6]=a,e[7]=m):m=e[7],m}function $(t){const e=j.c(20),{secret:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:s.jsx(E,{size:16,className:"text-muted-foreground"})}),e[0]=i):i=e[0];let c;e[1]!==r.name?(c=s.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=c):c=e[2];let n;e[3]!==r.scope?(n=s.jsx(re,{scope:r.scope}),e[3]=r.scope,e[4]=n):n=e[4];let l;e[5]!==c||e[6]!==n?(l=s.jsxs("div",{className:"flex items-center gap-2",children:[c,n]}),e[5]=c,e[6]=n,e[7]=l):l=e[7];let a;e[8]!==r.description?(a=r.description?s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=a):a=e[9];let m;e[10]!==l||e[11]!==a?(m=s.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[i,s.jsxs("div",{className:"min-w-0",children:[l,a]})]}),e[10]=l,e[11]=a,e[12]=m):m=e[12];let d;e[13]!==r.createdAt?(d=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=d):d=e[14];let u;e[15]!==d?(u=s.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:d}),e[15]=d,e[16]=u):u=e[16];let x;return e[17]!==m||e[18]!==u?(x=s.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[m,u]}),e[17]=m,e[18]=u,e[19]=x):x=e[19],x}function ne(t){const e=j.c(9),{action:r}=t,i=N();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(E,{}),e[0]=c):c=e[0];let n;e[1]!==i?(n=i("settings.secrets.emptyTitle"),e[1]=i,e[2]=n):n=e[2];let l;e[3]!==i?(l=i("settings.secrets.emptyDescription"),e[3]=i,e[4]=l):l=e[4];let a;return e[5]!==r||e[6]!==n||e[7]!==l?(a=s.jsx(H,{children:s.jsx(M,{size:"inline",icon:c,title:n,description:l,children:r})}),e[5]=r,e[6]=n,e[7]=l,e[8]=a):a=e[8],a}function T({open:t,onOpenChange:e}){const r=N(),[i,c]=y.useState("organization"),[n,l]=y.useState(""),[a,m]=y.useState(""),[d,u]=y.useState(""),x=ee();function g(){c("organization"),l(""),m(""),u("")}function p(){g(),e(!1)}async function S(o){if(o.preventDefault(),!(!n.trim()||!a))try{await x.mutateAsync({scope:i,name:n.trim(),value:a,description:d.trim()||void 0}),z.success(r("settings.secrets.secretCreated",{name:n.trim()})),p()}catch(f){z.error(f instanceof Error?f.message:r("settings.secrets.failedToCreateSecret"))}}return s.jsx(O,{open:t,onOpenChange:o=>{o?e(o):p()},children:s.jsxs(R,{className:"sm:max-w-lg",children:[s.jsxs(A,{children:[s.jsx(I,{children:r("settings.secrets.newSecretTitle")}),s.jsx(q,{children:r("settings.secrets.newSecretDescription")})]}),s.jsxs("form",{onSubmit:S,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-scope",children:r("settings.secrets.scopeLabel")}),s.jsxs(Q,{value:i,onValueChange:o=>c(o),children:[s.jsx(U,{id:"secret-scope",children:s.jsx(W,{})}),s.jsxs(X,{children:[s.jsx(P,{value:"organization",children:r("settings.secrets.scopeOrganizationDescription")}),s.jsx(P,{value:"user",children:r("settings.secrets.scopePrivateDescription")})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-name",children:r("settings.secrets.nameLabel")}),s.jsx(_,{id:"secret-name",value:n,onChange:o=>l(o.target.value),placeholder:r("settings.secrets.namePlaceholder"),autoComplete:"off",required:!0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:r("settings.secrets.nameHelp")})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-value",children:r("settings.secrets.valueLabel")}),s.jsx(_,{id:"secret-value",type:"password",value:a,onChange:o=>m(o.target.value),autoComplete:"new-password",required:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(w,{htmlFor:"secret-description",children:r("settings.secrets.descriptionLabel")}),s.jsx(Y,{id:"secret-description",value:d,onChange:o=>u(o.target.value),rows:2,placeholder:r("settings.secrets.descriptionPlaceholder")})]}),s.jsxs(V,{children:[s.jsx(D,{type:"button",variant:"outline",onClick:p,disabled:x.isPending,children:r("settings.secrets.cancelButton")}),s.jsx(D,{type:"submit",disabled:x.isPending||!n.trim()||!a,children:x.isPending?r("settings.secrets.creatingButton"):r("settings.secrets.createButton")})]})]})]})})}function ie(){const t=j.c(34),e=N(),r=Z(),[i,c]=y.useState(!1);let n,l;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>c(!0),l=s.jsx(J,{size:14}),t[0]=n,t[1]=l):(n=t[0],l=t[1]);let a;t[2]!==e?(a=e("settings.secrets.newSecret"),t[2]=e,t[3]=a):a=t[3];let m;t[4]!==a?(m=s.jsx(C.Actions,{children:s.jsxs(D,{size:"sm",onClick:n,children:[l,a]})}),t[4]=a,t[5]=m):m=t[5];const d=m;if(r.length===0){let o;t[6]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ne,{action:!1}),t[6]=o):o=t[6];let f;t[7]!==i?(f=s.jsx(T,{open:i,onOpenChange:c}),t[7]=i,t[8]=f):f=t[8];let h;return t[9]!==d||t[10]!==f?(h=s.jsxs(s.Fragment,{children:[d,o,f]}),t[9]=d,t[10]=f,t[11]=h):h=t[11],h}let u,x,g;if(t[12]!==d||t[13]!==r||t[14]!==e){const o=r.filter(oe),f=r.filter(ae),h=r.length===1?"settings.secrets.secretsCountSingular":"settings.secrets.secretsCountPlural";let b;t[18]!==r.length||t[19]!==e||t[20]!==h?(b=e(h,{count:r.length}),t[18]=r.length,t[19]=e,t[20]=h,t[21]=b):b=t[21];let v;t[22]!==b?(v=s.jsx("p",{className:"text-sm text-muted-foreground",children:b}),t[22]=b,t[23]=v):v=t[23],t[24]!==d||t[25]!==v?(u=s.jsxs("div",{className:"flex items-center justify-between",children:[v,d]}),t[24]=d,t[25]=v,t[26]=u):u=t[26],x=o.length>0?s.jsxs("section",{className:"surface p-5",children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:e("settings.secrets.sectionOrganization")}),s.jsx("div",{children:o.map(le)})]}):null,g=f.length>0?s.jsxs("section",{className:"surface p-5",children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:e("settings.secrets.sectionPrivate")}),s.jsx("div",{children:f.map(ce)})]}):null,t[12]=d,t[13]=r,t[14]=e,t[15]=u,t[16]=x,t[17]=g}else u=t[15],x=t[16],g=t[17];let p;t[27]!==i?(p=s.jsx(T,{open:i,onOpenChange:c}),t[27]=i,t[28]=p):p=t[28];let S;return t[29]!==u||t[30]!==x||t[31]!==g||t[32]!==p?(S=s.jsxs(s.Fragment,{children:[u,x,g,p]}),t[29]=u,t[30]=x,t[31]=g,t[32]=p,t[33]=S):S=t[33],S}function ce(t){return s.jsx($,{secret:t},t.id)}function le(t){return s.jsx($,{secret:t},t.id)}function ae(t){return t.scope==="user"}function oe(t){return t.scope==="organization"}function me(){const t=j.c(7),e=N();let r;t[0]!==e?(r=e("settings.nav.secrets"),t[0]=e,t[1]=r):r=t[1];let i;t[2]!==r?(i=s.jsx(C.Title,{children:r}),t[2]=r,t[3]=i):i=t[3];let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(F,{fallback:de,children:s.jsx(y.Suspense,{fallback:s.jsx(B,{className:"h-32 w-full"}),children:s.jsx(ie,{})})}),t[4]=c):c=t[4];let n;return t[5]!==i?(n=s.jsx(C,{children:s.jsx(C.Content,{children:s.jsx(C.Container,{children:s.jsxs(k,{children:[i,c]})})})}),t[5]=i,t[6]=n):n=t[6],n}function de(t){const{error:e}=t;return s.jsx(se,{error:e??new Error("Failed to load secrets")})}function _e(){const t=j.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(te,{capability:"secrets:manage",area:"secrets",children:s.jsx(me,{})}),t[0]=e):e=t[0],e}export{_e as default};
@@ -1 +1 @@
1
- import{bA as g,c5 as E,fz as w,fd as L,fA as A,bF as y,bL as d,bX as D,fB as P,bE as T,bV as k,bC as j,bW as B,fC as R,b7 as C,bR as x,bY as K}from"./index-D8pFT62M.js";import{D as I,r as F,A as W,Y as U,ad as Y}from"./blocks-tab-states-DjNiCspc.js";const l="https://docs.decocms.com/storefront/blocks",ne={quickstart:`${l}/next/quickstart`,siteEditor:`${l}/next/site-editor#edit-on-your-machine`,serve:`${l}/next/cli#deco-serve`,schema:`${l}/next/cli#deco-schema-and-deco-content`,troubleshooting:`${l}/next/troubleshooting#site-editor`},ae="https://github.com/decocms/blocks/tree/main/.agents/skills/deco-site-workflow";function $(e){return e.includes("matchers")||e.includes("Match")}function m(e,r){const t=e.__resolveType;return typeof t!="string"||!t||U(t,r)?!1:r?w(r,t):$(t)}function oe(e,r){const t=[];for(const[n,a]of Object.entries(r)){if(n.includes("/")||!g(n,e)||E(n)||!a||typeof a!="object"||Array.isArray(a))continue;const o=a;m(o,e)&&t.push({blockKey:n,matcherResolveType:o.__resolveType??"",name:typeof o.name=="string"?o.name:void 0})}return t.sort((n,a)=>(n.name??n.blockKey).localeCompare(a.name??a.blockKey))}function p(e,r,t){if(!e)return!1;const n=e.__resolveType;if(typeof n!="string"||!g(n,t)||!Object.hasOwn(r,n))return!1;const a=r[n];return!a||typeof a!="object"||Array.isArray(a)?!1:m(a,t)}function se(e,r,t){return p(e,r,t)?e?.__resolveType??null:null}function V(e,r,t){if(!e)return null;const n=e.__resolveType??"";if(!n)return null;if(p(e,r,t)){const s=r[n]??{},i=s.__resolveType??n,{__resolveType:c,name:u,...v}=s;return{resolveType:i,data:v,blockKey:n}}const{__resolveType:a,...o}=e;return{resolveType:n,data:o}}function q(e,r,t){const n=V(e,r,t);return n?{__resolveType:n.resolveType,...n.data}:{__resolveType:""}}function ie(e,r,t){if(e)return p(e,r,t)?q(e,r,t):e}function z(e,r,t,n){if(!e)return"Default";if(p(e,r,n)){const a=e.__resolveType??"",o=r[a];return I(a,o)}return t(e,F(r))}function ce(e,r,t){return{__resolveType:e,...r,name:t}}function ue(e){return{__resolveType:e}}function le(e,r,t){const n=V(e,r,t);return n?{resolveType:n.resolveType,formValue:n.data}:{resolveType:"",formValue:{}}}function fe(e,r){const t={__resolveType:e};if(!e||!r)return t;const n=W(e,r),a=n?.type==="inline-union"?n.inlineUnionBranches?.[0]?.discriminators:void 0;return a?{...t,...a}:t}function S(e){const r=[];for(let t=e;t?.key!=null;t=t.parent)r.push(t.key);return r.reverse()}function G(e){return{blockKey:e.blockKey,path:S(e)}}function N(e,r,t){const n=[];for(const[o,s]of Object.entries(e))o!==r&&n.push({node:s,blockKey:o,parent:null,key:null});const a=new Set;for(;n.length>0;){const o=n.pop(),{node:s}=o;if(!(!s||typeof s!="object")&&!a.has(s)){if(a.add(s),Array.isArray(s)){s.forEach((i,c)=>{n.push({node:i,blockKey:o.blockKey,parent:o,key:c})});continue}t(s,o);for(const[i,c]of Object.entries(s))n.push({node:c,blockKey:o.blockKey,parent:o,key:i})}}}function H(e,r,t){if(!r)return[];const n=[];return N(e,r,(a,o)=>{if(a.__resolveType!==r||!p(a,e,t))return;const s=X(o);n.push({...G(o),...s?{variant:s}:{}})}),n}function X(e){for(let r=e;r;r=r.parent){const t=r.parent,n=t?.parent,a=n?.parent;if(!t||!n||!a)return;if(r.key==="rule"&&typeof t.key=="number"&&n.key==="variants"&&Y(a.node)&&L(a.node.__resolveType)){const o=a.node.experiment;return{containerPath:S(a),containerType:a.node.__resolveType,index:t.key,...typeof o=="string"?{experiment:o}:{}}}}}function J(e){for(const r of e.anyOfRefs??[]){if(r.resolveType!==A&&r.resolveType!==y)continue;const t=r.schema?.properties?.variants?.items?.properties?.value,n=t?.lazy?t.properties?.value:t;if(n?.type==="array")return n}}function Q(e){return J(e)!==void 0}function ye(e,r){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Array.isArray(t.variants)?t.__resolveType===R?!0:r&&t.__resolveType===y&&!M(t.variants):!1}function M(e){return e.some(r=>Array.isArray(d(r)))}function O(e,r){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return t.__resolveType===A?!0:r&&t.__resolveType===y&&Array.isArray(t.variants)&&M(t.variants)}function pe(e,r){if(!O(e,r))return null;const t=e.variants;if(!Array.isArray(t))return null;const n=C(t[0],r);return Array.isArray(n)?n:null}function ve(e,r,t,n){if(!O(e,n))return r;const a=structuredClone(e),o=[...a.variants??[]];return o.length===0?o.push({rule:k(t),value:T(a.__resolveType,r)}):o[0]=x(a.__resolveType,o[0],r),{...a,variants:o}}function de(e,r){const n=e[r]?.sections;if(!n||Array.isArray(n))return 1;const a=n;return Array.isArray(a.variants)?a.variants.length:1}function _e(e,r,t){const a=e[r]?.sections;if(Array.isArray(a))return t===0?a:[];if(a&&typeof a=="object"){const o=a.variants;if(Array.isArray(o)){const s=d(o[t]);return Array.isArray(s)?s:[]}}return[]}function be(e,r,t){if(Array.isArray(e))return[{label:"Default",sections:e}];if(e&&typeof e=="object"){const n=e;if(Array.isArray(n.variants)){const a=n.variants,o=P(a.map(s=>z(s.rule,r,t)));return a.map((s,i)=>{const c=o[i],u=d(s);return{label:c||`Variant ${i+1}`,sections:Array.isArray(u)?u:[],rule:s.rule}})}}return[]}function _(e,r,t){return{rule:k(r),value:T(t,e)}}function b(e,r){return e?e.__resolveType===y?y:A:j(r)}function f(e,r,t){return{...r,__resolveType:b(r,t),variants:e}}function he(e,r,t,n=!1){const a=structuredClone(r);if(e&&typeof e=="object"&&!Array.isArray(e)){const c=e;if(!Array.isArray(c.variants))return null;const u=[...c.variants],v=D(u,n);return u.splice(v,0,_(a,t,b(c))),{sections:f(u,c),newVariantIndex:v}}const o=b(void 0,t),s=_(Array.isArray(e)?e:[],t,o),i=_(a,t,o);return{sections:f(n?[i,s]:[s,i],void 0,t),newVariantIndex:n?0:1}}function Ae(e,r,t=!1){const n=e[r];if(!n)return null;const a=[...e];return a.splice(K(e,r,t),0,structuredClone(n)),a}function ge(e,r){if(r.length===0)return f([],e);if(r.length===1){const t=r[0],n=t?.rule;if(!B(n))return f(r,e);const a=d(t);if(Array.isArray(a))return a}return f(r,e)}function Z(e,r,t){return H(e,r,t).length}function Te(e,r,t,n){return n?!1:Z(e,r,t)===0}const ke={claiming:{long:"Reserving sandbox",short:"Reserving sandbox"},"waiting-for-capacity":{long:"Waiting for cluster capacity",short:"Waiting for capacity"},"pulling-image":{long:"Downloading sandbox image",short:"Downloading image"},"starting-container":{long:"Starting your sandbox",short:"Starting container"},"warming-daemon":{long:"Connecting to your sandbox",short:"Connecting to sandbox"}};function h(e){return e.includes("/sections/")||e.includes("multivariate/section")||e===R}function ee(e){if(e.anyOfRefs?.length)return e.anyOfRefs.some(t=>h(t.resolveType));const r=e.properties?.__resolveType;return r?.type==="block-ref"&&r.anyOfRefs?.length?r.anyOfRefs.some(t=>h(t.resolveType)):!1}function Re(e){return e.type!=="block-ref"||!e.anyOfRefs?.length?!1:e.anyOfRefs.some(r=>h(r.resolveType))}function me(e,r){if(r==="global"||r==="sections"||Q(e))return!0;const t=e.type==="array"?e.items:void 0;return t?ee(t):!1}export{Te as A,Ae as B,ke as C,ae as D,de as a,he as b,me as c,q as d,ue as e,Re as f,_e as g,z as h,Q as i,se as j,le as k,oe as l,p as m,ce as n,ye as o,be as p,O as q,ie as r,fe as s,J as t,pe as u,ne as v,ve as w,h as x,V as y,ge as z};
1
+ import{bA as g,c5 as E,fz as w,fd as L,fA as A,bF as y,bL as d,bX as D,fB as P,bE as T,bV as k,bC as j,bW as B,fC as R,b7 as C,bR as x,bY as K}from"./index-C0YexCRj.js";import{D as I,r as F,A as W,Y as U,ad as Y}from"./blocks-tab-states-DAhg2Ye6.js";const l="https://docs.decocms.com/storefront/blocks",ne={quickstart:`${l}/next/quickstart`,siteEditor:`${l}/next/site-editor#edit-on-your-machine`,serve:`${l}/next/cli#deco-serve`,schema:`${l}/next/cli#deco-schema-and-deco-content`,troubleshooting:`${l}/next/troubleshooting#site-editor`},ae="https://github.com/decocms/blocks/tree/main/.agents/skills/deco-site-workflow";function $(e){return e.includes("matchers")||e.includes("Match")}function m(e,r){const t=e.__resolveType;return typeof t!="string"||!t||U(t,r)?!1:r?w(r,t):$(t)}function oe(e,r){const t=[];for(const[n,a]of Object.entries(r)){if(n.includes("/")||!g(n,e)||E(n)||!a||typeof a!="object"||Array.isArray(a))continue;const o=a;m(o,e)&&t.push({blockKey:n,matcherResolveType:o.__resolveType??"",name:typeof o.name=="string"?o.name:void 0})}return t.sort((n,a)=>(n.name??n.blockKey).localeCompare(a.name??a.blockKey))}function p(e,r,t){if(!e)return!1;const n=e.__resolveType;if(typeof n!="string"||!g(n,t)||!Object.hasOwn(r,n))return!1;const a=r[n];return!a||typeof a!="object"||Array.isArray(a)?!1:m(a,t)}function se(e,r,t){return p(e,r,t)?e?.__resolveType??null:null}function V(e,r,t){if(!e)return null;const n=e.__resolveType??"";if(!n)return null;if(p(e,r,t)){const s=r[n]??{},i=s.__resolveType??n,{__resolveType:c,name:u,...v}=s;return{resolveType:i,data:v,blockKey:n}}const{__resolveType:a,...o}=e;return{resolveType:n,data:o}}function q(e,r,t){const n=V(e,r,t);return n?{__resolveType:n.resolveType,...n.data}:{__resolveType:""}}function ie(e,r,t){if(e)return p(e,r,t)?q(e,r,t):e}function z(e,r,t,n){if(!e)return"Default";if(p(e,r,n)){const a=e.__resolveType??"",o=r[a];return I(a,o)}return t(e,F(r))}function ce(e,r,t){return{__resolveType:e,...r,name:t}}function ue(e){return{__resolveType:e}}function le(e,r,t){const n=V(e,r,t);return n?{resolveType:n.resolveType,formValue:n.data}:{resolveType:"",formValue:{}}}function fe(e,r){const t={__resolveType:e};if(!e||!r)return t;const n=W(e,r),a=n?.type==="inline-union"?n.inlineUnionBranches?.[0]?.discriminators:void 0;return a?{...t,...a}:t}function S(e){const r=[];for(let t=e;t?.key!=null;t=t.parent)r.push(t.key);return r.reverse()}function G(e){return{blockKey:e.blockKey,path:S(e)}}function N(e,r,t){const n=[];for(const[o,s]of Object.entries(e))o!==r&&n.push({node:s,blockKey:o,parent:null,key:null});const a=new Set;for(;n.length>0;){const o=n.pop(),{node:s}=o;if(!(!s||typeof s!="object")&&!a.has(s)){if(a.add(s),Array.isArray(s)){s.forEach((i,c)=>{n.push({node:i,blockKey:o.blockKey,parent:o,key:c})});continue}t(s,o);for(const[i,c]of Object.entries(s))n.push({node:c,blockKey:o.blockKey,parent:o,key:i})}}}function H(e,r,t){if(!r)return[];const n=[];return N(e,r,(a,o)=>{if(a.__resolveType!==r||!p(a,e,t))return;const s=X(o);n.push({...G(o),...s?{variant:s}:{}})}),n}function X(e){for(let r=e;r;r=r.parent){const t=r.parent,n=t?.parent,a=n?.parent;if(!t||!n||!a)return;if(r.key==="rule"&&typeof t.key=="number"&&n.key==="variants"&&Y(a.node)&&L(a.node.__resolveType)){const o=a.node.experiment;return{containerPath:S(a),containerType:a.node.__resolveType,index:t.key,...typeof o=="string"?{experiment:o}:{}}}}}function J(e){for(const r of e.anyOfRefs??[]){if(r.resolveType!==A&&r.resolveType!==y)continue;const t=r.schema?.properties?.variants?.items?.properties?.value,n=t?.lazy?t.properties?.value:t;if(n?.type==="array")return n}}function Q(e){return J(e)!==void 0}function ye(e,r){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return Array.isArray(t.variants)?t.__resolveType===R?!0:r&&t.__resolveType===y&&!M(t.variants):!1}function M(e){return e.some(r=>Array.isArray(d(r)))}function O(e,r){if(!e||typeof e!="object"||Array.isArray(e))return!1;const t=e;return t.__resolveType===A?!0:r&&t.__resolveType===y&&Array.isArray(t.variants)&&M(t.variants)}function pe(e,r){if(!O(e,r))return null;const t=e.variants;if(!Array.isArray(t))return null;const n=C(t[0],r);return Array.isArray(n)?n:null}function ve(e,r,t,n){if(!O(e,n))return r;const a=structuredClone(e),o=[...a.variants??[]];return o.length===0?o.push({rule:k(t),value:T(a.__resolveType,r)}):o[0]=x(a.__resolveType,o[0],r),{...a,variants:o}}function de(e,r){const n=e[r]?.sections;if(!n||Array.isArray(n))return 1;const a=n;return Array.isArray(a.variants)?a.variants.length:1}function _e(e,r,t){const a=e[r]?.sections;if(Array.isArray(a))return t===0?a:[];if(a&&typeof a=="object"){const o=a.variants;if(Array.isArray(o)){const s=d(o[t]);return Array.isArray(s)?s:[]}}return[]}function be(e,r,t){if(Array.isArray(e))return[{label:"Default",sections:e}];if(e&&typeof e=="object"){const n=e;if(Array.isArray(n.variants)){const a=n.variants,o=P(a.map(s=>z(s.rule,r,t)));return a.map((s,i)=>{const c=o[i],u=d(s);return{label:c||`Variant ${i+1}`,sections:Array.isArray(u)?u:[],rule:s.rule}})}}return[]}function _(e,r,t){return{rule:k(r),value:T(t,e)}}function b(e,r){return e?e.__resolveType===y?y:A:j(r)}function f(e,r,t){return{...r,__resolveType:b(r,t),variants:e}}function he(e,r,t,n=!1){const a=structuredClone(r);if(e&&typeof e=="object"&&!Array.isArray(e)){const c=e;if(!Array.isArray(c.variants))return null;const u=[...c.variants],v=D(u,n);return u.splice(v,0,_(a,t,b(c))),{sections:f(u,c),newVariantIndex:v}}const o=b(void 0,t),s=_(Array.isArray(e)?e:[],t,o),i=_(a,t,o);return{sections:f(n?[i,s]:[s,i],void 0,t),newVariantIndex:n?0:1}}function Ae(e,r,t=!1){const n=e[r];if(!n)return null;const a=[...e];return a.splice(K(e,r,t),0,structuredClone(n)),a}function ge(e,r){if(r.length===0)return f([],e);if(r.length===1){const t=r[0],n=t?.rule;if(!B(n))return f(r,e);const a=d(t);if(Array.isArray(a))return a}return f(r,e)}function Z(e,r,t){return H(e,r,t).length}function Te(e,r,t,n){return n?!1:Z(e,r,t)===0}const ke={claiming:{long:"Reserving sandbox",short:"Reserving sandbox"},"waiting-for-capacity":{long:"Waiting for cluster capacity",short:"Waiting for capacity"},"pulling-image":{long:"Downloading sandbox image",short:"Downloading image"},"starting-container":{long:"Starting your sandbox",short:"Starting container"},"warming-daemon":{long:"Connecting to your sandbox",short:"Connecting to sandbox"}};function h(e){return e.includes("/sections/")||e.includes("multivariate/section")||e===R}function ee(e){if(e.anyOfRefs?.length)return e.anyOfRefs.some(t=>h(t.resolveType));const r=e.properties?.__resolveType;return r?.type==="block-ref"&&r.anyOfRefs?.length?r.anyOfRefs.some(t=>h(t.resolveType)):!1}function Re(e){return e.type!=="block-ref"||!e.anyOfRefs?.length?!1:e.anyOfRefs.some(r=>h(r.resolveType))}function me(e,r){if(r==="global"||r==="sections"||Q(e))return!0;const t=e.type==="array"?e.items:void 0;return t?ee(t):!1}export{Te as A,Ae as B,ke as C,ae as D,de as a,he as b,me as c,q as d,ue as e,Re as f,_e as g,z as h,Q as i,se as j,le as k,oe as l,p as m,ce as n,ye as o,be as p,O as q,ie as r,fe as s,J as t,pe as u,ne as v,ve as w,h as x,V as y,ge as z};
@@ -1 +1 @@
1
- import{aU as i,T as e,l as s}from"./agent-icon-WM9Nds86.js";import{c6 as n}from"./index-D8pFT62M.js";import{a as o}from"./UserSquare-CeUdUVlp.js";const r=["general","views","connections","repository","site"],a={general:{icon:s,titleKey:"virtualMcp.settings.general.title",descriptionKey:"virtualMcp.settings.general.description"},views:{icon:o,titleKey:"virtualMcp.settings.views.title",descriptionKey:"virtualMcp.settings.views.description"},connections:{icon:i,titleKey:"virtualMcp.settings.connections.title",descriptionKey:"virtualMcp.settings.connections.description"},repository:{icon:n,titleKey:"virtualMcp.settings.repository.title",descriptionKey:"virtualMcp.settings.repository.description"},site:{icon:e,titleKey:"virtualMcp.settings.site.title",descriptionKey:"virtualMcp.settings.site.description"}};function g(t){return!!t&&r.includes(t)}export{a as P,r as a,g as i};
1
+ import{aU as i,T as e,l as s}from"./agent-icon-CTjv6Gf3.js";import{c6 as n}from"./index-C0YexCRj.js";import{a as o}from"./UserSquare-6Sdby0FR.js";const r=["general","views","connections","repository","site"],a={general:{icon:s,titleKey:"virtualMcp.settings.general.title",descriptionKey:"virtualMcp.settings.general.description"},views:{icon:o,titleKey:"virtualMcp.settings.views.title",descriptionKey:"virtualMcp.settings.views.description"},connections:{icon:i,titleKey:"virtualMcp.settings.connections.title",descriptionKey:"virtualMcp.settings.connections.description"},repository:{icon:n,titleKey:"virtualMcp.settings.repository.title",descriptionKey:"virtualMcp.settings.repository.description"},site:{icon:e,titleKey:"virtualMcp.settings.site.title",descriptionKey:"virtualMcp.settings.site.description"}};function g(t){return!!t&&r.includes(t)}export{a as P,r as a,g as i};
@@ -1 +1 @@
1
- import{i2 as Zo,bf as Xo,c as wn,b as Rn,r as b,m as de,j as r,bQ as ei,b8 as Ts,i3 as Pa,B as Ft,Y as an,au as ti,_ as ni,be as si,Z as ri,q as ai,hA as oi,i4 as ii,i5 as li,h as ci,bg as kt,i6 as Ur,i7 as vs,i8 as ui,i9 as dt,ia as Jr,ib as di,bt as fi,ic as mi,id as Yr,ie as pi,t as W,bZ as Qr,ig as hi,ih as Pt,ii as gi,ij as vi,ik as yi,bY as Zr,il as ys,im as Si,io as bi,ip as xi,bW as _i,bu as ki,iq as wi,ir as Ri,bT as ji,K as Ei,is as Xr,fc as Vi,bm as zn,br as ea,it as ta,iu as Ti,iv as Ai,iw as Ni,ix as Ss,iy as Ci,iz as Pi,iA as Bi,iB as na,iC as Ki,iD as Di,bR as sa,iE as Mi,iF as Fi,iG as Ii,bV as Li}from"./index-D8pFT62M.js";import{u as Oi}from"./chat-context-DGEoSZ8g.js";import{a5 as zi,O as Yn,a6 as $i,a7 as Wi,a8 as Hi,a9 as qi,aa as Gi,ab as Ui,ac as ra,ad as Ji,ae as Yi,A as qn,y as Gn,d as Qi,u as Zi,af as aa,i as Xi,ag as el,k as tl,h as nl,ah as Ba,p as kn,ai as sl,aj as rl,w as oa,ak as al,al as ol,am as $n,an as ia,ao as la,ap as ca,aq as bs,ar as il,F as ll,as as cl,z as ul,at as ua,au as dl,av as da,aw as fa,ax as ma,M as fl,ay as pa,a as ml,az as on,aA as pl,aB as hl,v as Wn,a4 as xn}from"./parse-sections-Cu3Ael-d.js";import{b as gl}from"./repository-binding-BgpHTQa3.js";import{n as vl,t as yl}from"./ChevronUp-CP2Q1tno.js";import{a7 as Ka,b as Jn,am as Sl,e as bl,E as xl,a1 as ha,Y as ga}from"./agent-icon-WM9Nds86.js";import{S as ln}from"./scroll-area-mSNTFn2P.js";import{c as wt,T as Rt,a as jt}from"./tooltip-BgCnMV2H.js";import{l as _l,u as kl,m as wl,U as Rl,ai as jl,S as El,F as va,aX as ya,as as Bt,at as Kt,a4 as Vl,aY as Tl,aZ as Al,aT as Sa,a7 as Nl,ae as Cl}from"./site-editor-toast-Aeb7soFG.js";import{u as Pl,ao as ba,e as xa,j as Bl,D as Kl,A as Hn,a3 as Dl,ae as Ml,ag as Fl}from"./blocks-tab-states-DjNiCspc.js";import{m as Il,u as Ll,P as Ol}from"./mustache-DYLtwKk5.js";import{a as ws,e as Da}from"./UserSquare-CeUdUVlp.js";import{i as _a,s as ka}from"./Tool01-BpRvGDMW.js";import{s as zl}from"./Plus-CcxRdpHl.js";import{s as $l}from"./Trash01-rMYgPi4D.js";import{i as Rs}from"./Zap-BheFKoJA.js";import{u as Wl,a as wa,K as Hl,P as ql,b as Gl,C as Ul,D as Jl,c as Yl}from"./core.esm-Dg3ste3x.js";import{u as Ql,s as Zl,a as Un,S as Xl,v as ec}from"./sortable.esm-BeVlNSdK.js";import{s as tc,g as nc,u as sc,A as rc}from"./use-section-preview-base-RT0rIB3U.js";import{u as ac,a as oc,P as Ra,w as ic,b as lc}from"./seo-editor-BE13UypD.js";import{R as cc,y as xs,T as ja,x as uc,U as dc}from"./hosted-reconcile-CFgAFv0C.js";import{u as fc}from"./use-apply-named-rule-BRkF3nZ-.js";import{m as Jt,d as js,y as Es,n as Mt,e as cn,q as mc,k as Ut,r as _s,j as Dt,h as _n,b as pc,s as Ea,z as hc,A as gc,B as vc}from"./section-array-field-DvmsCB7P.js";import{b as Va,a as yc}from"./variant-matcher-override-1piR_ouW.js";import"./autosend-BLwaDfuL.js";import"./thread-route-CZ8MMB_J.js";import"./use-project-scope-BmxYOSqD.js";import"./thread-intent-BIRE7Qtk.js";import"./use-mcp-client-CqE4Ghrf.js";import"./auth-A_dHVlLy.js";import"./delay-CnY5UFtP.js";import"./watch-sse-pool-BoqhatUL.js";import"./task-board-HVkUhR2P.js";import"./schema-Czvp_Lwx.js";import"./use-entitlements-BB4qLcGz.js";import"./use-ai-providers-F8TOugyU.js";import"./use-decopilot-events-CKMPTK-j.js";import"./use-organization-settings-B6zxeTvg.js";import"./utils-ymd1FJWf.js";import"./Play-Dl9rHUIQ.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-BqxIn6Y_.js";import"./LinkBroken01-Dhqzd5Xp.js";import"./collapsible-CBkOKy_V.js";import"./use-copy-L2-IdJ_Y.js";import"./usage-stats-DJLHvs3H.js";import"./tool-namespace-DxYdT3r_.js";import"./form-CX9Y8rXx.js";import"./label-DyJSQ7-Z.js";import"./utils-CVEq3hMx.js";import"./markdown-h9PNnEh6.js";import"./use-mobile-EwBUtNij.js";import"./shell-layout-DP24kzbV.js";import"./Globe04-DsEVRQ8J.js";import"./use-deployment-admin-_7fnOeiD.js";import"./admin-fetch-BhTJlAsX.js";import"./XClose-B8ZWakSs.js";import"./CheckCircle-BZC8qNjY.js";import"./Monitor01-CTh24U4S.js";import"./command-Dnw2pasR.js";import"./index-C_uBCqyj.js";import"./SearchMd-BvpUvADB.js";import"./integration-icon-oVgUnqWm.js";import"./project-icon-D_-oKizr.js";import"./use-navigate-to-agent-ByCAg0It.js";import"./new-project-dialog-CkpxzAtO.js";import"./ArrowLeft-NHzfDSKs.js";import"./repository-picker-DxnB6y8P.js";import"./github-icon-D5WAOakM.js";import"./useInfiniteQuery-C3wEWRY0.js";import"./infiniteQueryObserver-BCA8pHQ9.js";import"./collection-search-DLMLNhxJ.js";import"./ShoppingBag01-B2TVYCJe.js";import"./use-debounced-value-Dn9biZK4.js";import"./required-auth-layout-BPTXO06k.js";import"./use-org-sso-BQNy4M1M.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-CQuQ-XsR.js";import"./types-D8M__V__.js";import"./omit-server-managed-metadata-L5IhjRZB.js";import"./AlertCircle-BavhHXrm.js";import"./sheet-DzHWnq_T.js";import"./use-connection-DCYGUl-Y.js";import"./use-mcp-prompts-SlwHiJ8X.js";import"./use-thread-outputs-B4Zce4lE.js";import"./file-type-icon-BbCX4o-i.js";import"./switch-BaIjfvqD.js";import"./textarea-B05kUdob.js";import"./ChevronSelectorVertical-XtqZtaGN.js";import"./popover-Bc0Osxls.js";import"./monaco-editor-Cjb9-6hs.js";import"./editor-CtNrPORw.js";import"./calendar-B-_EB2yo.js";import"./SwitchHorizontal01-C6F9FLuz.js";import"./Minus-CF20rGao.js";import"./select-o79Ct_ay.js";import"./index-BdQq_4o_.js";import"./index-CLm0YAEW.js";import"./editor-classes-DGhQ0khm.js";import"./toggle-group-HpKtAH98.js";import"./active-indicator-CCMhAsc_.js";import"./combobox-Bv4H0UoH.js";import"./Upload01-CTvUgusS.js";import"./search-input-BFuc9oQg.js";import"./tabs-CzXyAmJC.js";import"./use-file-configs-c0RGBFjk.js";import"./asset-utils-B5Sq3qKL.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./use-voice-input-ADzQEEIx.js";import"./drawer-Cr3trfMB.js";import"./index-DsP4hX0b.js";import"./checkbox-2hVfC1K9.js";import"./Key01-CACSt4gn.js";import"./ai-providers-logos-DD3qZ33J.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./sandbox-git-api-DcqI6XE4.js";import"./sandbox-url-D3mC8qhT.js";import"./ArrowUp-D6obKkNl.js";import"./CreditCard01-DSR9reUx.js";import"./Sun-CwYfSEKK.js";import"./Users01-CgIFV9B4.js";import"./use-blocks-v8-project-BOjb1YoC.js";import"./use-sandbox-events-Bcmjy8_y.js";import"./empty-state-CQDiVxjd.js";import"./slider-Dh1rUkk7.js";import"./index-D9_88oYJ.js";import"./tooltipContext-BRYDLqxt.js";import"./CategoricalChart-9YwAdaOL.js";import"./index-C6icdhcm.js";import"./use-move-blocks-DIQrtI4I.js";const Sc={escape:zi};function bc(v,e){for(const p of tc(v,e)){const S=typeof p.title=="string"?p.title:void 0;if(S?.includes("{{"))return S}}function xc(v,e){if(!e)return;const p=Zo(v,Xo(e));if(p)try{const S=bc(p.resolveType,e);return S&&Il.render(S,p.data,{},Sc).trim()||void 0}catch{return}}function _c(v){const e=wn.c(13),{icon:p,label:S,className:x}=v;let E;e[0]!==x?(E=de("size-3.5",x),e[0]=x,e[1]=E):E=e[1];let C;e[2]!==p||e[3]!==E?(C=r.jsx(p,{className:E}),e[2]=p,e[3]=E,e[4]=C):C=e[4];let _;e[5]!==S||e[6]!==C?(_=r.jsx(Rt,{asChild:!0,children:r.jsx("span",{role:"img","aria-label":S,className:"shrink-0 cursor-help",children:C})}),e[5]=S,e[6]=C,e[7]=_):_=e[7];let P;e[8]!==S?(P=r.jsx(jt,{className:"max-w-56",children:S}),e[8]=S,e[9]=P):P=e[9];let k;return e[10]!==_||e[11]!==P?(k=r.jsxs(wt,{children:[_,P]}),e[10]=_,e[11]=P,e[12]=k):k=e[12],k}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 Ta(v){return Array.from({length:v},(e,p)=>({id:crypto.randomUUID(),index:p}))}function Ma(v){return v.map((e,p)=>({...e,index:p}))}function wc(v,e){if(e===v.length)return v;if(e<v.length)return Ma(v.slice(0,e));const p=Array.from({length:e-v.length},(S,x)=>({id:crypto.randomUUID(),index:v.length+x}));return[...v,...p]}function Fa(v){const e=wn.c(44),{section:p,raw:S,meta:x,decofile:E}=v,C=Rn(),_=Yn(),P=p.isSavedBlock===!0,k=p.isMultivariate===!0;let ee;e[0]!==x||e[1]!==S?(ee=S&&x?nc(S,x):void 0,e[0]=x,e[1]=S,e[2]=ee):ee=e[2];const be=ee;let qe;e[3]!==x||e[4]!==k||e[5]!==S||e[6]!==P?(qe=S&&x&&!P&&!k?xc(S,x):void 0,e[3]=x,e[4]=k,e[5]=S,e[6]=P,e[7]=qe):qe=e[7];const Oe=qe;let Ke;e[8]!==E||e[9]!==x||e[10]!==S||e[11]!==p?(Ke=Ui(S,p,E,x),e[8]=E,e[9]=x,e[10]=S,e[11]=p,e[12]=Ke):Ke=e[12];const fe=Ke;let l;e[13]!==k||e[14]!==S?.__resolveType?(l=!k&&Ts(S?.__resolveType??""),e[13]=k,e[14]=S?.__resolveType,e[15]=l):l=e[15];const N=l,Ee=P?Jn:k?Ka:Da;let G;e[16]!==k||e[17]!==P?(G=P?{color:si}:k?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=k,e[17]=P,e[18]=G):G=e[18];const ie=G;let H;e[19]!==Ee||e[20]!==_?(H=_?r.jsxs("span",{className:"relative size-4 shrink-0",children:[r.jsx(Ee,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),r.jsx(Yi,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):r.jsx(Sl,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=Ee,e[20]=_,e[21]=H):H=e[21];let f;e[22]!==be?(f=be&&r.jsx("img",{src:be,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=be,e[23]=f):f=e[23];let Q;e[24]!==_||e[25]!==ie?(Q=!_&&r.jsx(ws,{className:"h-4 w-4 shrink-0",style:ie}),e[24]=_,e[25]=ie,e[26]=Q):Q=e[26];const u=_?"shrink":"flex-1",Ce=p.isHidden&&"line-through opacity-50";let $;e[27]!==Ce||e[28]!==u?($=de("min-w-0 truncate text-sm font-medium",u,Ce),e[27]=Ce,e[28]=u,e[29]=$):$=e[29];const ft=Oe??p.label;let Ge;e[30]!==$||e[31]!==ft?(Ge=r.jsx("span",{className:$,children:ft}),e[30]=$,e[31]=ft,e[32]=Ge):Ge=e[32];let Ze;e[33]!==N||e[34]!==_||e[35]!==fe||e[36]!==C?(Ze=_?r.jsxs(r.Fragment,{children:[N&&r.jsx(_c,{icon:Rs,label:C("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),fe&&r.jsx(ra,{}),r.jsx("span",{className:"min-w-0 flex-1"})]}):fe&&r.jsx(ra,{className:"absolute -right-0.5 -top-0.5"}),e[33]=N,e[34]=_,e[35]=fe,e[36]=C,e[37]=Ze):Ze=e[37];let xe;return e[38]!==Ge||e[39]!==Ze||e[40]!==H||e[41]!==f||e[42]!==Q?(xe=r.jsxs(r.Fragment,{children:[H,f,Q,Ge,Ze]}),e[38]=Ge,e[39]=Ze,e[40]=H,e[41]=f,e[42]=Q,e[43]=xe):xe=e[43],xe}const Rc="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",jc="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 Ia(v,e,p){if(p)return Ji({selected:e});const S=v.isSavedBlock===!0,x=v.isMultivariate===!0;return de("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":S?Rc:x?jc:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ks(v,e){return de("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":v?"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 Ec(v){const e=wn.c(90),{section:p,raw:S,meta:x,decofile:E,sortableId:C,selected:_,onSelect:P,onDelete:k,onDuplicate:ee,onMakeReusable:be,onToggleHidden:qe,onToggleLazy:Oe,onAddVariant:Ke,onDetach:fe}=v,l=Rn(),N=Yn(),Ee=S?Ts(S.__resolveType??""):!1,G=p.isHidden===!0,ie=Ee||G;let H;e[0]!==p?(H=Pa(p),e[0]=p,e[1]=H):H=e[1];const f=H,Q=!!Oe&&!p.isMultivariate;let u;e[2]!==C?(u={id:C,animateLayoutChanges:Ac},e[2]=C,e[3]=u):u=e[3];const{attributes:Ce,listeners:$,setNodeRef:ft,transform:Ge,isDragging:Ze}=Ql(u);let xe;e[4]!==Ge?(xe=Ul.Transform.toString(Ge?{...Ge,x:0}:null),e[4]=Ge,e[5]=xe):xe=e[5];const Ve=Ze?0:void 0;let h;e[6]!==xe||e[7]!==Ve?(h={transform:xe,opacity:Ve},e[6]=xe,e[7]=Ve,e[8]=h):h=e[8];const Te=h;let tt;e[9]!==p?(tt=Wi(p),e[9]=p,e[10]=tt):tt=e[10];const mt=tt,m="button",L=0;let Xe;e[11]!==P?(Xe=z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),P())},e[11]=P,e[12]=Xe):Xe=e[12];const T=Ze?"cursor-grabbing":"cursor-pointer";let et;e[13]!==N||e[14]!==p||e[15]!==_||e[16]!==T?(et=de("touch-none transition-colors",T,Ia(p,_,N)),e[13]=N,e[14]=p,e[15]=_,e[16]=T,e[17]=et):et=e[17];let B;e[18]!==E||e[19]!==x||e[20]!==S||e[21]!==p?(B=r.jsx(Fa,{section:p,raw:S,meta:x,decofile:E}),e[18]=E,e[19]=x,e[20]=S,e[21]=p,e[22]=B):B=e[22];const It=!N&&Q&&r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"ghost",size:"icon","aria-label":l(Ee?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:de(ks(ie,Ee)),onClick:z=>{z.stopPropagation(),Oe?.()},onPointerDown:Tc,children:r.jsx(Rs,{className:de("h-3.5 w-3.5",Ee&&"text-warning")})})}),r.jsx(jt,{side:"bottom",children:l(Ee?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),he=N?r.jsx(Hi,{label:l(G?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:G,onToggle:qe,children:G?r.jsx(_a,{className:"h-3.5 w-3.5"}):r.jsx(ka,{className:"h-3.5 w-3.5"})}):r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"ghost",size:"icon","aria-label":l(G?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:de(ks(ie,G)),onClick:z=>{z.stopPropagation(),qe()},onPointerDown:Vc,children:G?r.jsx(_a,{className:"h-3.5 w-3.5"}):r.jsx(ka,{className:"h-3.5 w-3.5"})})}),r.jsx(jt,{side:"bottom",children:l(G?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),nt=ni,Ue=qi;let _e;e[23]!==l?(_e=l("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=l,e[24]=_e):_e=e[24];const st=de(ks(ie,!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 De;e[25]!==Ue||e[26]!==_e||e[27]!==st?(De=r.jsx(Ue,{label:_e,classicClassName:st}),e[25]=Ue,e[26]=_e,e[27]=st,e[28]=De):De=e[28];let Me;e[29]!==N||e[30]!==Q||e[31]!==Ee||e[32]!==Oe||e[33]!==l?(Me=N&&Q&&r.jsxs(r.Fragment,{children:[r.jsxs(an,{onClick:z=>{z.stopPropagation(),Oe?.()},children:[r.jsx(Rs,{className:"h-4 w-4"}),l(Ee?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),r.jsx(ti,{})]}),e[29]=N,e[30]=Q,e[31]=Ee,e[32]=Oe,e[33]=l,e[34]=Me):Me=e[34];let Z;e[35]!==ee?(Z=z=>{z.stopPropagation(),ee()},e[35]=ee,e[36]=Z):Z=e[36];let re;e[37]===Symbol.for("react.memo_cache_sentinel")?(re=r.jsx(bl,{className:"h-4 w-4"}),e[37]=re):re=e[37];let te;e[38]!==l?(te=l("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=l,e[39]=te):te=e[39];let D;e[40]!==Z||e[41]!==te?(D=r.jsxs(an,{onClick:Z,children:[re,te]}),e[40]=Z,e[41]=te,e[42]=D):D=e[42];let V;e[43]!==N||e[44]!==f||e[45]!==Ke||e[46]!==l?(V=f&&r.jsxs(an,{className:de(!N&&Gi),onClick:z=>{z.stopPropagation(),Ke()},children:[r.jsx(Ka,{className:"h-4 w-4"}),l("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=N,e[44]=f,e[45]=Ke,e[46]=l,e[47]=V):V=e[47];let le;e[48]!==N||e[49]!==mt||e[50]!==be||e[51]!==l?(le=mt&&r.jsxs(an,{className:de(!N&&kc),onClick:z=>{z.stopPropagation(),be()},children:[N?r.jsx(Jn,{className:"h-4 w-4"}):r.jsx(ws,{className:"h-4 w-4"}),l("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=N,e[49]=mt,e[50]=be,e[51]=l,e[52]=le):le=e[52];let ze;e[53]!==N||e[54]!==fe||e[55]!==p.isMultivariate||e[56]!==p.isSavedBlock||e[57]!==l?(ze=p.isSavedBlock===!0&&!p.isMultivariate&&r.jsxs(an,{onClick:z=>{z.stopPropagation(),fe()},children:[N?r.jsx(Da,{className:"h-4 w-4"}):r.jsx(ws,{className:"h-4 w-4"}),l("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=N,e[54]=fe,e[55]=p.isMultivariate,e[56]=p.isSavedBlock,e[57]=l,e[58]=ze):ze=e[58];let $e;e[59]!==k?($e=z=>{z.stopPropagation(),k()},e[59]=k,e[60]=$e):$e=e[60];let Je;e[61]===Symbol.for("react.memo_cache_sentinel")?(Je=r.jsx($l,{className:"h-4 w-4"}),e[61]=Je):Je=e[61];let O;e[62]!==l?(O=l("sectionsEditor.sectionList.deleteMenuItem"),e[62]=l,e[63]=O):O=e[63];let ce;e[64]!==$e||e[65]!==O?(ce=r.jsxs(an,{variant:"destructive",onClick:$e,children:[Je,O]}),e[64]=$e,e[65]=O,e[66]=ce):ce=e[66];let Pe;e[67]!==Me||e[68]!==D||e[69]!==V||e[70]!==le||e[71]!==ze||e[72]!==ce?(Pe=r.jsxs(ri,{align:"end",className:"w-44",children:[Me,D,V,le,ze,ce]}),e[67]=Me,e[68]=D,e[69]=V,e[70]=le,e[71]=ze,e[72]=ce,e[73]=Pe):Pe=e[73];let ke;e[74]!==nt||e[75]!==De||e[76]!==Pe?(ke=r.jsxs(nt,{children:[De,Pe]}),e[74]=nt,e[75]=De,e[76]=Pe,e[77]=ke):ke=e[77];let ge;return e[78]!==Ce||e[79]!==$||e[80]!==P||e[81]!==ft||e[82]!==Te||e[83]!==et||e[84]!==B||e[85]!==It||e[86]!==he||e[87]!==ke||e[88]!==Xe?(ge=r.jsxs("div",{ref:ft,style:Te,...Ce,...$,role:m,tabIndex:L,onClick:P,onKeyDown:Xe,className:et,children:[B,It,he,ke]}),e[78]=Ce,e[79]=$,e[80]=P,e[81]=ft,e[82]=Te,e[83]=et,e[84]=B,e[85]=It,e[86]=he,e[87]=ke,e[88]=Xe,e[89]=ge):ge=e[89],ge}function Vc(v){return v.stopPropagation()}function Tc(v){return v.stopPropagation()}function Ac(){return!1}function Vs(v){const e=wn.c(11),{canAddSection:p,onAddSection:S,className:x,size:E}=v,C=Rn();let _;e[0]!==x?(_=de("w-full",x),e[0]=x,e[1]=_):_=e[1];const P=!p;let k;e[2]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(zl,{size:14}),e[2]=k):k=e[2];let ee;e[3]!==C?(ee=C("sectionsEditor.sectionList.addSectionButton"),e[3]=C,e[4]=ee):ee=e[4];let be;return e[5]!==S||e[6]!==E||e[7]!==_||e[8]!==P||e[9]!==ee?(be=r.jsxs(Ft,{type:"button",variant:"outline",size:E,className:_,disabled:P,onClick:S,children:[k,ee]}),e[5]=S,e[6]=E,e[7]=_,e[8]=P,e[9]=ee,e[10]=be):be=e[10],be}function Nc(v){const e=wn.c(101),{listKey:p,rawSections:S,sections:x,meta:E,decofile:C,selectedIndex:_,onSelect:P,onReorder:k,onDelete:ee,onDuplicate:be,onMakeReusable:qe,onToggleHidden:Oe,onToggleLazy:Ke,onAddVariant:fe,onDetach:l,onAddSection:N,canAddSection:Ee}=v,G=Ee===void 0?!0:Ee,ie=Rn(),H=Yn();let f;e[0]!==x.length?(f=()=>Ta(x.length),e[0]=x.length,e[1]=f):f=e[1];const[Q,u]=b.useState(f),[Ce,$]=b.useState(null),[ft,Ge]=b.useState(p),[Ze,xe]=b.useState(x.length),Ve=b.useRef(!1);ft!==p?(Ge(p),xe(x.length),u(Ta(x.length))):Ze!==x.length&&(xe(x.length),u(Ye=>wc(Ye,x.length)));let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:8}},e[2]=h):h=e[2];let Te;e[3]===Symbol.for("react.memo_cache_sentinel")?(Te={coordinateGetter:Zl},e[3]=Te):Te=e[3];const tt=Wl(wa(ql,h),wa(Hl,Te));let mt;e[4]!==Q?(mt=Q.map(Cc),e[4]=Q,e[5]=mt):mt=e[5];const m=mt;let L;e[6]===Symbol.for("react.memo_cache_sentinel")?(L=Ye=>{$(String(Ye.active.id))},e[6]=L):L=e[6];const Xe=L;let T;e[7]!==m||e[8]!==k?(T=Ye=>{$(null);const{active:U,over:ue}=Ye;if(!ue||U.id===ue.id)return;const pt=m.indexOf(String(U.id)),rt=m.indexOf(String(ue.id));pt===-1||rt===-1||(u(ht=>Ma(Un([...ht],pt,rt))),Ve.current=!0,requestAnimationFrame(()=>{Ve.current=!1}),k?.(pt,rt))},e[7]=m,e[8]=k,e[9]=T):T=e[9];const et=T;let B;e[10]===Symbol.for("react.memo_cache_sentinel")?(B=()=>{$(null)},e[10]=B):B=e[10];const It=B;let he,nt,Ue,_e,st,De,Me,Z,re,te,D,V,le,ze,$e;if(e[11]!==Ce||e[12]!==G||e[13]!==H||e[14]!==C||e[15]!==Q||e[16]!==m||e[17]!==et||e[18]!==E||e[19]!==N||e[20]!==fe||e[21]!==ee||e[22]!==l||e[23]!==be||e[24]!==qe||e[25]!==P||e[26]!==Oe||e[27]!==Ke||e[28]!==S||e[29]!==x||e[30]!==_||e[31]!==tt||e[32]!==ie){ze=Symbol.for("react.early_return_sentinel");e:{const Ye=U=>{Ve.current||P(U)};if(e[48]!==Ce||e[49]!==G||e[50]!==H||e[51]!==Q||e[52]!==N||e[53]!==S||e[54]!==x||e[55]!==ie){const U=Ce?Q.find(ue=>ue.id===Ce):null;if(_e=U!=null?x[U.index]:null,Ue=U!=null?S[U.index]:void 0,Q.length===0){let ue;e[59]!==ie?(ue=ie("sectionsEditor.sectionList.noSections"),e[59]=ie,e[60]=ue):ue=e[60];let pt;e[61]!==ue?(pt=r.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:ue}),e[61]=ue,e[62]=pt):pt=e[62];const rt=pt;let ht;e[63]!==G||e[64]!==H||e[65]!==rt||e[66]!==N?(ht=H?rt:r.jsxs("div",{className:"space-y-2",children:[rt,r.jsx(Vs,{canAddSection:G,onAddSection:N,size:"sm"})]}),e[63]=G,e[64]=H,e[65]=rt,e[66]=N,e[67]=ht):ht=e[67],ze=ht;break e}le=de(U&&"cursor-grabbing"),e[48]=Ce,e[49]=G,e[50]=H,e[51]=Q,e[52]=N,e[53]=S,e[54]=x,e[55]=ie,e[56]=Ue,e[57]=_e,e[58]=le}else Ue=e[56],_e=e[57],le=e[58];nt=Jl,Z=tt,re=Yl,te=Xe,D=et,V=It,he=Xl,De=m,Me=ec,$e="space-y-1",st=Q.map(U=>{const ue=x[U.index];return ue?r.jsx(Ec,{sortableId:U.id,section:ue,raw:S[U.index],meta:E,decofile:C,selected:_===U.index,onSelect:()=>Ye(U.index),onDelete:()=>ee(U.index),onDuplicate:()=>be(U.index),onMakeReusable:()=>qe(U.index),onToggleHidden:()=>Oe(U.index),onToggleLazy:Ke?()=>Ke(U.index):void 0,onAddVariant:()=>fe(U.index),onDetach:()=>l(U.index)},U.id):null})}e[11]=Ce,e[12]=G,e[13]=H,e[14]=C,e[15]=Q,e[16]=m,e[17]=et,e[18]=E,e[19]=N,e[20]=fe,e[21]=ee,e[22]=l,e[23]=be,e[24]=qe,e[25]=P,e[26]=Oe,e[27]=Ke,e[28]=S,e[29]=x,e[30]=_,e[31]=tt,e[32]=ie,e[33]=he,e[34]=nt,e[35]=Ue,e[36]=_e,e[37]=st,e[38]=De,e[39]=Me,e[40]=Z,e[41]=re,e[42]=te,e[43]=D,e[44]=V,e[45]=le,e[46]=ze,e[47]=$e}else he=e[33],nt=e[34],Ue=e[35],_e=e[36],st=e[37],De=e[38],Me=e[39],Z=e[40],re=e[41],te=e[42],D=e[43],V=e[44],le=e[45],ze=e[46],$e=e[47];if(ze!==Symbol.for("react.early_return_sentinel"))return ze;let Je;e[68]!==st||e[69]!==$e?(Je=r.jsx("div",{className:$e,children:st}),e[68]=st,e[69]=$e,e[70]=Je):Je=e[70];let O;e[71]!==he||e[72]!==De||e[73]!==Me||e[74]!==Je?(O=r.jsx(he,{items:De,strategy:Me,children:Je}),e[71]=he,e[72]=De,e[73]=Me,e[74]=Je,e[75]=O):O=e[75];let ce;e[76]!==Ue||e[77]!==_e||e[78]!==H||e[79]!==C||e[80]!==E?(ce=_e?r.jsx("div",{className:de("cursor-grabbing shadow-lift",Ia(_e,!1,H)),children:r.jsx(Fa,{section:_e,raw:Ue,meta:E,decofile:C})}):null,e[76]=Ue,e[77]=_e,e[78]=H,e[79]=C,e[80]=E,e[81]=ce):ce=e[81];let Pe;e[82]!==ce?(Pe=ei.createPortal(r.jsx(Gl,{dropAnimation:$i,children:ce}),document.body),e[82]=ce,e[83]=Pe):Pe=e[83];let ke;e[84]!==nt||e[85]!==Z||e[86]!==re||e[87]!==te||e[88]!==D||e[89]!==V||e[90]!==O||e[91]!==Pe?(ke=r.jsxs(nt,{sensors:Z,collisionDetection:re,onDragStart:te,onDragEnd:D,onDragCancel:V,children:[O,Pe]}),e[84]=nt,e[85]=Z,e[86]=re,e[87]=te,e[88]=D,e[89]=V,e[90]=O,e[91]=Pe,e[92]=ke):ke=e[92];let ge;e[93]!==G||e[94]!==H||e[95]!==N?(ge=!H&&r.jsx(Vs,{canAddSection:G,onAddSection:N,size:"sm",className:"mt-2"}),e[93]=G,e[94]=H,e[95]=N,e[96]=ge):ge=e[96];let z;return e[97]!==le||e[98]!==ke||e[99]!==ge?(z=r.jsxs("div",{className:le,children:[ke,ge]}),e[97]=le,e[98]=ke,e[99]=ge,e[100]=z):z=e[100],z}function Cc(v){return v.id}function Pc(v,e,p,S){if(!v||typeof v!="object")return{kind:"error",reason:"no-matcher-rule"};const x=e.trim();if(!x)return Jt(v,p,S)?{kind:"inline",blockKey:v.__resolveType??"",inlinedRule:js(v,p,S)}:{kind:"noop"};const E=Es(v,p,S);if(!E)return{kind:"error",reason:"unreadable-rule"};if(E.blockKey)return{kind:"updateBlock",blockKey:E.blockKey,blockData:Mt(E.resolveType,E.data,x)};const C=qn(x),_=Gn(C,p);return _?{kind:"error",reason:"invalid-block-id",message:_}:{kind:"createBlock",blockId:C,blockData:Mt(E.resolveType,E.data,x),reference:cn(C)}}const Aa="section-form-stale-save",Bc=3;function Na(v,e,p){const S=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:Ba(e.pageKey?v[e.pageKey]?.sections:void 0,v,p),x=Math.max(0,Math.min(e.pageVariantIndex,S.length-1)),E=S[x]?.sections??[];return{pageVariants:S,variantIndex:x,rawSections:E,parsedSections:kn(E,v,p)}}const Ca=new WeakMap;let Kc=0;function Dc(v){let e=Ca.get(v);return e===void 0&&(e=++Kc,Ca.set(v,e)),e}function cf({orgSlug:v,virtualMcpId:e,branch:p,previewReady:S=!0,previewUrl:x,currentPath:E,activePageBlockKey:C=null,activeGlobalBlockKey:_=null,externalSelection:P,onSaved:k,initialEditSeo:ee=!1,onExitSeo:be,onSelectRoot:qe,onViewJsonFile:Oe,onFocusedBlockChange:Ke,onVariantPreviewOverride:fe}){const l=Rn(),N=Oi(),Ee=N?.taskId??null,G=S?{orgSlug:v,virtualMcpId:e,branch:p,threadId:Ee,previewUrl:x}:null,[ie,H]=b.useState([]),{data:f,isLoading:Q}=_l(G,{pollWhile:ie.length>0}),{data:u,isLoading:Ce}=Pl(G),$=Yn(),ft=N?.virtualMcpId,Ze=gl(ft===e?e:null)?.metadata?.siteSlug??null,xe=sc({virtualMcpId:e,branch:p,sandboxUrl:x}),Ve=kl(e,p),h=wl(Ve),Te=ji(h),tt=!h,mt=!!xe||h,[m,L]=b.useState(null),[Xe,T]=b.useState(null),[et,B]=b.useState(null),[It,he]=b.useState(0),[nt,Ue]=b.useState(void 0),[_e,st]=b.useState(null),De={index:_e,remember:st},[Me,Z]=b.useState(null),[re,te]=b.useState(null),[D,V]=b.useState([]),le=b.useRef(null),[ze,$e]=b.useState(D.length);ze!==D.length&&($e(D.length),requestAnimationFrame(()=>{le.current&&(le.current.scrollTop=0)}));const[Je,O]=b.useState(0),[ce,Pe]=b.useState(null),[ke,ge]=b.useState(null),[z,Ye]=b.useState(null),[U,ue]=b.useState(!1),[pt,rt]=b.useState(!1),ht=b.useRef(null),[jn,La]=b.useState(!0),[Yt,En]=b.useState(!1),[Lt,Vn]=b.useState(!1),[Ae,un]=b.useState(ee),[As,Ns]=b.useState(ee);ee&&!As&&(Ns(!0),un(!0),L(null),T(null),B(null),V([])),!ee&&As&&Ns(!1);const[Oa,dn]=b.useState(null),[Cs,Tn]=b.useState(void 0),[Ps,Ot]=b.useState([]),[Bs,Qt]=b.useState(0),[Fe,at]=b.useState(0),[za,Ie]=b.useState(null),[Zt,We]=b.useState(null),[Ks,Ds]=b.useState(null),Ms=ai(),Fs=Rl({orgSlug:v,virtualMcpId:e,branch:p},{tunnel:!1}),fn=Qi({orgSlug:v,virtualMcpId:e,branch:p}),[$a,Wa]=b.useState(E),[Ha,qa]=b.useState(C),[Ga,Ua]=b.useState(_);($a!==E||Ha!==C||Ga!==_)&&(queueMicrotask(()=>fn.flush()),Wa(E),qa(C),Ua(_),L(null),T(null),B(null),he(0),Z(null),te(null),at(0),Ie(null),We(null),V([]),O(t=>t+1),un(!1),dn(null),Tn(void 0),Ot([]),Qt(t=>t+1));const M=Zi({orgSlug:v,virtualMcpId:e,branch:p}),mn=ml((t,n)=>{M.mutate({blockKey:t,data:n},{onSuccess:()=>k?.(),onError:M.reportError})}),An=Ll({orgSlug:v,virtualMcpId:e,branch:p}),Is=fc({orgSlug:v,virtualMcpId:e,branch:p}),[Xt,en]=b.useState(!1),A=b.useRef(null),xt=b.useRef(null),gt=b.useRef(null),vt=b.useRef(null),Nn=b.useRef({}),zt=b.useRef(null),pn=b.useRef(!1),hn=b.useRef(!1),we=b.useRef(new Map),tn=b.useRef(!1),ot=b.useRef([]),Qn=b.useRef(new WeakSet);jl(v,e,t=>{const{activePageKey:n,rawSections:s,parsedSections:a,selectedSectionIndex:o}=ae.current,i=new Set;n&&i.add(n);for(const c of[xt.current?.sectionIndex,o]){const d=c==null?void 0:s[c],R=c==null?void 0:a[c],g=d&&R?.isSavedBlock?Ss(d,R):null;g&&i.add(g)}if([...i].some(c=>t.has(c))){for(const c of[A,gt,vt])c.current&&clearTimeout(c.current),c.current=null;xt.current=null,we.current.clear(),n&&t.has(n)&&(Nn.current={})}});const ae=b.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ls,Os]=b.useState(0),[Ja,Ya]=b.useState(0),zs=oi(Ve,{orgSlug:v,virtualMcpId:e,branch:p}),$s=ii(zs,ie[0]?.blockKey??null,li(f,ie[0]?.blockKey??null)),[Qa,Za]=b.useState(null),Zn=El(v,e).epoch,[Xa,eo]=b.useState(Zn);ac(Ae?{orgSlug:v,virtualMcpId:e,branch:p}:null,f??void 0,u??void 0);const Ws=_??(f&&u?ba(xa(f,u),E,C)?.key??null:null),Xn=va({orgSlug:v,virtualMcpId:e,branch:p},Ws?[Ws]:[],{withRefs:!0}),[Hs,to]=b.useState(!1),es=va({orgSlug:v,virtualMcpId:e,branch:p},Hs?Bl:[]),qs={ready:!(Ve.kind==="protocol"&&Ve.hosted)||Hs&&es.ready,failed:es.failed,retry:es.retry,request:()=>to(!0)};if(Xn.failed)return r.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-3 p-6 text-center text-sm text-muted-foreground",children:[r.jsx("p",{children:l("sectionsEditor.hosted.blockLoadFailed")}),r.jsx("p",{children:l("sectionsEditor.hosted.blockLoadFailedHint")}),r.jsx(Ft,{variant:"outline",size:"sm",onClick:Xn.retry,children:l("sectionsEditor.namedRules.tryAgain")})]});if(!S||Q||Ce||!Xn.ready)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(ci,{className:"size-5 text-muted-foreground"})});if(!f||!u)return r.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const no=xa(f,u),q=!!_,oe=q?null:ba(no,E,C),y=q?_:oe?.key??null,ts=q&&_?f[_]:void 0,Gs=q&&_&&ts?Kl(_,ts):q&&_?_:"",nn=!q&&y&&f[y]?f[y]:null,ns=Ae&&f&&u&&y&&oe?aa(f,{kind:"page",pageKey:y,pageName:String(oe.name??""),path:String(oe.path??"")},u):null,so=Ae?nn?.seo:void 0,Cn=Cs!==void 0?Cs:so,ro=Ae?Xi(Cn):void 0,Us=ns?.seoTypeOptions??[],Js=Ae&&u?el(u):"",ss=Oa??ro??{},Pn=Ae&&ns?oc(ss,ns):null,Ys=Ae&&Pn&&tl(Cn)?Hn(Pn,u):null,Qs=Ae?nl(f,u)?.seoData:void 0,ve=q?[{label:"Default",sections:[{__resolveType:_}]}]:Ba(nn?.sections,f??{},h),yt=ve.length>1,ne=Math.min(It,ve.length-1),Re=ve[ne],F=Re?.sections??[],ye=kn(F,f,h),Bn=!q&&mc(nn?.sections,h);if(q&&_&&Ks!==_){Ds(_);const t=F[0],n=ye[0];if(t&&n){L(0),at(0),V([]);const s=kt(t,n,f,h);s&&(T(s.data),B(s.resolveType),We(null),Ie(null))}}!q&&Ks!==null&&Ds(null),ae.current={rawSections:F,parsedSections:ye,decofile:f??{},activePageKey:y,pageVariants:ve,variantIndex:ne,sectionVariantIndex:Fe,selectedSectionIndex:m};const ao=()=>({multivariate:Bn,index:ne,variants:ve.map(t=>({rule:t.rule})),lazyValues:h&&Bn&&Vi(nn?.sections?.variants?.[ne]?.value)}),rs=(t,n)=>{if(!fe)return;if(!y||!Bn||t.length<=1){fe(null);return}const s={multivariate:!0,index:n,variants:t},a=h?ya(y,s):Va(y,s,f,u);fe(a.length>0?a:null)},as=fe&&y&&Bn&&yt&&!Q&&!Ce?y:null;if(as!==Qa&&(Za(as),as)){const t=ve.map(s=>({rule:s.rule})),n=ne;queueMicrotask(()=>rs(t,n))}const $t=(t,n,s)=>{if(!fe)return;if(!y){fe(null);return}const a=ao(),o=h?ya(y,a):Va(y,a,f,u);if(!t||n<0){fe(o.length>0?o:null);return}const i={pageKey:y,page:a,sectionIndex:n,sectionLazy:ye[n]?.isLazy??!1,mvObj:t,selectedVariantIndex:s},c=h?Tl(i):yc({...i,decofile:f,meta:u}),d=h?Al(o,c):[...o,...c];fe(d.length>0?d:null)},bt=(t,n,s,a=m??-1,o=!1)=>{const i=dt(t,n);if(!i){T(null),B(null),We(null),Ie(null),o&&$t(null,a,s);return}const d=Jr(i,Te)[s];if(!d){T(null),B(null),We(null),Ie(null),o&&$t(null,a,s);return}const R=mi(d.value,f);T(R?.data??null),B(R?.resolveType??null);const{resolveType:g,formValue:w}=Ut(d.rule,f,u??void 0);We(g),Ie(w),o&&$t(i,a,s)},os=t=>{ge(null),he(t),L(null),T(null),B(null),V([]);const n=ve[t]?.rule,{resolveType:s,formValue:a}=Ut(n,f??{},u??void 0);te(s),Z(a),rs(ve.map(o=>({rule:o.rule})),t)},oo=(t,n)=>{const s=F[t],a=ye[t];if(!s||!a)return!1;const o=a.isMultivariate?dt(s,a)?.variants?.length??0:0,i=n<o?n:0;if(L(t),at(i),V([]),O(c=>c+1),a.isMultivariate)bt(s,a,i,t);else{const c=kt(s,a,f,h);c?(T(c.data),B(c.resolveType)):(T(null),B(null)),We(null),Ie(null)}return!0},Zs=P?.index;if(P!==void 0&&(P?.seq??null)!==nt&&(Ue(P?.seq??null),typeof Zs=="number"&&oo(Zs,0)),Zn!==Xa){eo(Zn);const t=A.current!==null||we.current.size>0||vt.current!==null||gt.current!==null||M.isPending||fn.isPending||ie.length>0,n=m!==null&&Ur(le.current,document.activeElement);if(!t&&n&&(tn.current=!0),!t&&!n&&m!==null){const s=F[m],a=ye[m];if(V([]),O(o=>o+1),!s||!a)L(null),T(null),B(null);else if(a.isMultivariate)bt(s,a,Fe,m);else{const o=kt(s,a,f,h);T(o?.data??null),B(o?.resolveType??null)}}!t&&Ae&&(dn(null),Tn(void 0),Qt(s=>s+1))}if(Ls!==Ja){Ya(Ls);const t=m!==null?F[m]:null,n=m!==null?ye[m]:null;if(t&&n&&m!==null)if(V([]),O(s=>s+1),n.isMultivariate)bt(t,n,Fe,m);else{const s=kt(t,n,f,h);T(s?.data??null),B(s?.resolveType??null)}}const it=ie[0];if(it){const{formBase:t,target:n}=it,s=Na(f,n,h),a=t.sectionIndex,o=s.rawSections.length===t.sectionCount?vs(s.rawSections[a],s.parsedSections[a],n.sectionVariantIndex,f,h):null,i=ui(it,o,c=>Yr(t,c));if(i){const d=[{...it,...i,changedAgain:!0},...ie.slice(1)];ot.current=d,H(d)}}const gn={orgSlug:v,virtualMcpId:e,branch:p,threadId:Ee,previewUrl:h?void 0:x??void 0,siteSlug:Ze},Kn=et&&u?Hn(et,u):null,lt=(t,n)=>{if(!y)return;A.current&&(clearTimeout(A.current),A.current=null),we.current.clear(),vt.current&&(clearTimeout(vt.current),vt.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null);const s=on(f,y,t,ne,ve);M.mutate({blockKey:y,data:s},{onSuccess:()=>n?.onSuccess?.()??k?.(),onError:a=>{n?.onError?.(),M.reportError(a)}})},Wt=()=>{Ke?.(null),L(null),Vn(!1),T(null),B(null),at(0),Ie(null),We(null),V([]),O(t=>t+1)},Xs=()=>Ur(le.current,document.activeElement),is=(t=l("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(A.current&&(clearTimeout(A.current),A.current=null),we.current.clear(),xt.current=null,W.error(t,{id:Aa}),Xs()){tn.current=!0;return}Os(n=>n+1)},er=()=>{!tn.current||Xs()||ot.current.length>0||A.current!==null||pn.current||hn.current||we.current.size>0||(tn.current=!1,Os(t=>t+1))},tr=()=>{tn.current&&setTimeout(er,0)},nr=Ve.kind==="protocol"&&Ve.source==="github",sr=t=>Cl(Ms,Fs,t,Ve.kind==="protocol"?Ve:null),rr=t=>{we.current.size!==0&&setTimeout(()=>{if(pn.current||hn.current)return;const n=[...we.current.values()];we.current.clear();for(const s of n)s()},t)},io=t=>{const{activePageKey:n,variantIndex:s,sectionVariantIndex:a}=ae.current,o=zt.current;return{formBase:o?.sectionIndex===t&&o.variantIndex===a?o:null,pageKey:n,global:q,pageVariantIndex:s,sectionVariantIndex:a,schema:Kn}},vn=t=>{ot.current=t,H(t)},lo=t=>{const n=ot.current,s=n.findIndex(i=>i.formBase===t.formBase),a=s>=0?n[s]:void 0,o=a?n.with(s,{...t,choices:ta(a.plan,a.choices,t.plan),fresh:Mi(a.plan,t.plan,a.fresh),changedAgain:a.changedAgain||zn(a.plan.theirs)!==zn(t.plan.theirs)}):[...n,{...t,changedAgain:Qn.current.has(t.formBase)}];vn(o)},ar=(t,n)=>{const s=ot.current,a=s.findIndex(c=>c.formBase===t),o=s[a];if(!o)return!1;if(zn(o.plan.mine)===zn(n))return!0;const i=ea({...o.plan,mine:n});if(i.pointers.length===0){const c=s.filter(d=>d!==o);return vn(c),!1}return vn(s.with(a,{...o,plan:i,choices:ta(o.plan,o.choices,i)})),!0},co=t=>{const n=ae.current;return n.selectedSectionIndex===t.formBase.sectionIndex&&n.activePageKey===t.target.pageKey&&n.variantIndex===t.target.pageVariantIndex&&n.sectionVariantIndex===t.target.sectionVariantIndex},uo=()=>{const t=ot.current[0];if(!t)return null;const{formBase:n,target:s}=t;A.current&&xt.current?.sectionIndex===n.sectionIndex&&xt.current.sectionVariantIndex===s.sectionVariantIndex&&(clearTimeout(A.current),A.current=null,xt.current=null),we.current.delete(`${s.pageKey}:${n.sectionIndex}:${s.sectionVariantIndex}`);const a=n.emitted;return a&&typeof a=="object"&&!ar(n,a)&&yn(a,n.sectionIndex,0,s),ot.current[0]??null},fo=()=>{const t=ot.current[0],n=uo();if(!n||!t||n.formBase!==t.formBase||n.plan.pointers.some(i=>!t.plan.pointers.includes(i)))return;const s=ki(n.plan,n.choices);Ve.kind==="protocol"&&Ve.source==="github"&&wi(n.plan,n.choices)&&Vl(l,!1),vn(ot.current.slice(1));const{formBase:a,target:o}=n;a.base=n.plan.theirs,a.version=void 0,a.emitted=s,Qn.current.add(a),(zt.current===a||co(n))&&(zt.current=a,T(s),O(i=>i+1)),yn(s,a.sectionIndex,0,o)},mo=t=>{const[n,...s]=ot.current;n&&vn([{...n,choices:t},...s])},yn=(t,n,s=0,a,o=!1)=>{const i=a??io(n),c=i.sectionVariantIndex,d=i.formBase,R=o||Xr(ot.current,d,i,n,h).runNow,g=xt.current;A.current&&(clearTimeout(A.current),A.current=null,g&&(g.sectionIndex!==n||g.sectionVariantIndex!==c)&&g.write());const w=`${i.pageKey}:${n}:${c}`,j=()=>{if(pn.current||hn.current){we.current.set(w,j);return}const K=typeof t=="function"?t():t,I=Xr(ot.current,d,i,n,h).base;if(I&&ar(I,K))return;const se=ae.current.decofile,{rawSections:J,parsedSections:Be,pageVariants:Y,variantIndex:je}=Na(se,i,h),Le=i.pageKey,Se=J[n];if(!Se)return;const me=Be[n];if(!me)return;const He=d?.base,Qe=vs(Se,me,c,se,h),At=!!He&&!!Qe&&Ti(He,Qe)&&!(d&&Yr(d,Qe));if(At&&He&&Qe){if(Ai(He,Qe)){is(l("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const X=me.isSavedBlock?"here":Ni(He,J.map((pe,ut)=>vs(pe,Be[ut],c,se,h)),n,d?.sectionCount??J.length);if(X==="unknown"){is(l("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof X=="number"&&d){d.sectionCount=J.length,d.sectionIndex=X,zt.current===d&&L(X),yn(K,X,s,i);return}}const Nt=At&&He&&Qe?ea({ancestor:He,mine:K,theirs:Qe}):null;if(Nt&&Nt.pointers.length>0&&d){d.sectionCount=J.length,lo({plan:Nt,formBase:d,target:i,sectionIndex:n,choices:Ci(Nt),changedAgain:!1,blockKey:me.isSavedBlock?Ss(Se,me):Le,fresh:{}});return}const Ct=Nt?Nt.merged:null,rn=Ct??K,Hr=Pi({merged:!!Ct,tracked:d,current:zt.current,saved:K});Ct&&W.info(l("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:Aa}),Hr&&d&&(d.emitted=Ct,T(Ct));const gs=Hr||!Ct?rn:K;d&&(d.base=gs,d.sectionCount=J.length,Bi(d,gs));const qr={onSuccess:()=>{d&&Qn.current.delete(d),k?.()},onError:X=>{if(d?.base===gs&&He&&(d.base=He),X instanceof Nl){if(d&&(d.version=void 0),s<Bc){we.current.delete(w),hn.current=!0;const pe=Fi(s,X.carriedStored);setTimeout(()=>{hn.current=!1,yn(()=>{const ut=d?.emitted;return ut&&typeof ut=="object"?ut:K},n,s+1,i,pe.immediate),we.current.delete(w),rr(xn(h))},pe.delay)}else is();return}M.reportError(X)}},Gr=X=>{pn.current=!0;let pe=!1;M.mutateAsync(X).then(()=>qr.onSuccess(),ut=>{pe=!0,qr.onError(ut)}).finally(()=>{pn.current=!1,rr(pe?xn(h):0),er()})};if(me.isSavedBlock){const X=Ss(Se,me);if(!X)return;Gr({blockKey:X,data:rn,...He?{base:{value:Ki({startedFrom:He,stored:Qe,rebased:!!Ct,refused:s>0})}}:{},rebaseOnConflict:!1,guard:na({formBase:d,rebased:!!Ct,versionOf:sr,...nr?{copy:{value:se[X]}}:{}})});return}if(!Le)return;const On={...se[Le]},Gt=[...J];if(me.isMultivariate){const X=dt(Se,me);if(!X||!Le)return;const pe=Di(X,c,rn);Gt[n]=Pt(Se,me,pe)}else if(me.isHidden){const X=Ts(Se.__resolveType),pe=X?{...Se.section}:{...Se},ut=Array.isArray(pe.variants)?[...pe.variants]:[];ut[0]&&(ut[0]=sa(pe.__resolveType,ut[0],rn)),pe.variants=ut,X?Gt[n]={...Se,section:pe}:Gt[n]=pe}else me.isLazy?Gt[n]={...Se,section:rn}:Gt[n]=rn;if(Y.length>1){const X=On.sections,pe=[...X?.variants??[]];pe[je]&&(pe[je]=sa(X?.__resolveType,pe[je],Gt)),On.sections={...X,variants:pe}}else On.sections=Gt;Gr({blockKey:Le,data:On,rebaseOnConflict:!1,guard:na({formBase:null,rebased:!1,versionOf:sr,...nr?{copy:{value:se[Le]}}:{}})})};if(xt.current={sectionIndex:n,sectionVariantIndex:c,write:j},R){xt.current=null,j();return}A.current=setTimeout(()=>{A.current=null,j()},xn(h))},po=t=>{tn.current=!1,L(t),at(0),V([]),O(o=>o+1);const n=F[t],s=ye[t];if(Ke?.(s?.isSavedBlock?s.resolveType??null:null),!n||!s)return;if(s.isMultivariate){bt(n,s,0,t);return}const a=kt(n,s,f,h);if(!a){T(null),B(null),We(null),Ie(null),$t(null,t,0);return}T(a.data),B(a.resolveType),We(null),Ie(null),$t(null,t,0)},or=t=>{const n=t;m!==null&&(zt.current=Ri(zt.current,{sectionIndex:m,variantIndex:ae.current.sectionVariantIndex,shown:Xe,next:n,sectionCount:ae.current.rawSections.length})),T(n),m!==null&&yn(n,m)},ls=t=>{if(!y||!f||!u||!oe)return;const n={kind:"page",pageKey:y,pageName:String(oe.name??""),path:String(oe.path??"")},s=aa(f,n,u);s&&fn.save(y,()=>{const a=Ms.getQueryData(Ei.decofile(Fs))?.[y];if(!a||typeof a!="object"||a===null||Array.isArray(a))return null;const o={...a,...Nn.current};return Nn.current={},t?.raw!==void 0?ic(o,t.raw,u):t?.inner!==void 0?lc(n,s,o,t.inner):o})},ir=(t,n)=>{y&&(Nn.current[t]=n,ls())},ho=(t,n)=>{if(!y)return;const s=Un([...F],t,n);m!==null&&(m===t?L(n):t<m&&n>=m?L(m-1):t>m&&n<=m&&L(m+1)),lt(s)},go=t=>{if(!y)return;const n=F.filter((s,a)=>a!==t);m===t?Wt():m!==null&&m>t&&L(m-1),lt(n)},vo=t=>{if(!y)return;const n=F[t];if(!n)return;const s=[...F];s.splice(t+1,0,pl(n)),m!==null&&m>t&&L(m+1),lt(s)},yo=t=>{if(!y)return;const n=F[t],s=ye[t];if(!n||!s)return;const a=s.isHidden?bi(n,h):xi(n,u);if(!a)return;const o=[...F];o[t]=a,m===t&&Wt(),lt(o)},So=t=>{if(!y)return;const n=F[t],s=ye[t];if(!n||!s||s.isMultivariate)return;const a=Si(n);if(!a)return;const o=[...F];o[t]=a,m===t&&Wt(),lt(o)},bo=t=>{if(!y)return;const n=F[t],s=ye[t];if(!n||!s?.isSavedBlock)return;const a=kt(n,s,f,h);if(!a?.data)return;const{name:o,...i}=a.data,c=[...F];s.isLazy?c[t]={...n,section:i}:c[t]=i,m===t&&Wt(),lt(c)},xo=t=>{if(!y)return;const n=[...F,{__resolveType:t.resolveType}],s=n.length-1;lt(n,{onError:()=>{ae.current.selectedSectionIndex===s&&Wt()}}),ue(!1),L(s),at(0),V([]),O(c=>c+1);const a=n[s],o=kn(n,f,h)[s];if(!a||!o)return;if(o.isMultivariate){bt(a,o,0);return}const i=kt(a,o,f,h);if(!i){T(null),B(null),We(null),Ie(null);return}T(i.data),B(i.resolveType),We(null),Ie(null)},lr=t=>{ht.current=t.append,ue(!0)},_o=t=>{const n=ht.current;if(!n){xo(t);return}n({__resolveType:t.resolveType}),ue(!1),ht.current=null},cr=t=>{if(m===null)return;const n=F[m],s=ye[m];!n||!s?.isMultivariate||(at(t),V([]),O(a=>a+1),bt(n,s,t,m,!0))},ko=t=>{if(m===null||!y)return;const n=F[m],s=ye[m];if(!n||!s?.isMultivariate)return;const a=dt(n,s);if(!a)return;const o=vi(a,t);if(!o){W.error(l("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const i=[...F];i[m]=Pt(n,s,o);const c=o.variants;let d=Fe;t===Fe?d=Math.min(t,c.length-1):t<Fe&&(d=Fe-1),at(d),V([]),O(R=>R+1),bt(i[m],s,d),lt(i)},wo=t=>{if(m===null||!y)return;const n=F[m],s=ye[m];if(!n||!s?.isMultivariate)return;const a=dt(n,s);if(!a)return;const o=yi(a,t,h),i=[...F];i[m]=Pt(n,s,o);const c=Zr(a.variants??[],t,h);at(c),V([]),O(d=>d+1),bt(i[m],s,c,m,h),lt(i)},Ro=(t,n)=>{if(m===null||!y||t===n)return;const s=F[m],a=ye[m];if(!s||!a?.isMultivariate)return;const o=dt(s,a);if(!o)return;const i=hi(o,t,n),c=[...F];c[m]=Pt(s,a,i);let d=Fe;Fe===t?d=n:t<Fe&&n>=Fe?d=Fe-1:t>Fe&&n<=Fe&&(d=Fe+1),at(d),bt(c[m],a,d,m,h),lt(c)},Sn=t=>{const n=t??m;if(n===null||!y)return;const s=F[n],a=ye[n];if(!s||!a)return;const o=pi(s,a,void 0,u,h);if(!o){W.error(l("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const i=[...F];i[n]=o.section;const c=kn(i,f,h)[n];if(!c?.isMultivariate){W.error(l("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}L(n),at(o.newVariantIndex),V([]),O(d=>d+1),bt(o.section,c,o.newVariantIndex,n,h),lt(i)},ur=()=>{if(m===null||!y)return;const t=F[m],n=ye[m];if(!t||!n?.isMultivariate)return;const s=dt(t,n);if(!s)return;const a=gi(t,n,s);if(!a){W.error(l("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const o=[...F];o[m]=a;const i=kn(o,f,h)[m];if(!i)return;at(0),We(null),Ie(null),V([]),O(d=>d+1);const c=kt(a,i,f,h);c?(T(c.data),B(c.resolveType)):(T(null),B(null)),$t(null,m,0),lt(o)},jo=async t=>{if(ce===null||!y)return;const n=Gn(t,f,u);if(n){W.error(n);return}const s=F[ce],a=ye[ce];if(!s||!a)return;const o=kt(s,a,f,h);if(!o){W.error(l("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const i={...o.data,name:t};try{const c=await M.mutateAsync({blockKey:t,data:i,create:!0}),d=[...F];d[ce]={__resolveType:t},await M.mutateAsync({blockKey:y,data:on(f,y,d,ne,ve)}),m===ce&&Wt(),Pe(null),Wn(c)||W.success(l("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),k?.()}catch(c){W.error(l("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Bt(l,Kt(c))})}},dr=Re?.rule;if(yt&&m===null&&re===null&&dr){const{resolveType:t,formValue:n}=Ut(dr,f??{},u??void 0);te(t),Z(n)}const sn=u?sl(u):[],cs=u&&f?rl(u,f):[],Ht=h&&u&&f?cc(u,f):[],us=(t,n)=>{if(Ht.length===0)return;const s=Dl(t);return{kinds:Ht,selected:s,campaignPrefill:uc(t),onPick:n,load:qs}},fr=!q&&!!(mt&&u&&f),mr=re&&u?Hn(re,u):null,St=()=>{gt.current&&(clearTimeout(gt.current),gt.current=null),vt.current&&(clearTimeout(vt.current),vt.current=null)},qt=async(t,n)=>{if(gc(n,t,u,h))try{await An.mutateAsync({blockKey:t})}catch(s){W.error(l("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Bt(l,Kt(s))})}},pr=t=>{gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>{const{activePageKey:n,decofile:s,variantIndex:a}=ae.current;if(!n)return;const o={...s[n]},i={...o.sections},c=[...i.variants??[]],d=c[a],R=d?.rule;if(Jt(R,s,u)){const g=R?.__resolveType??"",w=s[g],j=typeof w?.name=="string"?w.name:g,{__resolveType:K,...I}=t;M.mutate({blockKey:g,data:Mt(K??"",I,j)},{onSuccess:()=>k?.(),onError:M.reportError});return}d&&(c[a]={...d,rule:t}),o.sections={...i,variants:c},M.mutate({blockKey:n,data:o},{onSuccess:()=>k?.(),onError:M.reportError})},xn(h))},hr=t=>{te(t);const n=t?Ea(t,u):{__resolveType:Qr(u)};Z(t?n:{}),pr(n)},gr=t=>{const n=t;Z(n);const s=re?{__resolveType:re,...n}:{...n};pr(s)},Dn=async(t,n,s)=>{const a=dc(n,t);if(!a.ok)return a.reason==="conflict"&&W.info(t.kind==="experiments"?l("sectionsEditor.namedRulePicker.conflictTests"):l("sectionsEditor.namedRulePicker.conflictCampaigns"),Sa),null;const o={};if(s){const i=s(a.rule);if(!i)return null;o[i.blockKey]=i.data}return a.blockWrite&&(o[a.blockWrite.blockKey]=a.blockWrite.block),Object.keys(o).length>0&&!(await Is.apply({writes:o})).ok?null:(a.blockWrite&&W.success(t.kind==="experiments"?l("sectionsEditor.namedRulePicker.createdTest",{name:t.name.trim()}):l("sectionsEditor.namedRulePicker.createdCampaign",{name:t.name.trim()}),{...Sa,description:l("sectionsEditor.namedRulePicker.createdHint")}),{rule:a.rule,projected:{...n,...o}})},vr=Ht.length>0?{kinds:Ht,load:qs,prepare:async t=>(await Dn(t,ae.current.decofile,void 0))?.rule??null,ensureBlock:async t=>{const n=Ml(ae.current.decofile,t);return n.kind==="saved"?!0:n.kind==="conflict"?!1:(await Is.apply({writes:{[Fl(t).blockKey]:n.block}})).ok}}:null,yr=async t=>{St();const{activePageKey:n,decofile:s,variantIndex:a}=ae.current;if(!n)return;const o=await Dn(t,s,d=>{const R=s[n],g=R?.sections;if(!g||typeof g!="object"||Array.isArray(g))return null;const w=g;if(!Array.isArray(w.variants))return null;const j=[...w.variants],K=j[a];return K?(j[a]={...K,rule:d},{blockKey:n,data:{...R,sections:{...w,variants:j}}}):null});if(!o)return;const{resolveType:i,formValue:c}=Ut(o.rule,o.projected,u??void 0);te(i),Z(c),k?.()},Sr=async t=>{St();const{activePageKey:n,decofile:s,variantIndex:a}=ae.current;if(!n)return;const o=s[n],i=o?.sections;if(!i||typeof i!="object"||Array.isArray(i))return;const c=i;if(!Array.isArray(c.variants))return;const d=[...c.variants],R=d[a];if(!R)return;const g=Dt(R.rule,s,u),w=cn(t);d[a]={...R,rule:w};const j={...s,[n]:{...o,sections:{...c,variants:d}}},{resolveType:K,formValue:I}=Ut(w,j,u??void 0);te(K),Z(I);try{await M.mutateAsync({blockKey:n,data:j[n]}),g&&g!==t&&await qt(g,j),k?.()}catch(se){W.error(l("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Bt(l,Kt(se))})}},br=t=>{vt.current&&clearTimeout(vt.current);const{selectedSectionIndex:n,sectionVariantIndex:s}=ae.current;n!==null&&(vt.current=setTimeout(()=>{const{rawSections:a,parsedSections:o,decofile:i,activePageKey:c,pageVariants:d,variantIndex:R}=ae.current;if(!c)return;const g=a[n],w=o[n];if(!g||!w?.isMultivariate)return;const j=dt(g,w);if(!j)return;const I=(j.variants??[])[s]?.rule;if(Jt(I,i,u)){const Y=I?.__resolveType??"",je=i[Y],Le=typeof je?.name=="string"?je.name:Y,{__resolveType:Se,...me}=t;M.mutate({blockKey:Y,data:Mt(Se??"",me,Le)},{onSuccess:()=>k?.(),onError:M.reportError});return}const se=ys(j,s,t),J=[...a];J[n]=Pt(g,w,se);const Be=on(i,c,J,R,d);M.mutate({blockKey:c,data:Be},{onSuccess:()=>k?.(),onError:M.reportError})},xn(h)))},Eo=t=>{We(t);const n=t?Ea(t,u):{__resolveType:Qr(u)};Ie(t?n:{}),br(n)},Vo=t=>{const n=t;Ie(n);const s=Zt?{__resolveType:Zt,...n}:{...n};br(s)},To=async t=>{St();const{selectedSectionIndex:n,sectionVariantIndex:s,rawSections:a,parsedSections:o,decofile:i,activePageKey:c,pageVariants:d,variantIndex:R}=ae.current;if(n===null||!c)return;const g=await Dn(t,i,K=>{const I=a[n],se=o[n];if(!I||!se?.isMultivariate)return null;const J=dt(I,se);if(!J)return null;const Be=[...a];return Be[n]=Pt(I,se,ys(J,s,K)),{blockKey:c,data:on(i,c,Be,R,d)}});if(!g)return;const{resolveType:w,formValue:j}=Ut(g.rule,g.projected,u??void 0);We(w),Ie(j),k?.()},Ao=async t=>{St();const{selectedSectionIndex:n,sectionVariantIndex:s,rawSections:a,parsedSections:o,decofile:i,activePageKey:c,pageVariants:d,variantIndex:R}=ae.current;if(n===null||!c)return;const g=a[n],w=o[n];if(!g||!w?.isMultivariate)return;const j=dt(g,w);if(!j)return;const K=j.variants??[],I=Dt(K[s]?.rule,i,u),se=cn(t),J=ys(j,s,se),Be=[...a];Be[n]=Pt(g,w,J);const Y=on(i,c,Be,R,d),je={...i,[c]:Y},{resolveType:Le,formValue:Se}=Ut(se,je,u??void 0);We(Le),Ie(Se);try{await M.mutateAsync({blockKey:c,data:Y}),I&&I!==t&&await qt(I,je),k?.()}catch(me){W.error(l("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Bt(l,Kt(me))})}};if(!q&&!oe)return r.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.noPageFound",{currentPath:E})});if(q&&!ts)return r.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.globalBlockNotFound")});const Ne=m!==null?ye[m]??null:null,xr=m!==null?F[m]:null,_r=xr&&Ne?.isMultivariate?dt(xr,Ne):null,Et=_r?Jr(_r,Te,h):[],Mn=Math.min(Fe,Math.max(Et.length-1,0)),_t=Et[Mn]??null,Vt=Ne?.isMultivariate===!0,ds=m!==null&&Ne!==null,Tt=ds&&(Vt||!!(Kn&&Xe)),No=Tt&&!q&&Ne?.isSavedBlock===!0,ct=q||No,kr=q?Gs:Ne?.label??"",Co=Zt&&u?Hn(Zt,u):null,wr=(t,n)=>n&&$?`${t} · ${n}`:t,Rr=Ne?Ne.variantOf??Ne.label:"",Po=(()=>{const t=Vt&&_t?_t.label:null;return t?$?[wr(Rr,t)]:[Ne.label,t]:[Ne?.label??""]})(),fs=wr(oe?.name??"",yt?Re?.label:null),Fn=Tt&&(!q||D.length>0)?q?[Gs,...D]:[fs,...Po,...D]:[],jr=Ae&&oe?[oe.name,"SEO",...Ps]:[],Er=l("sectionsEditor.pageVariantTabs.variantsLabel"),Vr=Yt&&oe?[oe.name,Er]:Lt&&oe&&Ne?[fs,Rr,Er]:[],In=Vr.length>0?Vr:jr.length>0?jr:ct?Fn.length>0?Fn:[kr]:Fn.length>0?Fn:[fs],Tr=ds&&!Vt&&!Ne?.isHidden&&!!y,Bo=ct||!q&&yt&&!!Re||Tr,Ko=ds&&!Vt&&!q&&D.length===0&&!!Ne&&Pa(Ne)&&!!y,Do=$&&Tt&&!Lt&&Vt&&D.length===0&&!!_t,Ar=$&&D.length>0?oa(D[D.length-1]):null,Mo=D.length>1?oa(D[D.length-2]):null,Nr=ct?kr:Tt?Ne?.label??"":oe?.name??"",Fo=Yt||Lt?l("sectionsEditor.pageVariantTabs.variantsLabel"):Ae?l("sectionsEditor.panelSections.seo"):Ar??Nr,Cr=Lt?Ne?.variantOf??Ne?.label??"":Yt||Ae?oe?.name??"":Ar?Mo??Nr:ct?l("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Tt?oe?.name??"":oe?.path??"",ms=!Yt&&!Lt&&!Ae&&!Tt&&!ct,Io=!$&&!Ae&&!q&&Vt&&D.length===0,bn=()=>{if(!y)return;St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const t=f[y],n=pc(t.sections,F,u,h);if(!n)return;const{sections:s,newVariantIndex:a}=n;M.mutate({blockKey:y,data:{...t,sections:s}},{onSuccess:()=>{he(a),L(null),T(null),B(null),V([]),Z(null),te(null)},onError:M.reportError})},Ln=(t,n,s)=>{if(!y)return;St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const a=f[y],o=a.sections;if(!o||typeof o!="object"||Array.isArray(o))return;const i=o;if(!Array.isArray(i.variants))return;const c=t([...i.variants]);if(!c)return;const d=hc(i,c),R={...f,[y]:{...a,sections:d}};M.mutate({blockKey:y,data:R[y]},{onSuccess:()=>{n?.();const g=typeof s=="string"?[s]:s??[];(async()=>{for(const w of g)await qt(w,R)})()},onError:M.reportError})},Pr=(t,n)=>{if(t===n)return;let s=ne;ne===t?s=n:t<ne&&n>=ne?s=ne-1:t>ne&&n<=ne&&(s=ne+1),he(s);const a=Un(ve.map(o=>({rule:o.rule})),t,n);rs(a,s),Ln(o=>Un(o,t,n))},Br=t=>{const n=ve[t]?.rule,s=Dt(n,f??{},u??void 0);Ln(a=>a.length<=1?null:(a.splice(t,1),a),()=>{ve.length-1===1?he(0):t<ne?he(ne-1):t===ne&&he(Math.max(0,t-1)),L(null),T(null),B(null),V([]),Z(null),te(null)},s)},Lo=()=>{const t=ve.map((n,s)=>({variant:n,index:s})).filter(({variant:n})=>!_i(n.rule)).map(({variant:n})=>Dt(n.rule,f??{},u??void 0)).filter(n=>!!n);Ln(n=>{const s=Ii({variants:n}),a=n[s];return a?[{...a,rule:Li(u)}]:null},()=>{he(0),L(null),T(null),B(null),V([]),Z(null),te(null),En(!1)},t)},Kr=t=>{let n=t+1;Ln(s=>(n=Zr(s,t,h),vc(s,t,h)),()=>{he(n),L(null),T(null),B(null),V([]),Z(null),te(null)})},Oo=async(t,n)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const s=ae.current.activePageKey,a=ae.current.decofile;if(!s)return;const o=a[s],i=o.sections;if(!i||typeof i!="object"||Array.isArray(i))return;const c=i;if(!Array.isArray(c.variants))return;const d=[...c.variants],R=d[t];if(!R?.rule||typeof R.rule!="object"){W.error(l("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const g=R.rule,w=n.trim();en(!0);try{if(!w){if(!Jt(g,a,u)){ge(null);return}const Y=g.__resolveType??"";d[t]={...R,rule:js(g,a,u)};const je={...a,[s]:{...o,sections:{...c,variants:d}}};await M.mutateAsync({blockKey:s,data:je[s]}),await qt(Y,je),ge(null),k?.();return}const j=Es(g,a,u);if(!j){W.error(l("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(j.blockKey){await M.mutateAsync({blockKey:j.blockKey,data:Mt(j.resolveType,j.data,w)}),ge(null),k?.();return}const K=qn(w),I=Gn(K,a,u);if(I){W.error(I);return}const se=Mt(j.resolveType,j.data,w);let J=null,Be=!1;try{const Y=await M.mutateAsync({blockKey:K,data:se,create:!0});Be=Wn(Y),J=Be?null:K,d[t]={...R,rule:cn(K)},await M.mutateAsync({blockKey:s,data:{...o,sections:{...c,variants:d}}}),J=null}catch(Y){throw J&&await An.mutateAsync({blockKey:J}).catch(()=>{}),Y}ge(null),Be||W.success(l("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:w})),k?.()}catch(j){W.error(l("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Bt(l,Kt(j))})}finally{en(!1)}},zo=async(t,n)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const{selectedSectionIndex:s,rawSections:a,parsedSections:o,decofile:i,activePageKey:c,pageVariants:d,variantIndex:R}=ae.current;if(s===null||!c)return;const g=a[s],w=o[s];if(!g||!w?.isMultivariate)return;const j=dt(g,w);if(!j)return;const K=j.variants??[],I=K[t];if(!I?.rule||typeof I.rule!="object"){W.error(l("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const se=I.rule,J=n.trim();en(!0);const Be=async Y=>{const je={...j,variants:Y},Le=[...a];Le[s]=Pt(g,w,je);const Se=on(i,c,Le,R,d);return await M.mutateAsync({blockKey:c,data:Se}),{...i,[c]:Se}};try{if(!J){if(!Jt(se,i,u)){Ye(null);return}const Qe=se.__resolveType??"",At=[...K];At[t]={...I,rule:js(se,i,u)};const Nt=await Be(At);await qt(Qe,Nt),Ye(null),k?.();return}const Y=Es(se,i,u);if(!Y){W.error(l("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(Y.blockKey){await M.mutateAsync({blockKey:Y.blockKey,data:Mt(Y.resolveType,Y.data,J)}),Ye(null),k?.();return}const je=qn(J),Le=Gn(je,i,u);if(Le){W.error(Le);return}const Se=Mt(Y.resolveType,Y.data,J);let me=null,He=!1;try{const Qe=await M.mutateAsync({blockKey:je,data:Se,create:!0});He=Wn(Qe),me=He?null:je;const At=[...K];At[t]={...I,rule:cn(je)},await Be(At),me=null}catch(Qe){throw me&&await An.mutateAsync({blockKey:me}).catch(()=>{}),Qe}Ye(null),He||W.success(l("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:J})),k?.()}catch(Y){W.error(l("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Bt(l,Kt(Y))})}finally{en(!1)}},Dr=async(t,n,s)=>{T(s);try{await M.mutateAsync({blockKey:t,data:s})}catch(a){throw T(o=>o===s?n:o),a}},$o={rename:async(t,n,s)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const{activePageKey:a,decofile:o}=ae.current;if(!a)return;const i=Array.isArray(t.variants)?[...t.variants]:[],c=i[n],d=c?.rule&&typeof c.rule=="object"?c.rule:void 0,R=async w=>{const j={...t,variants:w};return await Dr(a,t,j),{...o,[a]:j}},g=Pc(d,s,o,u);if(g.kind!=="noop"){if(g.kind==="error"){W.error(g.reason==="no-matcher-rule"?l("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):g.reason==="unreadable-rule"?l("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):g.message??l("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}en(!0);try{if(g.kind==="inline"){const K=[...i];K[n]={...c,rule:g.inlinedRule};const I=await R(K);await qt(g.blockKey,I),k?.();return}if(g.kind==="updateBlock"){await M.mutateAsync({blockKey:g.blockKey,data:g.blockData}),k?.();return}let w=null,j=!1;try{const K=await M.mutateAsync({blockKey:g.blockId,data:g.blockData,create:!0});j=Wn(K),w=j?null:g.blockId;const I=[...i];I[n]={...c,rule:g.reference},await R(I),w=null}catch(K){throw w&&await An.mutateAsync({blockKey:w}).catch(()=>{}),K}j||W.success(l("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:s.trim()})),k?.()}catch(w){W.error(l("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Bt(l,Kt(w))})}finally{en(!1)}}},selectGlobal:async(t,n,s)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const{activePageKey:a,decofile:o}=ae.current;if(!a)return;const i=Array.isArray(t.variants)?[...t.variants]:[],c=i[n];if(!c)return;const d=Dt(c.rule,o,u);i[n]={...c,rule:cn(s)};const R={...t,variants:i},g={...o,[a]:R};try{await Dr(a,t,R),d&&d!==s&&await qt(d,g),k?.()}catch(w){W.error(l("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Bt(l,Kt(w))})}},selectNamedRule:async(t,n,s)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const{activePageKey:a,decofile:o}=ae.current;if(!a)return;let i=null;!await Dn(s,o,d=>{const R=Array.isArray(t.variants)?[...t.variants]:[],g=R[n];return g?(R[n]={...g,rule:d},i={...t,variants:R},{blockKey:a,data:i}):null})||!i||(T(i),k?.())}},Mr=()=>{Wt(),h&&$t(null,-1,0)},Fr=t=>{dn(t),ls({inner:t})},Ir=t=>{Tn(t),ls({raw:t})},Lr=()=>{dn(null),Ot([])},Or=()=>Qt(t=>t+1),zr=()=>{fn.flush(),un(!1),dn(null),Tn(void 0),Ot([]),Qt(t=>t+1),be?.()},Wo=()=>{En(!1),Vn(!1),L(null),un(!0)},Ho=()=>{Ae&&zr(),L(null),En(!0)},qo=()=>Vn(!0),ps=t=>{if(Yt&&t===0){En(!1);return}if(Lt&&t<2){Vn(!1),t===0&&L(null);return}if(Ae){if(t===0){zr();return}if(t===1){Ot([]),Qt(s=>s+1);return}Ot(Ps.slice(0,t-1)),Qt(s=>s+1);return}if(q){V(D.slice(0,t)),O(s=>s+1);return}if(t===0){Mr();return}if(t===1){V([]),O(s=>s+1);return}const n=!$&&Vt&&_t?1:0;if(n===1&&t===2){V([]),O(s=>s+1);return}V(D.slice(0,t-1-n))},hs=In.length>1?r.jsx("button",{type:"button",onClick:()=>ps(hl(In.length,{isMultivariateSectionTop:Io})),title:l("sectionsEditor.sectionsEditor.back"),"aria-label":l("sectionsEditor.sectionsEditor.back"),className:de("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ct?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:r.jsx(xl,{className:"size-4"})}):null,Go=ct||Tt||Ae?Bo&&r.jsxs("div",{className:de("border-b px-3 py-2.5",ct&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!q&&yt&&Re&&r.jsxs("button",{type:"button",onClick:Mr,title:l("sectionsEditor.sectionsEditor.editingInVariant",{variant:Re.label}),className:de("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",ol),children:[r.jsx(al,{rule:_s(Re.rule,f??{},u??void 0),matchers:sn}),r.jsx("span",{className:"max-w-[160px] truncate",children:Re.label})]}),r.jsx("div",{className:"flex-1"}),ct&&r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx("span",{className:"shrink-0 cursor-help",children:r.jsx(Jn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),r.jsx(jt,{side:"bottom",className:"max-w-[260px]",children:l("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Tr&&r.jsx($n,{onClick:()=>Sn()})]}),ct&&r.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:l("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):r.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx(ia,{pageKey:y,initialName:oe.name,initialPath:oe.path,onFieldChange:ir,variant:"header"})}),r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"ghost",size:"icon-sm","aria-label":l("sectionsEditor.sectionsEditor.editSeo"),className:"shrink-0",onClick:()=>un(!0),children:r.jsx(ha,{size:14})})}),r.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.editSeo")})]}),r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"ghost",size:"icon-sm","aria-label":l("sectionsEditor.sectionsEditor.viewJson"),className:"shrink-0",onClick:()=>Oe&&y?Oe():rt(!0),children:r.jsx(ga,{size:14})})}),r.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.viewJson")})]}),r.jsx($n,{onClick:bn})]}),Uo=r.jsxs(r.Fragment,{children:[yt&&y&&r.jsx(la,{listKey:y,variants:ve,activeIndex:ne,decofile:f??{},meta:u,matchers:sn,onSelect:os,onReorder:Pr,onRename:ge,onDuplicate:Kr,onDelete:Br,onAdd:bn}),yt&&re!==null&&r.jsx(ca,{className:"mt-3",children:r.jsx("div",{className:de("space-y-3",Xt&&"pointer-events-none opacity-50"),children:r.jsx(bs,{currentRt:re,currentLabel:_n(Re?.rule,f??{},Te,u??void 0),currentGlobalKey:Dt(Re?.rule,f??{},u??void 0)??void 0,matchers:sn,globals:cs,onSelect:hr,onSelectGlobal:Sr,named:us(Re?.rule,yr),namedRow:xs(Re?.rule,Ht),rule:Re?.rule,schema:mr,formValue:Me,onChange:gr,formKey:`${ne}:${re??""}`,formWrapperClassName:"space-y-3",meta:u??void 0,decofile:f,onSaveReferencedBlock:mn,sandbox:gn})})})]}),$r=r.jsxs(r.Fragment,{children:[r.jsx(il,{listKey:`${y??""}:${m??""}`,variants:Et.map((t,n)=>({index:n,label:t.label})),selectedIndex:Mn,onSelect:cr,onRename:Ye,onDuplicate:wo,onDelete:ko,onRemoveAll:ur,onReorder:Ro,onAdd:()=>Sn()}),r.jsx(ca,{children:r.jsx(bs,{currentRt:Zt??"",currentLabel:_n(_t?.rule,f??{},Te,u??void 0),currentGlobalKey:Dt(_t?.rule,f??{},u??void 0)??void 0,matchers:sn,globals:cs,onSelect:Eo,onSelectGlobal:Ao,named:us(_t?.rule,To),namedRow:xs(_t?.rule,Ht),rule:_t?.rule,schema:Co,formValue:za,onChange:Vo,formKey:`${m??"none"}:${Mn}:${Zt??""}`,formWrapperClassName:"pt-1",meta:u??void 0,decofile:f,onSaveReferencedBlock:mn,sandbox:gn})})]}),Wr=r.jsx("div",{className:de($?"px-2":"p-2 pt-3"),children:r.jsx(Nc,{listKey:`${y??""}-${ne}`,rawSections:F,sections:ye,meta:u,decofile:f,selectedIndex:m,onSelect:po,onReorder:ho,onDelete:go,onDuplicate:vo,onMakeReusable:Pe,onToggleHidden:yo,onToggleLazy:tt?So:void 0,onAddVariant:Sn,onDetach:bo,onAddSection:()=>ue(!0),canAddSection:fr})}),Jo=r.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[y&&oe&&r.jsx(ia,{pageKey:y,initialName:oe.name,initialPath:oe.path,onFieldChange:ir}),nn&&y?r.jsx(Ra,{rawSeo:Cn,innerSeo:ss,defaultResolveType:Js,seoTypesLoading:h&&!u,seoSchema:Ys,activeResolveType:Pn,seoTypeOptions:Us,formResetKey:Bs,siteDefaultSeo:Qs,onBreadcrumbChange:Ot,onPersistRaw:Ir,onInnerChange:Fr,onClearForm:Lr,onBumpFormKey:Or,asyncRenderAvailable:tt}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Yo=r.jsx(ln,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:nn&&y?r.jsx(Ra,{rawSeo:Cn,innerSeo:ss,defaultResolveType:Js,seoTypesLoading:h&&!u,seoSchema:Ys,activeResolveType:Pn,seoTypeOptions:Us,formResetKey:Bs,siteDefaultSeo:Qs,onBreadcrumbChange:Ot,onPersistRaw:Ir,onInnerChange:Fr,onClearForm:Lr,onBumpFormKey:Or,asyncRenderAvailable:tt}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Qo=r.jsxs(ln,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[yt&&y&&r.jsx(la,{listKey:y,variants:ve,activeIndex:ne,decofile:f??{},meta:u,matchers:sn,onSelect:os,onReorder:Pr,onRename:ge,onDuplicate:Kr,onDelete:Br,onAdd:bn}),yt&&re!==null&&r.jsxs("div",{className:de("px-3 border-b",jn?"pt-3 pb-5 space-y-3":"py-2"),children:[r.jsxs("button",{type:"button",onClick:()=>La(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":jn,children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("sectionsEditor.sectionsEditor.variantRule")}),jn?r.jsx(vl,{className:"size-3.5 shrink-0 text-muted-foreground"}):r.jsx(yl,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),jn&&r.jsx("div",{className:de("space-y-3",Xt&&"pointer-events-none opacity-50"),children:r.jsx(bs,{currentRt:re,currentLabel:_n(Re?.rule,f??{},Te,u??void 0),currentGlobalKey:Dt(Re?.rule,f??{},u??void 0)??void 0,matchers:sn,globals:cs,onSelect:hr,onSelectGlobal:Sr,named:us(Re?.rule,yr),namedRow:xs(Re?.rule,Ht),rule:Re?.rule,schema:mr,formValue:Me,onChange:gr,formKey:`${ne}:${re??""}`,formWrapperClassName:"space-y-3",meta:u??void 0,decofile:f,onSaveReferencedBlock:mn,sandbox:gn})})]}),Wr]},"editor-section-list");return r.jsx(ll,{value:h,children:r.jsx(cl,{children:r.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!$&&hs&&r.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:hs}),($||In.length>1)&&r.jsx(ul,{crumbs:In,onSelect:ps,onSelectRoot:()=>{fn.flush(),qe?qe():ps(0)}}),r.jsx("div",{className:"shrink-0",children:$?r.jsxs("div",{className:de("flex items-center gap-2 border-b px-3 py-2.5",ct&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[$&&hs,ct&&r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx("span",{className:"shrink-0 cursor-help",children:r.jsx(Jn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),r.jsx(jt,{side:"bottom",className:"max-w-[260px]",children:l("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[r.jsx("span",{className:"truncate text-sm font-semibold",children:Fo}),Cr&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Cr})]}),ms&&yt&&Re&&r.jsx(ua,{variants:ve,activeIndex:ne,onSelect:os,onManage:Ho,onRemoveAll:Lo}),Do&&r.jsx(ua,{variants:Et,activeIndex:Mn,onSelect:cr,onManage:qo,onRemoveAll:ur}),ms&&!yt&&r.jsx($n,{onClick:bn}),Ko&&r.jsx($n,{onClick:()=>Sn()}),r.jsx(dl,{}),ms&&r.jsxs(r.Fragment,{children:[r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"outline",size:"icon-sm","aria-label":l("sectionsEditor.sectionsEditor.editSeo"),className:"shrink-0",onClick:Wo,children:r.jsx(ha,{size:14})})}),r.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.editSeo")})]}),!Oe&&r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"outline",size:"icon-sm","aria-label":l("sectionsEditor.sectionsEditor.viewJson"),className:"shrink-0",onClick:()=>rt(!0),children:r.jsx(ga,{size:14})})}),r.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Go}),it&&r.jsx(di,{open:!0,fields:fi(it.plan,it.target.schema),choices:it.choices,changedAgain:it.changedAgain,author:$s??null,authorPending:$s===void 0,fieldsAsLabeled:zs!==null,fresh:it.fresh,keepTyping:h,onChoose:(t,n)=>mo({...it.choices,[t]:n}),onApply:fo},Dc(it.formBase)),Lt?r.jsx(da,{onAdd:()=>Sn(),children:$r},"editor-section-variants"):Tt?r.jsxs(ln,{viewportRef:le,onBlur:tr,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!$&&Vt&&Et.length>0&&D.length===0&&$r,r.jsx(ja,{value:vr,children:r.jsx(fa,{value:q&&h?De:null,children:r.jsx(ma,{activeSchema:Kn,formValue:Xe,formResetKey:Je,onFormChange:or,onBreadcrumbChange:V,breadcrumbPath:D,emptyMessage:l("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:u,decofile:f,onSaveReferencedBlock:mn,sandbox:gn,previewBaseUrl:xe,onRequestAddSection:lr,onVariantMatcherOp:q?$o:void 0})})})]},"editor-section-form"):q?r.jsx(ln,{viewportRef:le,onBlur:tr,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx(ja,{value:vr,children:r.jsx(fa,{value:q&&h?De:null,children:r.jsx(ma,{activeSchema:Kn,formValue:Xe,formResetKey:Je,onFormChange:or,onBreadcrumbChange:V,breadcrumbPath:D,emptyMessage:l("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:u,decofile:f,onSaveReferencedBlock:mn,sandbox:gn,previewBaseUrl:xe,onRequestAddSection:lr})})})},"editor-global-block"):Ae?$?r.jsx(ln,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"p-3",children:Jo})},"editor-seo"):Yo:Yt?r.jsx(da,{onAdd:bn,children:Uo},"editor-variants"):$?r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsx(ln,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"py-2",children:Wr})}),r.jsx("div",{className:"shrink-0 border-t p-2",children:r.jsx(Vs,{canAddSection:fr,onAddSection:()=>ue(!0)})})]},"editor-section-list"):Qo,r.jsx(fl,{open:ce!==null,onOpenChange:t=>{t||Pe(null)},defaultBlockId:ce!==null?qn(ye[ce]?.label??""):"",isPending:M.isPending,onSubmit:jo}),mt&&r.jsx(rc,{open:U,onOpenChange:t=>{ue(t),t||(ht.current=null)},meta:u,decofile:f,previewBaseUrl:xe,onSelect:_o}),pt&&y&&f&&r.jsx(Ol,{open:pt,onOpenChange:rt,pageKey:y,decofile:f}),ke!==null&&r.jsx(pa,{open:!0,initialName:Jt(ve[ke]?.rule,f??{},u??void 0)?_n(ve[ke]?.rule,f??{},Te,u??void 0):"",autoLabel:Te(_s(ve[ke]?.rule,f??{},u??void 0)),isPending:Xt,onSubmit:async t=>{await Oo(ke,t)},onOpenChange:t=>{!t&&!Xt&&ge(null)}}),z!==null&&r.jsx(pa,{open:!0,initialName:Jt(Et[z]?.rule,f??{},u??void 0)?_n(Et[z]?.rule,f??{},Te,u??void 0):"",autoLabel:Te(_s(Et[z]?.rule,f??{},u??void 0)),isPending:Xt,onSubmit:async t=>{await zo(z,t)},onOpenChange:t=>{!t&&!Xt&&Ye(null)}})]})})})}export{cf as SectionsEditor};
1
+ import{i2 as Zo,bf as Xo,c as wn,b as Rn,r as b,m as de,j as r,bQ as ei,b8 as Ts,i3 as Pa,B as Ft,Y as an,au as ti,_ as ni,be as si,Z as ri,q as ai,hA as oi,i4 as ii,i5 as li,h as ci,bg as kt,i6 as Ur,i7 as vs,i8 as ui,i9 as dt,ia as Jr,ib as di,bt as fi,ic as mi,id as Yr,ie as pi,t as W,bZ as Qr,ig as hi,ih as Pt,ii as gi,ij as vi,ik as yi,bY as Zr,il as ys,im as Si,io as bi,ip as xi,bW as _i,bu as ki,iq as wi,ir as Ri,bT as ji,K as Ei,is as Xr,fc as Vi,bm as zn,br as ea,it as ta,iu as Ti,iv as Ai,iw as Ni,ix as Ss,iy as Ci,iz as Pi,iA as Bi,iB as na,iC as Ki,iD as Di,bR as sa,iE as Mi,iF as Fi,iG as Ii,bV as Li}from"./index-C0YexCRj.js";import{u as Oi}from"./chat-context-C4aI-9Gh.js";import{a5 as zi,O as Yn,a6 as $i,a7 as Wi,a8 as Hi,a9 as qi,aa as Gi,ab as Ui,ac as ra,ad as Ji,ae as Yi,A as qn,y as Gn,d as Qi,u as Zi,af as aa,i as Xi,ag as el,k as tl,h as nl,ah as Ba,p as kn,ai as sl,aj as rl,w as oa,ak as al,al as ol,am as $n,an as ia,ao as la,ap as ca,aq as bs,ar as il,F as ll,as as cl,z as ul,at as ua,au as dl,av as da,aw as fa,ax as ma,M as fl,ay as pa,a as ml,az as on,aA as pl,aB as hl,v as Wn,a4 as xn}from"./parse-sections-DAzG_Y-i.js";import{b as gl}from"./repository-binding-zAuhrRNl.js";import{n as vl,t as yl}from"./ChevronUp-DzfCpOxS.js";import{a7 as Ka,b as Jn,am as Sl,e as bl,E as xl,a1 as ha,Y as ga}from"./agent-icon-CTjv6Gf3.js";import{S as ln}from"./scroll-area-C8lIzaxm.js";import{c as wt,T as Rt,a as jt}from"./tooltip-B4vnoW3c.js";import{l as _l,u as kl,m as wl,U as Rl,ai as jl,S as El,F as va,aX as ya,as as Bt,at as Kt,a4 as Vl,aY as Tl,aZ as Al,aT as Sa,a7 as Nl,ae as Cl}from"./site-editor-toast-BQb3pwds.js";import{u as Pl,ao as ba,e as xa,j as Bl,D as Kl,A as Hn,a3 as Dl,ae as Ml,ag as Fl}from"./blocks-tab-states-DAhg2Ye6.js";import{m as Il,u as Ll,P as Ol}from"./mustache-CMDiec2Z.js";import{a as ws,e as Da}from"./UserSquare-6Sdby0FR.js";import{i as _a,s as ka}from"./Tool01-BhHpHR3H.js";import{s as zl}from"./Plus-CZbPbPr7.js";import{s as $l}from"./Trash01-HGp7pYgQ.js";import{i as Rs}from"./Zap-DalPfKev.js";import{u as Wl,a as wa,K as Hl,P as ql,b as Gl,C as Ul,D as Jl,c as Yl}from"./core.esm-DYzatWGk.js";import{u as Ql,s as Zl,a as Un,S as Xl,v as ec}from"./sortable.esm-BoEIu5W0.js";import{s as tc,g as nc,u as sc,A as rc}from"./use-section-preview-base-nthVDFUD.js";import{u as ac,a as oc,P as Ra,w as ic,b as lc}from"./seo-editor-D6BbHFAR.js";import{R as cc,y as xs,T as ja,x as uc,U as dc}from"./hosted-reconcile-DVCi8vCY.js";import{u as fc}from"./use-apply-named-rule-hAr6r48R.js";import{m as Jt,d as js,y as Es,n as Mt,e as cn,q as mc,k as Ut,r as _s,j as Dt,h as _n,b as pc,s as Ea,z as hc,A as gc,B as vc}from"./section-array-field-3fy_eFLn.js";import{b as Va,a as yc}from"./variant-matcher-override-BCR-xrVe.js";import"./autosend-FOyswNSR.js";import"./thread-route-D3Npgdwy.js";import"./use-project-scope-DwEcCTYT.js";import"./thread-intent-BGQF0i18.js";import"./use-mcp-client-DBEWWTcM.js";import"./auth-BZ5Ef56k.js";import"./delay-CnY5UFtP.js";import"./watch-sse-pool-BNZW-YJq.js";import"./task-board-4SvjUpMb.js";import"./schema-DfRf1jxZ.js";import"./use-entitlements-DyCdoeJS.js";import"./use-ai-providers-DKBQ22lC.js";import"./use-decopilot-events-Emf31ERY.js";import"./use-organization-settings-Df-csuDo.js";import"./utils-CtoE4BzT.js";import"./Play-B9PgWZlg.js";import"./sandbox-start-errors-BK_aDCyt.js";import"./pair-D-1ihySL.js";import"./LinkBroken01-BrWXpfvW.js";import"./collapsible-BgpbICto.js";import"./use-copy-L2uJJmEn.js";import"./usage-stats-D9-LtkOq.js";import"./tool-namespace-0JnTVTOi.js";import"./form-C_M4QV9P.js";import"./label-CnHmgvIU.js";import"./utils-CVEq3hMx.js";import"./markdown-CN4Sgkcu.js";import"./use-mobile-CRjTpdEZ.js";import"./shell-layout-q9TPgR4S.js";import"./Globe04-CbE4fQfn.js";import"./use-deployment-admin-C05Wl5hm.js";import"./admin-fetch-BhTJlAsX.js";import"./XClose-DeFo1VOD.js";import"./CheckCircle-CO-Sp-gI.js";import"./Monitor01-DPIeBRgo.js";import"./command-CsBJ3GOI.js";import"./index-Do6PllqG.js";import"./SearchMd-DseifSbW.js";import"./integration-icon-D6ksbVbr.js";import"./project-icon-CmV5zxWN.js";import"./use-navigate-to-agent-B9-xP8hn.js";import"./new-project-dialog-C0bl_2Ba.js";import"./ArrowLeft-DDdp1fkC.js";import"./repository-picker-C8xivTfl.js";import"./github-icon-BZYLnrQK.js";import"./useInfiniteQuery-Bq3XzHMD.js";import"./infiniteQueryObserver-BMqABh4H.js";import"./collection-search-CH54VXGp.js";import"./ShoppingBag01-TG8T0GTy.js";import"./use-debounced-value-yze9Agx0.js";import"./required-auth-layout-CQCCkUAY.js";import"./use-org-sso-DcHAsgmH.js";import"./content-blocks-o63cs2vh.js";import"./mcp-app-renderer-B7qZoNog.js";import"./types-Cvkdtetr.js";import"./omit-server-managed-metadata-L5IhjRZB.js";import"./AlertCircle-vm4sk-x9.js";import"./sheet-D1FdDYgh.js";import"./use-connection-Cd0tT7Hz.js";import"./use-mcp-prompts-CQ9PPuTj.js";import"./use-thread-outputs-D4glxnBY.js";import"./file-type-icon-BsiKabia.js";import"./switch-By9JubUf.js";import"./textarea-Duz08Iqx.js";import"./ChevronSelectorVertical-BsQHRlTg.js";import"./popover-ChvCIlNB.js";import"./monaco-editor-DRELyy_D.js";import"./editor-DD0jwUtP.js";import"./calendar-C6M3LMV4.js";import"./SwitchHorizontal01-CTmes_jp.js";import"./Minus-CGC-Ky2T.js";import"./select-C67xaSM-.js";import"./index-BdQq_4o_.js";import"./index-CdLJWnRN.js";import"./editor-classes-Dnkv0ExO.js";import"./toggle-group-CCnoRxJ5.js";import"./active-indicator-CCMhAsc_.js";import"./combobox-Bfj0PjLE.js";import"./Upload01-B2W5ZMg1.js";import"./search-input-D2E1z19V.js";import"./tabs-Bb2xgzcm.js";import"./use-file-configs-C2_msq8y.js";import"./asset-utils-DC1EoBVm.js";import"./match-site-slug-config-D3fUJ6vX.js";import"./use-voice-input-CXfzcEw1.js";import"./drawer-B5at6I_u.js";import"./index-BVwTm9yy.js";import"./checkbox-BpYZyZtV.js";import"./Key01-DnFTUPGs.js";import"./ai-providers-logos-DD3qZ33J.js";import"./openai-compatible-presets-BKGfVqEx.js";import"./sandbox-git-api-DcqI6XE4.js";import"./sandbox-url-D3mC8qhT.js";import"./ArrowUp-DD_r1Y_T.js";import"./CreditCard01-Dg0W_VbM.js";import"./Sun-CBOZY0wW.js";import"./Users01-DQRKjdTI.js";import"./use-blocks-v8-project-FZUFv9Vq.js";import"./use-sandbox-events-BxZfdvM3.js";import"./empty-state-D3yjfo9M.js";import"./slider-COwHhiq0.js";import"./index-BqJ-zbRp.js";import"./tooltipContext-Di8C4u-8.js";import"./CategoricalChart-Dannm-85.js";import"./index-DqGr7Hc1.js";import"./use-move-blocks-Dn5Uj2rh.js";const Sc={escape:zi};function bc(v,e){for(const p of tc(v,e)){const S=typeof p.title=="string"?p.title:void 0;if(S?.includes("{{"))return S}}function xc(v,e){if(!e)return;const p=Zo(v,Xo(e));if(p)try{const S=bc(p.resolveType,e);return S&&Il.render(S,p.data,{},Sc).trim()||void 0}catch{return}}function _c(v){const e=wn.c(13),{icon:p,label:S,className:x}=v;let E;e[0]!==x?(E=de("size-3.5",x),e[0]=x,e[1]=E):E=e[1];let C;e[2]!==p||e[3]!==E?(C=r.jsx(p,{className:E}),e[2]=p,e[3]=E,e[4]=C):C=e[4];let _;e[5]!==S||e[6]!==C?(_=r.jsx(Rt,{asChild:!0,children:r.jsx("span",{role:"img","aria-label":S,className:"shrink-0 cursor-help",children:C})}),e[5]=S,e[6]=C,e[7]=_):_=e[7];let P;e[8]!==S?(P=r.jsx(jt,{className:"max-w-56",children:S}),e[8]=S,e[9]=P):P=e[9];let k;return e[10]!==_||e[11]!==P?(k=r.jsxs(wt,{children:[_,P]}),e[10]=_,e[11]=P,e[12]=k):k=e[12],k}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 Ta(v){return Array.from({length:v},(e,p)=>({id:crypto.randomUUID(),index:p}))}function Ma(v){return v.map((e,p)=>({...e,index:p}))}function wc(v,e){if(e===v.length)return v;if(e<v.length)return Ma(v.slice(0,e));const p=Array.from({length:e-v.length},(S,x)=>({id:crypto.randomUUID(),index:v.length+x}));return[...v,...p]}function Fa(v){const e=wn.c(44),{section:p,raw:S,meta:x,decofile:E}=v,C=Rn(),_=Yn(),P=p.isSavedBlock===!0,k=p.isMultivariate===!0;let ee;e[0]!==x||e[1]!==S?(ee=S&&x?nc(S,x):void 0,e[0]=x,e[1]=S,e[2]=ee):ee=e[2];const be=ee;let qe;e[3]!==x||e[4]!==k||e[5]!==S||e[6]!==P?(qe=S&&x&&!P&&!k?xc(S,x):void 0,e[3]=x,e[4]=k,e[5]=S,e[6]=P,e[7]=qe):qe=e[7];const Oe=qe;let Ke;e[8]!==E||e[9]!==x||e[10]!==S||e[11]!==p?(Ke=Ui(S,p,E,x),e[8]=E,e[9]=x,e[10]=S,e[11]=p,e[12]=Ke):Ke=e[12];const fe=Ke;let l;e[13]!==k||e[14]!==S?.__resolveType?(l=!k&&Ts(S?.__resolveType??""),e[13]=k,e[14]=S?.__resolveType,e[15]=l):l=e[15];const N=l,Ee=P?Jn:k?Ka:Da;let G;e[16]!==k||e[17]!==P?(G=P?{color:si}:k?{color:"oklch(0.65 0.15 160)"}:void 0,e[16]=k,e[17]=P,e[18]=G):G=e[18];const ie=G;let H;e[19]!==Ee||e[20]!==_?(H=_?r.jsxs("span",{className:"relative size-4 shrink-0",children:[r.jsx(Ee,{className:"absolute inset-0 size-4 text-muted-foreground transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"}),r.jsx(Yi,{"aria-hidden":!0,className:"absolute inset-0 size-4 opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100"})]}):r.jsx(Sl,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[19]=Ee,e[20]=_,e[21]=H):H=e[21];let f;e[22]!==be?(f=be&&r.jsx("img",{src:be,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded-[var(--studio-control-radius,var(--radius))] object-cover"}),e[22]=be,e[23]=f):f=e[23];let Q;e[24]!==_||e[25]!==ie?(Q=!_&&r.jsx(ws,{className:"h-4 w-4 shrink-0",style:ie}),e[24]=_,e[25]=ie,e[26]=Q):Q=e[26];const u=_?"shrink":"flex-1",Ce=p.isHidden&&"line-through opacity-50";let $;e[27]!==Ce||e[28]!==u?($=de("min-w-0 truncate text-sm font-medium",u,Ce),e[27]=Ce,e[28]=u,e[29]=$):$=e[29];const ft=Oe??p.label;let Ge;e[30]!==$||e[31]!==ft?(Ge=r.jsx("span",{className:$,children:ft}),e[30]=$,e[31]=ft,e[32]=Ge):Ge=e[32];let Ze;e[33]!==N||e[34]!==_||e[35]!==fe||e[36]!==C?(Ze=_?r.jsxs(r.Fragment,{children:[N&&r.jsx(_c,{icon:Rs,label:C("sectionsEditor.sectionList.asyncBadge"),className:"text-muted-foreground"}),fe&&r.jsx(ra,{}),r.jsx("span",{className:"min-w-0 flex-1"})]}):fe&&r.jsx(ra,{className:"absolute -right-0.5 -top-0.5"}),e[33]=N,e[34]=_,e[35]=fe,e[36]=C,e[37]=Ze):Ze=e[37];let xe;return e[38]!==Ge||e[39]!==Ze||e[40]!==H||e[41]!==f||e[42]!==Q?(xe=r.jsxs(r.Fragment,{children:[H,f,Q,Ge,Ze]}),e[38]=Ge,e[39]=Ze,e[40]=H,e[41]=f,e[42]=Q,e[43]=xe):xe=e[43],xe}const Rc="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",jc="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 Ia(v,e,p){if(p)return Ji({selected:e});const S=v.isSavedBlock===!0,x=v.isMultivariate===!0;return de("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":S?Rc:x?jc:"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function ks(v,e){return de("h-7 shrink-0 overflow-hidden",e?"w-7 ml-0 opacity-100 [transition:opacity_150ms_ease-out,width_0ms,margin-left_0ms]":v?"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 Ec(v){const e=wn.c(90),{section:p,raw:S,meta:x,decofile:E,sortableId:C,selected:_,onSelect:P,onDelete:k,onDuplicate:ee,onMakeReusable:be,onToggleHidden:qe,onToggleLazy:Oe,onAddVariant:Ke,onDetach:fe}=v,l=Rn(),N=Yn(),Ee=S?Ts(S.__resolveType??""):!1,G=p.isHidden===!0,ie=Ee||G;let H;e[0]!==p?(H=Pa(p),e[0]=p,e[1]=H):H=e[1];const f=H,Q=!!Oe&&!p.isMultivariate;let u;e[2]!==C?(u={id:C,animateLayoutChanges:Ac},e[2]=C,e[3]=u):u=e[3];const{attributes:Ce,listeners:$,setNodeRef:ft,transform:Ge,isDragging:Ze}=Ql(u);let xe;e[4]!==Ge?(xe=Ul.Transform.toString(Ge?{...Ge,x:0}:null),e[4]=Ge,e[5]=xe):xe=e[5];const Ve=Ze?0:void 0;let h;e[6]!==xe||e[7]!==Ve?(h={transform:xe,opacity:Ve},e[6]=xe,e[7]=Ve,e[8]=h):h=e[8];const Te=h;let tt;e[9]!==p?(tt=Wi(p),e[9]=p,e[10]=tt):tt=e[10];const mt=tt,m="button",L=0;let Xe;e[11]!==P?(Xe=z=>{(z.key==="Enter"||z.key===" ")&&(z.preventDefault(),P())},e[11]=P,e[12]=Xe):Xe=e[12];const T=Ze?"cursor-grabbing":"cursor-pointer";let et;e[13]!==N||e[14]!==p||e[15]!==_||e[16]!==T?(et=de("touch-none transition-colors",T,Ia(p,_,N)),e[13]=N,e[14]=p,e[15]=_,e[16]=T,e[17]=et):et=e[17];let B;e[18]!==E||e[19]!==x||e[20]!==S||e[21]!==p?(B=r.jsx(Fa,{section:p,raw:S,meta:x,decofile:E}),e[18]=E,e[19]=x,e[20]=S,e[21]=p,e[22]=B):B=e[22];const It=!N&&Q&&r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"ghost",size:"icon","aria-label":l(Ee?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender"),className:de(ks(ie,Ee)),onClick:z=>{z.stopPropagation(),Oe?.()},onPointerDown:Tc,children:r.jsx(Rs,{className:de("h-3.5 w-3.5",Ee&&"text-warning")})})}),r.jsx(jt,{side:"bottom",children:l(Ee?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")})]}),he=N?r.jsx(Hi,{label:l(G?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),active:G,onToggle:qe,children:G?r.jsx(_a,{className:"h-3.5 w-3.5"}):r.jsx(ka,{className:"h-3.5 w-3.5"})}):r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"ghost",size:"icon","aria-label":l(G?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection"),className:de(ks(ie,G)),onClick:z=>{z.stopPropagation(),qe()},onPointerDown:Vc,children:G?r.jsx(_a,{className:"h-3.5 w-3.5"}):r.jsx(ka,{className:"h-3.5 w-3.5"})})}),r.jsx(jt,{side:"bottom",children:l(G?"sectionsEditor.sectionList.showSection":"sectionsEditor.sectionList.hideSection")})]}),nt=ni,Ue=qi;let _e;e[23]!==l?(_e=l("sectionsEditor.sectionList.sectionActionsMenu"),e[23]=l,e[24]=_e):_e=e[24];const st=de(ks(ie,!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 De;e[25]!==Ue||e[26]!==_e||e[27]!==st?(De=r.jsx(Ue,{label:_e,classicClassName:st}),e[25]=Ue,e[26]=_e,e[27]=st,e[28]=De):De=e[28];let Me;e[29]!==N||e[30]!==Q||e[31]!==Ee||e[32]!==Oe||e[33]!==l?(Me=N&&Q&&r.jsxs(r.Fragment,{children:[r.jsxs(an,{onClick:z=>{z.stopPropagation(),Oe?.()},children:[r.jsx(Rs,{className:"h-4 w-4"}),l(Ee?"sectionsEditor.sectionList.disableAsyncRender":"sectionsEditor.sectionList.enableAsyncRender")]}),r.jsx(ti,{})]}),e[29]=N,e[30]=Q,e[31]=Ee,e[32]=Oe,e[33]=l,e[34]=Me):Me=e[34];let Z;e[35]!==ee?(Z=z=>{z.stopPropagation(),ee()},e[35]=ee,e[36]=Z):Z=e[36];let re;e[37]===Symbol.for("react.memo_cache_sentinel")?(re=r.jsx(bl,{className:"h-4 w-4"}),e[37]=re):re=e[37];let te;e[38]!==l?(te=l("sectionsEditor.sectionList.duplicateMenuItem"),e[38]=l,e[39]=te):te=e[39];let D;e[40]!==Z||e[41]!==te?(D=r.jsxs(an,{onClick:Z,children:[re,te]}),e[40]=Z,e[41]=te,e[42]=D):D=e[42];let V;e[43]!==N||e[44]!==f||e[45]!==Ke||e[46]!==l?(V=f&&r.jsxs(an,{className:de(!N&&Gi),onClick:z=>{z.stopPropagation(),Ke()},children:[r.jsx(Ka,{className:"h-4 w-4"}),l("sectionsEditor.sectionList.addVariantMenuItem")]}),e[43]=N,e[44]=f,e[45]=Ke,e[46]=l,e[47]=V):V=e[47];let le;e[48]!==N||e[49]!==mt||e[50]!==be||e[51]!==l?(le=mt&&r.jsxs(an,{className:de(!N&&kc),onClick:z=>{z.stopPropagation(),be()},children:[N?r.jsx(Jn,{className:"h-4 w-4"}):r.jsx(ws,{className:"h-4 w-4"}),l("sectionsEditor.sectionList.makeReusableMenuItem")]}),e[48]=N,e[49]=mt,e[50]=be,e[51]=l,e[52]=le):le=e[52];let ze;e[53]!==N||e[54]!==fe||e[55]!==p.isMultivariate||e[56]!==p.isSavedBlock||e[57]!==l?(ze=p.isSavedBlock===!0&&!p.isMultivariate&&r.jsxs(an,{onClick:z=>{z.stopPropagation(),fe()},children:[N?r.jsx(Da,{className:"h-4 w-4"}):r.jsx(ws,{className:"h-4 w-4"}),l("sectionsEditor.sectionList.detachMenuItem")]}),e[53]=N,e[54]=fe,e[55]=p.isMultivariate,e[56]=p.isSavedBlock,e[57]=l,e[58]=ze):ze=e[58];let $e;e[59]!==k?($e=z=>{z.stopPropagation(),k()},e[59]=k,e[60]=$e):$e=e[60];let Je;e[61]===Symbol.for("react.memo_cache_sentinel")?(Je=r.jsx($l,{className:"h-4 w-4"}),e[61]=Je):Je=e[61];let O;e[62]!==l?(O=l("sectionsEditor.sectionList.deleteMenuItem"),e[62]=l,e[63]=O):O=e[63];let ce;e[64]!==$e||e[65]!==O?(ce=r.jsxs(an,{variant:"destructive",onClick:$e,children:[Je,O]}),e[64]=$e,e[65]=O,e[66]=ce):ce=e[66];let Pe;e[67]!==Me||e[68]!==D||e[69]!==V||e[70]!==le||e[71]!==ze||e[72]!==ce?(Pe=r.jsxs(ri,{align:"end",className:"w-44",children:[Me,D,V,le,ze,ce]}),e[67]=Me,e[68]=D,e[69]=V,e[70]=le,e[71]=ze,e[72]=ce,e[73]=Pe):Pe=e[73];let ke;e[74]!==nt||e[75]!==De||e[76]!==Pe?(ke=r.jsxs(nt,{children:[De,Pe]}),e[74]=nt,e[75]=De,e[76]=Pe,e[77]=ke):ke=e[77];let ge;return e[78]!==Ce||e[79]!==$||e[80]!==P||e[81]!==ft||e[82]!==Te||e[83]!==et||e[84]!==B||e[85]!==It||e[86]!==he||e[87]!==ke||e[88]!==Xe?(ge=r.jsxs("div",{ref:ft,style:Te,...Ce,...$,role:m,tabIndex:L,onClick:P,onKeyDown:Xe,className:et,children:[B,It,he,ke]}),e[78]=Ce,e[79]=$,e[80]=P,e[81]=ft,e[82]=Te,e[83]=et,e[84]=B,e[85]=It,e[86]=he,e[87]=ke,e[88]=Xe,e[89]=ge):ge=e[89],ge}function Vc(v){return v.stopPropagation()}function Tc(v){return v.stopPropagation()}function Ac(){return!1}function Vs(v){const e=wn.c(11),{canAddSection:p,onAddSection:S,className:x,size:E}=v,C=Rn();let _;e[0]!==x?(_=de("w-full",x),e[0]=x,e[1]=_):_=e[1];const P=!p;let k;e[2]===Symbol.for("react.memo_cache_sentinel")?(k=r.jsx(zl,{size:14}),e[2]=k):k=e[2];let ee;e[3]!==C?(ee=C("sectionsEditor.sectionList.addSectionButton"),e[3]=C,e[4]=ee):ee=e[4];let be;return e[5]!==S||e[6]!==E||e[7]!==_||e[8]!==P||e[9]!==ee?(be=r.jsxs(Ft,{type:"button",variant:"outline",size:E,className:_,disabled:P,onClick:S,children:[k,ee]}),e[5]=S,e[6]=E,e[7]=_,e[8]=P,e[9]=ee,e[10]=be):be=e[10],be}function Nc(v){const e=wn.c(101),{listKey:p,rawSections:S,sections:x,meta:E,decofile:C,selectedIndex:_,onSelect:P,onReorder:k,onDelete:ee,onDuplicate:be,onMakeReusable:qe,onToggleHidden:Oe,onToggleLazy:Ke,onAddVariant:fe,onDetach:l,onAddSection:N,canAddSection:Ee}=v,G=Ee===void 0?!0:Ee,ie=Rn(),H=Yn();let f;e[0]!==x.length?(f=()=>Ta(x.length),e[0]=x.length,e[1]=f):f=e[1];const[Q,u]=b.useState(f),[Ce,$]=b.useState(null),[ft,Ge]=b.useState(p),[Ze,xe]=b.useState(x.length),Ve=b.useRef(!1);ft!==p?(Ge(p),xe(x.length),u(Ta(x.length))):Ze!==x.length&&(xe(x.length),u(Ye=>wc(Ye,x.length)));let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:8}},e[2]=h):h=e[2];let Te;e[3]===Symbol.for("react.memo_cache_sentinel")?(Te={coordinateGetter:Zl},e[3]=Te):Te=e[3];const tt=Wl(wa(ql,h),wa(Hl,Te));let mt;e[4]!==Q?(mt=Q.map(Cc),e[4]=Q,e[5]=mt):mt=e[5];const m=mt;let L;e[6]===Symbol.for("react.memo_cache_sentinel")?(L=Ye=>{$(String(Ye.active.id))},e[6]=L):L=e[6];const Xe=L;let T;e[7]!==m||e[8]!==k?(T=Ye=>{$(null);const{active:U,over:ue}=Ye;if(!ue||U.id===ue.id)return;const pt=m.indexOf(String(U.id)),rt=m.indexOf(String(ue.id));pt===-1||rt===-1||(u(ht=>Ma(Un([...ht],pt,rt))),Ve.current=!0,requestAnimationFrame(()=>{Ve.current=!1}),k?.(pt,rt))},e[7]=m,e[8]=k,e[9]=T):T=e[9];const et=T;let B;e[10]===Symbol.for("react.memo_cache_sentinel")?(B=()=>{$(null)},e[10]=B):B=e[10];const It=B;let he,nt,Ue,_e,st,De,Me,Z,re,te,D,V,le,ze,$e;if(e[11]!==Ce||e[12]!==G||e[13]!==H||e[14]!==C||e[15]!==Q||e[16]!==m||e[17]!==et||e[18]!==E||e[19]!==N||e[20]!==fe||e[21]!==ee||e[22]!==l||e[23]!==be||e[24]!==qe||e[25]!==P||e[26]!==Oe||e[27]!==Ke||e[28]!==S||e[29]!==x||e[30]!==_||e[31]!==tt||e[32]!==ie){ze=Symbol.for("react.early_return_sentinel");e:{const Ye=U=>{Ve.current||P(U)};if(e[48]!==Ce||e[49]!==G||e[50]!==H||e[51]!==Q||e[52]!==N||e[53]!==S||e[54]!==x||e[55]!==ie){const U=Ce?Q.find(ue=>ue.id===Ce):null;if(_e=U!=null?x[U.index]:null,Ue=U!=null?S[U.index]:void 0,Q.length===0){let ue;e[59]!==ie?(ue=ie("sectionsEditor.sectionList.noSections"),e[59]=ie,e[60]=ue):ue=e[60];let pt;e[61]!==ue?(pt=r.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:ue}),e[61]=ue,e[62]=pt):pt=e[62];const rt=pt;let ht;e[63]!==G||e[64]!==H||e[65]!==rt||e[66]!==N?(ht=H?rt:r.jsxs("div",{className:"space-y-2",children:[rt,r.jsx(Vs,{canAddSection:G,onAddSection:N,size:"sm"})]}),e[63]=G,e[64]=H,e[65]=rt,e[66]=N,e[67]=ht):ht=e[67],ze=ht;break e}le=de(U&&"cursor-grabbing"),e[48]=Ce,e[49]=G,e[50]=H,e[51]=Q,e[52]=N,e[53]=S,e[54]=x,e[55]=ie,e[56]=Ue,e[57]=_e,e[58]=le}else Ue=e[56],_e=e[57],le=e[58];nt=Jl,Z=tt,re=Yl,te=Xe,D=et,V=It,he=Xl,De=m,Me=ec,$e="space-y-1",st=Q.map(U=>{const ue=x[U.index];return ue?r.jsx(Ec,{sortableId:U.id,section:ue,raw:S[U.index],meta:E,decofile:C,selected:_===U.index,onSelect:()=>Ye(U.index),onDelete:()=>ee(U.index),onDuplicate:()=>be(U.index),onMakeReusable:()=>qe(U.index),onToggleHidden:()=>Oe(U.index),onToggleLazy:Ke?()=>Ke(U.index):void 0,onAddVariant:()=>fe(U.index),onDetach:()=>l(U.index)},U.id):null})}e[11]=Ce,e[12]=G,e[13]=H,e[14]=C,e[15]=Q,e[16]=m,e[17]=et,e[18]=E,e[19]=N,e[20]=fe,e[21]=ee,e[22]=l,e[23]=be,e[24]=qe,e[25]=P,e[26]=Oe,e[27]=Ke,e[28]=S,e[29]=x,e[30]=_,e[31]=tt,e[32]=ie,e[33]=he,e[34]=nt,e[35]=Ue,e[36]=_e,e[37]=st,e[38]=De,e[39]=Me,e[40]=Z,e[41]=re,e[42]=te,e[43]=D,e[44]=V,e[45]=le,e[46]=ze,e[47]=$e}else he=e[33],nt=e[34],Ue=e[35],_e=e[36],st=e[37],De=e[38],Me=e[39],Z=e[40],re=e[41],te=e[42],D=e[43],V=e[44],le=e[45],ze=e[46],$e=e[47];if(ze!==Symbol.for("react.early_return_sentinel"))return ze;let Je;e[68]!==st||e[69]!==$e?(Je=r.jsx("div",{className:$e,children:st}),e[68]=st,e[69]=$e,e[70]=Je):Je=e[70];let O;e[71]!==he||e[72]!==De||e[73]!==Me||e[74]!==Je?(O=r.jsx(he,{items:De,strategy:Me,children:Je}),e[71]=he,e[72]=De,e[73]=Me,e[74]=Je,e[75]=O):O=e[75];let ce;e[76]!==Ue||e[77]!==_e||e[78]!==H||e[79]!==C||e[80]!==E?(ce=_e?r.jsx("div",{className:de("cursor-grabbing shadow-lift",Ia(_e,!1,H)),children:r.jsx(Fa,{section:_e,raw:Ue,meta:E,decofile:C})}):null,e[76]=Ue,e[77]=_e,e[78]=H,e[79]=C,e[80]=E,e[81]=ce):ce=e[81];let Pe;e[82]!==ce?(Pe=ei.createPortal(r.jsx(Gl,{dropAnimation:$i,children:ce}),document.body),e[82]=ce,e[83]=Pe):Pe=e[83];let ke;e[84]!==nt||e[85]!==Z||e[86]!==re||e[87]!==te||e[88]!==D||e[89]!==V||e[90]!==O||e[91]!==Pe?(ke=r.jsxs(nt,{sensors:Z,collisionDetection:re,onDragStart:te,onDragEnd:D,onDragCancel:V,children:[O,Pe]}),e[84]=nt,e[85]=Z,e[86]=re,e[87]=te,e[88]=D,e[89]=V,e[90]=O,e[91]=Pe,e[92]=ke):ke=e[92];let ge;e[93]!==G||e[94]!==H||e[95]!==N?(ge=!H&&r.jsx(Vs,{canAddSection:G,onAddSection:N,size:"sm",className:"mt-2"}),e[93]=G,e[94]=H,e[95]=N,e[96]=ge):ge=e[96];let z;return e[97]!==le||e[98]!==ke||e[99]!==ge?(z=r.jsxs("div",{className:le,children:[ke,ge]}),e[97]=le,e[98]=ke,e[99]=ge,e[100]=z):z=e[100],z}function Cc(v){return v.id}function Pc(v,e,p,S){if(!v||typeof v!="object")return{kind:"error",reason:"no-matcher-rule"};const x=e.trim();if(!x)return Jt(v,p,S)?{kind:"inline",blockKey:v.__resolveType??"",inlinedRule:js(v,p,S)}:{kind:"noop"};const E=Es(v,p,S);if(!E)return{kind:"error",reason:"unreadable-rule"};if(E.blockKey)return{kind:"updateBlock",blockKey:E.blockKey,blockData:Mt(E.resolveType,E.data,x)};const C=qn(x),_=Gn(C,p);return _?{kind:"error",reason:"invalid-block-id",message:_}:{kind:"createBlock",blockId:C,blockData:Mt(E.resolveType,E.data,x),reference:cn(C)}}const Aa="section-form-stale-save",Bc=3;function Na(v,e,p){const S=e.global&&e.pageKey?[{label:"Default",sections:[{__resolveType:e.pageKey}]}]:Ba(e.pageKey?v[e.pageKey]?.sections:void 0,v,p),x=Math.max(0,Math.min(e.pageVariantIndex,S.length-1)),E=S[x]?.sections??[];return{pageVariants:S,variantIndex:x,rawSections:E,parsedSections:kn(E,v,p)}}const Ca=new WeakMap;let Kc=0;function Dc(v){let e=Ca.get(v);return e===void 0&&(e=++Kc,Ca.set(v,e)),e}function cf({orgSlug:v,virtualMcpId:e,branch:p,previewReady:S=!0,previewUrl:x,currentPath:E,activePageBlockKey:C=null,activeGlobalBlockKey:_=null,externalSelection:P,onSaved:k,initialEditSeo:ee=!1,onExitSeo:be,onSelectRoot:qe,onViewJsonFile:Oe,onFocusedBlockChange:Ke,onVariantPreviewOverride:fe}){const l=Rn(),N=Oi(),Ee=N?.taskId??null,G=S?{orgSlug:v,virtualMcpId:e,branch:p,threadId:Ee,previewUrl:x}:null,[ie,H]=b.useState([]),{data:f,isLoading:Q}=_l(G,{pollWhile:ie.length>0}),{data:u,isLoading:Ce}=Pl(G),$=Yn(),ft=N?.virtualMcpId,Ze=gl(ft===e?e:null)?.metadata?.siteSlug??null,xe=sc({virtualMcpId:e,branch:p,sandboxUrl:x}),Ve=kl(e,p),h=wl(Ve),Te=ji(h),tt=!h,mt=!!xe||h,[m,L]=b.useState(null),[Xe,T]=b.useState(null),[et,B]=b.useState(null),[It,he]=b.useState(0),[nt,Ue]=b.useState(void 0),[_e,st]=b.useState(null),De={index:_e,remember:st},[Me,Z]=b.useState(null),[re,te]=b.useState(null),[D,V]=b.useState([]),le=b.useRef(null),[ze,$e]=b.useState(D.length);ze!==D.length&&($e(D.length),requestAnimationFrame(()=>{le.current&&(le.current.scrollTop=0)}));const[Je,O]=b.useState(0),[ce,Pe]=b.useState(null),[ke,ge]=b.useState(null),[z,Ye]=b.useState(null),[U,ue]=b.useState(!1),[pt,rt]=b.useState(!1),ht=b.useRef(null),[jn,La]=b.useState(!0),[Yt,En]=b.useState(!1),[Lt,Vn]=b.useState(!1),[Ae,un]=b.useState(ee),[As,Ns]=b.useState(ee);ee&&!As&&(Ns(!0),un(!0),L(null),T(null),B(null),V([])),!ee&&As&&Ns(!1);const[Oa,dn]=b.useState(null),[Cs,Tn]=b.useState(void 0),[Ps,Ot]=b.useState([]),[Bs,Qt]=b.useState(0),[Fe,at]=b.useState(0),[za,Ie]=b.useState(null),[Zt,We]=b.useState(null),[Ks,Ds]=b.useState(null),Ms=ai(),Fs=Rl({orgSlug:v,virtualMcpId:e,branch:p},{tunnel:!1}),fn=Qi({orgSlug:v,virtualMcpId:e,branch:p}),[$a,Wa]=b.useState(E),[Ha,qa]=b.useState(C),[Ga,Ua]=b.useState(_);($a!==E||Ha!==C||Ga!==_)&&(queueMicrotask(()=>fn.flush()),Wa(E),qa(C),Ua(_),L(null),T(null),B(null),he(0),Z(null),te(null),at(0),Ie(null),We(null),V([]),O(t=>t+1),un(!1),dn(null),Tn(void 0),Ot([]),Qt(t=>t+1));const M=Zi({orgSlug:v,virtualMcpId:e,branch:p}),mn=ml((t,n)=>{M.mutate({blockKey:t,data:n},{onSuccess:()=>k?.(),onError:M.reportError})}),An=Ll({orgSlug:v,virtualMcpId:e,branch:p}),Is=fc({orgSlug:v,virtualMcpId:e,branch:p}),[Xt,en]=b.useState(!1),A=b.useRef(null),xt=b.useRef(null),gt=b.useRef(null),vt=b.useRef(null),Nn=b.useRef({}),zt=b.useRef(null),pn=b.useRef(!1),hn=b.useRef(!1),we=b.useRef(new Map),tn=b.useRef(!1),ot=b.useRef([]),Qn=b.useRef(new WeakSet);jl(v,e,t=>{const{activePageKey:n,rawSections:s,parsedSections:a,selectedSectionIndex:o}=ae.current,i=new Set;n&&i.add(n);for(const c of[xt.current?.sectionIndex,o]){const d=c==null?void 0:s[c],R=c==null?void 0:a[c],g=d&&R?.isSavedBlock?Ss(d,R):null;g&&i.add(g)}if([...i].some(c=>t.has(c))){for(const c of[A,gt,vt])c.current&&clearTimeout(c.current),c.current=null;xt.current=null,we.current.clear(),n&&t.has(n)&&(Nn.current={})}});const ae=b.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null}),[Ls,Os]=b.useState(0),[Ja,Ya]=b.useState(0),zs=oi(Ve,{orgSlug:v,virtualMcpId:e,branch:p}),$s=ii(zs,ie[0]?.blockKey??null,li(f,ie[0]?.blockKey??null)),[Qa,Za]=b.useState(null),Zn=El(v,e).epoch,[Xa,eo]=b.useState(Zn);ac(Ae?{orgSlug:v,virtualMcpId:e,branch:p}:null,f??void 0,u??void 0);const Ws=_??(f&&u?ba(xa(f,u),E,C)?.key??null:null),Xn=va({orgSlug:v,virtualMcpId:e,branch:p},Ws?[Ws]:[],{withRefs:!0}),[Hs,to]=b.useState(!1),es=va({orgSlug:v,virtualMcpId:e,branch:p},Hs?Bl:[]),qs={ready:!(Ve.kind==="protocol"&&Ve.hosted)||Hs&&es.ready,failed:es.failed,retry:es.retry,request:()=>to(!0)};if(Xn.failed)return r.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-3 p-6 text-center text-sm text-muted-foreground",children:[r.jsx("p",{children:l("sectionsEditor.hosted.blockLoadFailed")}),r.jsx("p",{children:l("sectionsEditor.hosted.blockLoadFailedHint")}),r.jsx(Ft,{variant:"outline",size:"sm",onClick:Xn.retry,children:l("sectionsEditor.namedRules.tryAgain")})]});if(!S||Q||Ce||!Xn.ready)return r.jsx("div",{className:"h-full w-full flex items-center justify-center",children:r.jsx(ci,{className:"size-5 text-muted-foreground"})});if(!f||!u)return r.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.couldNotLoadSiteData")});const no=xa(f,u),q=!!_,oe=q?null:ba(no,E,C),y=q?_:oe?.key??null,ts=q&&_?f[_]:void 0,Gs=q&&_&&ts?Kl(_,ts):q&&_?_:"",nn=!q&&y&&f[y]?f[y]:null,ns=Ae&&f&&u&&y&&oe?aa(f,{kind:"page",pageKey:y,pageName:String(oe.name??""),path:String(oe.path??"")},u):null,so=Ae?nn?.seo:void 0,Cn=Cs!==void 0?Cs:so,ro=Ae?Xi(Cn):void 0,Us=ns?.seoTypeOptions??[],Js=Ae&&u?el(u):"",ss=Oa??ro??{},Pn=Ae&&ns?oc(ss,ns):null,Ys=Ae&&Pn&&tl(Cn)?Hn(Pn,u):null,Qs=Ae?nl(f,u)?.seoData:void 0,ve=q?[{label:"Default",sections:[{__resolveType:_}]}]:Ba(nn?.sections,f??{},h),yt=ve.length>1,ne=Math.min(It,ve.length-1),Re=ve[ne],F=Re?.sections??[],ye=kn(F,f,h),Bn=!q&&mc(nn?.sections,h);if(q&&_&&Ks!==_){Ds(_);const t=F[0],n=ye[0];if(t&&n){L(0),at(0),V([]);const s=kt(t,n,f,h);s&&(T(s.data),B(s.resolveType),We(null),Ie(null))}}!q&&Ks!==null&&Ds(null),ae.current={rawSections:F,parsedSections:ye,decofile:f??{},activePageKey:y,pageVariants:ve,variantIndex:ne,sectionVariantIndex:Fe,selectedSectionIndex:m};const ao=()=>({multivariate:Bn,index:ne,variants:ve.map(t=>({rule:t.rule})),lazyValues:h&&Bn&&Vi(nn?.sections?.variants?.[ne]?.value)}),rs=(t,n)=>{if(!fe)return;if(!y||!Bn||t.length<=1){fe(null);return}const s={multivariate:!0,index:n,variants:t},a=h?ya(y,s):Va(y,s,f,u);fe(a.length>0?a:null)},as=fe&&y&&Bn&&yt&&!Q&&!Ce?y:null;if(as!==Qa&&(Za(as),as)){const t=ve.map(s=>({rule:s.rule})),n=ne;queueMicrotask(()=>rs(t,n))}const $t=(t,n,s)=>{if(!fe)return;if(!y){fe(null);return}const a=ao(),o=h?ya(y,a):Va(y,a,f,u);if(!t||n<0){fe(o.length>0?o:null);return}const i={pageKey:y,page:a,sectionIndex:n,sectionLazy:ye[n]?.isLazy??!1,mvObj:t,selectedVariantIndex:s},c=h?Tl(i):yc({...i,decofile:f,meta:u}),d=h?Al(o,c):[...o,...c];fe(d.length>0?d:null)},bt=(t,n,s,a=m??-1,o=!1)=>{const i=dt(t,n);if(!i){T(null),B(null),We(null),Ie(null),o&&$t(null,a,s);return}const d=Jr(i,Te)[s];if(!d){T(null),B(null),We(null),Ie(null),o&&$t(null,a,s);return}const R=mi(d.value,f);T(R?.data??null),B(R?.resolveType??null);const{resolveType:g,formValue:w}=Ut(d.rule,f,u??void 0);We(g),Ie(w),o&&$t(i,a,s)},os=t=>{ge(null),he(t),L(null),T(null),B(null),V([]);const n=ve[t]?.rule,{resolveType:s,formValue:a}=Ut(n,f??{},u??void 0);te(s),Z(a),rs(ve.map(o=>({rule:o.rule})),t)},oo=(t,n)=>{const s=F[t],a=ye[t];if(!s||!a)return!1;const o=a.isMultivariate?dt(s,a)?.variants?.length??0:0,i=n<o?n:0;if(L(t),at(i),V([]),O(c=>c+1),a.isMultivariate)bt(s,a,i,t);else{const c=kt(s,a,f,h);c?(T(c.data),B(c.resolveType)):(T(null),B(null)),We(null),Ie(null)}return!0},Zs=P?.index;if(P!==void 0&&(P?.seq??null)!==nt&&(Ue(P?.seq??null),typeof Zs=="number"&&oo(Zs,0)),Zn!==Xa){eo(Zn);const t=A.current!==null||we.current.size>0||vt.current!==null||gt.current!==null||M.isPending||fn.isPending||ie.length>0,n=m!==null&&Ur(le.current,document.activeElement);if(!t&&n&&(tn.current=!0),!t&&!n&&m!==null){const s=F[m],a=ye[m];if(V([]),O(o=>o+1),!s||!a)L(null),T(null),B(null);else if(a.isMultivariate)bt(s,a,Fe,m);else{const o=kt(s,a,f,h);T(o?.data??null),B(o?.resolveType??null)}}!t&&Ae&&(dn(null),Tn(void 0),Qt(s=>s+1))}if(Ls!==Ja){Ya(Ls);const t=m!==null?F[m]:null,n=m!==null?ye[m]:null;if(t&&n&&m!==null)if(V([]),O(s=>s+1),n.isMultivariate)bt(t,n,Fe,m);else{const s=kt(t,n,f,h);T(s?.data??null),B(s?.resolveType??null)}}const it=ie[0];if(it){const{formBase:t,target:n}=it,s=Na(f,n,h),a=t.sectionIndex,o=s.rawSections.length===t.sectionCount?vs(s.rawSections[a],s.parsedSections[a],n.sectionVariantIndex,f,h):null,i=ui(it,o,c=>Yr(t,c));if(i){const d=[{...it,...i,changedAgain:!0},...ie.slice(1)];ot.current=d,H(d)}}const gn={orgSlug:v,virtualMcpId:e,branch:p,threadId:Ee,previewUrl:h?void 0:x??void 0,siteSlug:Ze},Kn=et&&u?Hn(et,u):null,lt=(t,n)=>{if(!y)return;A.current&&(clearTimeout(A.current),A.current=null),we.current.clear(),vt.current&&(clearTimeout(vt.current),vt.current=null),gt.current&&(clearTimeout(gt.current),gt.current=null);const s=on(f,y,t,ne,ve);M.mutate({blockKey:y,data:s},{onSuccess:()=>n?.onSuccess?.()??k?.(),onError:a=>{n?.onError?.(),M.reportError(a)}})},Wt=()=>{Ke?.(null),L(null),Vn(!1),T(null),B(null),at(0),Ie(null),We(null),V([]),O(t=>t+1)},Xs=()=>Ur(le.current,document.activeElement),is=(t=l("sectionsEditor.sectionsEditor.blockChangedElsewhere"))=>{if(A.current&&(clearTimeout(A.current),A.current=null),we.current.clear(),xt.current=null,W.error(t,{id:Aa}),Xs()){tn.current=!0;return}Os(n=>n+1)},er=()=>{!tn.current||Xs()||ot.current.length>0||A.current!==null||pn.current||hn.current||we.current.size>0||(tn.current=!1,Os(t=>t+1))},tr=()=>{tn.current&&setTimeout(er,0)},nr=Ve.kind==="protocol"&&Ve.source==="github",sr=t=>Cl(Ms,Fs,t,Ve.kind==="protocol"?Ve:null),rr=t=>{we.current.size!==0&&setTimeout(()=>{if(pn.current||hn.current)return;const n=[...we.current.values()];we.current.clear();for(const s of n)s()},t)},io=t=>{const{activePageKey:n,variantIndex:s,sectionVariantIndex:a}=ae.current,o=zt.current;return{formBase:o?.sectionIndex===t&&o.variantIndex===a?o:null,pageKey:n,global:q,pageVariantIndex:s,sectionVariantIndex:a,schema:Kn}},vn=t=>{ot.current=t,H(t)},lo=t=>{const n=ot.current,s=n.findIndex(i=>i.formBase===t.formBase),a=s>=0?n[s]:void 0,o=a?n.with(s,{...t,choices:ta(a.plan,a.choices,t.plan),fresh:Mi(a.plan,t.plan,a.fresh),changedAgain:a.changedAgain||zn(a.plan.theirs)!==zn(t.plan.theirs)}):[...n,{...t,changedAgain:Qn.current.has(t.formBase)}];vn(o)},ar=(t,n)=>{const s=ot.current,a=s.findIndex(c=>c.formBase===t),o=s[a];if(!o)return!1;if(zn(o.plan.mine)===zn(n))return!0;const i=ea({...o.plan,mine:n});if(i.pointers.length===0){const c=s.filter(d=>d!==o);return vn(c),!1}return vn(s.with(a,{...o,plan:i,choices:ta(o.plan,o.choices,i)})),!0},co=t=>{const n=ae.current;return n.selectedSectionIndex===t.formBase.sectionIndex&&n.activePageKey===t.target.pageKey&&n.variantIndex===t.target.pageVariantIndex&&n.sectionVariantIndex===t.target.sectionVariantIndex},uo=()=>{const t=ot.current[0];if(!t)return null;const{formBase:n,target:s}=t;A.current&&xt.current?.sectionIndex===n.sectionIndex&&xt.current.sectionVariantIndex===s.sectionVariantIndex&&(clearTimeout(A.current),A.current=null,xt.current=null),we.current.delete(`${s.pageKey}:${n.sectionIndex}:${s.sectionVariantIndex}`);const a=n.emitted;return a&&typeof a=="object"&&!ar(n,a)&&yn(a,n.sectionIndex,0,s),ot.current[0]??null},fo=()=>{const t=ot.current[0],n=uo();if(!n||!t||n.formBase!==t.formBase||n.plan.pointers.some(i=>!t.plan.pointers.includes(i)))return;const s=ki(n.plan,n.choices);Ve.kind==="protocol"&&Ve.source==="github"&&wi(n.plan,n.choices)&&Vl(l,!1),vn(ot.current.slice(1));const{formBase:a,target:o}=n;a.base=n.plan.theirs,a.version=void 0,a.emitted=s,Qn.current.add(a),(zt.current===a||co(n))&&(zt.current=a,T(s),O(i=>i+1)),yn(s,a.sectionIndex,0,o)},mo=t=>{const[n,...s]=ot.current;n&&vn([{...n,choices:t},...s])},yn=(t,n,s=0,a,o=!1)=>{const i=a??io(n),c=i.sectionVariantIndex,d=i.formBase,R=o||Xr(ot.current,d,i,n,h).runNow,g=xt.current;A.current&&(clearTimeout(A.current),A.current=null,g&&(g.sectionIndex!==n||g.sectionVariantIndex!==c)&&g.write());const w=`${i.pageKey}:${n}:${c}`,j=()=>{if(pn.current||hn.current){we.current.set(w,j);return}const K=typeof t=="function"?t():t,I=Xr(ot.current,d,i,n,h).base;if(I&&ar(I,K))return;const se=ae.current.decofile,{rawSections:J,parsedSections:Be,pageVariants:Y,variantIndex:je}=Na(se,i,h),Le=i.pageKey,Se=J[n];if(!Se)return;const me=Be[n];if(!me)return;const He=d?.base,Qe=vs(Se,me,c,se,h),At=!!He&&!!Qe&&Ti(He,Qe)&&!(d&&Yr(d,Qe));if(At&&He&&Qe){if(Ai(He,Qe)){is(l("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}const X=me.isSavedBlock?"here":Ni(He,J.map((pe,ut)=>vs(pe,Be[ut],c,se,h)),n,d?.sectionCount??J.length);if(X==="unknown"){is(l("sectionsEditor.sectionsEditor.sectionReplacedElsewhere"));return}if(typeof X=="number"&&d){d.sectionCount=J.length,d.sectionIndex=X,zt.current===d&&L(X),yn(K,X,s,i);return}}const Nt=At&&He&&Qe?ea({ancestor:He,mine:K,theirs:Qe}):null;if(Nt&&Nt.pointers.length>0&&d){d.sectionCount=J.length,lo({plan:Nt,formBase:d,target:i,sectionIndex:n,choices:Ci(Nt),changedAgain:!1,blockKey:me.isSavedBlock?Ss(Se,me):Le,fresh:{}});return}const Ct=Nt?Nt.merged:null,rn=Ct??K,Hr=Pi({merged:!!Ct,tracked:d,current:zt.current,saved:K});Ct&&W.info(l("sectionsEditor.sectionsEditor.blockMergedWithOthers"),{id:Aa}),Hr&&d&&(d.emitted=Ct,T(Ct));const gs=Hr||!Ct?rn:K;d&&(d.base=gs,d.sectionCount=J.length,Bi(d,gs));const qr={onSuccess:()=>{d&&Qn.current.delete(d),k?.()},onError:X=>{if(d?.base===gs&&He&&(d.base=He),X instanceof Nl){if(d&&(d.version=void 0),s<Bc){we.current.delete(w),hn.current=!0;const pe=Fi(s,X.carriedStored);setTimeout(()=>{hn.current=!1,yn(()=>{const ut=d?.emitted;return ut&&typeof ut=="object"?ut:K},n,s+1,i,pe.immediate),we.current.delete(w),rr(xn(h))},pe.delay)}else is();return}M.reportError(X)}},Gr=X=>{pn.current=!0;let pe=!1;M.mutateAsync(X).then(()=>qr.onSuccess(),ut=>{pe=!0,qr.onError(ut)}).finally(()=>{pn.current=!1,rr(pe?xn(h):0),er()})};if(me.isSavedBlock){const X=Ss(Se,me);if(!X)return;Gr({blockKey:X,data:rn,...He?{base:{value:Ki({startedFrom:He,stored:Qe,rebased:!!Ct,refused:s>0})}}:{},rebaseOnConflict:!1,guard:na({formBase:d,rebased:!!Ct,versionOf:sr,...nr?{copy:{value:se[X]}}:{}})});return}if(!Le)return;const On={...se[Le]},Gt=[...J];if(me.isMultivariate){const X=dt(Se,me);if(!X||!Le)return;const pe=Di(X,c,rn);Gt[n]=Pt(Se,me,pe)}else if(me.isHidden){const X=Ts(Se.__resolveType),pe=X?{...Se.section}:{...Se},ut=Array.isArray(pe.variants)?[...pe.variants]:[];ut[0]&&(ut[0]=sa(pe.__resolveType,ut[0],rn)),pe.variants=ut,X?Gt[n]={...Se,section:pe}:Gt[n]=pe}else me.isLazy?Gt[n]={...Se,section:rn}:Gt[n]=rn;if(Y.length>1){const X=On.sections,pe=[...X?.variants??[]];pe[je]&&(pe[je]=sa(X?.__resolveType,pe[je],Gt)),On.sections={...X,variants:pe}}else On.sections=Gt;Gr({blockKey:Le,data:On,rebaseOnConflict:!1,guard:na({formBase:null,rebased:!1,versionOf:sr,...nr?{copy:{value:se[Le]}}:{}})})};if(xt.current={sectionIndex:n,sectionVariantIndex:c,write:j},R){xt.current=null,j();return}A.current=setTimeout(()=>{A.current=null,j()},xn(h))},po=t=>{tn.current=!1,L(t),at(0),V([]),O(o=>o+1);const n=F[t],s=ye[t];if(Ke?.(s?.isSavedBlock?s.resolveType??null:null),!n||!s)return;if(s.isMultivariate){bt(n,s,0,t);return}const a=kt(n,s,f,h);if(!a){T(null),B(null),We(null),Ie(null),$t(null,t,0);return}T(a.data),B(a.resolveType),We(null),Ie(null),$t(null,t,0)},or=t=>{const n=t;m!==null&&(zt.current=Ri(zt.current,{sectionIndex:m,variantIndex:ae.current.sectionVariantIndex,shown:Xe,next:n,sectionCount:ae.current.rawSections.length})),T(n),m!==null&&yn(n,m)},ls=t=>{if(!y||!f||!u||!oe)return;const n={kind:"page",pageKey:y,pageName:String(oe.name??""),path:String(oe.path??"")},s=aa(f,n,u);s&&fn.save(y,()=>{const a=Ms.getQueryData(Ei.decofile(Fs))?.[y];if(!a||typeof a!="object"||a===null||Array.isArray(a))return null;const o={...a,...Nn.current};return Nn.current={},t?.raw!==void 0?ic(o,t.raw,u):t?.inner!==void 0?lc(n,s,o,t.inner):o})},ir=(t,n)=>{y&&(Nn.current[t]=n,ls())},ho=(t,n)=>{if(!y)return;const s=Un([...F],t,n);m!==null&&(m===t?L(n):t<m&&n>=m?L(m-1):t>m&&n<=m&&L(m+1)),lt(s)},go=t=>{if(!y)return;const n=F.filter((s,a)=>a!==t);m===t?Wt():m!==null&&m>t&&L(m-1),lt(n)},vo=t=>{if(!y)return;const n=F[t];if(!n)return;const s=[...F];s.splice(t+1,0,pl(n)),m!==null&&m>t&&L(m+1),lt(s)},yo=t=>{if(!y)return;const n=F[t],s=ye[t];if(!n||!s)return;const a=s.isHidden?bi(n,h):xi(n,u);if(!a)return;const o=[...F];o[t]=a,m===t&&Wt(),lt(o)},So=t=>{if(!y)return;const n=F[t],s=ye[t];if(!n||!s||s.isMultivariate)return;const a=Si(n);if(!a)return;const o=[...F];o[t]=a,m===t&&Wt(),lt(o)},bo=t=>{if(!y)return;const n=F[t],s=ye[t];if(!n||!s?.isSavedBlock)return;const a=kt(n,s,f,h);if(!a?.data)return;const{name:o,...i}=a.data,c=[...F];s.isLazy?c[t]={...n,section:i}:c[t]=i,m===t&&Wt(),lt(c)},xo=t=>{if(!y)return;const n=[...F,{__resolveType:t.resolveType}],s=n.length-1;lt(n,{onError:()=>{ae.current.selectedSectionIndex===s&&Wt()}}),ue(!1),L(s),at(0),V([]),O(c=>c+1);const a=n[s],o=kn(n,f,h)[s];if(!a||!o)return;if(o.isMultivariate){bt(a,o,0);return}const i=kt(a,o,f,h);if(!i){T(null),B(null),We(null),Ie(null);return}T(i.data),B(i.resolveType),We(null),Ie(null)},lr=t=>{ht.current=t.append,ue(!0)},_o=t=>{const n=ht.current;if(!n){xo(t);return}n({__resolveType:t.resolveType}),ue(!1),ht.current=null},cr=t=>{if(m===null)return;const n=F[m],s=ye[m];!n||!s?.isMultivariate||(at(t),V([]),O(a=>a+1),bt(n,s,t,m,!0))},ko=t=>{if(m===null||!y)return;const n=F[m],s=ye[m];if(!n||!s?.isMultivariate)return;const a=dt(n,s);if(!a)return;const o=vi(a,t);if(!o){W.error(l("sectionsEditor.sectionsEditor.cannotDeleteOnlyVariant"));return}const i=[...F];i[m]=Pt(n,s,o);const c=o.variants;let d=Fe;t===Fe?d=Math.min(t,c.length-1):t<Fe&&(d=Fe-1),at(d),V([]),O(R=>R+1),bt(i[m],s,d),lt(i)},wo=t=>{if(m===null||!y)return;const n=F[m],s=ye[m];if(!n||!s?.isMultivariate)return;const a=dt(n,s);if(!a)return;const o=yi(a,t,h),i=[...F];i[m]=Pt(n,s,o);const c=Zr(a.variants??[],t,h);at(c),V([]),O(d=>d+1),bt(i[m],s,c,m,h),lt(i)},Ro=(t,n)=>{if(m===null||!y||t===n)return;const s=F[m],a=ye[m];if(!s||!a?.isMultivariate)return;const o=dt(s,a);if(!o)return;const i=hi(o,t,n),c=[...F];c[m]=Pt(s,a,i);let d=Fe;Fe===t?d=n:t<Fe&&n>=Fe?d=Fe-1:t>Fe&&n<=Fe&&(d=Fe+1),at(d),bt(c[m],a,d,m,h),lt(c)},Sn=t=>{const n=t??m;if(n===null||!y)return;const s=F[n],a=ye[n];if(!s||!a)return;const o=pi(s,a,void 0,u,h);if(!o){W.error(l("sectionsEditor.sectionsEditor.sectionCannotHaveVariants"));return}const i=[...F];i[n]=o.section;const c=kn(i,f,h)[n];if(!c?.isMultivariate){W.error(l("sectionsEditor.sectionsEditor.couldNotAddVariant"));return}L(n),at(o.newVariantIndex),V([]),O(d=>d+1),bt(o.section,c,o.newVariantIndex,n,h),lt(i)},ur=()=>{if(m===null||!y)return;const t=F[m],n=ye[m];if(!t||!n?.isMultivariate)return;const s=dt(t,n);if(!s)return;const a=gi(t,n,s);if(!a){W.error(l("sectionsEditor.sectionsEditor.couldNotRemoveVariants"));return}const o=[...F];o[m]=a;const i=kn(o,f,h)[m];if(!i)return;at(0),We(null),Ie(null),V([]),O(d=>d+1);const c=kt(a,i,f,h);c?(T(c.data),B(c.resolveType)):(T(null),B(null)),$t(null,m,0),lt(o)},jo=async t=>{if(ce===null||!y)return;const n=Gn(t,f,u);if(n){W.error(n);return}const s=F[ce],a=ye[ce];if(!s||!a)return;const o=kt(s,a,f,h);if(!o){W.error(l("sectionsEditor.sectionsEditor.sectionCannotBeSavedAsGlobal"));return}const i={...o.data,name:t};try{const c=await M.mutateAsync({blockKey:t,data:i,create:!0}),d=[...F];d[ce]={__resolveType:t},await M.mutateAsync({blockKey:y,data:on(f,y,d,ne,ve)}),m===ce&&Wt(),Pe(null),Wn(c)||W.success(l("sectionsEditor.sectionsEditor.savedGlobalBlock",{blockId:t})),k?.()}catch(c){W.error(l("sectionsEditor.sectionsEditor.failedToSaveGlobalBlock"),{description:Bt(l,Kt(c))})}},dr=Re?.rule;if(yt&&m===null&&re===null&&dr){const{resolveType:t,formValue:n}=Ut(dr,f??{},u??void 0);te(t),Z(n)}const sn=u?sl(u):[],cs=u&&f?rl(u,f):[],Ht=h&&u&&f?cc(u,f):[],us=(t,n)=>{if(Ht.length===0)return;const s=Dl(t);return{kinds:Ht,selected:s,campaignPrefill:uc(t),onPick:n,load:qs}},fr=!q&&!!(mt&&u&&f),mr=re&&u?Hn(re,u):null,St=()=>{gt.current&&(clearTimeout(gt.current),gt.current=null),vt.current&&(clearTimeout(vt.current),vt.current=null)},qt=async(t,n)=>{if(gc(n,t,u,h))try{await An.mutateAsync({blockKey:t})}catch(s){W.error(l("sectionsEditor.sectionsEditor.couldNotDeleteMatcherBlock"),{description:Bt(l,Kt(s))})}},pr=t=>{gt.current&&clearTimeout(gt.current),gt.current=setTimeout(()=>{const{activePageKey:n,decofile:s,variantIndex:a}=ae.current;if(!n)return;const o={...s[n]},i={...o.sections},c=[...i.variants??[]],d=c[a],R=d?.rule;if(Jt(R,s,u)){const g=R?.__resolveType??"",w=s[g],j=typeof w?.name=="string"?w.name:g,{__resolveType:K,...I}=t;M.mutate({blockKey:g,data:Mt(K??"",I,j)},{onSuccess:()=>k?.(),onError:M.reportError});return}d&&(c[a]={...d,rule:t}),o.sections={...i,variants:c},M.mutate({blockKey:n,data:o},{onSuccess:()=>k?.(),onError:M.reportError})},xn(h))},hr=t=>{te(t);const n=t?Ea(t,u):{__resolveType:Qr(u)};Z(t?n:{}),pr(n)},gr=t=>{const n=t;Z(n);const s=re?{__resolveType:re,...n}:{...n};pr(s)},Dn=async(t,n,s)=>{const a=dc(n,t);if(!a.ok)return a.reason==="conflict"&&W.info(t.kind==="experiments"?l("sectionsEditor.namedRulePicker.conflictTests"):l("sectionsEditor.namedRulePicker.conflictCampaigns"),Sa),null;const o={};if(s){const i=s(a.rule);if(!i)return null;o[i.blockKey]=i.data}return a.blockWrite&&(o[a.blockWrite.blockKey]=a.blockWrite.block),Object.keys(o).length>0&&!(await Is.apply({writes:o})).ok?null:(a.blockWrite&&W.success(t.kind==="experiments"?l("sectionsEditor.namedRulePicker.createdTest",{name:t.name.trim()}):l("sectionsEditor.namedRulePicker.createdCampaign",{name:t.name.trim()}),{...Sa,description:l("sectionsEditor.namedRulePicker.createdHint")}),{rule:a.rule,projected:{...n,...o}})},vr=Ht.length>0?{kinds:Ht,load:qs,prepare:async t=>(await Dn(t,ae.current.decofile,void 0))?.rule??null,ensureBlock:async t=>{const n=Ml(ae.current.decofile,t);return n.kind==="saved"?!0:n.kind==="conflict"?!1:(await Is.apply({writes:{[Fl(t).blockKey]:n.block}})).ok}}:null,yr=async t=>{St();const{activePageKey:n,decofile:s,variantIndex:a}=ae.current;if(!n)return;const o=await Dn(t,s,d=>{const R=s[n],g=R?.sections;if(!g||typeof g!="object"||Array.isArray(g))return null;const w=g;if(!Array.isArray(w.variants))return null;const j=[...w.variants],K=j[a];return K?(j[a]={...K,rule:d},{blockKey:n,data:{...R,sections:{...w,variants:j}}}):null});if(!o)return;const{resolveType:i,formValue:c}=Ut(o.rule,o.projected,u??void 0);te(i),Z(c),k?.()},Sr=async t=>{St();const{activePageKey:n,decofile:s,variantIndex:a}=ae.current;if(!n)return;const o=s[n],i=o?.sections;if(!i||typeof i!="object"||Array.isArray(i))return;const c=i;if(!Array.isArray(c.variants))return;const d=[...c.variants],R=d[a];if(!R)return;const g=Dt(R.rule,s,u),w=cn(t);d[a]={...R,rule:w};const j={...s,[n]:{...o,sections:{...c,variants:d}}},{resolveType:K,formValue:I}=Ut(w,j,u??void 0);te(K),Z(I);try{await M.mutateAsync({blockKey:n,data:j[n]}),g&&g!==t&&await qt(g,j),k?.()}catch(se){W.error(l("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Bt(l,Kt(se))})}},br=t=>{vt.current&&clearTimeout(vt.current);const{selectedSectionIndex:n,sectionVariantIndex:s}=ae.current;n!==null&&(vt.current=setTimeout(()=>{const{rawSections:a,parsedSections:o,decofile:i,activePageKey:c,pageVariants:d,variantIndex:R}=ae.current;if(!c)return;const g=a[n],w=o[n];if(!g||!w?.isMultivariate)return;const j=dt(g,w);if(!j)return;const I=(j.variants??[])[s]?.rule;if(Jt(I,i,u)){const Y=I?.__resolveType??"",je=i[Y],Le=typeof je?.name=="string"?je.name:Y,{__resolveType:Se,...me}=t;M.mutate({blockKey:Y,data:Mt(Se??"",me,Le)},{onSuccess:()=>k?.(),onError:M.reportError});return}const se=ys(j,s,t),J=[...a];J[n]=Pt(g,w,se);const Be=on(i,c,J,R,d);M.mutate({blockKey:c,data:Be},{onSuccess:()=>k?.(),onError:M.reportError})},xn(h)))},Eo=t=>{We(t);const n=t?Ea(t,u):{__resolveType:Qr(u)};Ie(t?n:{}),br(n)},Vo=t=>{const n=t;Ie(n);const s=Zt?{__resolveType:Zt,...n}:{...n};br(s)},To=async t=>{St();const{selectedSectionIndex:n,sectionVariantIndex:s,rawSections:a,parsedSections:o,decofile:i,activePageKey:c,pageVariants:d,variantIndex:R}=ae.current;if(n===null||!c)return;const g=await Dn(t,i,K=>{const I=a[n],se=o[n];if(!I||!se?.isMultivariate)return null;const J=dt(I,se);if(!J)return null;const Be=[...a];return Be[n]=Pt(I,se,ys(J,s,K)),{blockKey:c,data:on(i,c,Be,R,d)}});if(!g)return;const{resolveType:w,formValue:j}=Ut(g.rule,g.projected,u??void 0);We(w),Ie(j),k?.()},Ao=async t=>{St();const{selectedSectionIndex:n,sectionVariantIndex:s,rawSections:a,parsedSections:o,decofile:i,activePageKey:c,pageVariants:d,variantIndex:R}=ae.current;if(n===null||!c)return;const g=a[n],w=o[n];if(!g||!w?.isMultivariate)return;const j=dt(g,w);if(!j)return;const K=j.variants??[],I=Dt(K[s]?.rule,i,u),se=cn(t),J=ys(j,s,se),Be=[...a];Be[n]=Pt(g,w,J);const Y=on(i,c,Be,R,d),je={...i,[c]:Y},{resolveType:Le,formValue:Se}=Ut(se,je,u??void 0);We(Le),Ie(Se);try{await M.mutateAsync({blockKey:c,data:Y}),I&&I!==t&&await qt(I,je),k?.()}catch(me){W.error(l("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Bt(l,Kt(me))})}};if(!q&&!oe)return r.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.noPageFound",{currentPath:E})});if(q&&!ts)return r.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:l("sectionsEditor.sectionsEditor.globalBlockNotFound")});const Ne=m!==null?ye[m]??null:null,xr=m!==null?F[m]:null,_r=xr&&Ne?.isMultivariate?dt(xr,Ne):null,Et=_r?Jr(_r,Te,h):[],Mn=Math.min(Fe,Math.max(Et.length-1,0)),_t=Et[Mn]??null,Vt=Ne?.isMultivariate===!0,ds=m!==null&&Ne!==null,Tt=ds&&(Vt||!!(Kn&&Xe)),No=Tt&&!q&&Ne?.isSavedBlock===!0,ct=q||No,kr=q?Gs:Ne?.label??"",Co=Zt&&u?Hn(Zt,u):null,wr=(t,n)=>n&&$?`${t} · ${n}`:t,Rr=Ne?Ne.variantOf??Ne.label:"",Po=(()=>{const t=Vt&&_t?_t.label:null;return t?$?[wr(Rr,t)]:[Ne.label,t]:[Ne?.label??""]})(),fs=wr(oe?.name??"",yt?Re?.label:null),Fn=Tt&&(!q||D.length>0)?q?[Gs,...D]:[fs,...Po,...D]:[],jr=Ae&&oe?[oe.name,"SEO",...Ps]:[],Er=l("sectionsEditor.pageVariantTabs.variantsLabel"),Vr=Yt&&oe?[oe.name,Er]:Lt&&oe&&Ne?[fs,Rr,Er]:[],In=Vr.length>0?Vr:jr.length>0?jr:ct?Fn.length>0?Fn:[kr]:Fn.length>0?Fn:[fs],Tr=ds&&!Vt&&!Ne?.isHidden&&!!y,Bo=ct||!q&&yt&&!!Re||Tr,Ko=ds&&!Vt&&!q&&D.length===0&&!!Ne&&Pa(Ne)&&!!y,Do=$&&Tt&&!Lt&&Vt&&D.length===0&&!!_t,Ar=$&&D.length>0?oa(D[D.length-1]):null,Mo=D.length>1?oa(D[D.length-2]):null,Nr=ct?kr:Tt?Ne?.label??"":oe?.name??"",Fo=Yt||Lt?l("sectionsEditor.pageVariantTabs.variantsLabel"):Ae?l("sectionsEditor.panelSections.seo"):Ar??Nr,Cr=Lt?Ne?.variantOf??Ne?.label??"":Yt||Ae?oe?.name??"":Ar?Mo??Nr:ct?l("sectionsEditor.sectionsEditor.globalSectionSubtitle"):Tt?oe?.name??"":oe?.path??"",ms=!Yt&&!Lt&&!Ae&&!Tt&&!ct,Io=!$&&!Ae&&!q&&Vt&&D.length===0,bn=()=>{if(!y)return;St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const t=f[y],n=pc(t.sections,F,u,h);if(!n)return;const{sections:s,newVariantIndex:a}=n;M.mutate({blockKey:y,data:{...t,sections:s}},{onSuccess:()=>{he(a),L(null),T(null),B(null),V([]),Z(null),te(null)},onError:M.reportError})},Ln=(t,n,s)=>{if(!y)return;St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const a=f[y],o=a.sections;if(!o||typeof o!="object"||Array.isArray(o))return;const i=o;if(!Array.isArray(i.variants))return;const c=t([...i.variants]);if(!c)return;const d=hc(i,c),R={...f,[y]:{...a,sections:d}};M.mutate({blockKey:y,data:R[y]},{onSuccess:()=>{n?.();const g=typeof s=="string"?[s]:s??[];(async()=>{for(const w of g)await qt(w,R)})()},onError:M.reportError})},Pr=(t,n)=>{if(t===n)return;let s=ne;ne===t?s=n:t<ne&&n>=ne?s=ne-1:t>ne&&n<=ne&&(s=ne+1),he(s);const a=Un(ve.map(o=>({rule:o.rule})),t,n);rs(a,s),Ln(o=>Un(o,t,n))},Br=t=>{const n=ve[t]?.rule,s=Dt(n,f??{},u??void 0);Ln(a=>a.length<=1?null:(a.splice(t,1),a),()=>{ve.length-1===1?he(0):t<ne?he(ne-1):t===ne&&he(Math.max(0,t-1)),L(null),T(null),B(null),V([]),Z(null),te(null)},s)},Lo=()=>{const t=ve.map((n,s)=>({variant:n,index:s})).filter(({variant:n})=>!_i(n.rule)).map(({variant:n})=>Dt(n.rule,f??{},u??void 0)).filter(n=>!!n);Ln(n=>{const s=Ii({variants:n}),a=n[s];return a?[{...a,rule:Li(u)}]:null},()=>{he(0),L(null),T(null),B(null),V([]),Z(null),te(null),En(!1)},t)},Kr=t=>{let n=t+1;Ln(s=>(n=Zr(s,t,h),vc(s,t,h)),()=>{he(n),L(null),T(null),B(null),V([]),Z(null),te(null)})},Oo=async(t,n)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const s=ae.current.activePageKey,a=ae.current.decofile;if(!s)return;const o=a[s],i=o.sections;if(!i||typeof i!="object"||Array.isArray(i))return;const c=i;if(!Array.isArray(c.variants))return;const d=[...c.variants],R=d[t];if(!R?.rule||typeof R.rule!="object"){W.error(l("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const g=R.rule,w=n.trim();en(!0);try{if(!w){if(!Jt(g,a,u)){ge(null);return}const Y=g.__resolveType??"";d[t]={...R,rule:js(g,a,u)};const je={...a,[s]:{...o,sections:{...c,variants:d}}};await M.mutateAsync({blockKey:s,data:je[s]}),await qt(Y,je),ge(null),k?.();return}const j=Es(g,a,u);if(!j){W.error(l("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(j.blockKey){await M.mutateAsync({blockKey:j.blockKey,data:Mt(j.resolveType,j.data,w)}),ge(null),k?.();return}const K=qn(w),I=Gn(K,a,u);if(I){W.error(I);return}const se=Mt(j.resolveType,j.data,w);let J=null,Be=!1;try{const Y=await M.mutateAsync({blockKey:K,data:se,create:!0});Be=Wn(Y),J=Be?null:K,d[t]={...R,rule:cn(K)},await M.mutateAsync({blockKey:s,data:{...o,sections:{...c,variants:d}}}),J=null}catch(Y){throw J&&await An.mutateAsync({blockKey:J}).catch(()=>{}),Y}ge(null),Be||W.success(l("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:w})),k?.()}catch(j){W.error(l("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Bt(l,Kt(j))})}finally{en(!1)}},zo=async(t,n)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const{selectedSectionIndex:s,rawSections:a,parsedSections:o,decofile:i,activePageKey:c,pageVariants:d,variantIndex:R}=ae.current;if(s===null||!c)return;const g=a[s],w=o[s];if(!g||!w?.isMultivariate)return;const j=dt(g,w);if(!j)return;const K=j.variants??[],I=K[t];if(!I?.rule||typeof I.rule!="object"){W.error(l("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"));return}const se=I.rule,J=n.trim();en(!0);const Be=async Y=>{const je={...j,variants:Y},Le=[...a];Le[s]=Pt(g,w,je);const Se=on(i,c,Le,R,d);return await M.mutateAsync({blockKey:c,data:Se}),{...i,[c]:Se}};try{if(!J){if(!Jt(se,i,u)){Ye(null);return}const Qe=se.__resolveType??"",At=[...K];At[t]={...I,rule:js(se,i,u)};const Nt=await Be(At);await qt(Qe,Nt),Ye(null),k?.();return}const Y=Es(se,i,u);if(!Y){W.error(l("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"));return}if(Y.blockKey){await M.mutateAsync({blockKey:Y.blockKey,data:Mt(Y.resolveType,Y.data,J)}),Ye(null),k?.();return}const je=qn(J),Le=Gn(je,i,u);if(Le){W.error(Le);return}const Se=Mt(Y.resolveType,Y.data,J);let me=null,He=!1;try{const Qe=await M.mutateAsync({blockKey:je,data:Se,create:!0});He=Wn(Qe),me=He?null:je;const At=[...K];At[t]={...I,rule:cn(je)},await Be(At),me=null}catch(Qe){throw me&&await An.mutateAsync({blockKey:me}).catch(()=>{}),Qe}Ye(null),He||W.success(l("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:J})),k?.()}catch(Y){W.error(l("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Bt(l,Kt(Y))})}finally{en(!1)}},Dr=async(t,n,s)=>{T(s);try{await M.mutateAsync({blockKey:t,data:s})}catch(a){throw T(o=>o===s?n:o),a}},$o={rename:async(t,n,s)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const{activePageKey:a,decofile:o}=ae.current;if(!a)return;const i=Array.isArray(t.variants)?[...t.variants]:[],c=i[n],d=c?.rule&&typeof c.rule=="object"?c.rule:void 0,R=async w=>{const j={...t,variants:w};return await Dr(a,t,j),{...o,[a]:j}},g=Pc(d,s,o,u);if(g.kind!=="noop"){if(g.kind==="error"){W.error(g.reason==="no-matcher-rule"?l("sectionsEditor.sectionsEditor.variantHasNoMatcherRule"):g.reason==="unreadable-rule"?l("sectionsEditor.sectionsEditor.couldNotReadVariantMatcherRule"):g.message??l("sectionsEditor.sectionsEditor.failedToRenameVariant"));return}en(!0);try{if(g.kind==="inline"){const K=[...i];K[n]={...c,rule:g.inlinedRule};const I=await R(K);await qt(g.blockKey,I),k?.();return}if(g.kind==="updateBlock"){await M.mutateAsync({blockKey:g.blockKey,data:g.blockData}),k?.();return}let w=null,j=!1;try{const K=await M.mutateAsync({blockKey:g.blockId,data:g.blockData,create:!0});j=Wn(K),w=j?null:g.blockId;const I=[...i];I[n]={...c,rule:g.reference},await R(I),w=null}catch(K){throw w&&await An.mutateAsync({blockKey:w}).catch(()=>{}),K}j||W.success(l("sectionsEditor.sectionsEditor.savedMatcherAsGlobalBlock",{trimmed:s.trim()})),k?.()}catch(w){W.error(l("sectionsEditor.sectionsEditor.failedToRenameVariant"),{description:Bt(l,Kt(w))})}finally{en(!1)}}},selectGlobal:async(t,n,s)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const{activePageKey:a,decofile:o}=ae.current;if(!a)return;const i=Array.isArray(t.variants)?[...t.variants]:[],c=i[n];if(!c)return;const d=Dt(c.rule,o,u);i[n]={...c,rule:cn(s)};const R={...t,variants:i},g={...o,[a]:R};try{await Dr(a,t,R),d&&d!==s&&await qt(d,g),k?.()}catch(w){W.error(l("sectionsEditor.sectionsEditor.couldNotApplySavedRule"),{description:Bt(l,Kt(w))})}},selectNamedRule:async(t,n,s)=>{St(),A.current&&(clearTimeout(A.current),A.current=null),we.current.clear();const{activePageKey:a,decofile:o}=ae.current;if(!a)return;let i=null;!await Dn(s,o,d=>{const R=Array.isArray(t.variants)?[...t.variants]:[],g=R[n];return g?(R[n]={...g,rule:d},i={...t,variants:R},{blockKey:a,data:i}):null})||!i||(T(i),k?.())}},Mr=()=>{Wt(),h&&$t(null,-1,0)},Fr=t=>{dn(t),ls({inner:t})},Ir=t=>{Tn(t),ls({raw:t})},Lr=()=>{dn(null),Ot([])},Or=()=>Qt(t=>t+1),zr=()=>{fn.flush(),un(!1),dn(null),Tn(void 0),Ot([]),Qt(t=>t+1),be?.()},Wo=()=>{En(!1),Vn(!1),L(null),un(!0)},Ho=()=>{Ae&&zr(),L(null),En(!0)},qo=()=>Vn(!0),ps=t=>{if(Yt&&t===0){En(!1);return}if(Lt&&t<2){Vn(!1),t===0&&L(null);return}if(Ae){if(t===0){zr();return}if(t===1){Ot([]),Qt(s=>s+1);return}Ot(Ps.slice(0,t-1)),Qt(s=>s+1);return}if(q){V(D.slice(0,t)),O(s=>s+1);return}if(t===0){Mr();return}if(t===1){V([]),O(s=>s+1);return}const n=!$&&Vt&&_t?1:0;if(n===1&&t===2){V([]),O(s=>s+1);return}V(D.slice(0,t-1-n))},hs=In.length>1?r.jsx("button",{type:"button",onClick:()=>ps(hl(In.length,{isMultivariateSectionTop:Io})),title:l("sectionsEditor.sectionsEditor.back"),"aria-label":l("sectionsEditor.sectionsEditor.back"),className:de("shrink-0 inline-flex size-6 items-center justify-center rounded-[var(--studio-control-radius,var(--radius-md))] transition-colors",ct?"text-foreground/80 hover:bg-global-section/15":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:r.jsx(xl,{className:"size-4"})}):null,Go=ct||Tt||Ae?Bo&&r.jsxs("div",{className:de("border-b px-3 py-2.5",ct&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!q&&yt&&Re&&r.jsxs("button",{type:"button",onClick:Mr,title:l("sectionsEditor.sectionsEditor.editingInVariant",{variant:Re.label}),className:de("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",ol),children:[r.jsx(al,{rule:_s(Re.rule,f??{},u??void 0),matchers:sn}),r.jsx("span",{className:"max-w-[160px] truncate",children:Re.label})]}),r.jsx("div",{className:"flex-1"}),ct&&r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx("span",{className:"shrink-0 cursor-help",children:r.jsx(Jn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),r.jsx(jt,{side:"bottom",className:"max-w-[260px]",children:l("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),Tr&&r.jsx($n,{onClick:()=>Sn()})]}),ct&&r.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:l("sectionsEditor.sectionsEditor.globalSectionBanner")})]}):r.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx(ia,{pageKey:y,initialName:oe.name,initialPath:oe.path,onFieldChange:ir,variant:"header"})}),r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"ghost",size:"icon-sm","aria-label":l("sectionsEditor.sectionsEditor.editSeo"),className:"shrink-0",onClick:()=>un(!0),children:r.jsx(ha,{size:14})})}),r.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.editSeo")})]}),r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"ghost",size:"icon-sm","aria-label":l("sectionsEditor.sectionsEditor.viewJson"),className:"shrink-0",onClick:()=>Oe&&y?Oe():rt(!0),children:r.jsx(ga,{size:14})})}),r.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.viewJson")})]}),r.jsx($n,{onClick:bn})]}),Uo=r.jsxs(r.Fragment,{children:[yt&&y&&r.jsx(la,{listKey:y,variants:ve,activeIndex:ne,decofile:f??{},meta:u,matchers:sn,onSelect:os,onReorder:Pr,onRename:ge,onDuplicate:Kr,onDelete:Br,onAdd:bn}),yt&&re!==null&&r.jsx(ca,{className:"mt-3",children:r.jsx("div",{className:de("space-y-3",Xt&&"pointer-events-none opacity-50"),children:r.jsx(bs,{currentRt:re,currentLabel:_n(Re?.rule,f??{},Te,u??void 0),currentGlobalKey:Dt(Re?.rule,f??{},u??void 0)??void 0,matchers:sn,globals:cs,onSelect:hr,onSelectGlobal:Sr,named:us(Re?.rule,yr),namedRow:xs(Re?.rule,Ht),rule:Re?.rule,schema:mr,formValue:Me,onChange:gr,formKey:`${ne}:${re??""}`,formWrapperClassName:"space-y-3",meta:u??void 0,decofile:f,onSaveReferencedBlock:mn,sandbox:gn})})})]}),$r=r.jsxs(r.Fragment,{children:[r.jsx(il,{listKey:`${y??""}:${m??""}`,variants:Et.map((t,n)=>({index:n,label:t.label})),selectedIndex:Mn,onSelect:cr,onRename:Ye,onDuplicate:wo,onDelete:ko,onRemoveAll:ur,onReorder:Ro,onAdd:()=>Sn()}),r.jsx(ca,{children:r.jsx(bs,{currentRt:Zt??"",currentLabel:_n(_t?.rule,f??{},Te,u??void 0),currentGlobalKey:Dt(_t?.rule,f??{},u??void 0)??void 0,matchers:sn,globals:cs,onSelect:Eo,onSelectGlobal:Ao,named:us(_t?.rule,To),namedRow:xs(_t?.rule,Ht),rule:_t?.rule,schema:Co,formValue:za,onChange:Vo,formKey:`${m??"none"}:${Mn}:${Zt??""}`,formWrapperClassName:"pt-1",meta:u??void 0,decofile:f,onSaveReferencedBlock:mn,sandbox:gn})})]}),Wr=r.jsx("div",{className:de($?"px-2":"p-2 pt-3"),children:r.jsx(Nc,{listKey:`${y??""}-${ne}`,rawSections:F,sections:ye,meta:u,decofile:f,selectedIndex:m,onSelect:po,onReorder:ho,onDelete:go,onDuplicate:vo,onMakeReusable:Pe,onToggleHidden:yo,onToggleLazy:tt?So:void 0,onAddVariant:Sn,onDetach:bo,onAddSection:()=>ue(!0),canAddSection:fr})}),Jo=r.jsxs("div",{className:"min-w-0 max-w-full space-y-4 overflow-x-hidden px-3",children:[y&&oe&&r.jsx(ia,{pageKey:y,initialName:oe.name,initialPath:oe.path,onFieldChange:ir}),nn&&y?r.jsx(Ra,{rawSeo:Cn,innerSeo:ss,defaultResolveType:Js,seoTypesLoading:h&&!u,seoSchema:Ys,activeResolveType:Pn,seoTypeOptions:Us,formResetKey:Bs,siteDefaultSeo:Qs,onBreadcrumbChange:Ot,onPersistRaw:Ir,onInnerChange:Fr,onClearForm:Lr,onBumpFormKey:Or,asyncRenderAvailable:tt}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l("sectionsEditor.sectionsEditor.seoSchemaNotFound")})]}),Yo=r.jsx(ln,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:r.jsx("div",{className:"mx-auto max-w-2xl",children:nn&&y?r.jsx(Ra,{rawSeo:Cn,innerSeo:ss,defaultResolveType:Js,seoTypesLoading:h&&!u,seoSchema:Ys,activeResolveType:Pn,seoTypeOptions:Us,formResetKey:Bs,siteDefaultSeo:Qs,onBreadcrumbChange:Ot,onPersistRaw:Ir,onInnerChange:Fr,onClearForm:Lr,onBumpFormKey:Or,asyncRenderAvailable:tt}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l("sectionsEditor.sectionsEditor.seoSchemaNotFound")})})})},"editor-seo"),Qo=r.jsxs(ln,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[yt&&y&&r.jsx(la,{listKey:y,variants:ve,activeIndex:ne,decofile:f??{},meta:u,matchers:sn,onSelect:os,onReorder:Pr,onRename:ge,onDuplicate:Kr,onDelete:Br,onAdd:bn}),yt&&re!==null&&r.jsxs("div",{className:de("px-3 border-b",jn?"pt-3 pb-5 space-y-3":"py-2"),children:[r.jsxs("button",{type:"button",onClick:()=>La(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":jn,children:[r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:l("sectionsEditor.sectionsEditor.variantRule")}),jn?r.jsx(vl,{className:"size-3.5 shrink-0 text-muted-foreground"}):r.jsx(yl,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),jn&&r.jsx("div",{className:de("space-y-3",Xt&&"pointer-events-none opacity-50"),children:r.jsx(bs,{currentRt:re,currentLabel:_n(Re?.rule,f??{},Te,u??void 0),currentGlobalKey:Dt(Re?.rule,f??{},u??void 0)??void 0,matchers:sn,globals:cs,onSelect:hr,onSelectGlobal:Sr,named:us(Re?.rule,yr),namedRow:xs(Re?.rule,Ht),rule:Re?.rule,schema:mr,formValue:Me,onChange:gr,formKey:`${ne}:${re??""}`,formWrapperClassName:"space-y-3",meta:u??void 0,decofile:f,onSaveReferencedBlock:mn,sandbox:gn})})]}),Wr]},"editor-section-list");return r.jsx(ll,{value:h,children:r.jsx(cl,{children:r.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[!$&&hs&&r.jsx("div",{className:"flex min-w-0 shrink-0 items-center gap-2 px-3 py-2",children:hs}),($||In.length>1)&&r.jsx(ul,{crumbs:In,onSelect:ps,onSelectRoot:()=>{fn.flush(),qe?qe():ps(0)}}),r.jsx("div",{className:"shrink-0",children:$?r.jsxs("div",{className:de("flex items-center gap-2 border-b px-3 py-2.5",ct&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[$&&hs,ct&&r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx("span",{className:"shrink-0 cursor-help",children:r.jsx(Jn,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),r.jsx(jt,{side:"bottom",className:"max-w-[260px]",children:l("sectionsEditor.sectionsEditor.globalSectionTooltip")})]}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col leading-tight",children:[r.jsx("span",{className:"truncate text-sm font-semibold",children:Fo}),Cr&&r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:Cr})]}),ms&&yt&&Re&&r.jsx(ua,{variants:ve,activeIndex:ne,onSelect:os,onManage:Ho,onRemoveAll:Lo}),Do&&r.jsx(ua,{variants:Et,activeIndex:Mn,onSelect:cr,onManage:qo,onRemoveAll:ur}),ms&&!yt&&r.jsx($n,{onClick:bn}),Ko&&r.jsx($n,{onClick:()=>Sn()}),r.jsx(dl,{}),ms&&r.jsxs(r.Fragment,{children:[r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"outline",size:"icon-sm","aria-label":l("sectionsEditor.sectionsEditor.editSeo"),className:"shrink-0",onClick:Wo,children:r.jsx(ha,{size:14})})}),r.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.editSeo")})]}),!Oe&&r.jsxs(wt,{children:[r.jsx(Rt,{asChild:!0,children:r.jsx(Ft,{type:"button",variant:"outline",size:"icon-sm","aria-label":l("sectionsEditor.sectionsEditor.viewJson"),className:"shrink-0",onClick:()=>rt(!0),children:r.jsx(ga,{size:14})})}),r.jsx(jt,{side:"bottom",children:l("sectionsEditor.sectionsEditor.viewJson")})]})]})]}):Go}),it&&r.jsx(di,{open:!0,fields:fi(it.plan,it.target.schema),choices:it.choices,changedAgain:it.changedAgain,author:$s??null,authorPending:$s===void 0,fieldsAsLabeled:zs!==null,fresh:it.fresh,keepTyping:h,onChoose:(t,n)=>mo({...it.choices,[t]:n}),onApply:fo},Dc(it.formBase)),Lt?r.jsx(da,{onAdd:()=>Sn(),children:$r},"editor-section-variants"):Tt?r.jsxs(ln,{viewportRef:le,onBlur:tr,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[!$&&Vt&&Et.length>0&&D.length===0&&$r,r.jsx(ja,{value:vr,children:r.jsx(fa,{value:q&&h?De:null,children:r.jsx(ma,{activeSchema:Kn,formValue:Xe,formResetKey:Je,onFormChange:or,onBreadcrumbChange:V,breadcrumbPath:D,emptyMessage:l("sectionsEditor.sectionsEditor.noEditableFieldsForVariant"),meta:u,decofile:f,onSaveReferencedBlock:mn,sandbox:gn,previewBaseUrl:xe,onRequestAddSection:lr,onVariantMatcherOp:q?$o:void 0})})})]},"editor-section-form"):q?r.jsx(ln,{viewportRef:le,onBlur:tr,className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx(ja,{value:vr,children:r.jsx(fa,{value:q&&h?De:null,children:r.jsx(ma,{activeSchema:Kn,formValue:Xe,formResetKey:Je,onFormChange:or,onBreadcrumbChange:V,breadcrumbPath:D,emptyMessage:l("sectionsEditor.sectionsEditor.noEditableFieldsForGlobalBlock"),meta:u,decofile:f,onSaveReferencedBlock:mn,sandbox:gn,previewBaseUrl:xe,onRequestAddSection:lr})})})},"editor-global-block"):Ae?$?r.jsx(ln,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"p-3",children:Jo})},"editor-seo"):Yo:Yt?r.jsx(da,{onAdd:bn,children:Uo},"editor-variants"):$?r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsx(ln,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:r.jsx("div",{className:"py-2",children:Wr})}),r.jsx("div",{className:"shrink-0 border-t p-2",children:r.jsx(Vs,{canAddSection:fr,onAddSection:()=>ue(!0)})})]},"editor-section-list"):Qo,r.jsx(fl,{open:ce!==null,onOpenChange:t=>{t||Pe(null)},defaultBlockId:ce!==null?qn(ye[ce]?.label??""):"",isPending:M.isPending,onSubmit:jo}),mt&&r.jsx(rc,{open:U,onOpenChange:t=>{ue(t),t||(ht.current=null)},meta:u,decofile:f,previewBaseUrl:xe,onSelect:_o}),pt&&y&&f&&r.jsx(Ol,{open:pt,onOpenChange:rt,pageKey:y,decofile:f}),ke!==null&&r.jsx(pa,{open:!0,initialName:Jt(ve[ke]?.rule,f??{},u??void 0)?_n(ve[ke]?.rule,f??{},Te,u??void 0):"",autoLabel:Te(_s(ve[ke]?.rule,f??{},u??void 0)),isPending:Xt,onSubmit:async t=>{await Oo(ke,t)},onOpenChange:t=>{!t&&!Xt&&ge(null)}}),z!==null&&r.jsx(pa,{open:!0,initialName:Jt(Et[z]?.rule,f??{},u??void 0)?_n(Et[z]?.rule,f??{},Te,u??void 0):"",autoLabel:Te(_s(Et[z]?.rule,f??{},u??void 0)),isPending:Xt,onSubmit:async t=>{await zo(z,t)},onOpenChange:t=>{!t&&!Xt&&Ye(null)}})]})})})}export{cf as SectionsEditor};