decocms 3.31.2 → 3.31.4

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 (234) hide show
  1. package/dist/client/assets/{AlertCircle-B4gYnOPQ.js → AlertCircle-bShPqj0b.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-D0kjnBU3.js → ArrowUpRight-DqovlcCu.js} +1 -1
  3. package/dist/client/assets/{Check-Cy2gwr8C.js → Check-Brj4pwYB.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-CNdjtGTh.js → CheckCircle-pRAXzo7t.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-3x5m66Bs.js → ChevronDown-D_tH3Pqr.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-2_IuBsKu.js → ChevronLeft-4Hbiz37d.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CeIr4WsE.js → ChevronRight-DBqLyhnF.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-Bh0YaH7H.js → ChevronUp-DGQC0Atp.js} +1 -1
  9. package/dist/client/assets/{Container-CYA7KoET.js → Container-ti1tbLcS.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-FCIPj2jh.js → DotsVertical-DQAlAgsi.js} +1 -1
  11. package/dist/client/assets/{Eye-BEaX-nOW.js → Eye-BxQHLAvy.js} +1 -1
  12. package/dist/client/assets/{FilterLines-PIiHcomo.js → FilterLines-CNQZgFrz.js} +1 -1
  13. package/dist/client/assets/{Globe01-DCcLGAPs.js → Globe01-D4-Uy-9c.js} +1 -1
  14. package/dist/client/assets/{HardDrive-DF3wR4Ey.js → HardDrive-Isqk_XJm.js} +1 -1
  15. package/dist/client/assets/{Key01-DOICf9Yf.js → Key01-qHO_oGcn.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-XvA4efJR.js → LayoutLeft-Dp9fcKbL.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-kEaZ-3VP.js → LinkExternal01-DpsN5O5x.js} +1 -1
  18. package/dist/client/assets/{Monitor01-BQ2ab3I8.js → Monitor01-Cq3Rr0Bq.js} +1 -1
  19. package/dist/client/assets/{Palette-BvgmCjcf.js → Palette-DnLOSgb2.js} +1 -1
  20. package/dist/client/assets/{Play-CgnBFM99.js → Play-DARJIl68.js} +1 -1
  21. package/dist/client/assets/{Plus-CZoFo8m3.js → Plus-sMFWDZbr.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-CoOu-1-t.js → RefreshCcw01-hvf0KTJT.js} +1 -1
  23. package/dist/client/assets/{SearchMd-Cd3g9OHi.js → SearchMd-D6MpWudP.js} +1 -1
  24. package/dist/client/assets/{Settings02-h4KhooA8.js → Settings02-Bin1Cw7v.js} +1 -1
  25. package/dist/client/assets/{Shield01-CxluyAom.js → Shield01-DRC-rFEQ.js} +1 -1
  26. package/dist/client/assets/{Star01-BQu9_hS7.js → Star01-CggQq8ba.js} +1 -1
  27. package/dist/client/assets/{Stars01-D3E_UsFP.js → Stars01-CY5bRou1.js} +1 -1
  28. package/dist/client/assets/{Stars02-DQPSVMUP.js → Stars02-BzgC_AGF.js} +1 -1
  29. package/dist/client/assets/{Sun-CGlOqn-C.js → Sun-CEmFPV-m.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-DruCuOB9.js → SwitchHorizontal01-CAy0bKbW.js} +1 -1
  31. package/dist/client/assets/{Tool01-DXZCxrW7.js → Tool01-CqL3jxd8.js} +1 -1
  32. package/dist/client/assets/{Trash01-CdVc63JX.js → Trash01-DsICeEC_.js} +1 -1
  33. package/dist/client/assets/{Upload01-hFtvGOKc.js → Upload01-CIS28esp.js} +1 -1
  34. package/dist/client/assets/{User01-DkghkjfJ.js → User01-CsLiOWB8.js} +1 -1
  35. package/dist/client/assets/{Users01-DSIM6pEW.js → Users01-D5-Msw_I.js} +1 -1
  36. package/dist/client/assets/{Users03-cwi85RQL.js → Users03-CQxPre2P.js} +1 -1
  37. package/dist/client/assets/{X-CiRjfhfc.js → X-gaFIWyoX.js} +1 -1
  38. package/dist/client/assets/{XCircle-m30sBtwe.js → XCircle-DuBPYs0H.js} +1 -1
  39. package/dist/client/assets/{XClose-DEtxBka1.js → XClose-D07gkN5y.js} +1 -1
  40. package/dist/client/assets/{Zap-BqoFLQhx.js → Zap-CsYfJTNM.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-88gaWy0c.js → ZapSquare-CPVDs4bS.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-OQ9XVMLx.js → ZoomOut-DeDtnVFm.js} +1 -1
  43. package/dist/client/assets/{access-gate-DADwk2R8.js → access-gate-DnQ2Yr9c.js} +1 -1
  44. package/dist/client/assets/{accordion-67DY3M-J.js → accordion-DVtaqvvd.js} +1 -1
  45. package/dist/client/assets/{add-section-modal-CAjwD6Pd.js → add-section-modal-Btwoiri0.js} +1 -1
  46. package/dist/client/assets/{agent-capabilities-f1C_QUMa.js → agent-capabilities-BAJZX0wW.js} +1 -1
  47. package/dist/client/assets/{agent-icon-DRs2sxx6.js → agent-icon-4CMG3vFL.js} +1 -1
  48. package/dist/client/assets/{agent-icons-4ZuoYvOM.js → agent-icons-BCXwhowg.js} +1 -1
  49. package/dist/client/assets/{agents-list-BawKTAIq.js → agents-list-BHy4zh-6.js} +1 -1
  50. package/dist/client/assets/{ai-providers-Cw6JIdBf.js → ai-providers-CuvBA1b2.js} +1 -1
  51. package/dist/client/assets/{alert-DvSgp-Ux.js → alert-C3vuN4IW.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-CvpxH7Lf.js → alert-dialog-3NLNL2lq.js} +1 -1
  53. package/dist/client/assets/app-editor-CBat848W.js +1 -0
  54. package/dist/client/assets/{auth-catchall-DYNGMvE3.js → auth-catchall-BYJ1swBp.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-NbrrlaWV.js → auth-split-layout-yLeGzEVA.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-DUFXJruv.js → automation-list-row-D8mYDnjb.js} +1 -1
  57. package/dist/client/assets/{automation-runs-CAmeSsSa.js → automation-runs-CuF-JN9c.js} +1 -1
  58. package/dist/client/assets/{automations-CgeuUTLU.js → automations-DWe8QuKZ.js} +1 -1
  59. package/dist/client/assets/{avatar-CWn5LER_.js → avatar-DwEz-EXI.js} +1 -1
  60. package/dist/client/assets/{badge-CIMelj9a.js → badge-DMy4XfdA.js} +1 -1
  61. package/dist/client/assets/{brand-context-H1clX-er.js → brand-context-3pmjlZzl.js} +1 -1
  62. package/dist/client/assets/{buckets-CC7y0QTv.js → buckets-CMQ2DERk.js} +1 -1
  63. package/dist/client/assets/{calendar-YPBFp_E0.js → calendar-BYIzFcxm.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-mbutkBah.js → capability-load-error-C4yCAHDm.js} +1 -1
  65. package/dist/client/assets/{card-CPe96wry.js → card-PxUBskM1.js} +1 -1
  66. package/dist/client/assets/{chat-context-BjxJIMHx.js → chat-context-PdyGZuK4.js} +1 -1
  67. package/dist/client/assets/{checkbox-CMfBi1P9.js → checkbox-G6h8O6OG.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-DYhb7-ie.js → cli-auth-success-CdFqQPYv.js} +1 -1
  69. package/dist/client/assets/{collection-detail-BxKQrABJ.js → collection-detail-Dfd0ZBQR.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-CT3gbaW0.js → collection-display-button-g-hSEw8h.js} +1 -1
  71. package/dist/client/assets/{collection-search-CR7VmYXP.js → collection-search-CShiXiaa.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-8RUKrDnB.js → collection-table-wrapper-B50YE2WX.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-DyRPz2M0.js → collection-tabs-D9Ep-EsF.js} +1 -1
  74. package/dist/client/assets/{collections-D3ATOWCI.js → collections-DLN4CeIw.js} +1 -1
  75. package/dist/client/assets/{command-DwAn8s0z.js → command-hpCEI8HV.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-CUd_SkHU.js → connect-desktop-dialog-BHm4RJbq.js} +1 -1
  77. package/dist/client/assets/{connection-card-0Tyv2fap.js → connection-card-B0mYu1w7.js} +1 -1
  78. package/dist/client/assets/{connection-detail-Ci7FJpsv.js → connection-detail-d7axH5M_.js} +1 -1
  79. package/dist/client/assets/{connection-form-helpers-Csat880R.js → connection-form-helpers-BDQvLU3D.js} +1 -1
  80. package/dist/client/assets/{connections-CCuMprHu.js → connections-DLJ-utaR.js} +1 -1
  81. package/dist/client/assets/decopilot-sse-pool-BjcL-1Ui.js +1 -0
  82. package/dist/client/assets/{dialog-BgALXZ6h.js → dialog-Bzs3Hvvc.js} +1 -1
  83. package/dist/client/assets/{domain-settings-AaPYLR4t.js → domain-settings-CnArr_FL.js} +1 -1
  84. package/dist/client/assets/{drawer-DLAFbROZ.js → drawer-Cga4GFA1.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-uYsl4z-0.js → dropdown-menu-Cj66A_eF.js} +1 -1
  86. package/dist/client/assets/{dynamic-plugin-layout-OZf-s4Vh.js → dynamic-plugin-layout-Bpc6QuVE.js} +1 -1
  87. package/dist/client/assets/{empty-state-DaQUj4WW.js → empty-state-CYqmQpsu.js} +1 -1
  88. package/dist/client/assets/{empty-state-CzSsahKD.js → empty-state-CkusJYyv.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-8yLRil2N.js → extract-connection-data-BFTJdqNG.js} +1 -1
  90. package/dist/client/assets/{features-BUlOTs5u.js → features-D1WwoUaL.js} +1 -1
  91. package/dist/client/assets/{file-explorer-1z_jfh76.js → file-explorer-B9njJ3zZ.js} +1 -1
  92. package/dist/client/assets/{file-type-icon-BI-57QdR.js → file-type-icon-Bv7yJWkg.js} +1 -1
  93. package/dist/client/assets/{files-CXNJllw8.js → files-BNs74qe-.js} +1 -1
  94. package/dist/client/assets/{form-BSWyFOE3.js → form-mXbDRaUg.js} +1 -1
  95. package/dist/client/assets/{general-D0FEa5ER.js → general-C5JwFJrI.js} +1 -1
  96. package/dist/client/assets/{generate-id-Cx2Cl6ns.js → generate-id-C6x8vNjW.js} +1 -1
  97. package/dist/client/assets/{github-repo-picker-DFc58L4T.js → github-repo-picker-Bzd2LnZV.js} +1 -1
  98. package/dist/client/assets/{header-tab-button-EU-XSa1F.js → header-tab-button-CgUtemvw.js} +1 -1
  99. package/dist/client/assets/{hover-card-B2Xe1JoR.js → hover-card-Dmeo4zUX.js} +1 -1
  100. package/dist/client/assets/{image-field-D5MmzFT-.js → image-field-Bl7bSl4R.js} +1 -1
  101. package/dist/client/assets/{index-BPnG82q8.js → index-5sXwpSVw.js} +3 -3
  102. package/dist/client/assets/{index-BpKJI7Dd.js → index-BM35mGfP.js} +1 -1
  103. package/dist/client/assets/{index-9-_G5hYz.js → index-BWSXYqOt.js} +1 -1
  104. package/dist/client/assets/{index-C0KuwIPp.js → index-C-6mevJO.js} +1 -1
  105. package/dist/client/assets/{index-BHORPjEK.js → index-C7tCeeY4.js} +1 -1
  106. package/dist/client/assets/{index-DMmuIje2.js → index-CnFaOAWT.js} +1 -1
  107. package/dist/client/assets/{index-CYt0V3AS.js → index-CyzbZBCB.js} +1 -1
  108. package/dist/client/assets/{index-CUWw06mX.js → index-D0CNEIL2.js} +1 -1
  109. package/dist/client/assets/{index-Nndg_EdX.js → index-DKMcZ0eu.js} +4 -4
  110. package/dist/client/assets/{index-CU_dpGl4.js → index-DMvKxg0m.js} +1 -1
  111. package/dist/client/assets/{index-B_KbH-mb.js → index-DQAG9M0L.js} +1 -1
  112. package/dist/client/assets/{index-8eGpjmNk.js → index-Y4CYUrRN.js} +1 -1
  113. package/dist/client/assets/{index-BK9zbgCs.js → index-YwfQ6D2-.js} +1 -1
  114. package/dist/client/assets/{index-DaOT4XJB.js → index-dC5o8KGN.js} +1 -1
  115. package/dist/client/assets/{index-CUVr6lcg.js → index-pFsfuXVO.js} +1 -1
  116. package/dist/client/assets/{index-redirect--1iDHaDV.js → index-redirect-gBc5kPsU.js} +1 -1
  117. package/dist/client/assets/{input-Dp561wvu.js → input-CK42g6x9.js} +1 -1
  118. package/dist/client/assets/{integration-icon-CcFsasgm.js → integration-icon-cendsrzP.js} +1 -1
  119. package/dist/client/assets/{label-BSaEPU5n.js → label-HQVCFF31.js} +1 -1
  120. package/dist/client/assets/{layout-DhLz9U2X.js → layout-jCta3PB1.js} +1 -1
  121. package/dist/client/assets/{login-KELNaPBJ.js → login-vsK8EHPN.js} +1 -1
  122. package/dist/client/assets/{members-W8grzhWu.js → members-DB5hAMiS.js} +1 -1
  123. package/dist/client/assets/{monaco-editor-BR_tbU8a.js → monaco-editor-DLKosp5w.js} +1 -1
  124. package/dist/client/assets/{monitoring-stats-row-5K-iNny9.js → monitoring-stats-row-C5_Ubato.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-8KL4StZE.js → oauth-callback-2T1mMZwB.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-ai-provider-N8VomC_I.js → oauth-callback-ai-provider-D84hmbSh.js} +1 -1
  127. package/dist/client/assets/{onboarding-DtdxPB0K.js → onboarding-ChyK52Y7.js} +1 -1
  128. package/dist/client/assets/{org-install-D5FbkY3j.js → org-install-CIryqJ9H.js} +1 -1
  129. package/dist/client/assets/{org-layout-KSFpSPTk.js → org-layout-B7SCBciF.js} +1 -1
  130. package/dist/client/assets/{org-plugin-layout-DJo1Z-Pr.js → org-plugin-layout-CVpar_1d.js} +1 -1
  131. package/dist/client/assets/{page-seo-form-DJY-iA3B.js → page-seo-form-BKyuhY5C.js} +1 -1
  132. package/dist/client/assets/page-seo-sheet-Cn1fL0YJ.js +1 -0
  133. package/dist/client/assets/{pair-B6H2XHda.js → pair-pnRe99Io.js} +1 -1
  134. package/dist/client/assets/{plugin-empty-state-APGWpnYe.js → plugin-empty-state-D-m0FEKs.js} +1 -1
  135. package/dist/client/assets/{plugin-header-CfyEfwUD.js → plugin-header-DA3xC9n4.js} +1 -1
  136. package/dist/client/assets/{plugin-layout-Bu5dLcrn.js → plugin-layout-h-TivuZM.js} +1 -1
  137. package/dist/client/assets/{popover-BYJBybY_.js → popover-Dakh_DW3.js} +1 -1
  138. package/dist/client/assets/{post-editor-CYVdmKp6.js → post-editor-UuKOvtl-.js} +1 -1
  139. package/dist/client/assets/{primitives-H10wZI-E.js → primitives-B9bIbW7q.js} +1 -1
  140. package/dist/client/assets/{profile-CRrSZ5vD.js → profile-BdGDGhIt.js} +1 -1
  141. package/dist/client/assets/project-app-view-D7-RtDUv.js +1 -0
  142. package/dist/client/assets/record-editor-BGwRTDw2.js +1 -0
  143. package/dist/client/assets/registry-78OPDNW-.js +2 -0
  144. package/dist/client/assets/{registry-layout-B7ptEXAi.js → registry-layout-8gQQkBAD.js} +1 -1
  145. package/dist/client/assets/{require-capability-C4c85-CT.js → require-capability-n9H-Zf3o.js} +1 -1
  146. package/dist/client/assets/{required-auth-layout-BApuEUpI.js → required-auth-layout-CgZG0sGl.js} +1 -1
  147. package/dist/client/assets/{reset-password-CAbJ7zW-.js → reset-password-D_zRsG5k.js} +1 -1
  148. package/dist/client/assets/{resizable-D7pt8dup.js → resizable-DVepITIE.js} +1 -1
  149. package/dist/client/assets/{roles-xJLawXZj.js → roles-BZVgNwWm.js} +1 -1
  150. package/dist/client/assets/save-referenced-block-ByYclKL_.js +1 -0
  151. package/dist/client/assets/{save-status-oczKxF1W.js → save-status-CPsu4fM4.js} +1 -1
  152. package/dist/client/assets/{schema-form-974itnxa.js → schema-form-Du1fABB8.js} +1 -1
  153. package/dist/client/assets/{scroll-area-DuFY4R5d.js → scroll-area-ilU6DceG.js} +1 -1
  154. package/dist/client/assets/{search-input-DACBbzIk.js → search-input-DlRbBAMq.js} +1 -1
  155. package/dist/client/assets/{secrets-DMWeEvqW.js → secrets-Dqr7tsem.js} +1 -1
  156. package/dist/client/assets/{sections-editor-DM97T9Hx.js → sections-editor-_2neP6C4.js} +1 -1
  157. package/dist/client/assets/{select-gqSNOxQD.js → select-DoApsdPu.js} +1 -1
  158. package/dist/client/assets/{select-model-CbdvfMbD.js → select-model-S3i6KUvb.js} +1 -1
  159. package/dist/client/assets/{seo-editor-BNi1XNxf.js → seo-editor-sZ15n7RL.js} +1 -1
  160. package/dist/client/assets/{settings-layout-XPdklskX.js → settings-layout-Cb3M0tFC.js} +1 -1
  161. package/dist/client/assets/{settings-section-BgPOTco2.js → settings-section-CS4YZmEl.js} +1 -1
  162. package/dist/client/assets/{sheet-J-5zCitH.js → sheet-BgFdZnkM.js} +1 -1
  163. package/dist/client/assets/{shell-controls-BB8JT3cu.js → shell-controls-BxJyT1tb.js} +1 -1
  164. package/dist/client/assets/{shell-layout-B1bpQmja.js → shell-layout-Cd7cG_OA.js} +1 -1
  165. package/dist/client/assets/{shell-route-loading-BL818aqT.js → shell-route-loading-B1fp-Ipd.js} +1 -1
  166. package/dist/client/assets/{sidebar-DpznaqAr.js → sidebar-WtJMNJ3L.js} +1 -1
  167. package/dist/client/assets/{skeleton-BrZY2U4q.js → skeleton-96bpkK-M.js} +1 -1
  168. package/dist/client/assets/{sortable.esm-DAdL_KCM.js → sortable.esm-BYBRFwqb.js} +1 -1
  169. package/dist/client/assets/{spinner-DWj9d3Oy.js → spinner-By2Ootpp.js} +1 -1
  170. package/dist/client/assets/{sso-_Gw_BXbF.js → sso-CPnutWyf.js} +1 -1
  171. package/dist/client/assets/{store-C4geYRDc.js → store-CtxnF-Ce.js} +1 -1
  172. package/dist/client/assets/store-registry-CdqiP6fG.js +2 -0
  173. package/dist/client/assets/{studio-tools-YbndxaJx.js → studio-tools-BfSfNeHU.js} +1 -1
  174. package/dist/client/assets/{switch-CWe9x1dO.js → switch-SFx4s8Mz.js} +1 -1
  175. package/dist/client/assets/{tab-id-Bc_4nZgl.js → tab-id-DW8DAjeq.js} +1 -1
  176. package/dist/client/assets/{table-MDhW4B8D.js → table-uM_BvOsz.js} +1 -1
  177. package/dist/client/assets/{tabs-9ZkZ5CXu.js → tabs-C6acO-nW.js} +1 -1
  178. package/dist/client/assets/{task-status-BNkxxOv6.js → task-status--a6y4hT2.js} +1 -1
  179. package/dist/client/assets/{textarea-CimG5sWW.js → textarea-B2pcaqEK.js} +1 -1
  180. package/dist/client/assets/{toggle-group-BqOsII08.js → toggle-group-DUOxki9q.js} +1 -1
  181. package/dist/client/assets/{toolbar-oWPvqwRC.js → toolbar-BlaYq2I2.js} +1 -1
  182. package/dist/client/assets/{tools-list-C2in0sGo.js → tools-list-Dxr_eQiP.js} +1 -1
  183. package/dist/client/assets/{tooltip-BwiZr2GD.js → tooltip-D0LAoEMr.js} +1 -1
  184. package/dist/client/assets/{types-BYtVTpDQ.js → types-D3yUtTXV.js} +1 -1
  185. package/dist/client/assets/{use-ai-providers-B4z2G4rP.js → use-ai-providers-D94PAiJh.js} +1 -1
  186. package/dist/client/assets/{use-automations-Cgz4YKs5.js → use-automations-CAQm69ll.js} +1 -1
  187. package/dist/client/assets/{use-capability-CtdbYGMh.js → use-capability-R4F2LPam.js} +1 -1
  188. package/dist/client/assets/{use-clock-tick-CPPdyWgW.js → use-clock-tick-C-_xih2z.js} +1 -1
  189. package/dist/client/assets/{use-collections-D52tQdGt.js → use-collections-JHs4cYqF.js} +1 -1
  190. package/dist/client/assets/{use-connection-DyyYYs8L.js → use-connection-CXOjgHQ4.js} +1 -1
  191. package/dist/client/assets/{use-copy-BEZFUgho.js → use-copy-B8gxtqNt.js} +1 -1
  192. package/dist/client/assets/{use-create-virtual-mcp-w-CGYLKc.js → use-create-virtual-mcp-BHiNkBGx.js} +1 -1
  193. package/dist/client/assets/{use-debounced-autosave-7GLgaJXq.js → use-debounced-autosave-BNCiV512.js} +1 -1
  194. package/dist/client/assets/{use-delete-connection-6bfkbwg3.js → use-delete-connection-BXmYWsjJ.js} +1 -1
  195. package/dist/client/assets/{use-file-configs-fZ_0pNgv.js → use-file-configs-DZXqK8Yj.js} +1 -1
  196. package/dist/client/assets/{use-infinite-scroll-D2-BvjXC.js → use-infinite-scroll-C94z2LLQ.js} +1 -1
  197. package/dist/client/assets/{use-list-state-BiQdeo-3.js → use-list-state-CfKIREqY.js} +1 -1
  198. package/dist/client/assets/{use-mcp-client-iXdxenz3.js → use-mcp-client-B6iSuijq.js} +1 -1
  199. package/dist/client/assets/{use-mcp-prompts-BZ3M88pO.js → use-mcp-prompts-s1sqXS3y.js} +1 -1
  200. package/dist/client/assets/{use-mcp-tools-BFte_Z9f.js → use-mcp-tools-D95JgNEL.js} +1 -1
  201. package/dist/client/assets/{use-members-lO5UPidt.js → use-members-CWz__Rma.js} +1 -1
  202. package/dist/client/assets/{use-navigate-to-agent-DIjWe8In.js → use-navigate-to-agent-bxX_4-SA.js} +1 -1
  203. package/dist/client/assets/{use-org-auth-client-CjM9gfPH.js → use-org-auth-client-BplPY98r.js} +1 -1
  204. package/dist/client/assets/{use-org-sso-Sk1A6q8-.js → use-org-sso-Dx8FPpVk.js} +1 -1
  205. package/dist/client/assets/{use-organization-roles-C5mxX9Rk.js → use-organization-roles-BM47a_nm.js} +1 -1
  206. package/dist/client/assets/{use-organization-settings-MrnwSgAR.js → use-organization-settings-kuC1VER7.js} +1 -1
  207. package/dist/client/assets/{use-registry-connections-CC-YLphz.js → use-registry-connections-D6C9SiZo.js} +1 -1
  208. package/dist/client/assets/{use-secrets-CajEM27b.js → use-secrets-BZKcNE95.js} +1 -1
  209. package/dist/client/assets/{use-status-sounds-BwNN0Dt-.js → use-status-sounds-Ce_qcxwH.js} +1 -1
  210. package/dist/client/assets/{use-view-mode-B5-wFbmS.js → use-view-mode-GGVgcYKQ.js} +1 -1
  211. package/dist/client/assets/{use-virtual-mcp-Cw_yVFMO.js → use-virtual-mcp-BfkoC_Jy.js} +1 -1
  212. package/dist/client/assets/useInfiniteQuery-F-pMGKml.js +1 -0
  213. package/dist/client/assets/{useRouterState-IhZ1SxRm.js → useRouterState--eNysN4d.js} +1 -1
  214. package/dist/client/assets/useSuspenseInfiniteQuery-DJ0xp4Hy.js +1 -0
  215. package/dist/client/assets/{user-CJUwgqvV.js → user-CT3TflBT.js} +1 -1
  216. package/dist/client/assets/{view-mode-toggle-CMrO4dTZ.js → view-mode-toggle-CE-BR8HX.js} +1 -1
  217. package/dist/client/assets/{watch-sse-pool-BZQA3Ki3.js → watch-sse-pool-Dwz6GgNQ.js} +1 -1
  218. package/dist/client/assets/workflow-detail-C2Gpq6oe.js +1 -0
  219. package/dist/client/assets/{workflow-CrJS-2vt.js → workflow-fr2igkJE.js} +1 -1
  220. package/dist/client/index.html +1 -1
  221. package/dist/server/cli.js +51 -23
  222. package/dist/server/server.js +6 -6
  223. package/package.json +1 -1
  224. package/dist/client/assets/app-editor-DFjSiVlG.js +0 -1
  225. package/dist/client/assets/decopilot-sse-pool-Qs-1EY0r.js +0 -1
  226. package/dist/client/assets/page-seo-sheet-BmGMfOzX.js +0 -1
  227. package/dist/client/assets/project-app-view-Dy7VlptC.js +0 -1
  228. package/dist/client/assets/record-editor-BnPSQQYA.js +0 -1
  229. package/dist/client/assets/registry-CX-ET0zi.js +0 -2
  230. package/dist/client/assets/save-referenced-block-ShdGpmDs.js +0 -1
  231. package/dist/client/assets/store-registry-WC9BumXE.js +0 -2
  232. package/dist/client/assets/useInfiniteQuery-DHhL-q8j.js +0 -1
  233. package/dist/client/assets/useSuspenseInfiniteQuery-oHftqcSU.js +0 -1
  234. package/dist/client/assets/workflow-detail-CBOkNhJP.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as w,dG as $l,bF as ju,j as O,aU as Hu,b5 as St,dH as Wu,a7 as it,a8 as Qe,bk as On,bh as Uu,bi as qu,bx as Mt,dA as Fl,ag as _l,bg as Ku,ad as ut,e as Vl,c as jl}from"./index-BPnG82q8.js";import{e as Ju}from"./select-gqSNOxQD.js";function Q(n){this.content=n}Q.prototype={constructor:Q,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Q(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Q(t)},addToStart:function(n,e){return new Q([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Q(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Q(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Q.from(n),n.size?new Q(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Q.from(n),n.size?new Q(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Q.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Q.from=function(n){if(n instanceof Q)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Q(e)};function Hl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Hl(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wl(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wl(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Hl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wl(this,e,t,r)}findIndex(e){if(e==0)return Ln(0,e);if(e==this.size)return Ln(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Ln(t+1,i):Ln(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const ls={index:0,offset:0};function Ln(n,e){return ls.index=n,ls.offset=e,ls}function Qn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Qn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Qn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let z=class Ps{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ps.none;if(e instanceof Ps)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};z.none=[];class Zn extends Error{}class v{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ql(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Ul(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return v.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new v(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new v(e,r,s)}}v.empty=new v(k.empty,0,0);function Ul(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Ul(i.content,e-s-1,t-s-1)))}function ql(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=ql(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Gu(n,e,t){if(t.openStart>n.depth)throw new Zn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Zn("Inconsistent open depths");return Kl(n,e,t,0)}function Kl(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kl(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return yt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Yu(t,n);return yt(i,Gl(n,o,l,e,r))}else return yt(i,er(n,e,r))}function Jl(n,e){if(!e.type.compatibleContent(n.type))throw new Zn("Cannot join "+e.type.name+" onto "+n.type.name)}function Ls(n,e,t){let r=n.node(t);return Jl(r,e.node(t)),r}function gt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function an(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(gt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)gt(s.child(l),r);e&&e.depth==t&&e.textOffset&&gt(e.nodeBefore,r)}function yt(n,e){return n.type.checkContent(e),n.copy(e)}function Gl(n,e,t,r,s){let i=n.depth>s&&Ls(n,e,s+1),o=r.depth>s&&Ls(t,r,s+1),l=[];return an(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jl(i,o),gt(yt(i,Gl(n,e,t,r,s+1)),l)):(i&&gt(yt(i,er(n,e,s+1)),l),an(e,t,s,l),o&&gt(yt(o,er(t,r,s+1)),l)),an(r,null,s,l),new k(l)}function er(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let s=Ls(n,e,t+1);gt(yt(s,er(n,e,t+1)),r)}return an(e,null,t,r),new k(r)}function Yu(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class kn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return z.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new tr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new kn(t,r,i)}static resolveCached(e,t){let r=so.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else so.set(e,r=new Xu);let s=r.elts[r.i]=kn.resolve(e,t);return r.i=(r.i+1)%Qu,s}}class Xu{constructor(){this.elts=[],this.i=0}}const Qu=12,so=new WeakMap;class tr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Zu=Object.create(null);class Ee{constructor(e,t,r,s=z.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Qn(this.attrs,t||e.defaultAttrs||Zu)&&z.sameSet(this.marks,r||z.none)}copy(e=null){return e==this.content?this:new Ee(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ee(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return v.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new v(c,s.depth-o,i.depth-o)}replace(e,t,r){return Gu(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return kn.resolveCached(this,e)}resolveNoCache(e){return kn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Yl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=z.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!z.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Ee.prototype.text=void 0;class nr extends Ee{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new nr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new nr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Yl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class wt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new ed(e,t);if(r.next==null)return wt.empty;let s=Xl(r);r.next&&r.err("Unexpected trailing text");let i=ld(od(s));return ad(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
1
+ import{r as w,dG as $l,bF as ju,j as O,aU as Hu,b5 as St,dH as Wu,a7 as it,a8 as Qe,bk as On,bh as Uu,bi as qu,bx as Mt,dA as Fl,ag as _l,bg as Ku,ad as ut,e as Vl,c as jl}from"./index-5sXwpSVw.js";import{e as Ju}from"./select-DoApsdPu.js";function Q(n){this.content=n}Q.prototype={constructor:Q,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new Q(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Q(t)},addToStart:function(n,e){return new Q([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Q(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new Q(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Q.from(n),n.size?new Q(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Q.from(n),n.size?new Q(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Q.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Q.from=function(n){if(n instanceof Q)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Q(e)};function Hl(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=Hl(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wl(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),l=e.child(--i),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,u=Math.min(o.text.length,l.text.length);for(;c<u&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||l.content.size){let c=Wl(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class k{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&r(a,s+l,i||null,o)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,t-u),r,s+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?s?typeof s=="function"?s(l):s:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new k(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let l=this.content[i],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),s+=l.nodeSize),o=a}return new k(r,s)}cutByIndex(e,t){return e==t?k.empty:e==0&&t==this.content.length?this:new k(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new k(s,i)}addToStart(e){return new k([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new k(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Hl(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wl(this,e,t,r)}findIndex(e){if(e==0)return Ln(0,e);if(e==this.size)return Ln(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),i=r+s.nodeSize;if(i>=e)return i==e?Ln(t+1,i):Ln(t,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return k.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new k(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return k.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new k(t||e,r)}static from(e){if(!e)return k.empty;if(e instanceof k)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new k([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}k.empty=new k([],0);const ls={index:0,offset:0};function Ln(n,e){return ls.index=n,ls.offset=e,ls}function Qn(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Qn(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Qn(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let z=class Ps{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Qn(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ps.none;if(e instanceof Ps)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};z.none=[];class Zn extends Error{}class v{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=ql(this.content,e+this.openStart,t);return r&&new v(r,this.openStart,this.openEnd)}removeBetween(e,t){return new v(Ul(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return v.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new v(k.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new v(e,r,s)}}v.empty=new v(k.empty,0,0);function Ul(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(s==e||i.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(Ul(i.content,e-s-1,t-s-1)))}function ql(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=ql(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Gu(n,e,t){if(t.openStart>n.depth)throw new Zn("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Zn("Inconsistent open depths");return Kl(n,e,t,0)}function Kl(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=Kl(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,l=o.content;return yt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Yu(t,n);return yt(i,Gl(n,o,l,e,r))}else return yt(i,er(n,e,r))}function Jl(n,e){if(!e.type.compatibleContent(n.type))throw new Zn("Cannot join "+e.type.name+" onto "+n.type.name)}function Ls(n,e,t){let r=n.node(t);return Jl(r,e.node(t)),r}function gt(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function an(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(gt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)gt(s.child(l),r);e&&e.depth==t&&e.textOffset&&gt(e.nodeBefore,r)}function yt(n,e){return n.type.checkContent(e),n.copy(e)}function Gl(n,e,t,r,s){let i=n.depth>s&&Ls(n,e,s+1),o=r.depth>s&&Ls(t,r,s+1),l=[];return an(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jl(i,o),gt(yt(i,Gl(n,e,t,r,s+1)),l)):(i&&gt(yt(i,er(n,e,s+1)),l),an(e,t,s,l),o&&gt(yt(o,er(t,r,s+1)),l)),an(r,null,s,l),new k(l)}function er(n,e,t){let r=[];if(an(null,n,t,r),n.depth>t){let s=Ls(n,e,t+1);gt(yt(s,er(n,e,t+1)),r)}return an(e,null,t,r),new k(r)}function Yu(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(k.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class kn{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return z.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let l=r;r=s,s=l}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new tr(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(i),c=i-a;if(r.push(o,l,s+a),!c||(o=o.child(l),o.isText))break;i=c-1,s+=a+1}return new kn(t,r,i)}static resolveCached(e,t){let r=so.get(e);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==t)return o}else so.set(e,r=new Xu);let s=r.elts[r.i]=kn.resolve(e,t);return r.i=(r.i+1)%Qu,s}}class Xu{constructor(){this.elts=[],this.i=0}}const Qu=12,so=new WeakMap;class tr{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Zu=Object.create(null);class Ee{constructor(e,t,r,s=z.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||k.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Qn(this.attrs,t||e.defaultAttrs||Zu)&&z.sameSet(this.marks,r||z.none)}copy(e=null){return e==this.content?this:new Ee(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Ee(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return v.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),l=s.start(o),c=s.node(o).content.cut(s.pos-l,i.pos-l);return new v(c,s.depth-o,i.depth-o)}replace(e,t,r){return Gu(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return kn.resolveCached(this,e)}resolveNoCache(e){return kn.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Yl(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=k.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=s;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=z.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!z.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=k.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}Ee.prototype.text=void 0;class nr extends Ee{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yl(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new nr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new nr(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Yl(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class wt{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new ed(e,t);if(r.next==null)return wt.empty;let s=Xl(r);r.next&&r.err("Unexpected trailing text");let i=ld(od(s));return ad(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,l){let a=o.matchFragment(e,r);if(a&&(!t||a.validEnd))return k.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let l=s;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:l,next:a}=i.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!s.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:s}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
2
2
  `)}}wt.empty=new wt(!0);class ed{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Xl(n){let e=[];do e.push(td(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function td(n){let e=[];do e.push(nd(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function nd(n){let e=id(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=rd(n,e);else break;return e}function io(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function rd(n,e){let t=io(n),r=t;return n.eat(",")&&(n.next!="}"?r=io(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function sd(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.isInGroup(e)&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function id(n){if(n.eat("(")){let e=Xl(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=sd(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function od(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function s(o,l){o.forEach(a=>a.to=l)}function i(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=i(o.exprs[a],l);if(a==o.exprs.length-1)return c;s(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),s(i(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return s(i(o.expr,l),a),s(i(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(i(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,a),u),a=u}if(o.max==-1)s(i(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let u=t();r(a,u),s(i(o.expr,a),u),a=u}return[r(a)]}else{if(o.type=="name")return[r(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Ql(n,e){return e-n}function oo(n,e){let t=[];return r(e),t.sort(Ql);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:l,to:a}=i[o];!l&&t.indexOf(a)==-1&&r(a)}}}function ld(n){let e=Object.create(null);return t(oo(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<s.length;u++)s[u][0]==l&&(c=s[u][1]);oo(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new wt(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Ql);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function ad(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let l=0;l<s.next.length;l++){let{type:a,next:c}=s.next[l];o.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Zl(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function ea(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function ta(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let i=n[s];i.validate&&i.validate(e[s])}}function na(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new ud(n,r,e[r]);return t}let lo=class ra{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=na(e,r.attrs),this.defaultAttrs=Zl(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==wt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ea(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ee(this,this.computeAttrs(e),k.from(t),z.setFrom(r))}createChecked(e=null,t,r){return t=k.from(t),this.checkContent(t),new Ee(this,this.computeAttrs(e),t,z.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=k.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(k.empty,!0);return i?new Ee(this,e,t.append(i),z.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ta(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:z.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ra(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function cd(n,e,t){let r=t.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${i}`)}}class ud{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?cd(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class jr{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=na(e,s.attrs),this.excluded=null;let i=Zl(this.attrs);this.instance=i?new z(this,i):null}create(e=null){return!e&&this.instance?this.instance:new z(this,ea(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new jr(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){ta(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class sa{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Q.from(e.nodes),t.marks=Q.from(e.marks||{}),this.nodes=lo.compile(this.spec.nodes,this),this.marks=jr.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=wt.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?ao(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:ao(this,o.split(" "))}this.nodeFromJSON=s=>Ee.fromJSON(this,s),this.markFromJSON=s=>z.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof lo){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new nr(r,r.defaultAttrs,e,z.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function ao(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(s=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function dd(n){return n.tag!=null}function fd(n){return n.style!=null}class Ze{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(dd(s))this.tags.push(s);else if(fd(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=e.nodes[s.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let r=new uo(this,t,!1);return r.addAll(e,z.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new uo(this,t,!0);return r.addAll(e,z.none,t.from,t.to),v.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(md(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=fo(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=fo(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ze(e,Ze.schemaRules(e)))}}const ia={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},hd={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oa={ol:!0,ul:!0},xn=1,Bs=2,cn=4;function co(n,e,t){return e!=null?(e?xn:0)|(e==="full"?Bs:0):n&&n.whitespace=="pre"?xn|Bs:t&~cn}class Bn{constructor(e,t,r,s,i,o){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=z.none,this.match=i||(o&cn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(k.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&xn)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=k.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ia.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class uo{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,i,o=co(null,t.preserveWhitespace,0)|(r?cn:0);s?i=new Bn(s.type,s.attrs,z.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Bn(null,null,z.none,!0,null,o):i=new Bn(e.schema.topNodeType,null,z.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,i=s.options&Bs?"full":this.localPreserveWS||(s.options&xn)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
3
3
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[a]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let l=s.content[s.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;oa.hasOwnProperty(o)&&this.parser.normalizeLists&&pd(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:hd.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(ia.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
4
  `),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(i,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,s){let i,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,r,s){let i=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=s==null?null:e.childNodes[s];o!=l;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,r){let s,i;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!s||s.length>c.length+l)&&(s=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)t=this.enterInner(s[o],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=z.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):ho(l.type,e.type))&&(o=l.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,t,r,s){let i=this.findPlace(e.create(t),r,!1);return i&&(i=this.enterInner(e,t,r,!0,s)),i}enterInner(e,t,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=co(e,i,o.options);o.options&cn&&o.content.length==0&&(l|=cn);let a=z.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):ho(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Bn(e,t,a,s,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=xn)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(o(l-1,a))return!0;return!1}else{let u=a>0||a==0&&s?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function pd(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&oa.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function md(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function fo(n){let e={};for(let t in n)e[t]=n[t];return e}function ho(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class At{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=as(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let l=0,a=0;for(;l<i.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)s=i.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Kn(as(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Kn(as(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Kn(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new At(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=po(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return po(e.marks)}}function po(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function as(n){return n.document||window.document}const mo=new WeakMap;function gd(n){let e=mo.get(n);return e===void 0&&mo.set(n,e=yd(n)),e}function yd(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Kn(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=gd(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(t=s.slice(0,o),s=s.slice(o+1));let l,a=t?n.createElementNS(t,s):n.createElement(s),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Kn(n,f,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}const la=65535,aa=Math.pow(2,16);function bd(n,e){return n+e*aa}function go(n){return n&la}function kd(n){return(n-(n&la))/aa}const ca=1,ua=2,Jn=4,da=8;class zs{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&da)>0}get deletedBefore(){return(this.delInfo&(ca|Jn))>0}get deletedAfter(){return(this.delInfo&(ua|Jn))>0}get deletedAcross(){return(this.delInfo&Jn)>0}}class fe{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&fe.empty)return fe.empty}recover(e){let t=0,r=go(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+kd(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?s:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+o],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:t:t,h=a+s+(f<0?0:u);if(r)return h;let p=e==(t<0?a:d)?null:bd(l/3,e-a),m=e==a?ua:e==d?ca:Jn;return(t<0?e!=a:e!=d)&&(m|=da),new zs(h,m,p)}s+=u-c}return r?e+s:new zs(e+s,0,null)}touches(e,t){let r=0,s=go(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==s*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],l=o-(this.inverted?i:0),a=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new fe(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?fe.empty:new fe(e<0?[0,-e,0]:[0,0,e])}}fe.empty=new fe([]);class Sn{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Sn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new Sn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}s|=l.delInfo,e=l.pos}return r?e:new zs(e,s,null)}}const cs=Object.create(null);class se{getMap(){return fe.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=cs[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in cs)throw new RangeError("Duplicate use of step JSON ID "+e);return cs[e]=t,t.prototype.jsonID=e,t}}class q{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new q(e,null)}static fail(e){return new q(null,e)}static fromReplace(e,t,r,s){try{return q.ok(e.replace(t,r,s))}catch(i){if(i instanceof Zn)return q.fail(i.message);throw i}}}function di(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(di(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return k.fromArray(r)}class Ge extends se{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new v(di(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,i)}invert(){return new ve(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ge(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ge&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ge(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Ge(t.from,t.to,e.markFromJSON(t.mark))}}se.jsonID("addMark",Ge);class ve extends se{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new v(di(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return q.fromReplace(e,this.from,this.to,r)}invert(){return new Ge(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ve(t.pos,r.pos,this.mark)}merge(e){return e instanceof ve&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ve(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new ve(t.from,t.to,e.markFromJSON(t.mark))}}se.jsonID("removeMark",ve);class Ye extends se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new v(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new Ye(this.pos,t.marks[s]);return new Ye(this.pos,this.mark)}}return new Ct(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ye(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ye(t.pos,e.markFromJSON(t.mark))}}se.jsonID("addNodeMark",Ye);class Ct extends se{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return q.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return q.fromReplace(e,this.pos,this.pos+1,new v(k.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Ye(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ct(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ct(t.pos,e.markFromJSON(t.mark))}}se.jsonID("removeNodeMark",Ct);class U extends se{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&$s(e,this.from,this.to)?q.fail("Structure replace would overwrite content"):q.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fe([this.from,this.to-this.from,this.slice.size])}invert(e){return new U(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),r=this.from==this.to&&U.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new U(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof U)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?v.empty:new v(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new U(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?v.empty:new v(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new U(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new U(t.from,t.to,v.fromJSON(e,t.slice),!!t.structure)}}U.MAP_BIAS=1;se.jsonID("replace",U);class Y extends se{constructor(e,t,r,s,i,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=l}apply(e){if(this.structure&&($s(e,this.from,this.gapFrom)||$s(e,this.gapTo,this.to)))return q.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return q.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?q.fromReplace(e,this.from,this.to,r):q.fail("Content does not fit in gap")}getMap(){return new fe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Y(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new Y(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Y(t.from,t.to,t.gapFrom,t.gapTo,v.fromJSON(e,t.slice),t.insert,!!t.structure)}}se.jsonID("replaceAround",Y);function $s(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function xd(n,e,t,r){let s=[],i=[],o,l;n.doc.nodesBetween(e,t,(a,c,u)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[m])?o.to=h:s.push(o=new ve(f,h,d[m])));l&&l.to==f?l.to=h:i.push(l=new Ge(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function Sd(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;i++;let a=null;if(r instanceof jr){let c=o.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<s.length;h++){let p=s[h];p.step==i-1&&d.eq(s[h].style)&&(f=p)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),s.forEach(o=>n.step(new ve(o.from,o.to,o.style)))}function fi(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new U(l,u,v.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new ve(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new v(k.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new U(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(k.empty,!0);n.replace(l,l,new v(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function wd(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Yt(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth,s=0,i=0;;--r){let o=n.$from.node(r),l=n.$from.index(r)+s,a=n.$to.indexAfter(r)-i;if(r<n.depth&&o.canReplace(l,a,t))return r;if(r==0||o.type.spec.isolating||!wd(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function Cd(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),l=s.after(i+1),a=o,c=l,u=k.empty,d=0;for(let p=i,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=k.from(r.node(p).copy(u)),d++):a--;let f=k.empty,h=0;for(let p=i,m=!1;p>t;p--)m||s.after(p+1)<s.end(p)?(m=!0,f=k.from(s.node(p).copy(f)),h++):c++;n.step(new Y(a,c,o,l,new v(u.append(f),d,h),u.size-d,!0))}function hi(n,e,t=null,r=n){let s=vd(n,e),i=s&&Ed(r,e);return i?s.map(yo).concat({type:e,attrs:t}).concat(i.map(yo)):null}function yo(n){return{type:n,attrs:null}}function vd(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function Ed(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;a&&c<s;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function Td(n,e,t){let r=k.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=k.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new Y(s,i,s,i,new v(r,0,0),t.length,!0))}function Md(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,a)&&Ad(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&ha(n,o,l,i),fi(n,n.mapping.slice(i).map(l,1),r,void 0,c===null);let u=n.mapping.slice(i),d=u.map(l,1),f=u.map(l+o.nodeSize,1);return n.step(new Y(d,f,d+1,f-1,new v(k.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&fa(n,o,l,i),!1}})}function fa(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(s.text);){let a=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function ha(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
@@ -1 +1 @@
1
- import{e as b,c as w,j as a,l as j}from"./index-BPnG82q8.js";import{i as N}from"./SearchMd-Cd3g9OHi.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
1
+ import{e as b,c as w,j as a,l as j}from"./index-5sXwpSVw.js";import{i as N}from"./SearchMd-D6MpWudP.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
@@ -1 +1 @@
1
- import{e as p,j as t,E as P,r as j,F as w,B as S,o as y}from"./index-BPnG82q8.js";import{i as k}from"./AlertCircle-B4gYnOPQ.js";import{s as z}from"./Plus-CZoFo8m3.js";import{s as F}from"./User01-DkghkjfJ.js";import{t as E}from"./Users01-DSIM6pEW.js";import{D as $,a as I,b as O,c as A,e as R,d as T}from"./dialog-BgALXZ6h.js";import{I as N}from"./input-Dp561wvu.js";import{L as g}from"./label-BSaEPU5n.js";import{d as B,S as V,a as L,b as q,c as C}from"./select-gqSNOxQD.js";import{S as H}from"./skeleton-BrZY2U4q.js";import{T as K}from"./textarea-CimG5sWW.js";import{P as b}from"./index-BpKJI7Dd.js";import{c as W}from"./settings-section-BgPOTco2.js";import{u as Y,a as G}from"./use-secrets-CajEM27b.js";import{R as J}from"./require-capability-C4c85-CT.js";import"./X-CiRjfhfc.js";import"./tooltip-BwiZr2GD.js";import"./Check-Cy2gwr8C.js";import"./ChevronDown-3x5m66Bs.js";import"./ChevronUp-Bh0YaH7H.js";import"./sidebar-DpznaqAr.js";import"./LayoutLeft-XvA4efJR.js";import"./sheet-J-5zCitH.js";import"./card-CPe96wry.js";import"./ArrowUpRight-D0kjnBU3.js";import"./studio-tools-YbndxaJx.js";import"./use-capability-CtdbYGMh.js";import"./access-gate-DADwk2R8.js";import"./capability-load-error-mbutkBah.js";function M(s){const e=p.c(3),{error:r}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(k,{size:16}),e[0]=o):o=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[o,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,o=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==o?(i=t.jsx(o,{size:12}),e[0]=o,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=o):o=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[o,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let c;e[15]!==l?(c=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=c):c=e[16];let x;return e[17]!==u||e[18]!==c?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,c]}),e[17]=u,e[18]=c,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let o,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=o,e[1]=n):(o=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[o,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,o]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),c=G();function x(){o("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await c.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>o(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:c.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:c.isPending||!n.trim()||!a,children:c.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,o]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>o(!0)}),s[0]=l):l=s[0];let c;return s[1]!==r?(c=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:o})]}),s[1]=r,s[2]=c):c=s[2],c}let n,i,a;if(s[3]!==e){const l=e.filter(se),c=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>o(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=c.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:c.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:o}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Ie(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Ie as default};
1
+ import{e as p,j as t,E as P,r as j,F as w,B as S,o as y}from"./index-5sXwpSVw.js";import{i as k}from"./AlertCircle-bShPqj0b.js";import{s as z}from"./Plus-sMFWDZbr.js";import{s as F}from"./User01-CsLiOWB8.js";import{t as E}from"./Users01-D5-Msw_I.js";import{D as $,a as I,b as O,c as A,e as R,d as T}from"./dialog-Bzs3Hvvc.js";import{I as N}from"./input-CK42g6x9.js";import{L as g}from"./label-HQVCFF31.js";import{d as B,S as V,a as L,b as q,c as C}from"./select-DoApsdPu.js";import{S as H}from"./skeleton-96bpkK-M.js";import{T as K}from"./textarea-B2pcaqEK.js";import{P as b}from"./index-BM35mGfP.js";import{c as W}from"./settings-section-CS4YZmEl.js";import{u as Y,a as G}from"./use-secrets-BZKcNE95.js";import{R as J}from"./require-capability-n9H-Zf3o.js";import"./X-gaFIWyoX.js";import"./tooltip-D0LAoEMr.js";import"./Check-Brj4pwYB.js";import"./ChevronDown-D_tH3Pqr.js";import"./ChevronUp-DGQC0Atp.js";import"./sidebar-WtJMNJ3L.js";import"./LayoutLeft-Dp9fcKbL.js";import"./sheet-BgFdZnkM.js";import"./card-PxUBskM1.js";import"./ArrowUpRight-DqovlcCu.js";import"./studio-tools-BfSfNeHU.js";import"./use-capability-R4F2LPam.js";import"./access-gate-DnQ2Yr9c.js";import"./capability-load-error-C4yCAHDm.js";function M(s){const e=p.c(3),{error:r}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(k,{size:16}),e[0]=o):o=e[0];let n;return e[1]!==r.message?(n=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[o,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load secrets: ",r.message]})]}),e[1]=r.message,e[2]=n):n=e[2],n}function Q(s){const e=p.c(5),{scope:r}=s,o=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==o?(i=t.jsx(o,{size:12}),e[0]=o,e[1]=i):i=e[1];let a;return e[2]!==n||e[3]!==i?(a=t.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md bg-muted text-muted-foreground text-xs",children:[i,n]}),e[2]=n,e[3]=i,e[4]=a):a=e[4],a}function D(s){const e=p.c(20),{secret:r}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(w,{size:16,className:"text-muted-foreground"})}),e[0]=o):o=e[0];let n;e[1]!==r.name?(n=t.jsx("span",{className:"font-medium text-sm truncate",children:r.name}),e[1]=r.name,e[2]=n):n=e[2];let i;e[3]!==r.scope?(i=t.jsx(Q,{scope:r.scope}),e[3]=r.scope,e[4]=i):i=e[4];let a;e[5]!==n||e[6]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2",children:[n,i]}),e[5]=n,e[6]=i,e[7]=a):a=e[7];let d;e[8]!==r.description?(d=r.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:r.description}):null,e[8]=r.description,e[9]=d):d=e[9];let u;e[10]!==a||e[11]!==d?(u=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[o,t.jsxs("div",{className:"min-w-0",children:[a,d]})]}),e[10]=a,e[11]=d,e[12]=u):u=e[12];let l;e[13]!==r.createdAt?(l=new Date(r.createdAt).toLocaleDateString(),e[13]=r.createdAt,e[14]=l):l=e[14];let c;e[15]!==l?(c=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=c):c=e[16];let x;return e[17]!==u||e[18]!==c?(x=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[u,c]}),e[17]=u,e[18]=c,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let o,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(w,{size:20,className:"text-muted-foreground"})}),n=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No secrets yet"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Store API keys, tokens, and other sensitive values. Values are encrypted at rest and never returned over the API."})]}),e[0]=o,e[1]=n):(o=e[0],n=e[1]);let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(z,{size:14}),e[2]=i):i=e[2];let a;return e[3]!==r?(a=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[o,n,t.jsxs(S,{onClick:r,size:"sm",className:"mt-2",children:[i,"New secret"]})]}),e[3]=r,e[4]=a):a=e[4],a}function _({open:s,onOpenChange:e}){const[r,o]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),c=G();function x(){o("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await c.mutateAsync({scope:r,name:n.trim(),value:a,description:u.trim()||void 0}),y.success(`Secret "${n.trim()}" created`),f()}catch(v){y.error(v instanceof Error?v.message:"Failed to create secret")}}return t.jsx($,{open:s,onOpenChange:m=>{m?e(m):f()},children:t.jsxs(I,{className:"sm:max-w-lg",children:[t.jsxs(O,{children:[t.jsx(A,{children:"New secret"}),t.jsx(R,{children:"Stored encrypted in the credential vault. Choose who can read it."})]}),t.jsxs("form",{onSubmit:h,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-scope",children:"Scope"}),t.jsxs(B,{value:r,onValueChange:m=>o(m),children:[t.jsx(V,{id:"secret-scope",children:t.jsx(L,{})}),t.jsxs(q,{children:[t.jsx(C,{value:"organization",children:"Organization — visible to all members"}),t.jsx(C,{value:"user",children:"Private — only visible to me"})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-name",children:"Name"}),t.jsx(N,{id:"secret-name",value:n,onChange:m=>i(m.target.value),placeholder:"STRIPE_API_KEY",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Case-insensitive within its scope."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-value",children:"Value"}),t.jsx(N,{id:"secret-value",type:"password",value:a,onChange:m=>d(m.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(g,{htmlFor:"secret-description",children:"Description (optional)"}),t.jsx(K,{id:"secret-description",value:u,onChange:m=>l(m.target.value),rows:2,placeholder:"What is this secret used for?"})]}),t.jsxs(T,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:f,disabled:c.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:c.isPending||!n.trim()||!a,children:c.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,o]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>o(!0)}),s[0]=l):l=s[0];let c;return s[1]!==r?(c=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:o})]}),s[1]=r,s[2]=c):c=s[2],c}let n,i,a;if(s[3]!==e){const l=e.filter(se),c=e.filter(te),x=e.length===1?"":"s";let f;s[7]!==e.length||s[8]!==x?(f=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," secret",x," stored"]}),s[7]=e.length,s[8]=x,s[9]=f):f=s[9];let h;s[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>o(!0),s[10]=h):h=s[10];let m;s[11]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs(S,{onClick:h,size:"sm",children:[t.jsx(z,{size:14}),"New secret"]}),s[11]=m):m=s[11],s[12]!==f?(n=t.jsxs("div",{className:"flex items-center justify-between",children:[f,m]}),s[12]=f,s[13]=n):n=s[13],i=l.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Organization"}),t.jsx("div",{children:l.map(ee)})]}):null,a=c.length>0?t.jsxs("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:[t.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Private to me"}),t.jsx("div",{children:c.map(Z)})]}):null,s[3]=e,s[4]=n,s[5]=i,s[6]=a}else n=s[4],i=s[5],a=s[6];let d;s[14]!==r?(d=t.jsx(_,{open:r,onOpenChange:o}),s[14]=r,s[15]=d):d=s[15];let u;return s[16]!==n||s[17]!==i||s[18]!==a||s[19]!==d?(u=t.jsxs(t.Fragment,{children:[n,i,a,d]}),s[16]=n,s[17]=i,s[18]=a,s[19]=d,s[20]=u):u=s[20],u}function Z(s){return t.jsx(D,{secret:s},s.id)}function ee(s){return t.jsx(D,{secret:s},s.id)}function te(s){return s.scope==="user"}function se(s){return s.scope==="organization"}function re(){const s=p.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(b.Title,{children:"Secrets"}),s[0]=e):e=s[0];let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(b,{children:t.jsx(b.Content,{children:t.jsx(b.Body,{children:t.jsxs(W,{children:[e,t.jsx(P,{fallback:ne,children:t.jsx(j.Suspense,{fallback:t.jsx(H,{className:"h-32 w-full"}),children:t.jsx(X,{})})})]})})})}),s[1]=r):r=s[1],r}function ne(s){const{error:e}=s;return t.jsx(M,{error:e??new Error("Failed to load secrets")})}function Ie(){const s=p.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(J,{capability:"secrets:manage",area:"secrets",children:t.jsx(re,{})}),s[0]=e):e=s[0],e}export{Ie as default};
@@ -1,2 +1,2 @@
1
- import{e as Me,r as R,j as t,B as Ve,l as Yt,c as pe,G as Qs,o as ce,K as Xs}from"./index-BPnG82q8.js";import{t as $n}from"./ChevronDown-3x5m66Bs.js";import{i as ea}from"./ChevronRight-CeIr4WsE.js";import{n as ta}from"./ChevronUp-Bh0YaH7H.js";import{E as qt,v as Gt,K as On,g as _t,F as na,G as sa}from"./agent-icon-DRs2sxx6.js";import{i as aa}from"./Globe01-DCcLGAPs.js";import{S as ft}from"./scroll-area-DuFY4R5d.js";import{T as nt,a as st,b as at}from"./tooltip-BwiZr2GD.js";import{c as Ln,b as In,e as zn,d as Fn,a as Bn,D as Kn}from"./dialog-BgALXZ6h.js";import{I as Hn}from"./input-Dp561wvu.js";import{r as oa,i as vt,P as ra,S as ia,N as la,l as He,c as ca,G as ua,a as da,b as xt,u as ma,d as fa,e as pa,f as ha,g as ga,h as va,j as xa,k as ba,m as pt,n as Lt,o as tt,p as _n,q as jn,s as Sa,t as It,v as ya,w as _a,x as ja,y as ka,z as wa,A as Na,B as Ca,C as Ta,D as ht,E as Ra,F as Aa,H as Da,I as Pa,J as Va,K as Ma,L as zt,M as Ea,O as $a,Q as Oa,R as Ft,T as La,U as Ia,V as kn}from"./index-Nndg_EdX.js";import{a as Un,s as za}from"./Eye-BEaX-nOW.js";import{d as Fa}from"./ZoomOut-OQ9XVMLx.js";import{a as Ba}from"./RefreshCcw01-CoOu-1-t.js";import{s as bt}from"./Plus-CZoFo8m3.js";import{s as jt}from"./Trash01-CdVc63JX.js";import{i as Ka}from"./Zap-BqoFLQhx.js";import{a as Wt,c as Ze,b as Jt,D as Zt,g as Ha}from"./dropdown-menu-uYsl4z-0.js";import{u as Yn,a as St,K as qn,P as Gn,b as Wn,C as Jn,s as Zn,d as yt,D as Qn,c as Xn,S as es,v as Ua,e as ts,h as Ya}from"./sortable.esm-DAdL_KCM.js";import{r as qa,s as Ga,u as it,S as Ut}from"./schema-form-974itnxa.js";import{r as wn,u as Wa,d as Ja,a as Za,i as Qa,f as Xa,P as eo,b as to,S as no}from"./page-seo-form-DJY-iA3B.js";import{c as so,C as ao,e as Nn,d as oo,a as ro,g as io}from"./command-DwAn8s0z.js";import{i as lo}from"./FilterLines-PIiHcomo.js";import{i as co}from"./Tool01-DXZCxrW7.js";import{AddSectionModal as uo}from"./add-section-modal-CAjwD6Pd.js";import{c as mo}from"./save-referenced-block-ShdGpmDs.js";import"./AlertCircle-B4gYnOPQ.js";import"./SwitchHorizontal01-DruCuOB9.js";import"./XCircle-m30sBtwe.js";import"./ArrowUpRight-D0kjnBU3.js";import"./ZapSquare-88gaWy0c.js";import"./Users03-cwi85RQL.js";import"./CheckCircle-CNdjtGTh.js";import"./Check-Cy2gwr8C.js";import"./ChevronLeft-2_IuBsKu.js";import"./DotsVertical-FCIPj2jh.js";import"./Container-CYA7KoET.js";import"./Star01-BQu9_hS7.js";import"./Palette-BvgmCjcf.js";import"./HardDrive-DF3wR4Ey.js";import"./Stars02-DQPSVMUP.js";import"./Key01-DOICf9Yf.js";import"./LayoutLeft-XvA4efJR.js";import"./LinkExternal01-kEaZ-3VP.js";import"./Monitor01-BQ2ab3I8.js";import"./Sun-CGlOqn-C.js";import"./Play-CgnBFM99.js";import"./SearchMd-Cd3g9OHi.js";import"./Settings02-h4KhooA8.js";import"./Shield01-CxluyAom.js";import"./Stars01-D3E_UsFP.js";import"./Upload01-hFtvGOKc.js";import"./User01-DkghkjfJ.js";import"./Users01-DSIM6pEW.js";import"./XClose-DEtxBka1.js";import"./X-CiRjfhfc.js";import"./select-gqSNOxQD.js";import"./agent-capabilities-f1C_QUMa.js";import"./chat-context-BjxJIMHx.js";import"./tab-id-Bc_4nZgl.js";import"./use-mcp-client-iXdxenz3.js";import"./watch-sse-pool-BZQA3Ki3.js";import"./decopilot-sse-pool-Qs-1EY0r.js";import"./studio-tools-YbndxaJx.js";import"./use-virtual-mcp-Cw_yVFMO.js";import"./use-collections-D52tQdGt.js";import"./use-ai-providers-B4z2G4rP.js";import"./use-organization-settings-MrnwSgAR.js";import"./pair-B6H2XHda.js";import"./use-clock-tick-CPPdyWgW.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BEZFUgho.js";import"./file-type-icon-BI-57QdR.js";import"./content-blocks-o63cs2vh.js";import"./types-BYtVTpDQ.js";import"./shell-layout-B1bpQmja.js";import"./avatar-CWn5LER_.js";import"./required-auth-layout-BApuEUpI.js";import"./useRouterState-IhZ1SxRm.js";import"./use-org-sso-Sk1A6q8-.js";import"./integration-icon-CcFsasgm.js";import"./use-navigate-to-agent-DIjWe8In.js";import"./use-connection-DyyYYs8L.js";import"./use-mcp-prompts-BZ3M88pO.js";import"./form-BSWyFOE3.js";import"./label-BSaEPU5n.js";import"./spinner-DWj9d3Oy.js";import"./drawer-DLAFbROZ.js";import"./collection-search-CR7VmYXP.js";import"./tabs-9ZkZ5CXu.js";import"./toggle-group-BqOsII08.js";import"./connect-desktop-dialog-CUd_SkHU.js";import"./agent-icons-4ZuoYvOM.js";import"./checkbox-CMfBi1P9.js";import"./skeleton-BrZY2U4q.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-BgPOTco2.js";import"./card-CPe96wry.js";import"./popover-BYJBybY_.js";import"./useInfiniteQuery-DHhL-q8j.js";import"./use-infinite-scroll-D2-BvjXC.js";import"./index-BK9zbgCs.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-BL818aqT.js";import"./sidebar-DpznaqAr.js";import"./sheet-J-5zCitH.js";import"./toolbar-oWPvqwRC.js";import"./use-create-virtual-mcp-w-CGYLKc.js";import"./github-repo-picker-DFc58L4T.js";import"./use-mcp-tools-BFte_Z9f.js";import"./extract-connection-data-8yLRil2N.js";import"./generate-id-Cx2Cl6ns.js";import"./collections-D3ATOWCI.js";import"./alert-dialog-CvpxH7Lf.js";import"./index-CUVr6lcg.js";import"./use-org-auth-client-CjM9gfPH.js";import"./hover-card-B2Xe1JoR.js";import"./task-status-BNkxxOv6.js";import"./use-status-sounds-BwNN0Dt-.js";import"./empty-state-CzSsahKD.js";import"./resizable-D7pt8dup.js";import"./use-capability-CtdbYGMh.js";import"./header-tab-button-EU-XSa1F.js";import"./index-BHORPjEK.js";import"./textarea-CimG5sWW.js";import"./user-CJUwgqvV.js";import"./tools-list-C2in0sGo.js";import"./badge-CIMelj9a.js";import"./connection-slug-eyAPH6o3.js";import"./switch-CWe9x1dO.js";import"./use-debounced-autosave-7GLgaJXq.js";import"./index-BpKJI7Dd.js";import"./search-input-DACBbzIk.js";import"./collection-tabs-DyRPz2M0.js";import"./use-secrets-CajEM27b.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./accordion-67DY3M-J.js";import"./view-mode-toggle-CMrO4dTZ.js";import"./select-model-CbdvfMbD.js";import"./use-automations-Cgz4YKs5.js";import"./monaco-editor-BR_tbU8a.js";import"./automation-runs-CAmeSsSa.js";import"./table-MDhW4B8D.js";import"./use-members-lO5UPidt.js";import"./useSuspenseInfiniteQuery-oHftqcSU.js";import"./automation-list-row-DUFXJruv.js";import"./connection-card-0Tyv2fap.js";import"./use-registry-connections-CC-YLphz.js";import"./connection-form-helpers-Csat880R.js";import"./calendar-YPBFp_E0.js";import"./image-field-D5MmzFT-.js";import"./use-file-configs-fZ_0pNgv.js";import"./index-9-_G5hYz.js";function fo(r){const e=Me.c(38),{open:s,initialName:a,autoLabel:i,isPending:c,onSubmit:p,onOpenChange:d}=r,l=c===void 0?!1:c,[g,v]=R.useState(a),[b,_]=R.useState(s);s!==b&&(_(s),s&&v(a));let w;e[0]!==l||e[1]!==d?(w=E=>{!E&&!l&&d(!1)},e[0]=l,e[1]=d,e[2]=w):w=e[2];const u=w;let x;e[3]!==l||e[4]!==g||e[5]!==p?(x=async E=>{E.preventDefault(),!l&&await p(g.trim())},e[3]=l,e[4]=g,e[5]=p,e[6]=x):x=e[6];const f=x;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Ln,{children:"Rename variant"}),e[7]=N):N=e[7];const h=i||"the rule";let S;e[8]!==h?(S=t.jsxs(In,{children:[N,t.jsxs(zn,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",t.jsx("span",{className:"font-medium",children:h}),"."]})]}),e[8]=h,e[9]=S):S=e[9];let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=C):C=e[10];let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=E=>v(E.target.value),e[11]=j):j=e[11];let P;e[12]!==i||e[13]!==l||e[14]!==g?(P=t.jsxs("div",{className:"space-y-1.5 py-4",children:[C,t.jsx(Hn,{id:"variant-rename-name",value:g,onChange:j,placeholder:i,autoFocus:!0,disabled:l})]}),e[12]=i,e[13]=l,e[14]=g,e[15]=P):P=e[15];let k;e[16]!==d?(k=()=>d(!1),e[16]=d,e[17]=k):k=e[17];let A;e[18]!==l||e[19]!==k?(A=t.jsx(Ve,{type:"button",variant:"outline",onClick:k,disabled:l,children:"Cancel"}),e[18]=l,e[19]=k,e[20]=A):A=e[20];let D;e[21]!==l?(D=l?t.jsxs(t.Fragment,{children:[t.jsx(Yt,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=l,e[22]=D):D=e[22];let V;e[23]!==l||e[24]!==D?(V=t.jsx(Ve,{type:"submit",disabled:l,children:D}),e[23]=l,e[24]=D,e[25]=V):V=e[25];let I;e[26]!==A||e[27]!==V?(I=t.jsxs(Fn,{children:[A,V]}),e[26]=A,e[27]=V,e[28]=I):I=e[28];let F;e[29]!==f||e[30]!==I||e[31]!==S||e[32]!==P?(F=t.jsx(Bn,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:f,children:[S,P,I]})}),e[29]=f,e[30]=I,e[31]=S,e[32]=P,e[33]=F):F=e[33];let M;return e[34]!==u||e[35]!==s||e[36]!==F?(M=t.jsx(Kn,{open:s,onOpenChange:u,children:F}),e[34]=u,e[35]=s,e[36]=F,e[37]=M):M=e[37],M}function Bt(r,e,s,a,i){const c={...r[e]};if(i.length>1){const p=c.sections,d=[...p?.variants??[]];d[a]&&(d[a]={...d[a],value:s}),c.sections={...p,variants:d}}else c.sections=s;return c}function po(r){return structuredClone(r)}function ho(r){return!r.isSavedBlock&&!r.isMultivariate}function Cn(r){const e=r.replace(/[^A-Za-z0-9_-]/g,"");return/^[A-Za-z]/.test(e)?e:e?`Block${e}`:""}function Tn(r,e){const s=r.trim();return s?s.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,s)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_-]*$/.test(s)?null:"Use letters, numbers, hyphens, or underscores. Must start with a letter.":"Block name is required."}const go="oklch(0.65 0.15 160)",vo="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)]",xo="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",bo="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function So(r){const e=Me.c(33),{variant:s,selected:a,canDelete:i,onSelect:c,onDuplicate:p,onDelete:d}=r;let l;e[0]!==c?(l=V=>{V.target===V.currentTarget&&(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),c())},e[0]=c,e[1]=l):l=e[1];const g=a?xo:vo;let v;e[2]!==g?(v=pe("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors cursor-pointer",g),e[2]=g,e[3]=v):v=e[3];let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(qt,{className:"h-4 w-4 shrink-0",style:{color:go}}),e[4]=b):b=e[4];let _;e[5]!==s.label?(_=t.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s.label}),e[5]=s.label,e[6]=_):_=e[6];const w=`Open actions for ${s.label}`;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Gt,{size:14}),e[7]=u):u=e[7];let x;e[8]!==w?(x=t.jsx(Wt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":w,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:_o,onPointerDown:yo,children:u})}),e[8]=w,e[9]=x):x=e[9];let f;e[10]!==p?(f=V=>{V.stopPropagation(),p()},e[10]=p,e[11]=f):f=e[11];let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Un,{size:14}),e[12]=N):N=e[12];let h;e[13]!==f?(h=t.jsxs(Ze,{onClick:f,children:[N,"Duplicate"]}),e[13]=f,e[14]=h):h=e[14];const S=!i;let C;e[15]!==d?(C=V=>{V.stopPropagation(),d()},e[15]=d,e[16]=C):C=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(jt,{size:14}),e[17]=j):j=e[17];let P;e[18]!==S||e[19]!==C?(P=t.jsxs(Ze,{variant:"destructive",disabled:S,onClick:C,children:[j,"Delete"]}),e[18]=S,e[19]=C,e[20]=P):P=e[20];let k;e[21]!==h||e[22]!==P?(k=t.jsxs(Jt,{align:"end",children:[h,P]}),e[21]=h,e[22]=P,e[23]=k):k=e[23];let A;e[24]!==k||e[25]!==x?(A=t.jsxs(Zt,{children:[x,k]}),e[24]=k,e[25]=x,e[26]=A):A=e[26];let D;return e[27]!==c||e[28]!==l||e[29]!==A||e[30]!==v||e[31]!==_?(D=t.jsxs("div",{role:"button",tabIndex:0,onClick:c,onKeyDown:l,className:v,children:[b,_,A]}),e[27]=c,e[28]=l,e[29]=A,e[30]=v,e[31]=_,e[32]=D):D=e[32],D}function yo(r){return r.stopPropagation()}function _o(r){return r.stopPropagation()}function jo(r){const e=Me.c(34),{variants:s,selectedIndex:a,onSelect:i,onDuplicate:c,onDelete:p,onRemoveAll:d,onAdd:l}=r,g=s.length>1;let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[0]=v):v=e[0];let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(bt,{size:14}),e[1]=b):b=e[1];let _;e[2]!==l?(_=t.jsx(nt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:l,children:b})}),e[2]=l,e[3]=_):_=e[3];let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(st,{children:"Add variant"}),e[4]=w):w=e[4];let u;e[5]!==_?(u=t.jsxs(at,{children:[_,w]}),e[5]=_,e[6]=u):u=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(jt,{size:14}),e[7]=x):x=e[7];let f;e[8]!==d?(f=t.jsx(nt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Remove all variants",className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:x})}),e[8]=d,e[9]=f):f=e[9];let N;e[10]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(st,{children:"Remove all variants"}),e[10]=N):N=e[10];let h;e[11]!==f?(h=t.jsxs(at,{children:[f,N]}),e[11]=f,e[12]=h):h=e[12];let S;e[13]!==u||e[14]!==h?(S=t.jsxs("div",{className:"flex items-center justify-between",children:[v,t.jsxs("div",{className:"flex items-center gap-0.5",children:[u,h]})]}),e[13]=u,e[14]=h,e[15]=S):S=e[15];let C;if(e[16]!==g||e[17]!==p||e[18]!==c||e[19]!==i||e[20]!==a||e[21]!==s){let k;e[23]!==g||e[24]!==p||e[25]!==c||e[26]!==i||e[27]!==a?(k=A=>t.jsx(So,{variant:A,selected:A.index===a,canDelete:g,onSelect:()=>i(A.index),onDuplicate:()=>c(A.index),onDelete:()=>p(A.index)},`${A.label}-${A.index}`),e[23]=g,e[24]=p,e[25]=c,e[26]=i,e[27]=a,e[28]=k):k=e[28],C=s.map(k),e[16]=g,e[17]=p,e[18]=c,e[19]=i,e[20]=a,e[21]=s,e[22]=C}else C=e[22];let j;e[29]!==C?(j=t.jsx("div",{className:"space-y-0.5",children:C}),e[29]=C,e[30]=j):j=e[30];let P;return e[31]!==S||e[32]!==j?(P=t.jsxs("div",{className:"space-y-1 border-b p-2",children:[S,j]}),e[31]=S,e[32]=j,e[33]=P):P=e[33],P}function ko(r){return r.schema?.definitions??r.schema?.$defs??{}}function wo(r,e){const s=ko(e),a=s[btoa(r)];if(!a)return;let i=typeof a.image=="string"?a.image:void 0;if(!i&&Array.isArray(a.allOf)){const c=a.allOf.find(p=>typeof p.$ref=="string")?.$ref;if(typeof c=="string"){const p=c.replace("#/definitions/",""),d=s[p];i=typeof d?.image=="string"?d.image:void 0}}if(i?.includes("{{{"))return i}function No(r,e){if(!e)return;const s=oa(r);if(!s)return;const a=wo(s.resolveType,e);if(!a)return;const i=qa(a,s.data);if(i)return Ga(i)}function gt(r,e){return r.map((s,a)=>{const i=s.__resolveType??"",c=vt(i);if(!c&&i!==""&&!i.includes("/")&&i in e){const g=e[i],v=typeof g?.name=="string"&&g.name||i.replace(/[-_]/g," ").replace(/\b\w/g,b=>b.toUpperCase())||`Section ${a+1}`;return{index:a,resolveType:i,label:v,isLazy:!1,isSavedBlock:!0}}const p=c?s.section:void 0,d=c?p?.__resolveType??"":i;if(d===ra||d===ia){const g=c?p:s,v=Array.isArray(g?.variants)?g.variants:[];if(v.length===1&&(v[0]?.rule?.__resolveType??"")===la){const w=v[0]?.value??{};let u=w.__resolveType??"";const x=vt(u);return x&&(u=w.section?.__resolveType??u),{index:a,resolveType:i,label:He(u)||`Section ${a+1}`,isHidden:!0,isLazy:x}}const b=v[0]?.value?.__resolveType,_=b?He(b):"Section";return{index:a,resolveType:i,label:`Variants of ${_}`,isMultivariate:!0,isLazy:c}}const l=c?s.section?.__resolveType??i:i;if(c&&l!==""&&!l.includes("/")&&l in e){const g=e[l],v=typeof g?.name=="string"&&g.name||l.replace(/[-_]/g," ").replace(/\b\w/g,b=>b.toUpperCase())||`Section ${a+1}`;return{index:a,resolveType:i,label:v,isLazy:!0,isSavedBlock:!0}}return{index:a,resolveType:i,label:He(l)||`Section ${a+1}`,isLazy:c}})}const Co="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",To="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 Rn(r){return Array.from({length:r},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ns(r){return r.map((e,s)=>({...e,index:s}))}function Ro(r,e){if(e===r.length)return r;if(e<r.length)return ns(r.slice(0,e));const s=Array.from({length:e-r.length},(a,i)=>({id:crypto.randomUUID(),index:r.length+i}));return[...r,...s]}function ss(r){const e=Me.c(20),{section:s,raw:a,meta:i}=r,c=s.isSavedBlock===!0,p=s.isMultivariate===!0;let d;e[0]!==i||e[1]!==a?(d=a&&i?No(a,i):void 0,e[0]=i,e[1]=a,e[2]=d):d=e[2];const l=d;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Fa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=g):g=e[3];let v;e[4]!==l?(v=l&&t.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=l,e[5]=v):v=e[5];let b;e[6]!==p||e[7]!==c?(b=c?{color:ua}:p?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=p,e[7]=c,e[8]=b):b=e[8];let _;e[9]!==b?(_=t.jsx(qt,{className:"h-4 w-4 shrink-0",style:b}),e[9]=b,e[10]=_):_=e[10];const w=s.isHidden&&"line-through opacity-50";let u;e[11]!==w?(u=pe("min-w-0 flex-1 truncate text-sm font-medium",w),e[11]=w,e[12]=u):u=e[12];let x;e[13]!==s.label||e[14]!==u?(x=t.jsx("span",{className:u,children:s.label}),e[13]=s.label,e[14]=u,e[15]=x):x=e[15];let f;return e[16]!==v||e[17]!==_||e[18]!==x?(f=t.jsxs(t.Fragment,{children:[g,v,_,x]}),e[16]=v,e[17]=_,e[18]=x,e[19]=f):f=e[19],f}function as(r,e){const s=r.isSavedBlock===!0,a=r.isMultivariate===!0;return pe("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":s?Co:a?"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)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ao(r){const e=Me.c(59),{section:s,raw:a,meta:i,sortableId:c,selected:p,onSelect:d,onDelete:l,onDuplicate:g,onMakeReusable:v,onToggleHidden:b,onToggleLazy:_,onAddVariant:w}=r,u=a?vt(a.__resolveType??""):!1;let x;e[0]!==s?(x=ca(s),e[0]=s,e[1]=x):x=e[1];const f=x;let N;e[2]!==c?(N={id:c,animateLayoutChanges:Eo},e[2]=c,e[3]=N):N=e[3];const{attributes:h,listeners:S,setNodeRef:C,transform:j,isDragging:P}=Wn(N);let k;e[4]!==j?(k=Jn.Transform.toString(j?{...j,x:0}:null),e[4]=j,e[5]=k):k=e[5];const A=P?0:void 0;let D;e[6]!==k||e[7]!==A?(D={transform:k,opacity:A},e[6]=k,e[7]=A,e[8]=D):D=e[8];const V=D;let I;e[9]!==s?(I=ho(s),e[9]=s,e[10]=I):I=e[10];const F=I,M="button",E=0;let J;e[11]!==d?(J=U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),d())},e[11]=d,e[12]=J):J=e[12];const se=P?"cursor-grabbing":"cursor-pointer";let $;e[13]!==s||e[14]!==p||e[15]!==se?($=pe("touch-none transition-colors",se,as(s,p)),e[13]=s,e[14]=p,e[15]=se,e[16]=$):$=e[16];let he;e[17]!==i||e[18]!==a||e[19]!==s?(he=t.jsx(ss,{section:s,raw:a,meta:i}),e[17]=i,e[18]=a,e[19]=s,e[20]=he):he=e[20];const K=!s.isMultivariate&&t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":u?"Disable async render":"Enable async render",className:pe("h-7 w-7 shrink-0",u?"":"opacity-0 group-hover:opacity-100"),onClick:U=>{U.stopPropagation(),_()},onPointerDown:Mo,children:t.jsx(Ka,{className:pe("h-3.5 w-3.5",u&&"text-yellow-500")})});let X;e[21]!==b||e[22]!==s.isHidden||e[23]!==s.isMultivariate?(X=!s.isMultivariate&&t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":s.isHidden?"Show section":"Hide section",className:pe("h-7 w-7 shrink-0",s.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:U=>{U.stopPropagation(),b()},onPointerDown:Vo,children:s.isHidden?t.jsx(Ba,{className:"h-3.5 w-3.5"}):t.jsx(za,{className:"h-3.5 w-3.5"})}),e[21]=b,e[22]=s.isHidden,e[23]=s.isMultivariate,e[24]=X):X=e[24];let re;e[25]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Wt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Po,onPointerDown:Do,children:t.jsx(Gt,{className:"h-3.5 w-3.5"})})}),e[25]=re):re=e[25];let ue;e[26]!==g?(ue=U=>{U.stopPropagation(),g()},e[26]=g,e[27]=ue):ue=e[27];let Z;e[28]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(Un,{className:"h-4 w-4"}),e[28]=Z):Z=e[28];let Q;e[29]!==ue?(Q=t.jsxs(Ze,{onClick:ue,children:[Z,"Duplicate"]}),e[29]=ue,e[30]=Q):Q=e[30];let G;e[31]!==f||e[32]!==w?(G=f&&t.jsxs(Ze,{className:bo,onClick:U=>{U.stopPropagation(),w()},children:[t.jsx(On,{className:"h-4 w-4"}),"Add variant"]}),e[31]=f,e[32]=w,e[33]=G):G=e[33];let Y;e[34]!==F||e[35]!==v?(Y=F&&t.jsxs(Ze,{className:To,onClick:U=>{U.stopPropagation(),v()},children:[t.jsx(qt,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=F,e[35]=v,e[36]=Y):Y=e[36];let W;e[37]!==l?(W=U=>{U.stopPropagation(),l()},e[37]=l,e[38]=W):W=e[38];let ae;e[39]===Symbol.for("react.memo_cache_sentinel")?(ae=t.jsx(jt,{className:"h-4 w-4"}),e[39]=ae):ae=e[39];let ie;e[40]!==W?(ie=t.jsxs(Ze,{className:"text-destructive focus:text-destructive",onClick:W,children:[ae,"Delete"]}),e[40]=W,e[41]=ie):ie=e[41];let H;e[42]!==Q||e[43]!==G||e[44]!==Y||e[45]!==ie?(H=t.jsxs(Zt,{children:[re,t.jsxs(Jt,{align:"end",className:"w-44",children:[Q,G,Y,ie]})]}),e[42]=Q,e[43]=G,e[44]=Y,e[45]=ie,e[46]=H):H=e[46];let le;return e[47]!==h||e[48]!==S||e[49]!==d||e[50]!==C||e[51]!==V||e[52]!==$||e[53]!==he||e[54]!==K||e[55]!==X||e[56]!==H||e[57]!==J?(le=t.jsxs("div",{ref:C,style:V,...h,...S,role:M,tabIndex:E,onClick:d,onKeyDown:J,className:$,children:[he,K,X,H]}),e[47]=h,e[48]=S,e[49]=d,e[50]=C,e[51]=V,e[52]=$,e[53]=he,e[54]=K,e[55]=X,e[56]=H,e[57]=J,e[58]=le):le=e[58],le}function Do(r){return r.stopPropagation()}function Po(r){return r.stopPropagation()}function Vo(r){return r.stopPropagation()}function Mo(r){return r.stopPropagation()}function Eo(){return!1}function $o(r){const e=Me.c(89),{listKey:s,rawSections:a,sections:i,meta:c,selectedIndex:p,onSelect:d,onReorder:l,onDelete:g,onDuplicate:v,onMakeReusable:b,onToggleHidden:_,onToggleLazy:w,onAddVariant:u,onAddSection:x,canAddSection:f}=r,N=f===void 0?!0:f;let h;e[0]!==i.length?(h=()=>Rn(i.length),e[0]=i.length,e[1]=h):h=e[1];const[S,C]=R.useState(h),[j,P]=R.useState(null),[k,A]=R.useState(s),[D,V]=R.useState(i.length),I=R.useRef(!1);k!==s?(A(s),V(i.length),C(Rn(i.length))):D!==i.length&&(V(i.length),C(q=>Ro(q,i.length)));let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[2]=F):F=e[2];let M;e[3]===Symbol.for("react.memo_cache_sentinel")?(M={coordinateGetter:Zn},e[3]=M):M=e[3];const E=Yn(St(Gn,F),St(qn,M));let J;e[4]!==S?(J=S.map(Oo),e[4]=S,e[5]=J):J=e[5];const se=J;let $;e[6]===Symbol.for("react.memo_cache_sentinel")?($=q=>{P(String(q.active.id))},e[6]=$):$=e[6];const he=$;let K;e[7]!==se||e[8]!==l?(K=q=>{P(null);const{active:O,over:de}=q;if(!de||O.id===de.id)return;const Ie=se.indexOf(String(O.id)),Be=se.indexOf(String(de.id));Ie===-1||Be===-1||(C(Ue=>ns(yt([...Ue],Ie,Be))),I.current=!0,requestAnimationFrame(()=>{I.current=!1}),l?.(Ie,Be))},e[7]=se,e[8]=l,e[9]=K):K=e[9];const X=K;let re;e[10]===Symbol.for("react.memo_cache_sentinel")?(re=()=>{P(null)},e[10]=re):re=e[10];const ue=re;let Z,Q,G,Y,W,ae,ie,H,le,U,Ce,Ee,ge,Te,we;if(e[11]!==j||e[12]!==N||e[13]!==S||e[14]!==se||e[15]!==X||e[16]!==c||e[17]!==x||e[18]!==u||e[19]!==g||e[20]!==v||e[21]!==b||e[22]!==d||e[23]!==_||e[24]!==w||e[25]!==a||e[26]!==i||e[27]!==p||e[28]!==E){Te=Symbol.for("react.early_return_sentinel");e:{const q=O=>{I.current||d(O)};if(e[44]!==j||e[45]!==N||e[46]!==S||e[47]!==x||e[48]!==a||e[49]!==i){const O=j?S.find(de=>de.id===j):null;if(Y=O!=null?i[O.index]:null,G=O!=null?a[O.index]:void 0,S.length===0){let de;e[53]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[53]=de):de=e[53];const Ie=!N;let Be;e[54]===Symbol.for("react.memo_cache_sentinel")?(Be=t.jsx(bt,{size:14}),e[54]=Be):Be=e[54];let Ue;e[55]!==x||e[56]!==Ie?(Ue=t.jsxs("div",{className:"space-y-2",children:[de,t.jsxs(Ve,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:x,children:[Be,"Add section"]})]}),e[55]=x,e[56]=Ie,e[57]=Ue):Ue=e[57],Te=Ue;break e}ge=pe(O&&"cursor-grabbing"),e[44]=j,e[45]=N,e[46]=S,e[47]=x,e[48]=a,e[49]=i,e[50]=G,e[51]=Y,e[52]=ge}else G=e[50],Y=e[51],ge=e[52];Q=Qn,H=E,le=Xn,U=he,Ce=X,Ee=ue,Z=es,ae=se,ie=Ua,we="space-y-1",W=S.map(O=>{const de=i[O.index];return de?t.jsx(Ao,{sortableId:O.id,section:de,raw:a[O.index],meta:c,selected:p===O.index,onSelect:()=>q(O.index),onDelete:()=>g(O.index),onDuplicate:()=>v(O.index),onMakeReusable:()=>b(O.index),onToggleHidden:()=>_(O.index),onToggleLazy:()=>w(O.index),onAddVariant:()=>u(O.index)},O.id):null})}e[11]=j,e[12]=N,e[13]=S,e[14]=se,e[15]=X,e[16]=c,e[17]=x,e[18]=u,e[19]=g,e[20]=v,e[21]=b,e[22]=d,e[23]=_,e[24]=w,e[25]=a,e[26]=i,e[27]=p,e[28]=E,e[29]=Z,e[30]=Q,e[31]=G,e[32]=Y,e[33]=W,e[34]=ae,e[35]=ie,e[36]=H,e[37]=le,e[38]=U,e[39]=Ce,e[40]=Ee,e[41]=ge,e[42]=Te,e[43]=we}else Z=e[29],Q=e[30],G=e[31],Y=e[32],W=e[33],ae=e[34],ie=e[35],H=e[36],le=e[37],U=e[38],Ce=e[39],Ee=e[40],ge=e[41],Te=e[42],we=e[43];if(Te!==Symbol.for("react.early_return_sentinel"))return Te;let Re;e[58]!==W||e[59]!==we?(Re=t.jsx("div",{className:we,children:W}),e[58]=W,e[59]=we,e[60]=Re):Re=e[60];let ve;e[61]!==Z||e[62]!==ae||e[63]!==ie||e[64]!==Re?(ve=t.jsx(Z,{items:ae,strategy:ie,children:Re}),e[61]=Z,e[62]=ae,e[63]=ie,e[64]=Re,e[65]=ve):ve=e[65];let Le;e[66]!==G||e[67]!==Y||e[68]!==c?(Le=Y?t.jsx("div",{className:pe("cursor-grabbing shadow-lg ring-1 ring-border/60",as(Y,!1)),children:t.jsx(ss,{section:Y,raw:G,meta:c})}):null,e[66]=G,e[67]=Y,e[68]=c,e[69]=Le):Le=e[69];let Ne;e[70]!==Le?(Ne=t.jsx(ts,{dropAnimation:null,children:Le}),e[70]=Le,e[71]=Ne):Ne=e[71];let xe;e[72]!==Q||e[73]!==H||e[74]!==le||e[75]!==U||e[76]!==Ce||e[77]!==Ee||e[78]!==ve||e[79]!==Ne?(xe=t.jsxs(Q,{sensors:H,collisionDetection:le,onDragStart:U,onDragEnd:Ce,onDragCancel:Ee,children:[ve,Ne]}),e[72]=Q,e[73]=H,e[74]=le,e[75]=U,e[76]=Ce,e[77]=Ee,e[78]=ve,e[79]=Ne,e[80]=xe):xe=e[80];const be=!N;let Oe;e[81]===Symbol.for("react.memo_cache_sentinel")?(Oe=t.jsx(bt,{size:14}),e[81]=Oe):Oe=e[81];let oe;e[82]!==x||e[83]!==be?(oe=t.jsxs(Ve,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:be,onClick:x,children:[Oe,"Add section"]}),e[82]=x,e[83]=be,e[84]=oe):oe=e[84];let ke;return e[85]!==ge||e[86]!==xe||e[87]!==oe?(ke=t.jsxs("div",{className:ge,children:[xe,oe]}),e[85]=ge,e[86]=xe,e[87]=oe,e[88]=ke):ke=e[88],ke}function Oo(r){return r.id}const Lo=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Io={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function Kt(r){return _t(r)!==void 0}function Qt(r,e){if(e){if(Kt(e))return e;const s=Io[e];if(s&&Kt(s))return s}for(const[s,a]of Lo)if(s.test(r)&&Kt(a))return a;return"FilterLines"}function zo(r){return _t(r)??lo}function An(r){const e=Me.c(11),{iconName:s,size:a,className:i}=r,c=a===void 0?"md":a;let p;e[0]!==s?(p=zo(s),e[0]=s,e[1]=p):p=e[1];const d=p,l=c==="sm"?"size-7":"size-9",g=c==="sm"?16:18;let v;e[2]!==l||e[3]!==i?(v=pe("flex shrink-0 items-center justify-center rounded-full bg-muted",l,i),e[2]=l,e[3]=i,e[4]=v):v=e[4];let b;e[5]!==d||e[6]!==g?(b=t.jsx(d,{size:g,className:"text-muted-foreground"}),e[5]=d,e[6]=g,e[7]=b):b=e[7];let _;return e[8]!==v||e[9]!==b?(_=t.jsx("div",{className:v,children:b}),e[8]=v,e[9]=b,e[10]=_):_=e[10],_}const os="Users03";function Fo(r){const e=r.manifest?.blocks??{},s=[];for(const[a,i]of Object.entries(e))if(a.includes("matchers"))for(const c of Object.keys(i)){if(c.includes("always"))continue;const p=da(c,r);s.push({resolveType:c,title:p.title??He(c),description:p.description,iconName:Qt(c,p.icon)})}return s}function Bo(r,e){if(!r)return os;const s=e.find(a=>a.resolveType===r);return s?s.iconName:Qt(r)}function Dn(r){const e=Me.c(41),{currentRt:s,currentLabel:a,matchers:i,onSelect:c}=r,[p,d]=R.useState(!1);let l;if(e[0]!==s||e[1]!==i){const M=Bo(s,i);l=_t(M),e[0]=s,e[1]=i,e[2]=l}else l=e[2];const g=l;let v;e[3]!==c?(v=M=>{c(M),d(!1)},e[3]=c,e[4]=v):v=e[4];const b=v;let _;e[5]===Symbol.for("react.memo_cache_sentinel")?(_=()=>d(!0),e[5]=_):_=e[5];let w;e[6]!==g?(w=g&&t.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[6]=g,e[7]=w):w=e[7];let u;e[8]!==a?(u=t.jsx("span",{className:"flex-1 truncate",children:a}),e[8]=a,e[9]=u):u=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx($n,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[10]=x):x=e[10];let f;e[11]!==w||e[12]!==u?(f=t.jsxs("button",{type:"button",onClick:_,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[w,u,x]}),e[11]=w,e[12]=u,e[13]=f):f=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(so,{placeholder:"Search rules..."}),e[14]=N):N=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(ao,{children:"No rules found."}),e[15]=h):h=e[15];let S;e[16]!==b?(S=()=>b(""),e[16]=b,e[17]=S):S=e[17];const C=!s&&"bg-accent/60";let j;e[18]!==C?(j=pe("gap-2.5",C),e[18]=C,e[19]=j):j=e[19];let P;e[20]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(An,{iconName:os,size:"sm"}),e[20]=P):P=e[20];let k;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"text-sm",children:"Always"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Target all users"})]}),e[21]=k):k=e[21];let A;e[22]!==S||e[23]!==j?(A=t.jsxs(Nn,{value:"always Target all users",onSelect:S,className:j,children:[P,k]}),e[22]=S,e[23]=j,e[24]=A):A=e[24];let D;if(e[25]!==s||e[26]!==b||e[27]!==i){let M;e[29]!==s||e[30]!==b?(M=E=>t.jsxs(Nn,{value:`${E.title} ${E.resolveType} ${E.description??""}`,onSelect:()=>b(E.resolveType),className:pe("gap-2.5",s===E.resolveType&&"bg-accent/60"),children:[t.jsx(An,{iconName:E.iconName,size:"sm"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"text-sm",children:E.title}),E.description&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:E.description})]})]},E.resolveType),e[29]=s,e[30]=b,e[31]=M):M=e[31],D=i.map(M),e[25]=s,e[26]=b,e[27]=i,e[28]=D}else D=e[28];let V;e[32]!==A||e[33]!==D?(V=t.jsxs(oo,{children:[h,t.jsxs(ro,{children:[A,D]})]}),e[32]=A,e[33]=D,e[34]=V):V=e[34];let I;e[35]!==p||e[36]!==V?(I=t.jsxs(io,{open:p,onOpenChange:d,title:"Choose a rule",description:"Pick how to target users for this variant",className:"sm:max-w-lg",children:[N,V]}),e[35]=p,e[36]=V,e[37]=I):I=e[37];let F;return e[38]!==I||e[39]!==f?(F=t.jsxs(t.Fragment,{children:[f,I]}),e[38]=I,e[39]=f,e[40]=F):F=e[40],F}const Ko="oklch(0.65 0.15 160)",rs="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function Xt(r){const e=Me.c(5),{rule:s,matchers:a}=r,i=s?.__resolveType??"";let c;if(e[0]!==a||e[1]!==i){const g=a.find(v=>v.resolveType===i)?.iconName??Qt(i);c=_t(g),e[0]=a,e[1]=i,e[2]=c}else c=e[2];const p=c;if(!p)return null;let d;return e[3]!==p?(d=t.jsx(p,{size:14,className:"shrink-0"}),e[3]=p,e[4]=d):d=e[4],d}function Pn(r){return r.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
1
+ import{e as Me,r as R,j as t,B as Ve,l as Yt,c as pe,G as Qs,o as ce,K as Xs}from"./index-5sXwpSVw.js";import{t as $n}from"./ChevronDown-D_tH3Pqr.js";import{i as ea}from"./ChevronRight-DBqLyhnF.js";import{n as ta}from"./ChevronUp-DGQC0Atp.js";import{E as qt,v as Gt,K as On,g as _t,F as na,G as sa}from"./agent-icon-4CMG3vFL.js";import{i as aa}from"./Globe01-D4-Uy-9c.js";import{S as ft}from"./scroll-area-ilU6DceG.js";import{T as nt,a as st,b as at}from"./tooltip-D0LAoEMr.js";import{c as Ln,b as In,e as zn,d as Fn,a as Bn,D as Kn}from"./dialog-Bzs3Hvvc.js";import{I as Hn}from"./input-CK42g6x9.js";import{r as oa,i as vt,P as ra,S as ia,N as la,l as He,c as ca,G as ua,a as da,b as xt,u as ma,d as fa,e as pa,f as ha,g as ga,h as va,j as xa,k as ba,m as pt,n as Lt,o as tt,p as _n,q as jn,s as Sa,t as It,v as ya,w as _a,x as ja,y as ka,z as wa,A as Na,B as Ca,C as Ta,D as ht,E as Ra,F as Aa,H as Da,I as Pa,J as Va,K as Ma,L as zt,M as Ea,O as $a,Q as Oa,R as Ft,T as La,U as Ia,V as kn}from"./index-DKMcZ0eu.js";import{a as Un,s as za}from"./Eye-BxQHLAvy.js";import{d as Fa}from"./ZoomOut-DeDtnVFm.js";import{a as Ba}from"./RefreshCcw01-hvf0KTJT.js";import{s as bt}from"./Plus-sMFWDZbr.js";import{s as jt}from"./Trash01-DsICeEC_.js";import{i as Ka}from"./Zap-CsYfJTNM.js";import{a as Wt,c as Ze,b as Jt,D as Zt,g as Ha}from"./dropdown-menu-Cj66A_eF.js";import{u as Yn,a as St,K as qn,P as Gn,b as Wn,C as Jn,s as Zn,d as yt,D as Qn,c as Xn,S as es,v as Ua,e as ts,h as Ya}from"./sortable.esm-BYBRFwqb.js";import{r as qa,s as Ga,u as it,S as Ut}from"./schema-form-Du1fABB8.js";import{r as wn,u as Wa,d as Ja,a as Za,i as Qa,f as Xa,P as eo,b as to,S as no}from"./page-seo-form-BKyuhY5C.js";import{c as so,C as ao,e as Nn,d as oo,a as ro,g as io}from"./command-hpCEI8HV.js";import{i as lo}from"./FilterLines-CNQZgFrz.js";import{i as co}from"./Tool01-CqL3jxd8.js";import{AddSectionModal as uo}from"./add-section-modal-Btwoiri0.js";import{c as mo}from"./save-referenced-block-ByYclKL_.js";import"./AlertCircle-bShPqj0b.js";import"./SwitchHorizontal01-CAy0bKbW.js";import"./XCircle-DuBPYs0H.js";import"./ArrowUpRight-DqovlcCu.js";import"./ZapSquare-CPVDs4bS.js";import"./Users03-CQxPre2P.js";import"./CheckCircle-pRAXzo7t.js";import"./Check-Brj4pwYB.js";import"./ChevronLeft-4Hbiz37d.js";import"./DotsVertical-DQAlAgsi.js";import"./Container-ti1tbLcS.js";import"./Star01-CggQq8ba.js";import"./Palette-DnLOSgb2.js";import"./HardDrive-Isqk_XJm.js";import"./Stars02-BzgC_AGF.js";import"./Key01-qHO_oGcn.js";import"./LayoutLeft-Dp9fcKbL.js";import"./LinkExternal01-DpsN5O5x.js";import"./Monitor01-Cq3Rr0Bq.js";import"./Sun-CEmFPV-m.js";import"./Play-DARJIl68.js";import"./SearchMd-D6MpWudP.js";import"./Settings02-Bin1Cw7v.js";import"./Shield01-DRC-rFEQ.js";import"./Stars01-CY5bRou1.js";import"./Upload01-CIS28esp.js";import"./User01-CsLiOWB8.js";import"./Users01-D5-Msw_I.js";import"./XClose-D07gkN5y.js";import"./X-gaFIWyoX.js";import"./select-DoApsdPu.js";import"./agent-capabilities-BAJZX0wW.js";import"./chat-context-PdyGZuK4.js";import"./tab-id-DW8DAjeq.js";import"./use-mcp-client-B6iSuijq.js";import"./watch-sse-pool-Dwz6GgNQ.js";import"./decopilot-sse-pool-BjcL-1Ui.js";import"./studio-tools-BfSfNeHU.js";import"./use-virtual-mcp-BfkoC_Jy.js";import"./use-collections-JHs4cYqF.js";import"./use-ai-providers-D94PAiJh.js";import"./use-organization-settings-kuC1VER7.js";import"./pair-pnRe99Io.js";import"./use-clock-tick-C-_xih2z.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-B8gxtqNt.js";import"./file-type-icon-Bv7yJWkg.js";import"./content-blocks-o63cs2vh.js";import"./types-D3yUtTXV.js";import"./shell-layout-Cd7cG_OA.js";import"./avatar-DwEz-EXI.js";import"./required-auth-layout-CgZG0sGl.js";import"./useRouterState--eNysN4d.js";import"./use-org-sso-Dx8FPpVk.js";import"./integration-icon-cendsrzP.js";import"./use-navigate-to-agent-bxX_4-SA.js";import"./use-connection-CXOjgHQ4.js";import"./use-mcp-prompts-s1sqXS3y.js";import"./form-mXbDRaUg.js";import"./label-HQVCFF31.js";import"./spinner-By2Ootpp.js";import"./drawer-Cga4GFA1.js";import"./collection-search-CShiXiaa.js";import"./tabs-C6acO-nW.js";import"./toggle-group-DUOxki9q.js";import"./connect-desktop-dialog-BHm4RJbq.js";import"./agent-icons-BCXwhowg.js";import"./checkbox-G6h8O6OG.js";import"./skeleton-96bpkK-M.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-CS4YZmEl.js";import"./card-PxUBskM1.js";import"./popover-Dakh_DW3.js";import"./useInfiniteQuery-F-pMGKml.js";import"./use-infinite-scroll-C94z2LLQ.js";import"./index-YwfQ6D2-.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-B1fp-Ipd.js";import"./sidebar-WtJMNJ3L.js";import"./sheet-BgFdZnkM.js";import"./toolbar-BlaYq2I2.js";import"./use-create-virtual-mcp-BHiNkBGx.js";import"./github-repo-picker-Bzd2LnZV.js";import"./use-mcp-tools-D95JgNEL.js";import"./extract-connection-data-BFTJdqNG.js";import"./generate-id-C6x8vNjW.js";import"./collections-DLN4CeIw.js";import"./alert-dialog-3NLNL2lq.js";import"./index-pFsfuXVO.js";import"./use-org-auth-client-BplPY98r.js";import"./hover-card-Dmeo4zUX.js";import"./task-status--a6y4hT2.js";import"./use-status-sounds-Ce_qcxwH.js";import"./empty-state-CkusJYyv.js";import"./resizable-DVepITIE.js";import"./use-capability-R4F2LPam.js";import"./header-tab-button-CgUtemvw.js";import"./index-C7tCeeY4.js";import"./textarea-B2pcaqEK.js";import"./user-CT3TflBT.js";import"./tools-list-Dxr_eQiP.js";import"./badge-DMy4XfdA.js";import"./connection-slug-eyAPH6o3.js";import"./switch-SFx4s8Mz.js";import"./use-debounced-autosave-BNCiV512.js";import"./index-BM35mGfP.js";import"./search-input-DlRbBAMq.js";import"./collection-tabs-D9Ep-EsF.js";import"./use-secrets-BZKcNE95.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./accordion-DVtaqvvd.js";import"./view-mode-toggle-CE-BR8HX.js";import"./select-model-S3i6KUvb.js";import"./use-automations-CAQm69ll.js";import"./monaco-editor-DLKosp5w.js";import"./automation-runs-CuF-JN9c.js";import"./table-uM_BvOsz.js";import"./use-members-CWz__Rma.js";import"./useSuspenseInfiniteQuery-DJ0xp4Hy.js";import"./automation-list-row-D8mYDnjb.js";import"./connection-card-B0mYu1w7.js";import"./use-registry-connections-D6C9SiZo.js";import"./connection-form-helpers-BDQvLU3D.js";import"./calendar-BYIzFcxm.js";import"./image-field-Bl7bSl4R.js";import"./use-file-configs-DZXqK8Yj.js";import"./index-BWSXYqOt.js";function fo(r){const e=Me.c(38),{open:s,initialName:a,autoLabel:i,isPending:c,onSubmit:p,onOpenChange:d}=r,l=c===void 0?!1:c,[g,v]=R.useState(a),[b,_]=R.useState(s);s!==b&&(_(s),s&&v(a));let w;e[0]!==l||e[1]!==d?(w=E=>{!E&&!l&&d(!1)},e[0]=l,e[1]=d,e[2]=w):w=e[2];const u=w;let x;e[3]!==l||e[4]!==g||e[5]!==p?(x=async E=>{E.preventDefault(),!l&&await p(g.trim())},e[3]=l,e[4]=g,e[5]=p,e[6]=x):x=e[6];const f=x;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Ln,{children:"Rename variant"}),e[7]=N):N=e[7];const h=i||"the rule";let S;e[8]!==h?(S=t.jsxs(In,{children:[N,t.jsxs(zn,{children:["Save this matcher as a global block with a custom label. Leave empty to inline the matcher again and fall back to"," ",t.jsx("span",{className:"font-medium",children:h}),"."]})]}),e[8]=h,e[9]=S):S=e[9];let C;e[10]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=C):C=e[10];let j;e[11]===Symbol.for("react.memo_cache_sentinel")?(j=E=>v(E.target.value),e[11]=j):j=e[11];let P;e[12]!==i||e[13]!==l||e[14]!==g?(P=t.jsxs("div",{className:"space-y-1.5 py-4",children:[C,t.jsx(Hn,{id:"variant-rename-name",value:g,onChange:j,placeholder:i,autoFocus:!0,disabled:l})]}),e[12]=i,e[13]=l,e[14]=g,e[15]=P):P=e[15];let k;e[16]!==d?(k=()=>d(!1),e[16]=d,e[17]=k):k=e[17];let A;e[18]!==l||e[19]!==k?(A=t.jsx(Ve,{type:"button",variant:"outline",onClick:k,disabled:l,children:"Cancel"}),e[18]=l,e[19]=k,e[20]=A):A=e[20];let D;e[21]!==l?(D=l?t.jsxs(t.Fragment,{children:[t.jsx(Yt,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=l,e[22]=D):D=e[22];let V;e[23]!==l||e[24]!==D?(V=t.jsx(Ve,{type:"submit",disabled:l,children:D}),e[23]=l,e[24]=D,e[25]=V):V=e[25];let I;e[26]!==A||e[27]!==V?(I=t.jsxs(Fn,{children:[A,V]}),e[26]=A,e[27]=V,e[28]=I):I=e[28];let F;e[29]!==f||e[30]!==I||e[31]!==S||e[32]!==P?(F=t.jsx(Bn,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:f,children:[S,P,I]})}),e[29]=f,e[30]=I,e[31]=S,e[32]=P,e[33]=F):F=e[33];let M;return e[34]!==u||e[35]!==s||e[36]!==F?(M=t.jsx(Kn,{open:s,onOpenChange:u,children:F}),e[34]=u,e[35]=s,e[36]=F,e[37]=M):M=e[37],M}function Bt(r,e,s,a,i){const c={...r[e]};if(i.length>1){const p=c.sections,d=[...p?.variants??[]];d[a]&&(d[a]={...d[a],value:s}),c.sections={...p,variants:d}}else c.sections=s;return c}function po(r){return structuredClone(r)}function ho(r){return!r.isSavedBlock&&!r.isMultivariate}function Cn(r){const e=r.replace(/[^A-Za-z0-9_-]/g,"");return/^[A-Za-z]/.test(e)?e:e?`Block${e}`:""}function Tn(r,e){const s=r.trim();return s?s.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,s)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_-]*$/.test(s)?null:"Use letters, numbers, hyphens, or underscores. Must start with a letter.":"Block name is required."}const go="oklch(0.65 0.15 160)",vo="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)]",xo="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.2)]",bo="text-[oklch(0.45_0.15_160)] focus:bg-[oklch(0.65_0.15_160/0.12)] focus:text-[oklch(0.45_0.15_160)] dark:text-[oklch(0.78_0.15_160)] dark:focus:bg-[oklch(0.65_0.15_160/0.15)] dark:focus:text-[oklch(0.78_0.15_160)]";function So(r){const e=Me.c(33),{variant:s,selected:a,canDelete:i,onSelect:c,onDuplicate:p,onDelete:d}=r;let l;e[0]!==c?(l=V=>{V.target===V.currentTarget&&(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),c())},e[0]=c,e[1]=l):l=e[1];const g=a?xo:vo;let v;e[2]!==g?(v=pe("group flex select-none items-center gap-2 rounded-md px-2 py-2.5 transition-colors cursor-pointer",g),e[2]=g,e[3]=v):v=e[3];let b;e[4]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(qt,{className:"h-4 w-4 shrink-0",style:{color:go}}),e[4]=b):b=e[4];let _;e[5]!==s.label?(_=t.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s.label}),e[5]=s.label,e[6]=_):_=e[6];const w=`Open actions for ${s.label}`;let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Gt,{size:14}),e[7]=u):u=e[7];let x;e[8]!==w?(x=t.jsx(Wt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":w,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",onClick:_o,onPointerDown:yo,children:u})}),e[8]=w,e[9]=x):x=e[9];let f;e[10]!==p?(f=V=>{V.stopPropagation(),p()},e[10]=p,e[11]=f):f=e[11];let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Un,{size:14}),e[12]=N):N=e[12];let h;e[13]!==f?(h=t.jsxs(Ze,{onClick:f,children:[N,"Duplicate"]}),e[13]=f,e[14]=h):h=e[14];const S=!i;let C;e[15]!==d?(C=V=>{V.stopPropagation(),d()},e[15]=d,e[16]=C):C=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(jt,{size:14}),e[17]=j):j=e[17];let P;e[18]!==S||e[19]!==C?(P=t.jsxs(Ze,{variant:"destructive",disabled:S,onClick:C,children:[j,"Delete"]}),e[18]=S,e[19]=C,e[20]=P):P=e[20];let k;e[21]!==h||e[22]!==P?(k=t.jsxs(Jt,{align:"end",children:[h,P]}),e[21]=h,e[22]=P,e[23]=k):k=e[23];let A;e[24]!==k||e[25]!==x?(A=t.jsxs(Zt,{children:[x,k]}),e[24]=k,e[25]=x,e[26]=A):A=e[26];let D;return e[27]!==c||e[28]!==l||e[29]!==A||e[30]!==v||e[31]!==_?(D=t.jsxs("div",{role:"button",tabIndex:0,onClick:c,onKeyDown:l,className:v,children:[b,_,A]}),e[27]=c,e[28]=l,e[29]=A,e[30]=v,e[31]=_,e[32]=D):D=e[32],D}function yo(r){return r.stopPropagation()}function _o(r){return r.stopPropagation()}function jo(r){const e=Me.c(34),{variants:s,selectedIndex:a,onSelect:i,onDuplicate:c,onDelete:p,onRemoveAll:d,onAdd:l}=r,g=s.length>1;let v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variants"}),e[0]=v):v=e[0];let b;e[1]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(bt,{size:14}),e[1]=b):b=e[1];let _;e[2]!==l?(_=t.jsx(nt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-6",onClick:l,children:b})}),e[2]=l,e[3]=_):_=e[3];let w;e[4]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(st,{children:"Add variant"}),e[4]=w):w=e[4];let u;e[5]!==_?(u=t.jsxs(at,{children:[_,w]}),e[5]=_,e[6]=u):u=e[6];let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(jt,{size:14}),e[7]=x):x=e[7];let f;e[8]!==d?(f=t.jsx(nt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Remove all variants",className:"size-6 text-muted-foreground hover:text-destructive",onClick:d,children:x})}),e[8]=d,e[9]=f):f=e[9];let N;e[10]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(st,{children:"Remove all variants"}),e[10]=N):N=e[10];let h;e[11]!==f?(h=t.jsxs(at,{children:[f,N]}),e[11]=f,e[12]=h):h=e[12];let S;e[13]!==u||e[14]!==h?(S=t.jsxs("div",{className:"flex items-center justify-between",children:[v,t.jsxs("div",{className:"flex items-center gap-0.5",children:[u,h]})]}),e[13]=u,e[14]=h,e[15]=S):S=e[15];let C;if(e[16]!==g||e[17]!==p||e[18]!==c||e[19]!==i||e[20]!==a||e[21]!==s){let k;e[23]!==g||e[24]!==p||e[25]!==c||e[26]!==i||e[27]!==a?(k=A=>t.jsx(So,{variant:A,selected:A.index===a,canDelete:g,onSelect:()=>i(A.index),onDuplicate:()=>c(A.index),onDelete:()=>p(A.index)},`${A.label}-${A.index}`),e[23]=g,e[24]=p,e[25]=c,e[26]=i,e[27]=a,e[28]=k):k=e[28],C=s.map(k),e[16]=g,e[17]=p,e[18]=c,e[19]=i,e[20]=a,e[21]=s,e[22]=C}else C=e[22];let j;e[29]!==C?(j=t.jsx("div",{className:"space-y-0.5",children:C}),e[29]=C,e[30]=j):j=e[30];let P;return e[31]!==S||e[32]!==j?(P=t.jsxs("div",{className:"space-y-1 border-b p-2",children:[S,j]}),e[31]=S,e[32]=j,e[33]=P):P=e[33],P}function ko(r){return r.schema?.definitions??r.schema?.$defs??{}}function wo(r,e){const s=ko(e),a=s[btoa(r)];if(!a)return;let i=typeof a.image=="string"?a.image:void 0;if(!i&&Array.isArray(a.allOf)){const c=a.allOf.find(p=>typeof p.$ref=="string")?.$ref;if(typeof c=="string"){const p=c.replace("#/definitions/",""),d=s[p];i=typeof d?.image=="string"?d.image:void 0}}if(i?.includes("{{{"))return i}function No(r,e){if(!e)return;const s=oa(r);if(!s)return;const a=wo(s.resolveType,e);if(!a)return;const i=qa(a,s.data);if(i)return Ga(i)}function gt(r,e){return r.map((s,a)=>{const i=s.__resolveType??"",c=vt(i);if(!c&&i!==""&&!i.includes("/")&&i in e){const g=e[i],v=typeof g?.name=="string"&&g.name||i.replace(/[-_]/g," ").replace(/\b\w/g,b=>b.toUpperCase())||`Section ${a+1}`;return{index:a,resolveType:i,label:v,isLazy:!1,isSavedBlock:!0}}const p=c?s.section:void 0,d=c?p?.__resolveType??"":i;if(d===ra||d===ia){const g=c?p:s,v=Array.isArray(g?.variants)?g.variants:[];if(v.length===1&&(v[0]?.rule?.__resolveType??"")===la){const w=v[0]?.value??{};let u=w.__resolveType??"";const x=vt(u);return x&&(u=w.section?.__resolveType??u),{index:a,resolveType:i,label:He(u)||`Section ${a+1}`,isHidden:!0,isLazy:x}}const b=v[0]?.value?.__resolveType,_=b?He(b):"Section";return{index:a,resolveType:i,label:`Variants of ${_}`,isMultivariate:!0,isLazy:c}}const l=c?s.section?.__resolveType??i:i;if(c&&l!==""&&!l.includes("/")&&l in e){const g=e[l],v=typeof g?.name=="string"&&g.name||l.replace(/[-_]/g," ").replace(/\b\w/g,b=>b.toUpperCase())||`Section ${a+1}`;return{index:a,resolveType:i,label:v,isLazy:!0,isSavedBlock:!0}}return{index:a,resolveType:i,label:He(l)||`Section ${a+1}`,isLazy:c}})}const Co="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",To="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 Rn(r){return Array.from({length:r},(e,s)=>({id:crypto.randomUUID(),index:s}))}function ns(r){return r.map((e,s)=>({...e,index:s}))}function Ro(r,e){if(e===r.length)return r;if(e<r.length)return ns(r.slice(0,e));const s=Array.from({length:e-r.length},(a,i)=>({id:crypto.randomUUID(),index:r.length+i}));return[...r,...s]}function ss(r){const e=Me.c(20),{section:s,raw:a,meta:i}=r,c=s.isSavedBlock===!0,p=s.isMultivariate===!0;let d;e[0]!==i||e[1]!==a?(d=a&&i?No(a,i):void 0,e[0]=i,e[1]=a,e[2]=d):d=e[2];const l=d;let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Fa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=g):g=e[3];let v;e[4]!==l?(v=l&&t.jsx("img",{src:l,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=l,e[5]=v):v=e[5];let b;e[6]!==p||e[7]!==c?(b=c?{color:ua}:p?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=p,e[7]=c,e[8]=b):b=e[8];let _;e[9]!==b?(_=t.jsx(qt,{className:"h-4 w-4 shrink-0",style:b}),e[9]=b,e[10]=_):_=e[10];const w=s.isHidden&&"line-through opacity-50";let u;e[11]!==w?(u=pe("min-w-0 flex-1 truncate text-sm font-medium",w),e[11]=w,e[12]=u):u=e[12];let x;e[13]!==s.label||e[14]!==u?(x=t.jsx("span",{className:u,children:s.label}),e[13]=s.label,e[14]=u,e[15]=x):x=e[15];let f;return e[16]!==v||e[17]!==_||e[18]!==x?(f=t.jsxs(t.Fragment,{children:[g,v,_,x]}),e[16]=v,e[17]=_,e[18]=x,e[19]=f):f=e[19],f}function as(r,e){const s=r.isSavedBlock===!0,a=r.isMultivariate===!0;return pe("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":s?Co:a?"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)]":"text-foreground/80 hover:bg-accent hover:text-accent-foreground")}function Ao(r){const e=Me.c(59),{section:s,raw:a,meta:i,sortableId:c,selected:p,onSelect:d,onDelete:l,onDuplicate:g,onMakeReusable:v,onToggleHidden:b,onToggleLazy:_,onAddVariant:w}=r,u=a?vt(a.__resolveType??""):!1;let x;e[0]!==s?(x=ca(s),e[0]=s,e[1]=x):x=e[1];const f=x;let N;e[2]!==c?(N={id:c,animateLayoutChanges:Eo},e[2]=c,e[3]=N):N=e[3];const{attributes:h,listeners:S,setNodeRef:C,transform:j,isDragging:P}=Wn(N);let k;e[4]!==j?(k=Jn.Transform.toString(j?{...j,x:0}:null),e[4]=j,e[5]=k):k=e[5];const A=P?0:void 0;let D;e[6]!==k||e[7]!==A?(D={transform:k,opacity:A},e[6]=k,e[7]=A,e[8]=D):D=e[8];const V=D;let I;e[9]!==s?(I=ho(s),e[9]=s,e[10]=I):I=e[10];const F=I,M="button",E=0;let J;e[11]!==d?(J=U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),d())},e[11]=d,e[12]=J):J=e[12];const se=P?"cursor-grabbing":"cursor-pointer";let $;e[13]!==s||e[14]!==p||e[15]!==se?($=pe("touch-none transition-colors",se,as(s,p)),e[13]=s,e[14]=p,e[15]=se,e[16]=$):$=e[16];let he;e[17]!==i||e[18]!==a||e[19]!==s?(he=t.jsx(ss,{section:s,raw:a,meta:i}),e[17]=i,e[18]=a,e[19]=s,e[20]=he):he=e[20];const K=!s.isMultivariate&&t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":u?"Disable async render":"Enable async render",className:pe("h-7 w-7 shrink-0",u?"":"opacity-0 group-hover:opacity-100"),onClick:U=>{U.stopPropagation(),_()},onPointerDown:Mo,children:t.jsx(Ka,{className:pe("h-3.5 w-3.5",u&&"text-yellow-500")})});let X;e[21]!==b||e[22]!==s.isHidden||e[23]!==s.isMultivariate?(X=!s.isMultivariate&&t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":s.isHidden?"Show section":"Hide section",className:pe("h-7 w-7 shrink-0",s.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:U=>{U.stopPropagation(),b()},onPointerDown:Vo,children:s.isHidden?t.jsx(Ba,{className:"h-3.5 w-3.5"}):t.jsx(za,{className:"h-3.5 w-3.5"})}),e[21]=b,e[22]=s.isHidden,e[23]=s.isMultivariate,e[24]=X):X=e[24];let re;e[25]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Wt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Po,onPointerDown:Do,children:t.jsx(Gt,{className:"h-3.5 w-3.5"})})}),e[25]=re):re=e[25];let ue;e[26]!==g?(ue=U=>{U.stopPropagation(),g()},e[26]=g,e[27]=ue):ue=e[27];let Z;e[28]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(Un,{className:"h-4 w-4"}),e[28]=Z):Z=e[28];let Q;e[29]!==ue?(Q=t.jsxs(Ze,{onClick:ue,children:[Z,"Duplicate"]}),e[29]=ue,e[30]=Q):Q=e[30];let G;e[31]!==f||e[32]!==w?(G=f&&t.jsxs(Ze,{className:bo,onClick:U=>{U.stopPropagation(),w()},children:[t.jsx(On,{className:"h-4 w-4"}),"Add variant"]}),e[31]=f,e[32]=w,e[33]=G):G=e[33];let Y;e[34]!==F||e[35]!==v?(Y=F&&t.jsxs(Ze,{className:To,onClick:U=>{U.stopPropagation(),v()},children:[t.jsx(qt,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=F,e[35]=v,e[36]=Y):Y=e[36];let W;e[37]!==l?(W=U=>{U.stopPropagation(),l()},e[37]=l,e[38]=W):W=e[38];let ae;e[39]===Symbol.for("react.memo_cache_sentinel")?(ae=t.jsx(jt,{className:"h-4 w-4"}),e[39]=ae):ae=e[39];let ie;e[40]!==W?(ie=t.jsxs(Ze,{className:"text-destructive focus:text-destructive",onClick:W,children:[ae,"Delete"]}),e[40]=W,e[41]=ie):ie=e[41];let H;e[42]!==Q||e[43]!==G||e[44]!==Y||e[45]!==ie?(H=t.jsxs(Zt,{children:[re,t.jsxs(Jt,{align:"end",className:"w-44",children:[Q,G,Y,ie]})]}),e[42]=Q,e[43]=G,e[44]=Y,e[45]=ie,e[46]=H):H=e[46];let le;return e[47]!==h||e[48]!==S||e[49]!==d||e[50]!==C||e[51]!==V||e[52]!==$||e[53]!==he||e[54]!==K||e[55]!==X||e[56]!==H||e[57]!==J?(le=t.jsxs("div",{ref:C,style:V,...h,...S,role:M,tabIndex:E,onClick:d,onKeyDown:J,className:$,children:[he,K,X,H]}),e[47]=h,e[48]=S,e[49]=d,e[50]=C,e[51]=V,e[52]=$,e[53]=he,e[54]=K,e[55]=X,e[56]=H,e[57]=J,e[58]=le):le=e[58],le}function Do(r){return r.stopPropagation()}function Po(r){return r.stopPropagation()}function Vo(r){return r.stopPropagation()}function Mo(r){return r.stopPropagation()}function Eo(){return!1}function $o(r){const e=Me.c(89),{listKey:s,rawSections:a,sections:i,meta:c,selectedIndex:p,onSelect:d,onReorder:l,onDelete:g,onDuplicate:v,onMakeReusable:b,onToggleHidden:_,onToggleLazy:w,onAddVariant:u,onAddSection:x,canAddSection:f}=r,N=f===void 0?!0:f;let h;e[0]!==i.length?(h=()=>Rn(i.length),e[0]=i.length,e[1]=h):h=e[1];const[S,C]=R.useState(h),[j,P]=R.useState(null),[k,A]=R.useState(s),[D,V]=R.useState(i.length),I=R.useRef(!1);k!==s?(A(s),V(i.length),C(Rn(i.length))):D!==i.length&&(V(i.length),C(q=>Ro(q,i.length)));let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F={activationConstraint:{distance:8}},e[2]=F):F=e[2];let M;e[3]===Symbol.for("react.memo_cache_sentinel")?(M={coordinateGetter:Zn},e[3]=M):M=e[3];const E=Yn(St(Gn,F),St(qn,M));let J;e[4]!==S?(J=S.map(Oo),e[4]=S,e[5]=J):J=e[5];const se=J;let $;e[6]===Symbol.for("react.memo_cache_sentinel")?($=q=>{P(String(q.active.id))},e[6]=$):$=e[6];const he=$;let K;e[7]!==se||e[8]!==l?(K=q=>{P(null);const{active:O,over:de}=q;if(!de||O.id===de.id)return;const Ie=se.indexOf(String(O.id)),Be=se.indexOf(String(de.id));Ie===-1||Be===-1||(C(Ue=>ns(yt([...Ue],Ie,Be))),I.current=!0,requestAnimationFrame(()=>{I.current=!1}),l?.(Ie,Be))},e[7]=se,e[8]=l,e[9]=K):K=e[9];const X=K;let re;e[10]===Symbol.for("react.memo_cache_sentinel")?(re=()=>{P(null)},e[10]=re):re=e[10];const ue=re;let Z,Q,G,Y,W,ae,ie,H,le,U,Ce,Ee,ge,Te,we;if(e[11]!==j||e[12]!==N||e[13]!==S||e[14]!==se||e[15]!==X||e[16]!==c||e[17]!==x||e[18]!==u||e[19]!==g||e[20]!==v||e[21]!==b||e[22]!==d||e[23]!==_||e[24]!==w||e[25]!==a||e[26]!==i||e[27]!==p||e[28]!==E){Te=Symbol.for("react.early_return_sentinel");e:{const q=O=>{I.current||d(O)};if(e[44]!==j||e[45]!==N||e[46]!==S||e[47]!==x||e[48]!==a||e[49]!==i){const O=j?S.find(de=>de.id===j):null;if(Y=O!=null?i[O.index]:null,G=O!=null?a[O.index]:void 0,S.length===0){let de;e[53]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[53]=de):de=e[53];const Ie=!N;let Be;e[54]===Symbol.for("react.memo_cache_sentinel")?(Be=t.jsx(bt,{size:14}),e[54]=Be):Be=e[54];let Ue;e[55]!==x||e[56]!==Ie?(Ue=t.jsxs("div",{className:"space-y-2",children:[de,t.jsxs(Ve,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:Ie,onClick:x,children:[Be,"Add section"]})]}),e[55]=x,e[56]=Ie,e[57]=Ue):Ue=e[57],Te=Ue;break e}ge=pe(O&&"cursor-grabbing"),e[44]=j,e[45]=N,e[46]=S,e[47]=x,e[48]=a,e[49]=i,e[50]=G,e[51]=Y,e[52]=ge}else G=e[50],Y=e[51],ge=e[52];Q=Qn,H=E,le=Xn,U=he,Ce=X,Ee=ue,Z=es,ae=se,ie=Ua,we="space-y-1",W=S.map(O=>{const de=i[O.index];return de?t.jsx(Ao,{sortableId:O.id,section:de,raw:a[O.index],meta:c,selected:p===O.index,onSelect:()=>q(O.index),onDelete:()=>g(O.index),onDuplicate:()=>v(O.index),onMakeReusable:()=>b(O.index),onToggleHidden:()=>_(O.index),onToggleLazy:()=>w(O.index),onAddVariant:()=>u(O.index)},O.id):null})}e[11]=j,e[12]=N,e[13]=S,e[14]=se,e[15]=X,e[16]=c,e[17]=x,e[18]=u,e[19]=g,e[20]=v,e[21]=b,e[22]=d,e[23]=_,e[24]=w,e[25]=a,e[26]=i,e[27]=p,e[28]=E,e[29]=Z,e[30]=Q,e[31]=G,e[32]=Y,e[33]=W,e[34]=ae,e[35]=ie,e[36]=H,e[37]=le,e[38]=U,e[39]=Ce,e[40]=Ee,e[41]=ge,e[42]=Te,e[43]=we}else Z=e[29],Q=e[30],G=e[31],Y=e[32],W=e[33],ae=e[34],ie=e[35],H=e[36],le=e[37],U=e[38],Ce=e[39],Ee=e[40],ge=e[41],Te=e[42],we=e[43];if(Te!==Symbol.for("react.early_return_sentinel"))return Te;let Re;e[58]!==W||e[59]!==we?(Re=t.jsx("div",{className:we,children:W}),e[58]=W,e[59]=we,e[60]=Re):Re=e[60];let ve;e[61]!==Z||e[62]!==ae||e[63]!==ie||e[64]!==Re?(ve=t.jsx(Z,{items:ae,strategy:ie,children:Re}),e[61]=Z,e[62]=ae,e[63]=ie,e[64]=Re,e[65]=ve):ve=e[65];let Le;e[66]!==G||e[67]!==Y||e[68]!==c?(Le=Y?t.jsx("div",{className:pe("cursor-grabbing shadow-lg ring-1 ring-border/60",as(Y,!1)),children:t.jsx(ss,{section:Y,raw:G,meta:c})}):null,e[66]=G,e[67]=Y,e[68]=c,e[69]=Le):Le=e[69];let Ne;e[70]!==Le?(Ne=t.jsx(ts,{dropAnimation:null,children:Le}),e[70]=Le,e[71]=Ne):Ne=e[71];let xe;e[72]!==Q||e[73]!==H||e[74]!==le||e[75]!==U||e[76]!==Ce||e[77]!==Ee||e[78]!==ve||e[79]!==Ne?(xe=t.jsxs(Q,{sensors:H,collisionDetection:le,onDragStart:U,onDragEnd:Ce,onDragCancel:Ee,children:[ve,Ne]}),e[72]=Q,e[73]=H,e[74]=le,e[75]=U,e[76]=Ce,e[77]=Ee,e[78]=ve,e[79]=Ne,e[80]=xe):xe=e[80];const be=!N;let Oe;e[81]===Symbol.for("react.memo_cache_sentinel")?(Oe=t.jsx(bt,{size:14}),e[81]=Oe):Oe=e[81];let oe;e[82]!==x||e[83]!==be?(oe=t.jsxs(Ve,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:be,onClick:x,children:[Oe,"Add section"]}),e[82]=x,e[83]=be,e[84]=oe):oe=e[84];let ke;return e[85]!==ge||e[86]!==xe||e[87]!==oe?(ke=t.jsxs("div",{className:ge,children:[xe,oe]}),e[85]=ge,e[86]=xe,e[87]=oe,e[88]=ke):ke=e[88],ke}function Oo(r){return r.id}const Lo=[[/always|matchalways/i,"Users03"],[/device|matchdevice/i,"Phone02"],[/date|matchdate/i,"Calendar"],[/random|matchrandom/i,"Shuffle01"],[/host|matchhost/i,"Globe02"],[/location|matchlocation/i,"MarkerPin01"],[/pathname/i,"Link03"],[/cron|matchcron/i,"Clock"],[/multi|matchmulti/i,"FilterLines"],[/never|matchnever/i,"EyeOff"],[/environment|matchenvironment/i,"Cloud01"],[/eq\.ts|\/eq$/i,"Brackets"],[/user|requser|isdecouser/i,"User01"],[/site|template/i,"LayoutAlt01"]],Io={"device-mobile":"Phone02","device-desktop":"Monitor01","device-tablet":"Tablet01","calendar-event":"Calendar","calendar-month":"Calendar",clock:"Clock","current-location":"MarkerPin01","map-2":"MarkerPin01","world-search":"Globe02",shuffle:"Shuffle01",filter:"FilterLines","eye-off":"EyeOff",flask:"Beaker02",link:"Link03","git-merge":"GitBranch01",users:"Users03",flag:"Flag01","cloud-storm":"Cloud01",campaign:"Announcement01",experiment:"Beaker02",language:"Globe02","hand-click":"CursorClick01"};function Kt(r){return _t(r)!==void 0}function Qt(r,e){if(e){if(Kt(e))return e;const s=Io[e];if(s&&Kt(s))return s}for(const[s,a]of Lo)if(s.test(r)&&Kt(a))return a;return"FilterLines"}function zo(r){return _t(r)??lo}function An(r){const e=Me.c(11),{iconName:s,size:a,className:i}=r,c=a===void 0?"md":a;let p;e[0]!==s?(p=zo(s),e[0]=s,e[1]=p):p=e[1];const d=p,l=c==="sm"?"size-7":"size-9",g=c==="sm"?16:18;let v;e[2]!==l||e[3]!==i?(v=pe("flex shrink-0 items-center justify-center rounded-full bg-muted",l,i),e[2]=l,e[3]=i,e[4]=v):v=e[4];let b;e[5]!==d||e[6]!==g?(b=t.jsx(d,{size:g,className:"text-muted-foreground"}),e[5]=d,e[6]=g,e[7]=b):b=e[7];let _;return e[8]!==v||e[9]!==b?(_=t.jsx("div",{className:v,children:b}),e[8]=v,e[9]=b,e[10]=_):_=e[10],_}const os="Users03";function Fo(r){const e=r.manifest?.blocks??{},s=[];for(const[a,i]of Object.entries(e))if(a.includes("matchers"))for(const c of Object.keys(i)){if(c.includes("always"))continue;const p=da(c,r);s.push({resolveType:c,title:p.title??He(c),description:p.description,iconName:Qt(c,p.icon)})}return s}function Bo(r,e){if(!r)return os;const s=e.find(a=>a.resolveType===r);return s?s.iconName:Qt(r)}function Dn(r){const e=Me.c(41),{currentRt:s,currentLabel:a,matchers:i,onSelect:c}=r,[p,d]=R.useState(!1);let l;if(e[0]!==s||e[1]!==i){const M=Bo(s,i);l=_t(M),e[0]=s,e[1]=i,e[2]=l}else l=e[2];const g=l;let v;e[3]!==c?(v=M=>{c(M),d(!1)},e[3]=c,e[4]=v):v=e[4];const b=v;let _;e[5]===Symbol.for("react.memo_cache_sentinel")?(_=()=>d(!0),e[5]=_):_=e[5];let w;e[6]!==g?(w=g&&t.jsx(g,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[6]=g,e[7]=w):w=e[7];let u;e[8]!==a?(u=t.jsx("span",{className:"flex-1 truncate",children:a}),e[8]=a,e[9]=u):u=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx($n,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e[10]=x):x=e[10];let f;e[11]!==w||e[12]!==u?(f=t.jsxs("button",{type:"button",onClick:_,className:"flex h-10 w-full items-center gap-2 rounded-md border border-input bg-transparent px-3 text-left text-sm shadow-xs transition-colors hover:bg-accent/40 cursor-pointer",children:[w,u,x]}),e[11]=w,e[12]=u,e[13]=f):f=e[13];let N;e[14]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(so,{placeholder:"Search rules..."}),e[14]=N):N=e[14];let h;e[15]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(ao,{children:"No rules found."}),e[15]=h):h=e[15];let S;e[16]!==b?(S=()=>b(""),e[16]=b,e[17]=S):S=e[17];const C=!s&&"bg-accent/60";let j;e[18]!==C?(j=pe("gap-2.5",C),e[18]=C,e[19]=j):j=e[19];let P;e[20]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(An,{iconName:os,size:"sm"}),e[20]=P):P=e[20];let k;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"text-sm",children:"Always"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"Target all users"})]}),e[21]=k):k=e[21];let A;e[22]!==S||e[23]!==j?(A=t.jsxs(Nn,{value:"always Target all users",onSelect:S,className:j,children:[P,k]}),e[22]=S,e[23]=j,e[24]=A):A=e[24];let D;if(e[25]!==s||e[26]!==b||e[27]!==i){let M;e[29]!==s||e[30]!==b?(M=E=>t.jsxs(Nn,{value:`${E.title} ${E.resolveType} ${E.description??""}`,onSelect:()=>b(E.resolveType),className:pe("gap-2.5",s===E.resolveType&&"bg-accent/60"),children:[t.jsx(An,{iconName:E.iconName,size:"sm"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"text-sm",children:E.title}),E.description&&t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:E.description})]})]},E.resolveType),e[29]=s,e[30]=b,e[31]=M):M=e[31],D=i.map(M),e[25]=s,e[26]=b,e[27]=i,e[28]=D}else D=e[28];let V;e[32]!==A||e[33]!==D?(V=t.jsxs(oo,{children:[h,t.jsxs(ro,{children:[A,D]})]}),e[32]=A,e[33]=D,e[34]=V):V=e[34];let I;e[35]!==p||e[36]!==V?(I=t.jsxs(io,{open:p,onOpenChange:d,title:"Choose a rule",description:"Pick how to target users for this variant",className:"sm:max-w-lg",children:[N,V]}),e[35]=p,e[36]=V,e[37]=I):I=e[37];let F;return e[38]!==I||e[39]!==f?(F=t.jsxs(t.Fragment,{children:[f,I]}),e[38]=I,e[39]=f,e[40]=F):F=e[40],F}const Ko="oklch(0.65 0.15 160)",rs="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]";function Xt(r){const e=Me.c(5),{rule:s,matchers:a}=r,i=s?.__resolveType??"";let c;if(e[0]!==a||e[1]!==i){const g=a.find(v=>v.resolveType===i)?.iconName??Qt(i);c=_t(g),e[0]=a,e[1]=i,e[2]=c}else c=e[2];const p=c;if(!p)return null;let d;return e[3]!==p?(d=t.jsx(p,{size:14,className:"shrink-0"}),e[3]=p,e[4]=d):d=e[4],d}function Pn(r){return r.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
2
2
  `)}function Ht(r){return r.map((e,s)=>({id:crypto.randomUUID(),index:s,variant:e}))}function Ho(r){return r.map((e,s)=>({...e,index:s}))}function Uo(r){const e=Me.c(51),{entry:s,sortableId:a,isActive:i,canDelete:c,decofile:p,meta:d,matchers:l,onSelect:g,onRename:v,onDelete:b}=r;let _;e[0]!==a?(_={id:a,animateLayoutChanges:Go},e[0]=a,e[1]=_):_=e[1];const{attributes:w,listeners:u,setNodeRef:x,transform:f,isDragging:N}=Wn(_);let h;e[2]!==f?(h=Jn.Transform.toString(f?{...f,y:0}:null),e[2]=f,e[3]=h):h=e[3];const S=N?0:void 0;let C;e[4]!==h||e[5]!==S?(C={transform:h,opacity:S},e[4]=h,e[5]=S,e[6]=C):C=e[6];const j=C,P=d??void 0;let k;e[7]!==p||e[8]!==s.variant.rule||e[9]!==P?(k=xt(s.variant.rule,p,P),e[7]=p,e[8]=s.variant.rule,e[9]=P,e[10]=k):k=e[10];const A=k,D=i?rs:"text-muted-foreground hover:bg-muted hover:text-foreground",V=N?"cursor-grabbing":"cursor-grab";let I;e[11]!==D||e[12]!==V?(I=pe("group shrink-0 inline-flex items-center rounded-md transition-colors touch-none",D,V),e[11]=D,e[12]=V,e[13]=I):I=e[13];let F;e[14]!==A||e[15]!==l?(F=t.jsx(Xt,{rule:A,matchers:l}),e[14]=A,e[15]=l,e[16]=F):F=e[16];let M;e[17]!==s.variant.label?(M=t.jsx("span",{className:"truncate",children:s.variant.label}),e[17]=s.variant.label,e[18]=M):M=e[18];let E;e[19]!==w||e[20]!==u||e[21]!==g||e[22]!==F||e[23]!==M?(E=t.jsxs("button",{type:"button",...w,...u,onClick:g,className:"inline-flex items-center gap-1.5 h-8 pl-3 pr-1.5 text-sm font-medium cursor-[inherit]",children:[F,M]}),e[19]=w,e[20]=u,e[21]=g,e[22]=F,e[23]=M,e[24]=E):E=e[24];const J=`Actions for ${s.variant.label}`,se=i&&"opacity-100";let $;e[25]!==se?($=pe("inline-flex h-8 w-6 items-center justify-center pr-1 cursor-pointer transition-opacity","opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100",se),e[25]=se,e[26]=$):$=e[26];let he;e[27]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(Gt,{size:12}),e[27]=he):he=e[27];let K;e[28]!==J||e[29]!==$?(K=t.jsx(Wt,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":J,onClick:qo,onPointerDown:Yo,className:$,children:he})}),e[28]=J,e[29]=$,e[30]=K):K=e[30];let X;e[31]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(co,{size:14}),e[31]=X):X=e[31];let re;e[32]!==v?(re=t.jsxs(Ze,{onClick:v,children:[X,"Rename"]}),e[32]=v,e[33]=re):re=e[33];let ue;e[34]===Symbol.for("react.memo_cache_sentinel")?(ue=t.jsx(Ha,{}),e[34]=ue):ue=e[34];const Z=!c;let Q;e[35]===Symbol.for("react.memo_cache_sentinel")?(Q=t.jsx(jt,{size:14}),e[35]=Q):Q=e[35];let G;e[36]!==b||e[37]!==Z?(G=t.jsxs(Ze,{variant:"destructive",disabled:Z,onClick:b,children:[Q,"Delete"]}),e[36]=b,e[37]=Z,e[38]=G):G=e[38];let Y;e[39]!==re||e[40]!==G?(Y=t.jsxs(Jt,{align:"start",className:"w-36",children:[re,ue,G]}),e[39]=re,e[40]=G,e[41]=Y):Y=e[41];let W;e[42]!==K||e[43]!==Y?(W=t.jsxs(Zt,{children:[K,Y]}),e[42]=K,e[43]=Y,e[44]=W):W=e[44];let ae;return e[45]!==x||e[46]!==j||e[47]!==E||e[48]!==W||e[49]!==I?(ae=t.jsxs("div",{ref:x,style:j,className:I,children:[E,W]}),e[45]=x,e[46]=j,e[47]=E,e[48]=W,e[49]=I,e[50]=ae):ae=e[50],ae}function Yo(r){return r.stopPropagation()}function qo(r){return r.stopPropagation()}function Go(){return!1}function Wo(r){const e=Me.c(13),{variant:s,decofile:a,meta:i,matchers:c}=r,p=i??void 0;let d;e[0]!==a||e[1]!==p||e[2]!==s.rule?(d=xt(s.rule,a,p),e[0]=a,e[1]=p,e[2]=s.rule,e[3]=d):d=e[3];const l=d;let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=pe("inline-flex items-center gap-1.5 h-8 pl-3 pr-3 text-sm font-medium rounded-md shadow-lg ring-1 ring-border/60 cursor-grabbing",rs),e[4]=g):g=e[4];let v;e[5]!==l||e[6]!==c?(v=t.jsx(Xt,{rule:l,matchers:c}),e[5]=l,e[6]=c,e[7]=v):v=e[7];let b;e[8]!==s.label?(b=t.jsx("span",{className:"truncate",children:s.label}),e[8]=s.label,e[9]=b):b=e[9];let _;return e[10]!==v||e[11]!==b?(_=t.jsxs("div",{className:g,children:[v,b]}),e[10]=v,e[11]=b,e[12]=_):_=e[12],_}function Jo(r){const e=Me.c(77),{listKey:s,variants:a,activeIndex:i,decofile:c,meta:p,matchers:d,onSelect:l,onReorder:g,onRename:v,onDelete:b,onAdd:_}=r;let w;e[0]!==a?(w=()=>Ht(a),e[0]=a,e[1]=w):w=e[1];const[u,x]=R.useState(w),[f,N]=R.useState(null),[h,S]=R.useState(s),[C,j]=R.useState(a.length);let P;e[2]!==a?(P=()=>Pn(a),e[2]=a,e[3]=P):P=e[3];const[k,A]=R.useState(P),D=R.useRef(!1),V=Pn(a);h!==s?(S(s),j(a.length),A(V),x(Ht(a))):C!==a.length?(j(a.length),A(V),x(Ht(a))):k!==V&&(A(V),x(ke=>a.map((q,O)=>({id:ke[O]?.id??crypto.randomUUID(),index:O,variant:q}))));let I;e[4]===Symbol.for("react.memo_cache_sentinel")?(I={activationConstraint:{distance:8}},e[4]=I):I=e[4];let F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F={coordinateGetter:Zn},e[5]=F):F=e[5];const M=Yn(St(Gn,I),St(qn,F));let E;e[6]!==u?(E=u.map(Zo),e[6]=u,e[7]=E):E=e[7];const J=E,se=a.length>1;let $;e[8]!==u?($=ke=>{const q=String(ke.active.id);N(u.find(O=>O.id===q)??null)},e[8]=u,e[9]=$):$=e[9];const he=$;let K;e[10]!==J||e[11]!==g?(K=ke=>{N(null);const{active:q,over:O}=ke;if(!O||q.id===O.id)return;const de=J.indexOf(String(q.id)),Ie=J.indexOf(String(O.id));de===-1||Ie===-1||(x(Be=>Ho(yt([...Be],de,Ie))),D.current=!0,requestAnimationFrame(()=>{D.current=!1}),g(de,Ie))},e[10]=J,e[11]=g,e[12]=K):K=e[12];const X=K;let re;e[13]===Symbol.for("react.memo_cache_sentinel")?(re=()=>{N(null)},e[13]=re):re=e[13];const ue=re;let Z,Q,G,Y,W,ae,ie,H,le,U,Ce,Ee;if(e[14]!==f||e[15]!==i||e[16]!==se||e[17]!==c||e[18]!==u||e[19]!==J||e[20]!==X||e[21]!==he||e[22]!==d||e[23]!==p||e[24]!==b||e[25]!==v||e[26]!==l||e[27]!==M){const ke=O=>{D.current||l(O)};Ce="flex items-center border-b shrink-0";const q=f&&"cursor-grabbing";e[40]!==q?(U=pe("flex flex-1 min-w-0 items-center gap-1.5 pl-3 pr-2 py-2 overflow-x-auto",q),e[40]=q,e[41]=U):U=e[41],Q=Qn,W=M,ae=Xn,ie=he,H=X,le=ue,Z=es,Ee=J,G=Ya,Y=u.map(O=>t.jsx(Uo,{sortableId:O.id,entry:O,isActive:O.index===i,canDelete:se,decofile:c,meta:p,matchers:d,onSelect:()=>ke(O.index),onRename:()=>v(O.index),onDelete:()=>b(O.index)},O.id)),e[14]=f,e[15]=i,e[16]=se,e[17]=c,e[18]=u,e[19]=J,e[20]=X,e[21]=he,e[22]=d,e[23]=p,e[24]=b,e[25]=v,e[26]=l,e[27]=M,e[28]=Z,e[29]=Q,e[30]=G,e[31]=Y,e[32]=W,e[33]=ae,e[34]=ie,e[35]=H,e[36]=le,e[37]=U,e[38]=Ce,e[39]=Ee}else Z=e[28],Q=e[29],G=e[30],Y=e[31],W=e[32],ae=e[33],ie=e[34],H=e[35],le=e[36],U=e[37],Ce=e[38],Ee=e[39];let ge;e[42]!==Z||e[43]!==G||e[44]!==Y||e[45]!==Ee?(ge=t.jsx(Z,{items:Ee,strategy:G,children:Y}),e[42]=Z,e[43]=G,e[44]=Y,e[45]=Ee,e[46]=ge):ge=e[46];let Te;e[47]!==f||e[48]!==c||e[49]!==d||e[50]!==p?(Te=f?t.jsx(Wo,{variant:f.variant,decofile:c,meta:p,matchers:d}):null,e[47]=f,e[48]=c,e[49]=d,e[50]=p,e[51]=Te):Te=e[51];let we;e[52]!==Te?(we=t.jsx(ts,{dropAnimation:null,children:Te}),e[52]=Te,e[53]=we):we=e[53];let Re;e[54]!==Q||e[55]!==W||e[56]!==ae||e[57]!==ie||e[58]!==H||e[59]!==le||e[60]!==ge||e[61]!==we?(Re=t.jsxs(Q,{sensors:W,collisionDetection:ae,onDragStart:ie,onDragEnd:H,onDragCancel:le,children:[ge,we]}),e[54]=Q,e[55]=W,e[56]=ae,e[57]=ie,e[58]=H,e[59]=le,e[60]=ge,e[61]=we,e[62]=Re):Re=e[62];let ve;e[63]!==U||e[64]!==Re?(ve=t.jsx("div",{className:U,children:Re}),e[63]=U,e[64]=Re,e[65]=ve):ve=e[65];let Le;e[66]===Symbol.for("react.memo_cache_sentinel")?(Le={color:Ko},e[66]=Le):Le=e[66];let Ne;e[67]===Symbol.for("react.memo_cache_sentinel")?(Ne=t.jsx(bt,{size:14}),e[67]=Ne):Ne=e[67];let xe;e[68]!==_?(xe=t.jsx(nt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-8 shrink-0 cursor-pointer",style:Le,onClick:_,children:Ne})}),e[68]=_,e[69]=xe):xe=e[69];let be;e[70]===Symbol.for("react.memo_cache_sentinel")?(be=t.jsx(st,{side:"bottom",children:"Add variant"}),e[70]=be):be=e[70];let Oe;e[71]!==xe?(Oe=t.jsx("div",{className:"shrink-0 pr-3 pl-1 py-2",children:t.jsxs(at,{children:[xe,be]})}),e[71]=xe,e[72]=Oe):Oe=e[72];let oe;return e[73]!==Ce||e[74]!==ve||e[75]!==Oe?(oe=t.jsxs("div",{className:Ce,children:[ve,Oe]}),e[73]=Ce,e[74]=ve,e[75]=Oe,e[76]=oe):oe=e[76],oe}function Zo(r){return r.id}function Qo(r){const e=Me.c(37),{open:s,onOpenChange:a,defaultBlockId:i,isPending:c,onSubmit:p}=r,d=i===void 0?"":i,l=c===void 0?!1:c,[g,v]=R.useState(d),[b,_]=R.useState(s);s!==b&&(_(s),s&&v(d));let w;e[0]!==l||e[1]!==a?(w=M=>{!M&&!l&&a(!1)},e[0]=l,e[1]=a,e[2]=w):w=e[2];const u=w;let x;e[3]!==g||e[4]!==l||e[5]!==p?(x=async M=>{M.preventDefault();const E=g.trim();!E||l||await p(E)},e[3]=g,e[4]=l,e[5]=p,e[6]=x):x=e[6];const f=x;let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsxs(In,{children:[t.jsx(Ln,{children:"Save as global"}),t.jsx(zn,{children:"Save this section as a global block so it can be reused on other pages."})]}),e[7]=N):N=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:"Block name"}),e[8]=h):h=e[8];let S;e[9]===Symbol.for("react.memo_cache_sentinel")?(S=M=>v(M.target.value),e[9]=S):S=e[9];let C;e[10]!==g||e[11]!==l?(C=t.jsxs("div",{className:"py-4 space-y-2",children:[h,t.jsx(Hn,{id:"block-id",value:g,onChange:S,placeholder:"MyNewBlock",autoFocus:!0,disabled:l})]}),e[10]=g,e[11]=l,e[12]=C):C=e[12];let j;e[13]!==a?(j=()=>a(!1),e[13]=a,e[14]=j):j=e[14];let P;e[15]!==l||e[16]!==j?(P=t.jsx(Ve,{type:"button",variant:"outline",onClick:j,disabled:l,children:"Cancel"}),e[15]=l,e[16]=j,e[17]=P):P=e[17];let k;e[18]!==g||e[19]!==l?(k=!g.trim()||l,e[18]=g,e[19]=l,e[20]=k):k=e[20];let A;e[21]!==l?(A=l?t.jsxs(t.Fragment,{children:[t.jsx(Yt,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=l,e[22]=A):A=e[22];let D;e[23]!==k||e[24]!==A?(D=t.jsx(Ve,{type:"submit",disabled:k,children:A}),e[23]=k,e[24]=A,e[25]=D):D=e[25];let V;e[26]!==P||e[27]!==D?(V=t.jsxs(Fn,{children:[P,D]}),e[26]=P,e[27]=D,e[28]=V):V=e[28];let I;e[29]!==f||e[30]!==V||e[31]!==C?(I=t.jsx(Bn,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:f,children:[N,C,V]})}),e[29]=f,e[30]=V,e[31]=C,e[32]=I):I=e[32];let F;return e[33]!==u||e[34]!==s||e[35]!==I?(F=t.jsx(Kn,{open:s,onOpenChange:u,children:I}),e[33]=u,e[34]=s,e[35]=I,e[36]=F):F=e[36],F}function Vn(r){const e=Me.c(20),{activeSchema:s,formValue:a,formResetKey:i,onFormChange:c,onBreadcrumbChange:p,breadcrumbPath:d,emptyMessage:l,beforeForm:g,seoResolveType:v,siteDefaultSeo:b,meta:_,decofile:w,onSaveReferencedBlock:u}=r;let x;e[0]!==d?(x=d===void 0?[]:d,e[0]=d,e[1]=x):x=e[1];const f=x;let N;e[2]!==s||e[3]!==f||e[4]!==w||e[5]!==i||e[6]!==a||e[7]!==_||e[8]!==p||e[9]!==c||e[10]!==u||e[11]!==v||e[12]!==b?(N=s&&a?v?t.jsx(no,{schema:s,resolveType:v,value:a,formResetKey:i,onChange:c,onBreadcrumbChange:p,siteDefaultSeo:b}):t.jsx(Ut,{schema:s,value:a,onChange:c,basePath:"",breadcrumbPath:f,onBreadcrumbChange:p,meta:_,decofile:w,onSaveReferencedBlock:u},i):null,e[2]=s,e[3]=f,e[4]=w,e[5]=i,e[6]=a,e[7]=_,e[8]=p,e[9]=c,e[10]=u,e[11]=v,e[12]=b,e[13]=N):N=e[13];const h=N;let S;e[14]!==l||e[15]!==h?(S=h??t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:l}),e[14]=l,e[15]=h,e[16]=S):S=e[16];let C;return e[17]!==g||e[18]!==S?(C=t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsxs("div",{className:"mx-auto max-w-2xl",children:[g,S]})}),e[17]=g,e[18]=S,e[19]=C):C=e[19],C}const Xo="text-[oklch(0.45_0.15_160)] bg-[oklch(0.65_0.15_160/0.18)] dark:text-[oklch(0.78_0.15_160)] dark:bg-[oklch(0.65_0.15_160/0.22)]",er=r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase();function Mn(r){const{start:e,end:s}=r,a=typeof e=="string"?e:"",i=typeof s=="string"?s:"";if(!a&&!i)return null;const c=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"}),p=g=>{if(!g)return null;const v=new Date(g);return Number.isNaN(v.getTime())?null:c.format(v)},d=p(a),l=p(i);return d&&l?`${d} → ${l}`:d?`From ${d}`:l?`Until ${l}`:null}function Je(r){if(!r)return"Default";const e=r.__resolveType??"";if(["website/matchers/always.ts","$live/matchers/MatchAlways.ts"].includes(e)||e==="")return"Default";switch(e){case"website/matchers/never.ts":return"Hidden";case"website/matchers/device.ts":case"$live/matchers/MatchDevice.ts":{const{mobile:a,tablet:i,desktop:c,devices:p=[]}=r,d=[...p];return a&&d.push("Mobile"),i&&d.push("Tablet"),c&&d.push("Desktop"),d.length>0?d.map(er).join(" & "):He(e)}case"website/matchers/date.ts":case"$live/matchers/MatchDate.ts":return Mn(r)??He(e);case"website/matchers/random.ts":case"$live/matchers/MatchRandom.ts":{const{traffic:a}=r;return typeof a=="number"?`${Math.ceil(a*100)}% of sessions`:He(e)}case"website/matchers/host.ts":case"$live/matchers/MatchHost.ts":{const{includes:a,match:i}=r,c=[];return a&&c.push(a),i&&c.push(i),c.length>0?c.join(" - "):He(e)}case"website/matchers/pathname.ts":{const a=r.case,{type:i,pathname:c}=a??{};return i&&c?`Pathname ${i} ${c}`:He(e)}case"website/matchers/location.ts":case"$live/matchers/MatchLocation.ts":{const{includeLocations:a,excludeLocations:i}=r,c=l=>[l.city,l.regionCode,l.country].filter(Boolean).join(" - "),p=a?.[0];if(p){const l=(a?.length??0)-1;return`${c(p)}${l>0?` +${l}`:""}`}const d=i?.[0];if(d){const l=(i?.length??0)-1;return`Except ${c(d)}${l>0?` +${l}`:""}`}return"Any location"}case"website/matchers/multi.ts":case"$live/matchers/MatchMulti.ts":{const{matchers:a,op:i="AND"}=r;return a&&a.length>0?a.map(Je).join(` ${i} `):He(e)}default:{const a=Mn(r);return a||He(e)||"Default"}}}function tr(r,e){return ya(r,e,Je)}function nr(r){const e=Me.c(13),{pageKey:s,initialName:a,initialPath:i,onFieldChange:c}=r,[p,d]=R.useState(a),[l,g]=R.useState(i),[v,b]=R.useState(s);v!==s&&(b(s),d(a),g(i));let _;e[0]!==c?(_=N=>{d(N.target.value),c("name",N.target.value)},e[0]=c,e[1]=_):_=e[1];let w;e[2]!==p||e[3]!==_?(w=t.jsx("input",{type:"text",value:p,onChange:_,className:"w-full bg-transparent text-sm font-semibold truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"Page name"}),e[2]=p,e[3]=_,e[4]=w):w=e[4];let u;e[5]!==c?(u=N=>{g(N.target.value),c("path",N.target.value)},e[5]=c,e[6]=u):u=e[6];let x;e[7]!==l||e[8]!==u?(x=t.jsx("input",{type:"text",value:l,onChange:u,className:"w-full bg-transparent text-xs text-muted-foreground truncate outline-none border-none p-0 focus:ring-0 placeholder:text-muted-foreground",placeholder:"/path"}),e[7]=l,e[8]=u,e[9]=x):x=e[9];let f;return e[10]!==w||e[11]!==x?(f=t.jsxs("div",{className:"space-y-1",children:[w,x]}),e[10]=w,e[11]=x,e[12]=f):f=e[12],f}function En(r){const e=Me.c(6),{onClick:s}=r;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(On,{size:14}),e[0]=a):a=e[0];let i;e[1]!==s?(i=t.jsx(nt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:s,children:a})}),e[1]=s,e[2]=i):i=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(st,{side:"bottom",children:"Add variant"}),e[3]=c):c=e[3];let p;return e[4]!==i?(p=t.jsxs(at,{children:[i,c]}),e[4]=i,e[5]=p):p=e[5],p}function Gl({orgSlug:r,virtualMcpId:e,branch:s,previewReady:a=!0,previewUrl:i,currentPath:c,activePageBlockKey:p=null,activeGlobalBlockKey:d=null,externalSelectedIndex:l,onSaved:g,initialEditSeo:v=!1,onExitSeo:b,onViewJsonFile:_}){const w=a?{orgSlug:r,virtualMcpId:e,branch:s}:null,{data:u,isLoading:x}=ma(w),{data:f,isLoading:N}=fa(w),[h,S]=R.useState(null),[C,j]=R.useState(null),[P,k]=R.useState(null),[A,D]=R.useState(0),[V,I]=R.useState(void 0),[F,M]=R.useState(null),[E,J]=R.useState(null),[se,$]=R.useState([]),[he,K]=R.useState(0),[X,re]=R.useState(null),[ue,Z]=R.useState(null),[Q,G]=R.useState(!0),[Y,W]=R.useState(!1),[ae,ie]=R.useState(!1),[H,le]=R.useState(v),[U,Ce]=R.useState(v);v&&!U&&(Ce(!0),le(!0),S(null),j(null),k(null),$([])),!v&&U&&Ce(!1);const[Ee,ge]=R.useState(null),[Te,we]=R.useState(void 0),[Re,ve]=R.useState([]),[Le,Ne]=R.useState(0),[xe,be]=R.useState(0),[Oe,oe]=R.useState(null),[ke,q]=R.useState(null),[O,de]=R.useState(null),Ie=Qs(),Be=`${r}/${e}/${s}`,Ue=pa({orgSlug:r,virtualMcpId:e,branch:s}),[is,ls]=R.useState(c),[cs,us]=R.useState(p),[ds,ms]=R.useState(d);(is!==c||cs!==p||ds!==d)&&(queueMicrotask(()=>Ue.flush()),ls(c),us(p),ms(d),S(null),j(null),k(null),D(0),M(null),J(null),be(0),oe(null),q(null),$([]),K(n=>n+1),le(!1),ge(null),we(void 0),ve([]),Ne(n=>n+1));const Ae=ha({orgSlug:r,virtualMcpId:e,branch:s}),en=mo((n,o)=>{Ae.mutate({blockKey:n,data:o},{onSuccess:()=>g?.(),onError:m=>ce.error(`Save failed: ${m.message}`)})}),tn=ga({orgSlug:r,virtualMcpId:e,branch:s}),[kt,nn]=R.useState(!1),wt=R.useRef(null),ot=R.useRef(null),rt=R.useRef(null),Nt=R.useRef({}),qe=R.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!a||x||N)return t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:t.jsx(Yt,{size:20,className:"animate-spin text-muted-foreground"})});if(!u||!f)return t.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Could not load site data."});const fs=va(u),Se=!!d,ze=Se?null:xa(fs,c,p),L=Se?d:ze?.key??null,Ct=Se&&d?u[d]:void 0,sn=Se&&d&&Ct?ba(d,Ct):Se&&d?d:"",Tt=!Se&&L&&u[L]?u[L]:null,Rt=H&&u&&f&&L&&ze?wn(u,{kind:"page",pageKey:L,pageName:String(ze.name??""),path:String(ze.path??"")},f):null,ps=H?Tt?.seo:void 0,At=Te!==void 0?Te:ps,hs=H?Wa(At):void 0,gs=Rt?.seoTypeOptions??[],vs=H&&f?Ja(f):"",an=Ee??hs??{},Dt=H&&Rt?Za(an,Rt):null,xs=H&&Dt&&Qa(At)?pt(Dt,f):null,bs=H?Xa(u,f)?.seoData:void 0,Fe=Se?[{label:"Default",sections:[{__resolveType:d}]}]:tr(Tt?.sections,u??{}),ut=Fe.length>1,De=Math.min(A,Fe.length-1),Qe=Fe[De],ee=Qe?.sections??[],$e=gt(ee,u);if(Se&&d&&O!==d){de(d);const n=ee[0],o=$e[0];if(n&&o){S(0),be(0),$([]);const m=it(n,o,u);m&&(j(m.data),k(m.resolveType),q(null),oe(null))}}!Se&&O!==null&&de(null),qe.current={rawSections:ee,parsedSections:$e,decofile:u??{},activePageKey:L,pageVariants:Fe,variantIndex:De,sectionVariantIndex:xe,selectedSectionIndex:h};const Xe=(n,o,m)=>{const y=tt(n,o);if(!y){j(null),k(null),q(null),oe(null);return}const B=_n(y,Je)[m];if(!B){j(null),k(null),q(null),oe(null);return}const z=_a(B.value,u);j(z?.data??null),k(z?.resolveType??null);const{resolveType:te,formValue:me}=Lt(B.rule,u,f??void 0);q(te),oe(me)};if(l!==void 0&&l!==V&&(I(l??null),typeof l=="number")){const n=ee[l],o=$e[l];if(n&&o)if(S(l),be(0),$([]),K(m=>m+1),o.isMultivariate)Xe(n,o,0);else{const m=it(n,o,u);m?(j(m.data),k(m.resolveType)):(j(null),k(null)),q(null),oe(null)}}const Pt=P&&f?pt(P,f):null,Ye=(n,o)=>{if(!L)return;const m=Bt(u,L,n,De,Fe);Ae.mutate({blockKey:L,data:m},{onSuccess:()=>o?.onSuccess?.()??g?.(),onError:y=>ce.error(`Save failed: ${y.message}`)})},lt=()=>{S(null),j(null),k(null),be(0),oe(null),q(null),$([]),K(n=>n+1)},Ss=(n,o)=>{wt.current&&clearTimeout(wt.current);const m=qe.current.sectionVariantIndex;wt.current=setTimeout(()=>{const{rawSections:y,parsedSections:T,decofile:B,activePageKey:z,pageVariants:te,variantIndex:me}=qe.current,ne=y[o];if(!ne)return;const fe=T[o];if(!fe)return;if(fe.isSavedBlock){const _e=fe.isLazy?ne.section?.__resolveType??ne.__resolveType:ne.__resolveType;Ae.mutate({blockKey:_e,data:n},{onSuccess:()=>g?.(),onError:je=>ce.error(`Save failed: ${je.message}`)});return}if(!z)return;const ye={...B[z]},Pe=[...y];if(fe.isMultivariate){const _e=tt(ne,fe);if(!_e||!z)return;const je=La(_e,m,n);Pe[o]=ht(ne,fe,je)}else if(fe.isHidden){const _e=vt(ne.__resolveType),je=_e?{...ne.section}:{...ne},Ke=Array.isArray(je.variants)?[...je.variants]:[];Ke[0]&&(Ke[0]={...Ke[0],value:n}),je.variants=Ke,_e?Pe[o]={...ne,section:je}:Pe[o]=je}else fe.isLazy?Pe[o]={...ne,section:n}:Pe[o]=n;if(te.length>1){const _e=ye.sections,je=[..._e?.variants??[]];je[me]&&(je[me]={...je[me],value:Pe}),ye.sections={..._e,variants:je}}else ye.sections=Pe;Ae.mutate({blockKey:z,data:ye},{onSuccess:()=>g?.(),onError:_e=>ce.error(`Save failed: ${_e.message}`)})},Ft)},ys=n=>{S(n),be(0),$([]),K(T=>T+1);const o=ee[n],m=$e[n];if(!o||!m)return;if(m.isMultivariate){Xe(o,m,0);return}const y=it(o,m,u);if(!y){j(null),k(null),q(null),oe(null);return}j(y.data),k(y.resolveType),q(null),oe(null)},on=n=>{const o=n;j(o),h!==null&&Ss(o,h)},Vt=n=>{if(!L||!u||!f||!ze)return;const o={kind:"page",pageKey:L,pageName:String(ze.name??""),path:String(ze.path??"")},m=wn(u,o,f);m&&Ue.save(L,()=>{const y=Ie.getQueryData(Xs.decofile(Be))?.[L];if(!y||typeof y!="object"||y===null||Array.isArray(y))return null;const T={...y,...Nt.current};return Nt.current={},n?.raw!==void 0?{...T,seo:n.raw}:n?.inner!==void 0?to(o,m,T,n.inner):T})},_s=(n,o)=>{L&&(Nt.current[n]=o,Vt())},js=(n,o)=>{if(!L)return;const m=yt([...ee],n,o);h!==null&&(h===n?S(o):n<h&&o>=h?S(h-1):n>h&&o<=h&&S(h+1)),Ye(m)},ks=n=>{if(!L)return;const o=ee.filter((m,y)=>y!==n);h===n?lt():h!==null&&h>n&&S(h-1),Ye(o)},ws=n=>{if(!L)return;const o=ee[n];if(!o)return;const m=[...ee];m.splice(n+1,0,po(o)),h!==null&&h>n&&S(h+1),Ye(m)},Ns=n=>{if(!L)return;const o=ee[n],m=$e[n];if(!o||!m||m.isMultivariate)return;const y=m.isHidden?Da(o):Pa(o);if(!y)return;const T=[...ee];T[n]=y,h===n&&lt(),Ye(T)},Cs=n=>{if(!L)return;const o=ee[n],m=$e[n];if(!o||!m||m.isMultivariate)return;const y=Aa(o);if(!y)return;const T=[...ee];T[n]=y,h===n&&lt(),Ye(T)},Ts=n=>{if(!L)return;const o=[...ee,{__resolveType:n.resolveType}],m=o.length-1;Ye(o,{onSuccess:()=>{W(!1),S(m),be(0),$([]),K(z=>z+1);const y=o[m],T=gt(o,u)[m];if(!y||!T)return;if(T.isMultivariate){Xe(y,T,0);return}const B=it(y,T,u);if(!B){j(null),k(null),q(null),oe(null);return}j(B.data),k(B.resolveType),q(null),oe(null)}})},Rs=n=>{if(h===null)return;const o=ee[h],m=$e[h];!o||!m?.isMultivariate||(be(n),$([]),K(y=>y+1),Xe(o,m,n))},As=n=>{if(h===null||!L)return;const o=ee[h],m=$e[h];if(!o||!m?.isMultivariate)return;const y=tt(o,m);if(!y)return;const T=Ta(y,n);if(!T){ce.error("Cannot delete the only variant.");return}const B=[...ee];B[h]=ht(o,m,T);const z=T.variants;let te=xe;n===xe?te=Math.min(n,z.length-1):n<xe&&(te=xe-1),be(te),$([]),K(me=>me+1),Xe(B[h],m,te),Ye(B)},Ds=n=>{if(h===null||!L)return;const o=ee[h],m=$e[h];if(!o||!m?.isMultivariate)return;const y=tt(o,m);if(!y)return;const T=Ra(y,n),B=[...ee];B[h]=ht(o,m,T);const z=n+1;be(z),$([]),K(te=>te+1),Xe(B[h],m,z),Ye(B)},Mt=n=>{const o=n??h;if(o===null||!L)return;const m=ee[o],y=$e[o];if(!m||!y)return;const T=ja(m,y);if(!T){ce.error("This section cannot have variants.");return}const B=[...ee];B[o]=T.section;const z=gt(B,u)[o];if(!z?.isMultivariate){ce.error("Could not add variant.");return}S(o),be(T.newVariantIndex),$([]),K(te=>te+1),Xe(T.section,z,T.newVariantIndex),Ye(B)},Ps=()=>{if(h===null||!L)return;const n=ee[h],o=$e[h];if(!n||!o?.isMultivariate)return;const m=tt(n,o);if(!m)return;const y=Ca(n,o,m);if(!y){ce.error("Could not remove variants.");return}const T=[...ee];T[h]=y;const B=gt(T,u)[h];if(!B)return;be(0),q(null),oe(null),$([]),K(te=>te+1);const z=it(y,B,u);z?(j(z.data),k(z.resolveType)):(j(null),k(null)),Ye(T)},Vs=async n=>{if(X===null||!L)return;const o=Tn(n,u);if(o){ce.error(o);return}const m=ee[X],y=$e[X];if(!m||!y)return;const T=it(m,y,u);if(!T){ce.error("This section cannot be saved as global.");return}const B={...T.data,name:n};try{await Ae.mutateAsync({blockKey:n,data:B});const z=[...ee];z[X]={__resolveType:n},await Ae.mutateAsync({blockKey:L,data:Bt(u,L,z,De,Fe)}),h===X&&lt(),re(null),ce.success(`Saved global block "${n}"`),g?.()}catch(z){ce.error(z instanceof Error?z.message:"Failed to save global block")}},rn=Qe?.rule;if(ut&&h===null&&E===null&&rn){const{resolveType:n,formValue:o}=Lt(rn,u??{},f??void 0);J(n),M(o)}const dt=f?Fo(f):[],Ms=!Se&&!!(i&&f&&u),ln=E&&f?pt(E,f):null,Es=()=>{ot.current&&(clearTimeout(ot.current),ot.current=null),rt.current&&(clearTimeout(rt.current),rt.current=null)},cn=async(n,o)=>{if(!(Ia(o,n,f)>0))try{await tn.mutateAsync({blockKey:n})}catch(m){ce.error(m instanceof Error?m.message:"Could not delete matcher block")}},un=n=>{ot.current&&clearTimeout(ot.current),ot.current=setTimeout(()=>{const{activePageKey:o,decofile:m,variantIndex:y}=qe.current;if(!o)return;const T={...m[o]},B={...T.sections},z=[...B.variants??[]],te=z[y],me=te?.rule;if(It(me,m,f)){const ne=me?.__resolveType??"",fe=m[ne],ye=typeof fe?.name=="string"?fe.name:ne,{__resolveType:Pe,..._e}=n;Ae.mutate({blockKey:ne,data:zt(Pe??"",_e,ye)},{onSuccess:()=>g?.(),onError:je=>ce.error(`Save failed: ${je.message}`)});return}te&&(z[y]={...te,rule:n}),T.sections={...B,variants:z},Ae.mutate({blockKey:o,data:T},{onSuccess:()=>g?.(),onError:ne=>ce.error(`Save failed: ${ne.message}`)})},Ft)},$s=n=>{J(n);const o=n?{__resolveType:n}:{__resolveType:kn};M({}),un(o)},Os=n=>{const o=n;M(o);const m=E?{__resolveType:E,...o}:{...o};un(m)},dn=n=>{rt.current&&clearTimeout(rt.current);const{selectedSectionIndex:o,sectionVariantIndex:m}=qe.current;o!==null&&(rt.current=setTimeout(()=>{const{rawSections:y,parsedSections:T,decofile:B,activePageKey:z,pageVariants:te,variantIndex:me}=qe.current;if(!z)return;const ne=y[o],fe=T[o];if(!ne||!fe?.isMultivariate)return;const ye=tt(ne,fe);if(!ye)return;const Pe=Oa(ye,m,n),_e=[...y];_e[o]=ht(ne,fe,Pe);const je=Bt(B,z,_e,me,te);Ae.mutate({blockKey:z,data:je},{onSuccess:()=>g?.(),onError:Ke=>ce.error(`Save failed: ${Ke.message}`)})},Ft))},Ls=n=>{q(n),oe({}),dn(n?{__resolveType:n}:{__resolveType:kn})},Is=n=>{const o=n;oe(o);const m=ke?{__resolveType:ke,...o}:{...o};dn(m)};if(!Se&&!ze)return t.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",c]});if(Se&&!Ct)return t.jsx("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:"Global block not found"});const Ge=h!==null?$e[h]??null:null,mn=h!==null?ee[h]:null,fn=mn&&Ge?.isMultivariate?tt(mn,Ge):null,mt=fn?_n(fn,Je):[],pn=Math.min(xe,Math.max(mt.length-1,0)),Et=mt[pn]??null,et=Ge?.isMultivariate===!0,hn=h!==null&&Ge!==null,ct=hn&&(et||!!(Pt&&C)),zs=ct&&!Se&&Ge?.isSavedBlock===!0,We=Se||zs,Fs=Se?sn:Ge?.label??"",gn=ke&&f?pt(ke,f):null,$t=ct&&(!Se||se.length>0)?Se?[sn,...se]:[ze.name,Ge.label,...et&&Et?[Et.label]:[],...se]:[],Bs=H&&ze?[ze.name,"SEO",...Re]:[],vn=H?Bs:We?$t.length>0?$t:[Fs]:$t,xn=()=>{if(!L)return;const n=u[L],o=ka(n.sections,ee);if(!o)return;const m=wa(o);Ae.mutate({blockKey:L,data:{...n,sections:o}},{onSuccess:()=>{D(m),S(null),j(null),k(null),$([]),M(null),J(null)},onError:y=>ce.error(`Save failed: ${y.message}`)})},bn=(n,o,m)=>{if(!L)return;const y=u[L],T=y.sections;if(!T||typeof T!="object"||Array.isArray(T))return;const B=T;if(!Array.isArray(B.variants))return;const z=n([...B.variants]);if(!z)return;const te=$a(B,z),me={...u,[L]:{...y,sections:te}};Ae.mutate({blockKey:L,data:me[L]},{onSuccess:()=>{o?.(),m&&cn(m,me)},onError:ne=>ce.error(`Save failed: ${ne.message}`)})},Ks=n=>{Z(null),D(n),S(null),j(null),k(null),$([]);const o=Fe[n]?.rule,{resolveType:m,formValue:y}=Lt(o,u??{},f??void 0);J(m),M(y)},Hs=(n,o)=>{n!==o&&(De===n?D(o):n<De&&o>=De?D(De-1):n>De&&o<=De&&D(De+1),bn(m=>yt(m,n,o)))},Us=n=>{const o=Fe[n]?.rule,m=Na(o,u??{},f??void 0);bn(y=>y.length<=1?null:(y.splice(n,1),y),()=>{Fe.length-1===1?D(0):n<De?D(De-1):n===De&&D(Math.max(0,n-1)),S(null),j(null),k(null),$([]),M(null),J(null)},m)},Ys=async(n,o)=>{Es();const m=qe.current.activePageKey,y=qe.current.decofile;if(!m)return;const T=y[m],B=T.sections;if(!B||typeof B!="object"||Array.isArray(B))return;const z=B;if(!Array.isArray(z.variants))return;const te=[...z.variants],me=te[n];if(!me?.rule||typeof me.rule!="object"){ce.error("This variant has no matcher rule to rename.");return}const ne=me.rule,fe=o.trim();nn(!0);try{if(!fe){if(!It(ne,y,f)){Z(null);return}const Ot=ne.__resolveType??"";te[n]={...me,rule:Va(ne,y,f)};const yn={...y,[m]:{...T,sections:{...z,variants:te}}};await Ae.mutateAsync({blockKey:m,data:yn[m]}),await cn(Ot,yn),Z(null),g?.();return}const ye=Ma(ne,y,f);if(!ye){ce.error("Could not read this variant's matcher rule.");return}if(ye.blockKey){await Ae.mutateAsync({blockKey:ye.blockKey,data:zt(ye.resolveType,ye.data,fe)}),Z(null),g?.();return}const Pe=Cn(fe),_e=Tn(Pe,y);if(_e){ce.error(_e);return}const je=zt(ye.resolveType,ye.data,fe);let Ke=null;try{await Ae.mutateAsync({blockKey:Pe,data:je}),Ke=Pe,te[n]={...me,rule:Ea(Pe)},await Ae.mutateAsync({blockKey:m,data:{...T,sections:{...z,variants:te}}}),Ke=null}catch(Ot){throw Ke&&await tn.mutateAsync({blockKey:Ke}).catch(()=>{}),Ot}Z(null),ce.success(`Saved matcher as global block "${fe}"`),g?.()}catch(ye){ce.error(ye instanceof Error?ye.message:"Failed to rename variant")}finally{nn(!1)}},Sn=()=>{lt()},qs=n=>{ge(n),Vt({inner:n})},Gs=n=>{we(n),Vt({raw:n})},Ws=()=>{ge(null),ve([])},Js=()=>Ne(n=>n+1),Zs=n=>{if(H){if(n===0){Ue.flush(),le(!1),ge(null),we(void 0),ve([]),Ne(m=>m+1),b?.();return}if(n===1){ve([]),Ne(m=>m+1);return}ve(Re.slice(0,n-1)),Ne(m=>m+1);return}if(Se){$(se.slice(0,n)),K(m=>m+1);return}if(n===0){Sn();return}if(n===1){$([]),K(m=>m+1);return}if(et&&n===2){$([]),K(m=>m+1);return}const o=et?2:1;$(se.slice(0,n-o))};return t.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[t.jsx("div",{className:"shrink-0",children:We||ct||H?t.jsxs("div",{className:pe("border-b px-3 py-2.5",We&&"border-global-section/22 bg-global-section/12 dark:bg-global-section/16"),children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[!Se&&ut&&Qe&&t.jsxs("button",{type:"button",onClick:Sn,title:`Editing in variant: ${Qe.label}`,className:pe("shrink-0 inline-flex items-center gap-1 rounded-md h-6 px-1.5 text-xs font-medium cursor-pointer transition-opacity hover:opacity-80",Xo),children:[t.jsx(Xt,{rule:xt(Qe.rule,u??{},f??void 0),matchers:dt}),t.jsx("span",{className:"max-w-[160px] truncate",children:Qe.label})]}),t.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:vn.map((n,o)=>{const m=o===vn.length-1;return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[o>0&&t.jsx(ea,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>Zs(o),title:n,className:pe("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",m?We?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":We?"text-foreground/80":"text-muted-foreground",We?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:n})]},`${n}-${o}`)})}),We&&t.jsxs(at,{children:[t.jsx(nt,{asChild:!0,children:t.jsx("span",{className:"shrink-0 cursor-help",children:t.jsx(aa,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),t.jsx(st,{side:"bottom",className:"max-w-[260px]",children:"A global section is a reusable block shared across your site. Editing it here updates it everywhere it's used."})]}),hn&&!et&&!Ge?.isHidden&&L&&t.jsx(En,{onClick:()=>Mt()})]}),We&&t.jsx("p",{className:"mt-1.5 py-1.5 pl-1 text-sm leading-snug text-foreground",children:"This is a global section. Changes apply everywhere this section is used across your site."})]}):t.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(nr,{pageKey:L,initialName:ze.name,initialPath:ze.path,onFieldChange:_s})}),t.jsxs(at,{children:[t.jsx(nt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>le(!0),children:t.jsx(na,{size:14})})}),t.jsx(st,{side:"bottom",children:"Edit SEO"})]}),t.jsxs(at,{children:[t.jsx(nt,{asChild:!0,children:t.jsx(Ve,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>_&&L?_(L):ie(!0),children:t.jsx(sa,{size:14})})}),t.jsx(st,{side:"bottom",children:"View JSON"})]}),t.jsx(En,{onClick:xn})]})}),ut&&!ct&&!H&&L&&t.jsx(Jo,{listKey:L,variants:Fe,activeIndex:De,decofile:u??{},meta:f,matchers:dt,onSelect:Ks,onReorder:Hs,onRename:Z,onDelete:Us,onAdd:xn}),H?t.jsx(ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:t.jsx("div",{className:"mx-auto max-w-2xl",children:Tt&&L?t.jsx(eo,{rawSeo:At,innerSeo:an,defaultResolveType:vs,seoSchema:xs,activeResolveType:Dt,seoTypeOptions:gs,formResetKey:Le,siteDefaultSeo:bs,onBreadcrumbChange:ve,onPersistRaw:Gs,onInnerChange:qs,onClearForm:Ws,onBumpFormKey:Js}):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):ct?t.jsxs(ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[et&&mt.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(jo,{variants:mt.map((n,o)=>({index:o,label:n.label})),selectedIndex:pn,onSelect:Rs,onDuplicate:Ds,onDelete:As,onRemoveAll:Ps,onAdd:()=>Mt()}),et&&t.jsxs("div",{className:"px-3 py-3 border-b space-y-2",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),t.jsx(Dn,{currentRt:ke??"",currentLabel:Je(Et?.rule),matchers:dt,onSelect:Ls}),gn&&Oe&&t.jsx("div",{className:"pt-1",children:t.jsx(Ut,{schema:gn,value:Oe,onChange:Is,basePath:""})})]})]}),t.jsx(Vn,{activeSchema:Pt,formValue:C,formResetKey:he,onFormChange:on,onBreadcrumbChange:$,breadcrumbPath:se,emptyMessage:"No editable fields for this variant.",meta:f,decofile:u,onSaveReferencedBlock:en})]}):Se?t.jsx(ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx(Vn,{activeSchema:Pt,formValue:C,formResetKey:he,onFormChange:on,onBreadcrumbChange:$,breadcrumbPath:se,emptyMessage:"No editable fields for this global block.",meta:f,decofile:u,onSaveReferencedBlock:en})}):t.jsxs(ft,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ut&&E!==null&&t.jsxs("div",{className:pe("px-3 border-b",Q?"pt-3 pb-5 space-y-3":"py-2"),children:[t.jsxs("button",{type:"button",onClick:()=>G(n=>!n),className:"flex w-full items-center justify-between gap-2 text-left cursor-pointer rounded-sm py-0.5 hover:bg-muted/40","aria-expanded":Q,children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),Q?t.jsx(ta,{className:"size-3.5 shrink-0 text-muted-foreground"}):t.jsx($n,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),Q&&t.jsxs("div",{className:pe("space-y-3",kt&&"pointer-events-none opacity-50"),children:[t.jsx(Dn,{currentRt:E,currentLabel:jn(Qe?.rule,u??{},Je,f??void 0),matchers:dt,onSelect:$s}),ln&&F&&t.jsx("div",{className:"space-y-3",children:t.jsx(Ut,{schema:ln,value:F,onChange:Os,basePath:""})})]})]}),t.jsx("div",{className:"p-2 pt-3",children:t.jsx($o,{listKey:`${L??""}-${De}`,rawSections:ee,sections:$e,meta:f,selectedIndex:h,onSelect:ys,onReorder:js,onDelete:ks,onDuplicate:ws,onMakeReusable:re,onToggleHidden:Ns,onToggleLazy:Cs,onAddVariant:Mt,onAddSection:()=>W(!0),canAddSection:Ms})})]}),t.jsx(Qo,{open:X!==null,onOpenChange:n=>{n||re(null)},defaultBlockId:X!==null?Cn($e[X]?.label??""):"",isPending:Ae.isPending,onSubmit:Vs}),i&&t.jsx(uo,{open:Y,onOpenChange:W,meta:f,decofile:u,previewBaseUrl:i,onSelect:Ts}),ae&&L&&u&&t.jsx(Sa,{open:ae,onOpenChange:ie,pageKey:L,decofile:u}),ue!==null&&t.jsx(fo,{open:!0,initialName:It(Fe[ue]?.rule,u??{},f??void 0)?jn(Fe[ue]?.rule,u??{},Je,f??void 0):"",autoLabel:Je(xt(Fe[ue]?.rule,u??{},f??void 0)),isPending:kt,onSubmit:async n=>{await Ys(ue,n)},onOpenChange:n=>{!n&&!kt&&Z(null)}})]})}export{Gl as SectionsEditor};