decocms 3.78.0 → 3.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/client/assets/{AlertCircle-Caru_t3W.js → AlertCircle-CKei65yQ.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-B2Dt0814.js → ArrowUpRight-BygwtcZ2.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-CpjuZYS5.js → CheckCircle-BZlFJbF8.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-DeW1WG4N.js → ChevronDown-DXOZkIso.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-DhtKqfYa.js → ChevronLeft-DPLHregZ.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-DSC2aiCG.js → ChevronRight-BkBgwZxs.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-CiZNoBS5.js → ChevronUp-BCwumcyZ.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-CAFbny0A.js → DotsVertical-DQDEDjEX.js} +1 -1
  9. package/dist/client/assets/{Eye-BSAOg3tU.js → Eye-IocHlobo.js} +1 -1
  10. package/dist/client/assets/{FilterLines-BWsEA6cc.js → FilterLines-dauCx8Za.js} +1 -1
  11. package/dist/client/assets/{Globe01-B8cJAk0V.js → Globe01-CQy0Cxa-.js} +1 -1
  12. package/dist/client/assets/{Globe04-BHoeDf9U.js → Globe04-CBuYvlRn.js} +1 -1
  13. package/dist/client/assets/{HardDrive-Ca-rpUZp.js → HardDrive-DSj8WeP3.js} +1 -1
  14. package/dist/client/assets/{Key01-hqliL23I.js → Key01-ktWRCkRP.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-DfLCxQJZ.js → LayoutLeft-TAhoC2xE.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-C-uuQSHY.js → LinkExternal01-BenQb5F0.js} +1 -1
  17. package/dist/client/assets/{Monitor01-C4mUj5DO.js → Monitor01-CF5y8J9X.js} +1 -1
  18. package/dist/client/assets/{Palette-BqPdnSvn.js → Palette-ZSzAttfE.js} +1 -1
  19. package/dist/client/assets/{Play-u3Xpo-3H.js → Play-BrJBHlm8.js} +1 -1
  20. package/dist/client/assets/{Plus-e8vsh1yI.js → Plus-DptVePQj.js} +1 -1
  21. package/dist/client/assets/{SearchMd-pbTyIZQ0.js → SearchMd-DmrRiPsU.js} +1 -1
  22. package/dist/client/assets/{Settings02-1OASYAA8.js → Settings02-BynaGT2l.js} +1 -1
  23. package/dist/client/assets/{Shield01-BZP4Q_Vm.js → Shield01-CGOi4o3B.js} +1 -1
  24. package/dist/client/assets/{Star01-BokvC0Yc.js → Star01-G7bzpuzw.js} +1 -1
  25. package/dist/client/assets/{Stars01-CM7BslwP.js → Stars01-BxW6Ze_W.js} +1 -1
  26. package/dist/client/assets/{Stars02-DTDItJ62.js → Stars02-CJJhFv2L.js} +1 -1
  27. package/dist/client/assets/{Sun-CO5Z2lcQ.js → Sun-CUZqy0kq.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-DCwdrg-O.js → SwitchHorizontal01-D04vL0_f.js} +1 -1
  29. package/dist/client/assets/{Tool01-BDvWQGEc.js → Tool01-hkwqrr6Q.js} +1 -1
  30. package/dist/client/assets/{Trash01-C3khOwsb.js → Trash01-Ds3jbDQE.js} +1 -1
  31. package/dist/client/assets/{Upload01-BWq8M5mQ.js → Upload01-Cuswrale.js} +1 -1
  32. package/dist/client/assets/{User01-B5NDreK2.js → User01-DJhz4tmk.js} +1 -1
  33. package/dist/client/assets/{Users01-BM4ZmEbl.js → Users01-D1GekRvz.js} +1 -1
  34. package/dist/client/assets/{Users03-DPSOJZh_.js → Users03-CjtA3d84.js} +1 -1
  35. package/dist/client/assets/{X-CdcmL6WW.js → X-CvnlrpyG.js} +1 -1
  36. package/dist/client/assets/{XCircle-YOrPaSTA.js → XCircle-CTJX6MKF.js} +1 -1
  37. package/dist/client/assets/{XClose-B1WSb9MQ.js → XClose-BbKrO-bh.js} +1 -1
  38. package/dist/client/assets/{Zap-CJ80I152.js → Zap-B-ccy6C4.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-CgWRLEJy.js → ZapSquare-bUJqwnW3.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-OytsIYD1.js → ZoomOut-DRnFWZo9.js} +1 -1
  41. package/dist/client/assets/{access-gate-DqzudH0L.js → access-gate-CAr_jPZ4.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-kp6f6erO.js → add-section-modal-DpjAnzTC.js} +1 -1
  43. package/dist/client/assets/{agent-icon-DY5w59uF.js → agent-icon-BB2_1lHd.js} +1 -1
  44. package/dist/client/assets/{agents-list-DDHbeg5p.js → agents-list-DhbMkPNU.js} +1 -1
  45. package/dist/client/assets/{ai-providers-P8q844Dm.js → ai-providers-B6285-0G.js} +1 -1
  46. package/dist/client/assets/{alert-FbljLOaQ.js → alert-B39DYg6q.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-BO7X_BMw.js → alert-dialog-gK63ktIU.js} +1 -1
  48. package/dist/client/assets/{app-editor-C4YX8u15.js → app-editor-CB02ERjc.js} +1 -1
  49. package/dist/client/assets/{auth-DpDDb6PJ.js → auth-DxKMCtEO.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-BwEPZ9sp.js → auth-catchall-DAcTzerO.js} +1 -1
  51. package/dist/client/assets/auth-entry-Bu3ut1b9.js +1 -0
  52. package/dist/client/assets/{auth-split-layout-6kbG-q9M.js → auth-split-layout-Bo7x5X53.js} +1 -1
  53. package/dist/client/assets/{authenticate-and-persist-oauth-SkR5Q2kF.js → authenticate-and-persist-oauth-CXYJ_57C.js} +1 -1
  54. package/dist/client/assets/{automation-list-row-BZROLPDh.js → automation-list-row-BYfl9414.js} +1 -1
  55. package/dist/client/assets/{automation-runs-VqVE_yW9.js → automation-runs-DiHYOI-G.js} +1 -1
  56. package/dist/client/assets/{automations-1DiKFOBq.js → automations-Bqn5XkdY.js} +1 -1
  57. package/dist/client/assets/{avatar-C7RfbSV0.js → avatar-CfKY2_hs.js} +1 -1
  58. package/dist/client/assets/{badge-S-QCOrNN.js → badge-tlnu_6T3.js} +1 -1
  59. package/dist/client/assets/{block-document-CLeG1P-N.js → block-document-D35IO4X3.js} +1 -1
  60. package/dist/client/assets/{brand-context-GZiNd5v6.js → brand-context-CkTeGoic.js} +1 -1
  61. package/dist/client/assets/{buckets-DTeRBDWJ.js → buckets-CDBAN8NB.js} +1 -1
  62. package/dist/client/assets/{calendar-katBc34c.js → calendar-CaxcRF1k.js} +1 -1
  63. package/dist/client/assets/{capability-load-error-D72JLeT1.js → capability-load-error-Bab-5zvo.js} +1 -1
  64. package/dist/client/assets/{card-B0EjU25K.js → card-DU2I8eHH.js} +1 -1
  65. package/dist/client/assets/category-editor-CL_UxJoz.js +1 -0
  66. package/dist/client/assets/{chat-context-DdkEgZ9_.js → chat-context-CdOsOHQ0.js} +1 -1
  67. package/dist/client/assets/{checkbox-DbzbLYfL.js → checkbox-H7xxQ3iC.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-C9MRaugF.js → cli-auth-success-K-z0R_Ah.js} +1 -1
  69. package/dist/client/assets/{collection-detail-DU1VM1YR.js → collection-detail-C5Wn5oY4.js} +1 -1
  70. package/dist/client/assets/{collection-display-button-BNnw7G4D.js → collection-display-button-DTs9IB7s.js} +1 -1
  71. package/dist/client/assets/{collection-search-hESxl20y.js → collection-search-ClGGT1KV.js} +1 -1
  72. package/dist/client/assets/{collection-tabs-99Rq6QsS.js → collection-tabs-xD0Ry7Iv.js} +1 -1
  73. package/dist/client/assets/{command-DJiJXkzC.js → command-CLZq7t6J.js} +1 -1
  74. package/dist/client/assets/commerce-onboarding-3oBhw9NK.js +1 -0
  75. package/dist/client/assets/{connect-desktop-dialog-DR4-xhbf.js → connect-desktop-dialog-BCsFp2qg.js} +1 -1
  76. package/dist/client/assets/{connection-card-CJjprKft.js → connection-card-CrUjfVJB.js} +1 -1
  77. package/dist/client/assets/{connection-detail-DZAfgvu2.js → connection-detail-BaKSwWVH.js} +1 -1
  78. package/dist/client/assets/{connection-form-helpers-DT5c99yt.js → connection-form-helpers-BqpyRjgd.js} +1 -1
  79. package/dist/client/assets/{connections-B3yso__h.js → connections-W9DsG8aw.js} +1 -1
  80. package/dist/client/assets/{context-menu-B3oZHh4c.js → context-menu-CqLno4KJ.js} +1 -1
  81. package/dist/client/assets/{decopilot-KvFscv5D.js → decopilot-B2PnahSO.js} +1 -1
  82. package/dist/client/assets/{decopilot-sse-pool-C9VeVJ93.js → decopilot-sse-pool-D8ZetksK.js} +1 -1
  83. package/dist/client/assets/{dialog-jX6bYdqO.js → dialog-9Dal6l7D.js} +1 -1
  84. package/dist/client/assets/{domain-settings-DSTf_XC1.js → domain-settings-L_Aj9ndM.js} +1 -1
  85. package/dist/client/assets/{drawer-EgN8HzIq.js → drawer-DW4IYbB1.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-BOrPFviJ.js → dropdown-menu-DveShRRm.js} +1 -1
  87. package/dist/client/assets/{empty-state-BZIY4ETU.js → empty-state-b7tnb7q2.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-Dz1SJTDF.js → extract-connection-data-BL81V9PY.js} +1 -1
  89. package/dist/client/assets/{file-explorer-CtIkaECZ.js → file-explorer-0kznGCON.js} +1 -1
  90. package/dist/client/assets/{file-type-icon-CiTHpOyi.js → file-type-icon-hjib5alc.js} +1 -1
  91. package/dist/client/assets/{files-D4cQybZ3.js → files-x3Ne7hb6.js} +1 -1
  92. package/dist/client/assets/{form-D-Lg2Vno.js → form-6Nre8f-k.js} +1 -1
  93. package/dist/client/assets/{general-BLLTGXVC.js → general-BuYCdj0r.js} +1 -1
  94. package/dist/client/assets/{github-repo-picker-BtGY0bTC.js → github-repo-picker-CdGt5INt.js} +1 -1
  95. package/dist/client/assets/{hooks-Bq2gpnHq.js → hooks-Gm6nJHH5.js} +1 -1
  96. package/dist/client/assets/{image-field-CopsGD8K.js → image-field-CfVmwwEw.js} +1 -1
  97. package/dist/client/assets/{import-from-deco-dialog-DTeSs8zZ.js → import-from-deco-dialog-COzfTmtE.js} +1 -1
  98. package/dist/client/assets/{index-OWX18MdF.js → index-ARPJar1Z.js} +1 -1
  99. package/dist/client/assets/{index-an-q9BoC.js → index-BsTDFmrB.js} +1 -1
  100. package/dist/client/assets/{index-B_T2Tm_n.js → index-C5uKx36f.js} +1 -1
  101. package/dist/client/assets/{index-D9cso_OE.js → index-C6QaS0Zh.js} +3 -3
  102. package/dist/client/assets/{index-DjsYubVL.js → index-CaL7muMy.js} +1 -1
  103. package/dist/client/assets/{index-DsuFa3M3.js → index-DB4Y8lPy.js} +1 -1
  104. package/dist/client/assets/{index-TfVSao84.js → index-DXWbUTbb.js} +1 -1
  105. package/dist/client/assets/index-DYNdZRHD.css +1 -0
  106. package/dist/client/assets/{index-CwCkKeIW.js → index-DcLVAN0f.js} +1 -1
  107. package/dist/client/assets/{index-CApC7A2-.js → index-DllFGtwL.js} +1 -1
  108. package/dist/client/assets/{index-BIlZxD1s.js → index-SIbEiNOY.js} +1 -1
  109. package/dist/client/assets/{index-FMQJTdgj.js → index-_NByWM-i.js} +1 -1
  110. package/dist/client/assets/{index-CpN1_PlS.js → index-gAhVY6Qu.js} +1 -1
  111. package/dist/client/assets/{index-DJ0Ge3cT.js → index-ki8HSB2c.js} +4 -4
  112. package/dist/client/assets/{index-redirect-B5cnslmT.js → index-redirect-ChQQXx0A.js} +1 -1
  113. package/dist/client/assets/{index-BMuKOY-R.js → index-royGCF58.js} +1 -1
  114. package/dist/client/assets/{input-aftZq0qp.js → input-szhd6Snj.js} +1 -1
  115. package/dist/client/assets/integration-icon-XSMgSpds.js +1 -0
  116. package/dist/client/assets/{label-BlTB1rsr.js → label-Bjb_vEVQ.js} +1 -1
  117. package/dist/client/assets/{login-DwqD6H9f.js → login-C6SDd68X.js} +1 -1
  118. package/dist/client/assets/{mcp-oauth-DYo7_iWt.js → mcp-oauth-8Oqz2kjD.js} +1 -1
  119. package/dist/client/assets/{members-BAmGZs_l.js → members-BZMsTuPj.js} +1 -1
  120. package/dist/client/assets/{monaco-editor-dFjmNtXr.js → monaco-editor-Bzp2tCW_.js} +1 -1
  121. package/dist/client/assets/{monitoring-stats-row-DXzyXSPo.js → monitoring-stats-row-Q-gDhXN7.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-BnUvVOzM.js → oauth-callback-C41rH1zN.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-ai-provider-CtGpymDw.js → oauth-callback-ai-provider-L9Z7KnVB.js} +1 -1
  124. package/dist/client/assets/{onboarding-tHyZv_uW.js → onboarding-sxFOChym.js} +1 -1
  125. package/dist/client/assets/{org-install-BJnctrXU.js → org-install-DjUJMgS3.js} +1 -1
  126. package/dist/client/assets/{org-layout-DgadVfYy.js → org-layout-C4CQO9nz.js} +1 -1
  127. package/dist/client/assets/{organization-choice-HfpQcKxS.js → organization-choice-CPVuyoim.js} +1 -1
  128. package/dist/client/assets/{page-seo-form-j7a8Z1BY.js → page-seo-form--ih05Y7N.js} +1 -1
  129. package/dist/client/assets/page-seo-sheet-BGthAy6g.js +1 -0
  130. package/dist/client/assets/{popover-D43tJ8in.js → popover-CJ-idfVW.js} +1 -1
  131. package/dist/client/assets/{post-editor-XU3B2wmV.js → post-editor-BhGUUjQx.js} +1 -1
  132. package/dist/client/assets/{preview-dialog-BrHmAwG0.js → preview-dialog-WfNb4k8L.js} +1 -1
  133. package/dist/client/assets/{primitives-BRyBxVlk.js → primitives-BmQhQ3Bl.js} +1 -1
  134. package/dist/client/assets/{profile-CLM3LuOb.js → profile-C2hbZXR_.js} +1 -1
  135. package/dist/client/assets/project-app-view-QWISlKTP.js +1 -0
  136. package/dist/client/assets/record-editor-D9nFQqRP.js +1 -0
  137. package/dist/client/assets/registry-C4EXobcg.js +2 -0
  138. package/dist/client/assets/{registry-layout-pqx5X3wF.js → registry-layout-BSbINHnj.js} +1 -1
  139. package/dist/client/assets/{require-capability-BQ22Wt23.js → require-capability-D2kIyw8V.js} +1 -1
  140. package/dist/client/assets/{required-auth-layout-wApn6jVI.js → required-auth-layout-BbLd1LMa.js} +1 -1
  141. package/dist/client/assets/{reset-password-deaGgEkO.js → reset-password-lidTRlgJ.js} +1 -1
  142. package/dist/client/assets/{roles-RG2bRHsu.js → roles-7cj_C6tf.js} +1 -1
  143. package/dist/client/assets/save-referenced-block-Dw7QM0hK.js +1 -0
  144. package/dist/client/assets/{save-status-BiRx7JAD.js → save-status-BkW3fzUs.js} +1 -1
  145. package/dist/client/assets/{schema-form-sBBUMk07.js → schema-form-Cg7Lxy8-.js} +1 -1
  146. package/dist/client/assets/{scroll-area-BSGl-_zx.js → scroll-area-Dz-FqKWj.js} +1 -1
  147. package/dist/client/assets/{search-input-Cn14rzZS.js → search-input-DjVPTtCb.js} +1 -1
  148. package/dist/client/assets/{secrets-D-nSpmHI.js → secrets-BJZgSFDD.js} +1 -1
  149. package/dist/client/assets/{sections-editor-NjvzZlHu.js → sections-editor-ez2BbDtS.js} +1 -1
  150. package/dist/client/assets/{select-BGb-ZPds.js → select-FwtHY18v.js} +1 -1
  151. package/dist/client/assets/{select-model-C_rVNd_q.js → select-model-Bf7O5MiJ.js} +1 -1
  152. package/dist/client/assets/{seo-editor-Bvd2538m.js → seo-editor-BtQCMu5l.js} +1 -1
  153. package/dist/client/assets/{settings-layout-CrGAcHuU.js → settings-layout-DDlBA-ta.js} +1 -1
  154. package/dist/client/assets/{settings-section-Bc3yjWcB.js → settings-section-PIk2gDH0.js} +1 -1
  155. package/dist/client/assets/{sheet-HFHR_AuU.js → sheet-BvSpiY2r.js} +1 -1
  156. package/dist/client/assets/{shell-controls-HLzK4I7E.js → shell-controls-C08RpHmT.js} +1 -1
  157. package/dist/client/assets/{shell-layout-LI1vyNzj.js → shell-layout-BWQLmjyW.js} +1 -1
  158. package/dist/client/assets/{shell-route-loading-BDOpNoYP.js → shell-route-loading-Cf96p6By.js} +1 -1
  159. package/dist/client/assets/{sidebar-BGJoJ5IQ.js → sidebar-LVNues-1.js} +1 -1
  160. package/dist/client/assets/{skeleton-hFHnIcZ0.js → skeleton-B8_-zyKb.js} +1 -1
  161. package/dist/client/assets/{sortable.esm-DIVJmvz6.js → sortable.esm-DHMK7_tT.js} +1 -1
  162. package/dist/client/assets/{sso-Bn468zRH.js → sso-CRuWYtBt.js} +1 -1
  163. package/dist/client/assets/{store-DytIJvdt.js → store-73nRfAHP.js} +1 -1
  164. package/dist/client/assets/store-registry-Dj2QFrh5.js +2 -0
  165. package/dist/client/assets/{studio-tools-eP_o-Bzq.js → studio-tools-CJMVZA0W.js} +1 -1
  166. package/dist/client/assets/{switch-DalcHZ66.js → switch-YOR9drgK.js} +1 -1
  167. package/dist/client/assets/{table-CnWjZkvw.js → table-COWO-rWc.js} +1 -1
  168. package/dist/client/assets/{tabs-BhJfCfA3.js → tabs-CsXXbMGG.js} +1 -1
  169. package/dist/client/assets/{task-status-BwSSlnug.js → task-status-D4qDcTy4.js} +1 -1
  170. package/dist/client/assets/{textarea-DTW1SKGc.js → textarea-BTbunR8j.js} +1 -1
  171. package/dist/client/assets/{toggle-group-CRnMovNn.js → toggle-group-CSMS4HAA.js} +1 -1
  172. package/dist/client/assets/{toolbar-BVgga9fW.js → toolbar-CvxN3T7P.js} +1 -1
  173. package/dist/client/assets/{tooltip-DVHwyu-W.js → tooltip-BdbfQCYl.js} +1 -1
  174. package/dist/client/assets/{types-B1E3Ybp7.js → types-D18PqArI.js} +1 -1
  175. package/dist/client/assets/{use-ai-providers-DP8qFD8W.js → use-ai-providers-CiBlqHeC.js} +1 -1
  176. package/dist/client/assets/{use-automations-QBk1wzKE.js → use-automations-44dHfXzj.js} +1 -1
  177. package/dist/client/assets/{use-capability-D3mzXNBE.js → use-capability-DH5i0nun.js} +1 -1
  178. package/dist/client/assets/{use-clock-tick-YCiBQpNz.js → use-clock-tick-bD6VBNNM.js} +1 -1
  179. package/dist/client/assets/{use-collections-sgcijgPQ.js → use-collections-DaAI2dS_.js} +1 -1
  180. package/dist/client/assets/{use-connection-CFC8WumP.js → use-connection-z93iohVP.js} +1 -1
  181. package/dist/client/assets/{use-copy-BVyzmTt4.js → use-copy-_XYMvM2G.js} +1 -1
  182. package/dist/client/assets/{use-create-virtual-mcp-40n1TbuY.js → use-create-virtual-mcp-BA4rAHKP.js} +1 -1
  183. package/dist/client/assets/{use-debounced-autosave-tiHawAIR.js → use-debounced-autosave-CaWQv8Ap.js} +1 -1
  184. package/dist/client/assets/{use-deco-credits-C1ftH3If.js → use-deco-credits-C3sjfJyT.js} +1 -1
  185. package/dist/client/assets/{use-delete-connection-CUd76KVl.js → use-delete-connection-ftKt28t_.js} +1 -1
  186. package/dist/client/assets/{use-file-configs-C2ceyi4L.js → use-file-configs-CS1kf1Mx.js} +1 -1
  187. package/dist/client/assets/{use-infinite-scroll-CvmJXJdB.js → use-infinite-scroll-CUe3Elw1.js} +1 -1
  188. package/dist/client/assets/{use-join-requests-CRlCmWm0.js → use-join-requests-iCFOb_l5.js} +1 -1
  189. package/dist/client/assets/{use-mcp-client-DFe1X8lW.js → use-mcp-client-DZQbnef-.js} +1 -1
  190. package/dist/client/assets/{use-mcp-prompts-4cCmLVZX.js → use-mcp-prompts-CDHTi3et.js} +1 -1
  191. package/dist/client/assets/{use-mcp-tools-DI9Jj-_Y.js → use-mcp-tools-DOD2Zkcv.js} +1 -1
  192. package/dist/client/assets/{use-members-KDk_htTJ.js → use-members-Cgp-qtNm.js} +1 -1
  193. package/dist/client/assets/{use-navigate-to-agent-D9iFw7Zt.js → use-navigate-to-agent-DUbEZuBm.js} +1 -1
  194. package/dist/client/assets/{use-org-auth-client-SaCcE0Qc.js → use-org-auth-client-TLh9Nsd6.js} +1 -1
  195. package/dist/client/assets/{use-org-sso-4n2o97PC.js → use-org-sso-BhXMb9mL.js} +1 -1
  196. package/dist/client/assets/{use-organization-roles-BXjlJlvC.js → use-organization-roles-Dua0G_kp.js} +1 -1
  197. package/dist/client/assets/{use-organization-settings-CJJ_tXSe.js → use-organization-settings-Bjk_kH1I.js} +1 -1
  198. package/dist/client/assets/{use-registry-connections-DGZtDiY8.js → use-registry-connections-DfipPXqa.js} +1 -1
  199. package/dist/client/assets/{use-secrets-DOmnFlDE.js → use-secrets-DCPSjnYq.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-C7IKQ0M3.js → use-status-sounds-DFtMiuOm.js} +1 -1
  201. package/dist/client/assets/{use-view-mode-5sHRttq3.js → use-view-mode-tunDtZ1F.js} +1 -1
  202. package/dist/client/assets/{use-virtual-mcp-Dt17nZX7.js → use-virtual-mcp-BCkbHrLW.js} +1 -1
  203. package/dist/client/assets/useInfiniteQuery-CX9x55X-.js +1 -0
  204. package/dist/client/assets/useSuspenseInfiniteQuery-C_SaQkGF.js +1 -0
  205. package/dist/client/assets/{variant-calendar-DBaInJsx.js → variant-calendar-hE6C_kQd.js} +1 -1
  206. package/dist/client/assets/{view-mode-toggle-dVNz8sR0.js → view-mode-toggle-B1Thrh1l.js} +1 -1
  207. package/dist/client/index.html +2 -2
  208. package/dist/server/cli.js +1 -1
  209. package/package.json +1 -1
  210. package/dist/client/assets/auth-entry-9rxagxJL.js +0 -1
  211. package/dist/client/assets/category-editor-C-xyYK6m.js +0 -1
  212. package/dist/client/assets/commerce-onboarding-YO2BywhJ.js +0 -1
  213. package/dist/client/assets/index-BITgxoqa.css +0 -1
  214. package/dist/client/assets/integration-icon-Dn8UgHow.js +0 -1
  215. package/dist/client/assets/page-seo-sheet-C5rR31Cs.js +0 -1
  216. package/dist/client/assets/project-app-view-Bojee27q.js +0 -1
  217. package/dist/client/assets/record-editor-Cb2nxa0o.js +0 -1
  218. package/dist/client/assets/registry-DJ2WJB-k.js +0 -2
  219. package/dist/client/assets/save-referenced-block-B0RkutY2.js +0 -1
  220. package/dist/client/assets/store-registry-C32JZ3Yi.js +0 -2
  221. package/dist/client/assets/useInfiniteQuery-LattvRM6.js +0 -1
  222. package/dist/client/assets/useSuspenseInfiniteQuery-JNoud7Ca.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as P,r as M,y as xc,C as ah,E as ch,j as p,B as lr,z as Ol,bK as bc,bL as uh,aO as dh,af as rn,bM as fh,l as Z,q as hh,P as $t,Q as Ot,V as kr,$ as ph,ai as mh,W as hn,bN as kc,U as Sc,v as zt,m as gh,d as yh,K as Kt,t as zi,k as Co,b as Ln,a2 as xh,ac as vc,bO as To,ah as bh,bP as Ut}from"./index-D9cso_OE.js";import{f as kh,M as Sh,d as vh,ae as wh,W as Ch,V as Th,U as Nh,ab as wc,af as Mh,ag as Eh,A as Cc,ah as it,ai as Ah,aj as Oh,ak as Ih,j as Rh}from"./agent-icon-DY5w59uF.js";import{t as Fs}from"./Stars01-CM7BslwP.js";import{i as Tc,t as jh,d as Nc,b as Er}from"./XCircle-YOrPaSTA.js";import{i as No}from"./ChevronUp-CiZNoBS5.js";import{i as Il}from"./ChevronRight-DSC2aiCG.js";import{a as Mc,s as Dh}from"./Eye-BSAOg3tU.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-YCiBQpNz.js";import{u as Oc}from"./use-copy-BVyzmTt4.js";import{T as sn,a as on,b as ln}from"./tooltip-DVHwyu-W.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-CiTHpOyi.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-B1E3Ybp7.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-DdkEgZ9_.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-Bq2gpnHq.js";import{u as Uh}from"./studio-tools-eP_o-Bzq.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{e as Gh,u as jc,l as Xh}from"./use-mcp-client-DFe1X8lW.js";import{i as Dc}from"./AlertCircle-Caru_t3W.js";import{s as Jr,t as Pc}from"./Star01-BokvC0Yc.js";import{s as Yh}from"./XClose-B1WSb9MQ.js";import{n as Bi}from"./ZapSquare-CgWRLEJy.js";import{n as Lc,i as Qh}from"./Globe01-B8cJAk0V.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-BDvWQGEc.js";import{b as jl,a as tp}from"./ZoomOut-OytsIYD1.js";import{i as Gn}from"./Monitor01-C4mUj5DO.js";import{i as np}from"./SearchMd-pbTyIZQ0.js";import{i as rp}from"./Upload01-BWq8M5mQ.js";import{b as sp,c as ip}from"./shell-layout-LI1vyNzj.js";import{n as _c}from"./LinkExternal01-C-uuQSHY.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-HFHR_AuU.js";import{I as Sr}from"./integration-icon-Dn8UgHow.js";import{a as up}from"./use-virtual-mcp-Dt17nZX7.js";import{i as dp}from"./ArrowUpRight-B2Dt0814.js";import{a as Ao}from"./Users03-DPSOJZh_.js";import{a as ot}from"./Palette-BqPdnSvn.js";import{m as $c}from"./use-navigate-to-agent-D9iFw7Zt.js";import{a as fp}from"./use-connection-CFC8WumP.js";import{a as hp}from"./Stars02-DTDItJ62.js";import{g as pp}from"./use-mcp-prompts-4cCmLVZX.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-jX6bYdqO.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-D-Lg2Vno.js";import{I as Np}from"./input-aftZq0qp.js";import{t as Mp}from"./ChevronDown-DeW1WG4N.js";import{e as Ep}from"./select-BGb-ZPds.js";const Ap={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function zc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Ap)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Bc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Fc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+zc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function gw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Op(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Oo(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Io(n,e){if(!e)return n;const t=`${Op(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Ip(n,e){return Io(n,e).replace(/[_-]/g," ").toLowerCase()}function Rp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Ol().min(1,"Required"):Ol();return xc(e)}function jp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Dp(n){const e=P.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?Rp(t):xc({});l=ah($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?jp(t,i):{},e[2]=i,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=ch(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let S;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(S=t.title||Ip(t.name,Oo(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=S):S=e[20];let v;e[21]!==S?(v=p.jsx(mp,{children:p.jsx("span",{className:"capitalize",children:S})}),e[21]=S,e[22]=v):v=e[22];let k;e[23]!==t.description?(k=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=k):k=e[24];let C;e[25]!==k||e[26]!==v?(C=p.jsxs(gp,{children:[v,k]}),e[25]=k,e[26]=v,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==y?(w=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=w):w=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=B=>p.jsx(Sp,{control:f.control,name:B.name,render:J=>{const{field:Y}=J;return p.jsxs(vp,{children:[p.jsxs(wp,{className:"text-xs",children:[B.name,B.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Cp,{children:p.jsx(Np,{...Y,value:Y.value??"",required:B.required,placeholder:B.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Tp,{})]})}},B.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(lr,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx($h,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(L=p.jsx(lr,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=o,e[47]=j,e[48]=L):L=e[48];let O;e[49]!==E||e[50]!==L?(O=p.jsxs(yp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=O):O=e[51];let D;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==O?(D=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,O]}),e[52]=o,e[53]=w,e[54]=T,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==f||e[58]!==D?(R=p.jsx(kp,{...f,children:D}),e[57]=f,e[58]=D,e[59]=R):R=e[59];let F;e[60]!==C||e[61]!==R?(F=p.jsxs(xp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[60]=C,e[61]=R,e[62]=F):F=e[62];let z;return e[63]!==b||e[64]!==F?(z=p.jsx(bp,{open:!0,onOpenChange:b,children:F}),e[63]=b,e[64]=F,e[65]=z):z=e[65],z}function Hc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function tt(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function $n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Te(n){this.content=n}Te.prototype={constructor:Te,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 Te(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 Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(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 Te(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=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.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}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Vc(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=Vc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wc(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=Wc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{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 A(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 A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(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 A(s,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(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 Vc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(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?Or(t+1,i):Or(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 A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.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 A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ci={index:0,offset:0};function Or(n,e){return ci.index=n,ci.offset=e,ci}function Gr(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(!Gr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Fi{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&&Gr(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 Fi.none;if(e instanceof Fi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ne.none=[];class Xr extends Error{}class _{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=qc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Uc(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 _.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 _(A.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 _(e,r,s)}}_.empty=new _(A.empty,0,0);function Uc(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(Uc(i.content,e-s-1,t-s-1)))}function qc(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=qc(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Kc(n,e,t,0)}function Kc(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=Kc(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 Zt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Lp(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Yr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function Hi(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function Qt(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 Xn(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&&(Qt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Qt(e.nodeBefore,r)}function Zt(n,e){return n.type.checkContent(e),n.copy(e)}function Gc(n,e,t,r,s){let i=n.depth>s&&Hi(n,e,s+1),o=r.depth>s&&Hi(t,r,s+1),l=[];return Xn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jc(i,o),Qt(Zt(i,Gc(n,e,t,r,s+1)),l)):(i&&Qt(Zt(i,Yr(n,e,s+1)),l),Xn(e,t,s,l),o&&Qt(Zt(o,Yr(t,r,s+1)),l)),Xn(r,null,s,l),new A(l)}function Yr(n,e,t){let r=[];if(Xn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Yr(n,e,t+1)),r)}return Xn(e,null,t,r),new A(r)}function Lp(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(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ar{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 ne.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 Qr(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 ar(t,r,i)}static resolveCached(e,t){let r=Dl.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 Dl.set(e,r=new _p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%$p,s}}class _p{constructor(){this.elts=[],this.i=0}}const $p=12,Dl=new WeakMap;class Qr{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 zp=Object.create(null);class et{constructor(e,t,r,s=ne.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.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&&Gr(this.attrs,t||e.defaultAttrs||zp)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(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 _.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 _(c,s.depth-o,i.depth-o)}replace(e,t,r){return Pp(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 ar.resolveCached(this,e)}resolveNoCache(e){return ar.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()+")"),Xc(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=A.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=ne.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(!ne.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=A.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}et.prototype.text=void 0;class Zr extends et{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):Xc(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 Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(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 Xc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bp(e,t);if(r.next==null)return an.empty;let s=Yc(r);r.next&&r.err("Unexpected trailing text");let i=Kp(qp(s));return Jp(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 A.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{c as P,r as M,y as xc,C as ah,E as ch,j as p,B as lr,z as Ol,bK as bc,bL as uh,aO as dh,af as rn,bM as fh,l as Z,q as hh,P as $t,Q as Ot,V as kr,$ as ph,ai as mh,W as hn,bN as kc,U as Sc,v as zt,m as gh,d as yh,K as Kt,t as zi,k as Co,b as Ln,a2 as xh,ac as vc,bO as To,ah as bh,bP as Ut}from"./index-C6QaS0Zh.js";import{f as kh,M as Sh,d as vh,ae as wh,W as Ch,V as Th,U as Nh,ab as wc,af as Mh,ag as Eh,A as Cc,ah as it,ai as Ah,aj as Oh,ak as Ih,j as Rh}from"./agent-icon-BB2_1lHd.js";import{t as Fs}from"./Stars01-BxW6Ze_W.js";import{i as Tc,t as jh,d as Nc,b as Er}from"./XCircle-CTJX6MKF.js";import{i as No}from"./ChevronUp-BCwumcyZ.js";import{i as Il}from"./ChevronRight-BkBgwZxs.js";import{a as Mc,s as Dh}from"./Eye-IocHlobo.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-bD6VBNNM.js";import{u as Oc}from"./use-copy-_XYMvM2G.js";import{T as sn,a as on,b as ln}from"./tooltip-BdbfQCYl.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-hjib5alc.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-D18PqArI.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-CdOsOHQ0.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-Gm6nJHH5.js";import{u as Uh}from"./studio-tools-CJMVZA0W.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{e as Gh,u as jc,l as Xh}from"./use-mcp-client-DZQbnef-.js";import{i as Dc}from"./AlertCircle-CKei65yQ.js";import{s as Jr,t as Pc}from"./Star01-G7bzpuzw.js";import{s as Yh}from"./XClose-BbKrO-bh.js";import{n as Bi}from"./ZapSquare-bUJqwnW3.js";import{n as Lc,i as Qh}from"./Globe01-CQy0Cxa-.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-hkwqrr6Q.js";import{b as jl,a as tp}from"./ZoomOut-DRnFWZo9.js";import{i as Gn}from"./Monitor01-CF5y8J9X.js";import{i as np}from"./SearchMd-DmrRiPsU.js";import{i as rp}from"./Upload01-Cuswrale.js";import{b as sp,c as ip}from"./shell-layout-BWQLmjyW.js";import{n as _c}from"./LinkExternal01-BenQb5F0.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-BvSpiY2r.js";import{I as Sr}from"./integration-icon-XSMgSpds.js";import{a as up}from"./use-virtual-mcp-BCkbHrLW.js";import{i as dp}from"./ArrowUpRight-BygwtcZ2.js";import{a as Ao}from"./Users03-CjtA3d84.js";import{a as ot}from"./Palette-ZSzAttfE.js";import{m as $c}from"./use-navigate-to-agent-DUbEZuBm.js";import{a as fp}from"./use-connection-z93iohVP.js";import{a as hp}from"./Stars02-CJJhFv2L.js";import{g as pp}from"./use-mcp-prompts-CDHTi3et.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-9Dal6l7D.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-6Nre8f-k.js";import{I as Np}from"./input-szhd6Snj.js";import{t as Mp}from"./ChevronDown-DXOZkIso.js";import{e as Ep}from"./select-FwtHY18v.js";const Ap={openrouter:n=>{const e=n?.openrouter;return typeof e=="object"&&e!==null&&"usage"in e&&typeof e.usage=="object"&&e.usage!==null&&"cost"in e.usage&&typeof e.usage.cost=="number"?e.usage.cost:null}};function zc(n){if(!n?.providerMetadata)return 0;for(const e of Object.values(Ap)){const t=e(n.providerMetadata);if(t!==null)return t}return 0}function Bc(){return{inputTokens:0,outputTokens:0,reasoningTokens:0,totalTokens:0,cost:0,cacheReadTokens:0,cacheWriteTokens:0}}function Fc(n,e){if(!e)return n;const t=e.inputTokenDetails?.cacheReadTokens??e.cachedInputTokens??0,r=e.inputTokenDetails?.cacheWriteTokens??0;return{inputTokens:n.inputTokens+(e.inputTokens??0),outputTokens:n.outputTokens+(e.outputTokens??0),reasoningTokens:n.reasoningTokens+(e.reasoningTokens??0),totalTokens:n.totalTokens+(e.totalTokens??0),cost:n.cost+zc(e),cacheReadTokens:n.cacheReadTokens+t,cacheWriteTokens:n.cacheWriteTokens+r}}function gw(n){return n.reduce((e,t)=>Fc(e,t.metadata?.usage),Bc())}function Op(n){return n.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Oo(n){if(n&&typeof n=="object"&&"gatewayClientId"in n&&typeof n.gatewayClientId=="string")return n.gatewayClientId}function Io(n,e){if(!e)return n;const t=`${Op(e)}_`;return n.startsWith(t)?n.slice(t.length):n}function Ip(n,e){return Io(n,e).replace(/[_-]/g," ").toLowerCase()}function Rp(n){const e={};for(const t of n.arguments??[])e[t.name]=t.required?Ol().min(1,"Required"):Ol();return xc(e)}function jp(n,e){const t={};for(const r of n.arguments??[])t[r.name]=e?.[r.name]??"";return t}function Dp(n){const e=P.c(66),{prompt:t,setPrompt:r,onSubmit:s,defaultValues:i}=n,o=M.useId();let l;if(e[0]!==t){const $=t?Rp(t):xc({});l=ah($),e[0]=t,e[1]=l}else l=e[1];const c=l;let u;e[2]!==i||e[3]!==t?(u=t?jp(t,i):{},e[2]=i,e[3]=t,e[4]=u):u=e[4];let d;e[5]!==c||e[6]!==u?(d={resolver:c,defaultValues:u,mode:"onChange"},e[5]=c,e[6]=u,e[7]=d):d=e[7];const f=ch(d);let h;e[8]!==t?.arguments?(h=t?.arguments??[],e[8]=t?.arguments,e[9]=h):h=e[9];const m=h;let g;e[10]!==f||e[11]!==s||e[12]!==r?(g=async $=>{await s($),r(null),f.reset()},e[10]=f,e[11]=s,e[12]=r,e[13]=g):g=e[13];const y=g;let x;e[14]!==f||e[15]!==r?(x=$=>{$||(f.reset(),r(null))},e[14]=f,e[15]=r,e[16]=x):x=e[16];const b=x;if(!t)return null;let S;e[17]!==t._meta||e[18]!==t.name||e[19]!==t.title?(S=t.title||Ip(t.name,Oo(t._meta)),e[17]=t._meta,e[18]=t.name,e[19]=t.title,e[20]=S):S=e[20];let v;e[21]!==S?(v=p.jsx(mp,{children:p.jsx("span",{className:"capitalize",children:S})}),e[21]=S,e[22]=v):v=e[22];let k;e[23]!==t.description?(k=t.description&&p.jsx("p",{className:"text-sm text-muted-foreground",children:t.description}),e[23]=t.description,e[24]=k):k=e[24];let C;e[25]!==k||e[26]!==v?(C=p.jsxs(gp,{children:[v,k]}),e[25]=k,e[26]=v,e[27]=C):C=e[27];let w;e[28]!==f||e[29]!==y?(w=$=>{$.stopPropagation(),f.handleSubmit(y)($)},e[28]=f,e[29]=y,e[30]=w):w=e[30];let T;if(e[31]!==m||e[32]!==f.control||e[33]!==f.formState.isSubmitting){let $;e[35]!==f.control||e[36]!==f.formState.isSubmitting?($=B=>p.jsx(Sp,{control:f.control,name:B.name,render:J=>{const{field:Y}=J;return p.jsxs(vp,{children:[p.jsxs(wp,{className:"text-xs",children:[B.name,B.required?null:p.jsxs("span",{className:"text-muted-foreground font-normal",children:[" ","(optional)"]})]}),p.jsx(Cp,{children:p.jsx(Np,{...Y,value:Y.value??"",required:B.required,placeholder:B.description??"",className:"h-9",disabled:f.formState.isSubmitting})}),p.jsx(Tp,{})]})}},B.name),e[35]=f.control,e[36]=f.formState.isSubmitting,e[37]=$):$=e[37],T=m.map($),e[31]=m,e[32]=f.control,e[33]=f.formState.isSubmitting,e[34]=T}else T=e[34];let N;e[38]!==b?(N=()=>b(!1),e[38]=b,e[39]=N):N=e[39];let E;e[40]!==f.formState.isSubmitting||e[41]!==N?(E=p.jsx(lr,{type:"button",variant:"ghost",onClick:N,disabled:f.formState.isSubmitting,children:"Cancel"}),e[40]=f.formState.isSubmitting,e[41]=N,e[42]=E):E=e[42];let j;e[43]!==f.formState.isSubmitting?(j=f.formState.isSubmitting?p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx($h,{size:"xs"}),"Loading..."]}):"Use prompt",e[43]=f.formState.isSubmitting,e[44]=j):j=e[44];let L;e[45]!==f.formState.isSubmitting||e[46]!==o||e[47]!==j?(L=p.jsx(lr,{type:"submit",form:o,disabled:f.formState.isSubmitting,children:j}),e[45]=f.formState.isSubmitting,e[46]=o,e[47]=j,e[48]=L):L=e[48];let O;e[49]!==E||e[50]!==L?(O=p.jsxs(yp,{children:[E,L]}),e[49]=E,e[50]=L,e[51]=O):O=e[51];let D;e[52]!==o||e[53]!==w||e[54]!==T||e[55]!==O?(D=p.jsxs("form",{id:o,className:"space-y-4 py-4",autoComplete:"off",onSubmit:w,children:[T,O]}),e[52]=o,e[53]=w,e[54]=T,e[55]=O,e[56]=D):D=e[56];let R;e[57]!==f||e[58]!==D?(R=p.jsx(kp,{...f,children:D}),e[57]=f,e[58]=D,e[59]=R):R=e[59];let F;e[60]!==C||e[61]!==R?(F=p.jsxs(xp,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[C,R]}),e[60]=C,e[61]=R,e[62]=F):F=e[62];let z;return e[63]!==b||e[64]!==F?(z=p.jsx(bp,{open:!0,onOpenChange:b,children:F}),e[63]=b,e[64]=F,e[65]=z):z=e[65],z}function Hc(n){return n?n.replace(/[_-]/g," ").toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "):""}function tt(n,e){return n==="output-error"||n==="output-denied"?"error":n==="approval-requested"?"approval":n==="input-streaming"||n==="input-available"||n==="output-available"&&e===!0?"loading":"idle"}function $n(n){if(n==null||typeof n!="object")return;const e=n;if(e.structuredContent&&typeof e.structuredContent=="object")return e.structuredContent;if(Array.isArray(e.content)){const t=e.content[0];if(t?.type==="text"&&typeof t.text=="string")try{return JSON.parse(t.text)}catch{return}return}return n}function Te(n){this.content=n}Te.prototype={constructor:Te,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 Te(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 Te(t)},addToStart:function(n,e){return new Te([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Te(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 Te(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=Te.from(n),n.size?new Te(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Te.from(n),n.size?new Te(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Te.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}};Te.from=function(n){if(n instanceof Te)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Te(e)};function Vc(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=Vc(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function Wc(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=Wc(o.content,l.content,t-1,r-1);if(c)return c}t-=a,r-=a}}class A{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 A(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 A(r,s)}cutByIndex(e,t){return e==t?A.empty:e==0&&t==this.content.length?this:new A(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 A(s,i)}addToStart(e){return new A([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new A(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 Vc(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Wc(this,e,t,r)}findIndex(e){if(e==0)return Or(0,e);if(e==this.size)return Or(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?Or(t+1,i):Or(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 A.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new A(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return A.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 A(t||e,r)}static from(e){if(!e)return A.empty;if(e instanceof A)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new A([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}A.empty=new A([],0);const ci={index:0,offset:0};function Or(n,e){return ci.index=n,ci.offset=e,ci}function Gr(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(!Gr(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Gr(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let ne=class Fi{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&&Gr(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 Fi.none;if(e instanceof Fi)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};ne.none=[];class Xr extends Error{}class _{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=qc(this.content,e+this.openStart,t);return r&&new _(r,this.openStart,this.openEnd)}removeBetween(e,t){return new _(Uc(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 _.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 _(A.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 _(e,r,s)}}_.empty=new _(A.empty,0,0);function Uc(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(Uc(i.content,e-s-1,t-s-1)))}function qc(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=qc(o.content,e-i-1,t,o);return l&&n.replaceChild(s,o.copy(l))}function Pp(n,e,t){if(t.openStart>n.depth)throw new Xr("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Xr("Inconsistent open depths");return Kc(n,e,t,0)}function Kc(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=Kc(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 Zt(o,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Lp(t,n);return Zt(i,Gc(n,o,l,e,r))}else return Zt(i,Yr(n,e,r))}function Jc(n,e){if(!e.type.compatibleContent(n.type))throw new Xr("Cannot join "+e.type.name+" onto "+n.type.name)}function Hi(n,e,t){let r=n.node(t);return Jc(r,e.node(t)),r}function Qt(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 Xn(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&&(Qt(n.nodeAfter,r),i++));for(let l=i;l<o;l++)Qt(s.child(l),r);e&&e.depth==t&&e.textOffset&&Qt(e.nodeBefore,r)}function Zt(n,e){return n.type.checkContent(e),n.copy(e)}function Gc(n,e,t,r,s){let i=n.depth>s&&Hi(n,e,s+1),o=r.depth>s&&Hi(t,r,s+1),l=[];return Xn(null,n,s,l),i&&o&&e.index(s)==t.index(s)?(Jc(i,o),Qt(Zt(i,Gc(n,e,t,r,s+1)),l)):(i&&Qt(Zt(i,Yr(n,e,s+1)),l),Xn(e,t,s,l),o&&Qt(Zt(o,Yr(t,r,s+1)),l)),Xn(r,null,s,l),new A(l)}function Yr(n,e,t){let r=[];if(Xn(null,n,t,r),n.depth>t){let s=Hi(n,e,t+1);Qt(Zt(s,Yr(n,e,t+1)),r)}return Xn(e,null,t,r),new A(r)}function Lp(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(A.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class ar{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 ne.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 Qr(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 ar(t,r,i)}static resolveCached(e,t){let r=Dl.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 Dl.set(e,r=new _p);let s=r.elts[r.i]=ar.resolve(e,t);return r.i=(r.i+1)%$p,s}}class _p{constructor(){this.elts=[],this.i=0}}const $p=12,Dl=new WeakMap;class Qr{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 zp=Object.create(null);class et{constructor(e,t,r,s=ne.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||A.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&&Gr(this.attrs,t||e.defaultAttrs||zp)&&ne.sameSet(this.marks,r||ne.none)}copy(e=null){return e==this.content?this:new et(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new et(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 _.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 _(c,s.depth-o,i.depth-o)}replace(e,t,r){return Pp(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 ar.resolveCached(this,e)}resolveNoCache(e){return ar.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()+")"),Xc(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=A.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=ne.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(!ne.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=A.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,s,r);return i.type.checkAttrs(i.attrs),i}}et.prototype.text=void 0;class Zr extends et{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):Xc(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 Zr(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Zr(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 Xc(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class an{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Bp(e,t);if(r.next==null)return an.empty;let s=Yc(r);r.next&&r.err("Unexpected trailing text");let i=Kp(qp(s));return Jp(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 A.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
  `)}}an.empty=new an(!0);class Bp{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 Yc(n){let e=[];do e.push(Fp(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Fp(n){let e=[];do e.push(Hp(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Hp(n){let e=Up(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=Vp(n,e);else break;return e}function Pl(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Vp(n,e){let t=Pl(n),r=t;return n.eat(",")&&(n.next!="}"?r=Pl(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Wp(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 Up(n){if(n.eat("(")){let e=Yc(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=Wp(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 qp(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 Qc(n,e){return e-n}function Ll(n,e){let t=[];return r(e),t.sort(Qc);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 Kp(n){let e=Object.create(null);return t(Ll(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]);Ll(n,a).forEach(u=>{c||s.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new an(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let l=s[o][1].sort(Qc);i.next.push({type:s[o][0],next:e[l.join(",")]||t(l)})}return i}}function Jp(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 Zc(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 eu(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 tu(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 nu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new Xp(n,r,e[r]);return t}let _l=class ru{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=nu(e,r.attrs),this.defaultAttrs=Zc(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==an.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:eu(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new et(this,this.computeAttrs(e),A.from(t),ne.setFrom(r))}createChecked(e=null,t,r){return t=A.from(t),this.checkContent(t),new et(this,this.computeAttrs(e),t,ne.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=A.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(A.empty,!0);return i?new et(this,e,t.append(i),ne.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){tu(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:ne.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new ru(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 Gp(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 Xp{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Gp(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Hs{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=nu(e,s.attrs),this.excluded=null;let i=Zc(this.attrs);this.instance=i?new ne(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ne(this,eu(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new Hs(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){tu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class su{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=Te.from(e.nodes),t.marks=Te.from(e.marks||{}),this.nodes=_l.compile(this.spec.nodes,this),this.marks=Hs.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]=an.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?$l(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==""?[]:$l(this,o.split(" "))}this.nodeFromJSON=s=>et.fromJSON(this,s),this.markFromJSON=s=>ne.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 _l){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 Zr(r,r.defaultAttrs,e,ne.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 $l(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 Yp(n){return n.tag!=null}function Qp(n){return n.style!=null}class It{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(Yp(s))this.tags.push(s);else if(Qp(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 Bl(this,t,!1);return r.addAll(e,ne.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Bl(this,t,!0);return r.addAll(e,ne.none,t.from,t.to),_.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(tm(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=Fl(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=Fl(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new It(e,It.schemaRules(e)))}}const iu={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},Zp={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},ou={ol:!0,ul:!0},cr=1,Vi=2,Yn=4;function zl(n,e,t){return e!=null?(e?cr:0)|(e==="full"?Vi:0):n&&n.whitespace=="pre"?cr|Vi:t&~Yn}class Ir{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=ne.none,this.match=i||(o&Yn?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(A.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&cr)){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=A.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(A.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&&!iu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Bl{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=zl(null,t.preserveWhitespace,0)|(r?Yn:0);s?i=new Ir(s.type,s.attrs,ne.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new Ir(null,null,ne.none,!0,null,o):i=new Ir(e.schema.topNodeType,null,ne.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&Vi?"full":this.localPreserveWS||(s.options&cr)>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;ou.hasOwnProperty(o)&&this.parser.normalizeLists&&em(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:Zp.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(iu.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=ne.none;for(let l of s.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Hl(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=zl(e,i,o.options);o.options&Yn&&o.content.length==0&&(l|=Yn);let a=ne.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):Hl(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new Ir(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|=cr)}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 em(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&ou.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function tm(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Fl(n){let e={};for(let t in n)e[t]=n[t];return e}function Hl(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 pn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=ui(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}=Vr(ui(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&&Vr(ui(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Vr(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new pn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Vl(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return Vl(e.marks)}}function Vl(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function ui(n){return n.document||window.document}const Wl=new WeakMap;function nm(n){let e=Wl.get(n);return e===void 0&&Wl.set(n,e=rm(n)),e}function rm(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 Vr(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=nm(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:m}=Vr(n,f,t,r);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const lu=65535,au=Math.pow(2,16);function sm(n,e){return n+e*au}function Ul(n){return n&lu}function im(n){return(n-(n&lu))/au}const cu=1,uu=2,Wr=4,du=8;class Wi{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&du)>0}get deletedBefore(){return(this.delInfo&(cu|Wr))>0}get deletedAfter(){return(this.delInfo&(uu|Wr))>0}get deletedAcross(){return(this.delInfo&Wr)>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=Ul(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+im(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 m=e==(t<0?a:d)?null:sm(l/3,e-a),g=e==a?uu:e==d?cu:Wr;return(t<0?e!=a:e!=d)&&(g|=du),new Wi(h,g,m)}s+=u-c}return r?e+s:new Wi(e+s,0,null)}touches(e,t){let r=0,s=Ul(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 ur{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 ur(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 ur;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 Wi(e,s,null)}}const di=Object.create(null);class De{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=di[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 di)throw new RangeError("Duplicate use of step JSON ID "+e);return di[e]=t,t.prototype.jsonID=e,t}}class me{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new me(e,null)}static fail(e){return new me(null,e)}static fromReplace(e,t,r,s){try{return me.ok(e.replace(t,r,s))}catch(i){if(i instanceof Xr)return me.fail(i.message);throw i}}}function Ro(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(Ro(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return A.fromArray(r)}class Mt extends De{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 _(Ro(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 me.fromReplace(e,this.from,this.to,i)}invert(){return new Ze(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 Mt(t.pos,r.pos,this.mark)}merge(e){return e instanceof Mt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Mt(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 Mt(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("addMark",Mt);class Ze extends De{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 _(Ro(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return me.fromReplace(e,this.from,this.to,r)}invert(){return new Mt(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 Ze(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ze&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ze(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 Ze(t.from,t.to,e.markFromJSON(t.mark))}}De.jsonID("removeMark",Ze);class Et extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new _(A.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 Et(this.pos,t.marks[s]);return new Et(this.pos,this.mark)}}return new cn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Et(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 Et(t.pos,e.markFromJSON(t.mark))}}De.jsonID("addNodeMark",Et);class cn extends De{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return me.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return me.fromReplace(e,this.pos,this.pos+1,new _(A.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Et(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new cn(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 cn(t.pos,e.markFromJSON(t.mark))}}De.jsonID("removeNodeMark",cn);class pe extends De{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&Ui(e,this.from,this.to)?me.fail("Structure replace would overwrite content"):me.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 pe(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&&pe.MAP_BIAS<0?t:e.mapResult(this.from,1);return r.deletedAcross&&t.deletedAcross?null:new pe(r.pos,Math.max(r.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof pe)||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?_.empty:new _(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pe(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?_.empty:new _(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pe(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 pe(t.from,t.to,_.fromJSON(e,t.slice),!!t.structure)}}pe.MAP_BIAS=1;De.jsonID("replace",pe);class ve extends De{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&&(Ui(e,this.from,this.gapFrom)||Ui(e,this.gapTo,this.to)))return me.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return me.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?me.fromReplace(e,this.from,this.to,r):me.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 ve(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 ve(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 ve(t.from,t.to,t.gapFrom,t.gapTo,_.fromJSON(e,t.slice),t.insert,!!t.structure)}}De.jsonID("replaceAround",ve);function Ui(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 om(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),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:s.push(o=new Ze(f,h,d[g])));l&&l.to==f?l.to=h:i.push(l=new Mt(f,h,r))}}),s.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function lm(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 Hs){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 m=s[h];m.step==i-1&&d.eq(s[h].style)&&(f=m)}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 Ze(o.from,o.to,o.style)))}function jo(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 pe(l,u,_.empty));else{r=d;for(let f=0;f<c.marks.length;f++)t.allowsMarkType(c.marks[f].type)||n.step(new Ze(l,u,c.marks[f]));if(s&&c.isText&&t.whitespace!="pre"){let f,h=/\r?\n|\r/g,m;for(;f=h.exec(c.text);)m||(m=new _(A.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new pe(l+f.index,l+f.index+f[0].length,m))}}l=u}if(!r.validEnd){let a=r.fillBefore(A.empty,!0);n.replace(l,l,new _(a,0,0))}for(let a=o.length-1;a>=0;a--)n.step(o[a])}function am(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function zn(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||!am(o,l,a))break;l&&(s=1),a<o.childCount&&(i=1)}return null}function cm(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=A.empty,d=0;for(let m=i,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=A.from(r.node(m).copy(u)),d++):a--;let f=A.empty,h=0;for(let m=i,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=A.from(s.node(m).copy(f)),h++):c++;n.step(new ve(a,c,o,l,new _(u.append(f),d,h),u.size-d,!0))}function Do(n,e,t=null,r=n){let s=um(n,e),i=s&&dm(r,e);return i?s.map(ql).concat({type:e,attrs:t}).concat(i.map(ql)):null}function ql(n){return{type:n,attrs:null}}function um(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 dm(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 fm(n,e,t){let r=A.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=A.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new ve(s,i,s,i,new _(r,0,0),t.length,!0))}function hm(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)&&pm(n.doc,n.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?c=!1:!h&&m&&(c=!0)}c===!1&&hu(n,o,l,i),jo(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 ve(d,f,d+1,f-1,new _(A.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&fu(n,o,l,i),!1}})}function fu(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 hu(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{c as b,l as w,j as a,i as j}from"./index-D9cso_OE.js";import{i as N}from"./SearchMd-pbTyIZQ0.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{c as b,l as w,j as a,i as j}from"./index-C6QaS0Zh.js";import{i as N}from"./SearchMd-DmrRiPsU.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{c as p,j as t,a2 as P,r as j,ae as w,B as S,t as y}from"./index-D9cso_OE.js";import{i as k}from"./AlertCircle-Caru_t3W.js";import{s as z}from"./Plus-e8vsh1yI.js";import{s as F}from"./User01-B5NDreK2.js";import{t as E}from"./Users01-BM4ZmEbl.js";import{d as $,c as I,D as O,a as A,b as R,e as T}from"./dialog-jX6bYdqO.js";import{I as N}from"./input-aftZq0qp.js";import{L as g}from"./label-BlTB1rsr.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-BGb-ZPds.js";import{S as H}from"./skeleton-hFHnIcZ0.js";import{T as K}from"./textarea-DTW1SKGc.js";import{P as b}from"./index-DsuFa3M3.js";import{c as W}from"./settings-section-Bc3yjWcB.js";import{u as Y,a as G}from"./use-secrets-DOmnFlDE.js";import{R as J}from"./require-capability-BQ22Wt23.js";import"./X-CdcmL6WW.js";import"./tooltip-DVHwyu-W.js";import"./ChevronUp-CiZNoBS5.js";import"./ChevronDown-DeW1WG4N.js";import"./sidebar-BGJoJ5IQ.js";import"./LayoutLeft-DfLCxQJZ.js";import"./sheet-HFHR_AuU.js";import"./card-B0EjU25K.js";import"./ArrowUpRight-B2Dt0814.js";import"./studio-tools-eP_o-Bzq.js";import"./use-capability-D3mzXNBE.js";import"./access-gate-DqzudH0L.js";import"./capability-load-error-D72JLeT1.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=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:[c,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,c=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,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 c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=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]=c):c=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:[c,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 o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(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,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=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]=c,e[1]=n):(c=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:[c,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,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.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=>c(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:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=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=()=>c(!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=o.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:o.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:c}),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 $e(){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{$e as default};
1
+ import{c as p,j as t,a2 as P,r as j,ae as w,B as S,t as y}from"./index-C6QaS0Zh.js";import{i as k}from"./AlertCircle-CKei65yQ.js";import{s as z}from"./Plus-DptVePQj.js";import{s as F}from"./User01-DJhz4tmk.js";import{t as E}from"./Users01-D1GekRvz.js";import{d as $,c as I,D as O,a as A,b as R,e as T}from"./dialog-9Dal6l7D.js";import{I as N}from"./input-szhd6Snj.js";import{L as g}from"./label-Bjb_vEVQ.js";import{d as B,b as V,c as L,S as q,a as C}from"./select-FwtHY18v.js";import{S as H}from"./skeleton-B8_-zyKb.js";import{T as K}from"./textarea-BTbunR8j.js";import{P as b}from"./index-DB4Y8lPy.js";import{c as W}from"./settings-section-PIk2gDH0.js";import{u as Y,a as G}from"./use-secrets-DCPSjnYq.js";import{R as J}from"./require-capability-D2kIyw8V.js";import"./X-CvnlrpyG.js";import"./tooltip-BdbfQCYl.js";import"./ChevronUp-BCwumcyZ.js";import"./ChevronDown-DXOZkIso.js";import"./sidebar-LVNues-1.js";import"./LayoutLeft-TAhoC2xE.js";import"./sheet-BvSpiY2r.js";import"./card-DU2I8eHH.js";import"./ArrowUpRight-BygwtcZ2.js";import"./studio-tools-CJMVZA0W.js";import"./use-capability-DH5i0nun.js";import"./access-gate-CAr_jPZ4.js";import"./capability-load-error-Bab-5zvo.js";function M(s){const e=p.c(3),{error:r}=s;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(k,{size:16}),e[0]=c):c=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:[c,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,c=r==="user"?F:E,n=r==="user"?"Private":"Organization";let i;e[0]!==c?(i=t.jsx(c,{size:12}),e[0]=c,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 c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=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]=c):c=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:[c,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 o;e[15]!==l?(o=t.jsx("div",{className:"text-xs text-muted-foreground shrink-0",children:l}),e[15]=l,e[16]=o):o=e[16];let x;return e[17]!==u||e[18]!==o?(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,o]}),e[17]=u,e[18]=o,e[19]=x):x=e[19],x}function U(s){const e=p.c(5),{onCreate:r}=s;let c,n;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=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]=c,e[1]=n):(c=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:[c,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,c]=j.useState("organization"),[n,i]=j.useState(""),[a,d]=j.useState(""),[u,l]=j.useState(""),o=G();function x(){c("organization"),i(""),d(""),l("")}function f(){x(),e(!1)}async function h(m){if(m.preventDefault(),!(!n.trim()||!a))try{await o.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=>c(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:o.isPending,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:o.isPending||!n.trim()||!a,children:o.isPending?"Creating…":"Create secret"})]})]})]})})}function X(){const s=p.c(21),e=Y(),[r,c]=j.useState(!1);if(e.length===0){let l;s[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(U,{onCreate:()=>c(!0)}),s[0]=l):l=s[0];let o;return s[1]!==r?(o=t.jsxs(t.Fragment,{children:[l,t.jsx(_,{open:r,onOpenChange:c})]}),s[1]=r,s[2]=o):o=s[2],o}let n,i,a;if(s[3]!==e){const l=e.filter(se),o=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=()=>c(!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=o.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:o.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:c}),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 $e(){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{$e as default};
@@ -1,2 +1,2 @@
1
- import{c as Le,r as w,j as t,B as Fe,i as qt,l as Ce,m as ta,t as fe,K as na}from"./index-D9cso_OE.js";import{r as sa,i as Tn,c as aa,G as ra,a as jt,b as oa,d as ia,e as la,f as ca,g as ua,h as da,j as ma,k as fa,l as pa,m as bt,p as xt,n as ha,o as Kt,q as Qe,s as vn,t as Sn,P as ga,v as Ft,w as va,x as Sa,y as ba,z as xa,A as ya,B as ja,C as _a,D as dt,E as ka,F as wa,H as Na,I as Ra,J as Ca,K as Da,L as Ta,M as Pa,N as Lt,O as Va,Q as bn,R as Aa,S as Ma,T as Ea,U as zt,V as $a,W as Oa,X as xn}from"./index-DJ0Ge3cT.js";import{t as Ba}from"./ChevronDown-DeW1WG4N.js";import{n as Ka}from"./ChevronLeft-DhtKqfYa.js";import{i as Pn}from"./ChevronRight-DSC2aiCG.js";import{n as Fa}from"./ChevronUp-CiZNoBS5.js";import{K as Ut,D as Vn,S as An,l as La,L as za,M as Ia}from"./agent-icon-DY5w59uF.js";import{i as Ha}from"./Globe01-B8cJAk0V.js";import{S as yt}from"./scroll-area-BSGl-_zx.js";import{b as st,T as at,a as rt}from"./tooltip-DVHwyu-W.js";import{a as Mn,D as En,b as $n,e as On,c as Bn,d as Kn}from"./dialog-jX6bYdqO.js";import{I as Fn}from"./input-aftZq0qp.js";import{s as Ua,a as Wa}from"./Eye-BSAOg3tU.js";import{c as qa}from"./ZoomOut-OytsIYD1.js";import{b as Ja}from"./Settings02-1OASYAA8.js";import{s as Wt}from"./Plus-e8vsh1yI.js";import{s as Ln}from"./Trash01-C3khOwsb.js";import{i as Ya}from"./Zap-CJ80I152.js";import{c as nt,a as zn,D as In,b as Hn,g as Za}from"./dropdown-menu-BOrPFviJ.js";import{u as Un,a as _t,K as Wn,P as qn,b as Jn,C as Yn,s as Zn,d as mt,D as Qn,c as Xn,S as Gn,v as Qa,e as es,h as Xa}from"./sortable.esm-DIVJmvz6.js";import{r as Ga,s as er,V as tr,a as nr,u as et,e as sr,S as ar,M as yn,f as tt,b as ts}from"./schema-form-sBBUMk07.js";import{r as jn,u as rr,d as or,a as ir,i as lr,f as cr,P as ur,b as dr,S as mr}from"./page-seo-form-j7a8Z1BY.js";import{i as fr}from"./Tool01-BDvWQGEc.js";import{AddSectionModal as pr}from"./add-section-modal-kp6f6erO.js";import{c as hr}from"./save-referenced-block-B0RkutY2.js";import"./index-OWX18MdF.js";import"./chat-context-DdkEgZ9_.js";import"./hooks-Bq2gpnHq.js";import"./use-mcp-client-DFe1X8lW.js";import"./auth-DpDDb6PJ.js";import"./decopilot-sse-pool-C9VeVJ93.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-Dt17nZX7.js";import"./use-collections-sgcijgPQ.js";import"./use-ai-providers-DP8qFD8W.js";import"./studio-tools-eP_o-Bzq.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-CJJ_tXSe.js";import"./drawer-EgN8HzIq.js";import"./collection-search-hESxl20y.js";import"./SearchMd-pbTyIZQ0.js";import"./use-mcp-prompts-4cCmLVZX.js";import"./X-CdcmL6WW.js";import"./shell-layout-LI1vyNzj.js";import"./avatar-C7RfbSV0.js";import"./User01-B5NDreK2.js";import"./Users03-DPSOJZh_.js";import"./Stars02-DTDItJ62.js";import"./XClose-B1WSb9MQ.js";import"./CheckCircle-CpjuZYS5.js";import"./FilterLines-BWsEA6cc.js";import"./required-auth-layout-wApn6jVI.js";import"./use-org-sso-4n2o97PC.js";import"./SwitchHorizontal01-DCwdrg-O.js";import"./ZapSquare-CgWRLEJy.js";import"./Star01-BokvC0Yc.js";import"./Upload01-BWq8M5mQ.js";import"./AlertCircle-Caru_t3W.js";import"./form-D-Lg2Vno.js";import"./label-BlTB1rsr.js";import"./select-BGb-ZPds.js";import"./XCircle-YOrPaSTA.js";import"./tabs-BhJfCfA3.js";import"./toggle-group-CRnMovNn.js";import"./use-deco-credits-C1ftH3If.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CJjprKft.js";import"./use-registry-connections-DGZtDiY8.js";import"./use-connection-CFC8WumP.js";import"./useInfiniteQuery-LattvRM6.js";import"./use-infinite-scroll-CvmJXJdB.js";import"./extract-connection-data-Dz1SJTDF.js";import"./card-B0EjU25K.js";import"./integration-icon-Dn8UgHow.js";import"./collection-tabs-99Rq6QsS.js";import"./badge-S-QCOrNN.js";import"./textarea-DTW1SKGc.js";import"./connection-form-helpers-DT5c99yt.js";import"./authenticate-and-persist-oauth-SkR5Q2kF.js";import"./mcp-oauth-DYo7_iWt.js";import"./useSuspenseInfiniteQuery-JNoud7Ca.js";import"./Monitor01-C4mUj5DO.js";import"./connect-desktop-dialog-DR4-xhbf.js";import"./decopilot-KvFscv5D.js";import"./checkbox-DbzbLYfL.js";import"./skeleton-hFHnIcZ0.js";import"./Key01-hqliL23I.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Bc3yjWcB.js";import"./ArrowUpRight-B2Dt0814.js";import"./Stars01-CM7BslwP.js";import"./popover-D43tJ8in.js";import"./command-DJiJXkzC.js";import"./index-CwCkKeIW.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-C7IKQ0M3.js";import"./empty-state-BZIY4ETU.js";import"./toolbar-BVgga9fW.js";import"./preview-dialog-BrHmAwG0.js";import"./LinkExternal01-C-uuQSHY.js";import"./index-BIlZxD1s.js";import"./file-type-icon-CiTHpOyi.js";import"./LayoutLeft-DfLCxQJZ.js";import"./use-mcp-tools-DI9Jj-_Y.js";import"./types-B1E3Ybp7.js";import"./use-capability-D3mzXNBE.js";import"./shell-route-loading-BDOpNoYP.js";import"./index-CApC7A2-.js";import"./alert-dialog-BO7X_BMw.js";import"./switch-DalcHZ66.js";import"./Play-u3Xpo-3H.js";import"./use-debounced-autosave-tiHawAIR.js";import"./index-DsuFa3M3.js";import"./sidebar-BGJoJ5IQ.js";import"./sheet-HFHR_AuU.js";import"./search-input-Cn14rzZS.js";import"./github-repo-picker-BtGY0bTC.js";import"./use-navigate-to-agent-D9iFw7Zt.js";import"./Users01-BM4ZmEbl.js";import"./use-secrets-DOmnFlDE.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-dVNz8sR0.js";import"./DotsVertical-CAFbny0A.js";import"./select-model-C_rVNd_q.js";import"./use-automations-QBk1wzKE.js";import"./monaco-editor-dFjmNtXr.js";import"./automation-runs-VqVE_yW9.js";import"./table-CnWjZkvw.js";import"./use-members-KDk_htTJ.js";import"./use-org-auth-client-SaCcE0Qc.js";import"./task-status-BwSSlnug.js";import"./automation-list-row-BZROLPDh.js";import"./Globe04-BHoeDf9U.js";import"./HardDrive-Ca-rpUZp.js";import"./Sun-CO5Z2lcQ.js";import"./Palette-BqPdnSvn.js";import"./Shield01-BZP4Q_Vm.js";import"./use-clock-tick-YCiBQpNz.js";import"./use-copy-BVyzmTt4.js";import"./content-blocks-o63cs2vh.js";import"./calendar-katBc34c.js";import"./image-field-CopsGD8K.js";import"./use-file-configs-C2ceyi4L.js";function gr(l){const e=Le.c(38),{open:r,initialName:i,autoLabel:m,isPending:h,onSubmit:v,onOpenChange:f}=l,d=h===void 0?!1:h,[S,b]=w.useState(i),[P,N]=w.useState(r);r!==P&&(N(r),r&&b(i));let y;e[0]!==d||e[1]!==f?(y=ee=>{!ee&&!d&&f(!1)},e[0]=d,e[1]=f,e[2]=y):y=e[2];const j=y;let o;e[3]!==d||e[4]!==S||e[5]!==v?(o=async ee=>{ee.preventDefault(),!d&&await v(S.trim())},e[3]=d,e[4]=S,e[5]=v,e[6]=o):o=e[6];const x=o;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Mn,{children:"Rename variant"}),e[7]=p):p=e[7];const O=m||"the rule";let I;e[8]!==O?(I=t.jsxs(En,{children:[p,t.jsxs($n,{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:O}),"."]})]}),e[8]=O,e[9]=I):I=e[9];let V;e[10]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=V):V=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=ee=>b(ee.target.value),e[11]=c):c=e[11];let R;e[12]!==m||e[13]!==d||e[14]!==S?(R=t.jsxs("div",{className:"space-y-1.5 py-4",children:[V,t.jsx(Fn,{id:"variant-rename-name",value:S,onChange:c,placeholder:m,autoFocus:!0,disabled:d})]}),e[12]=m,e[13]=d,e[14]=S,e[15]=R):R=e[15];let Y;e[16]!==f?(Y=()=>f(!1),e[16]=f,e[17]=Y):Y=e[17];let C;e[18]!==d||e[19]!==Y?(C=t.jsx(Fe,{type:"button",variant:"outline",onClick:Y,disabled:d,children:"Cancel"}),e[18]=d,e[19]=Y,e[20]=C):C=e[20];let Q;e[21]!==d?(Q=d?t.jsxs(t.Fragment,{children:[t.jsx(qt,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=d,e[22]=Q):Q=e[22];let D;e[23]!==d||e[24]!==Q?(D=t.jsx(Fe,{type:"submit",disabled:d,children:Q}),e[23]=d,e[24]=Q,e[25]=D):D=e[25];let z;e[26]!==C||e[27]!==D?(z=t.jsxs(On,{children:[C,D]}),e[26]=C,e[27]=D,e[28]=z):z=e[28];let M;e[29]!==x||e[30]!==z||e[31]!==I||e[32]!==R?(M=t.jsx(Bn,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:x,children:[I,R,z]})}),e[29]=x,e[30]=z,e[31]=I,e[32]=R,e[33]=M):M=e[33];let U;return e[34]!==j||e[35]!==r||e[36]!==M?(U=t.jsx(Kn,{open:r,onOpenChange:j,children:M}),e[34]=j,e[35]=r,e[36]=M,e[37]=U):U=e[37],U}function It(l,e,r,i,m){const h={...l[e]};if(m.length>1){const v=h.sections,f=[...v?.variants??[]];f[i]&&(f[i]={...f[i],value:r}),h.sections={...v,variants:f}}else h.sections=r;return h}function vr(l){return structuredClone(l)}function Sr(l){return!l.isSavedBlock&&!l.isMultivariate&&!l.isHidden}function _n(l){const e=l.replace(/[^A-Za-z0-9_-]/g,"");return/^[A-Za-z]/.test(e)?e:e?`Block${e}`:""}function kn(l,e){const r=l.trim();return r?r.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,r)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_-]*$/.test(r)?null:"Use letters, numbers, hyphens, or underscores. Must start with a letter.":"Block name is required."}function br(l){return l.schema?.definitions??l.schema?.$defs??{}}function xr(l,e){const r=br(e),i=r[btoa(l)];if(!i)return;let m=typeof i.image=="string"?i.image:void 0;if(!m&&Array.isArray(i.allOf)){const h=i.allOf.find(v=>typeof v.$ref=="string")?.$ref;if(typeof h=="string"){const v=h.replace("#/definitions/",""),f=r[v];m=typeof f?.image=="string"?f.image:void 0}}if(m?.includes("{{{"))return m}function yr(l,e){if(!e)return;const r=sa(l);if(!r)return;const i=xr(r.resolveType,e);if(!i)return;const m=Ga(i,r.data);if(m)return er(m)}const jr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",_r="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 wn(l){return Array.from({length:l},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ns(l){return l.map((e,r)=>({...e,index:r}))}function kr(l,e){if(e===l.length)return l;if(e<l.length)return ns(l.slice(0,e));const r=Array.from({length:e-l.length},(i,m)=>({id:crypto.randomUUID(),index:l.length+m}));return[...l,...r]}function ss(l){const e=Le.c(20),{section:r,raw:i,meta:m}=l,h=r.isSavedBlock===!0,v=r.isMultivariate===!0;let f;e[0]!==m||e[1]!==i?(f=i&&m?yr(i,m):void 0,e[0]=m,e[1]=i,e[2]=f):f=e[2];const d=f;let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(qa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=S):S=e[3];let b;e[4]!==d?(b=d&&t.jsx("img",{src:d,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=d,e[5]=b):b=e[5];let P;e[6]!==v||e[7]!==h?(P=h?{color:ra}:v?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=v,e[7]=h,e[8]=P):P=e[8];let N;e[9]!==P?(N=t.jsx(Ut,{className:"h-4 w-4 shrink-0",style:P}),e[9]=P,e[10]=N):N=e[10];const y=r.isHidden&&"line-through opacity-50";let j;e[11]!==y?(j=Ce("min-w-0 flex-1 truncate text-sm font-medium",y),e[11]=y,e[12]=j):j=e[12];let o;e[13]!==r.label||e[14]!==j?(o=t.jsx("span",{className:j,children:r.label}),e[13]=r.label,e[14]=j,e[15]=o):o=e[15];let x;return e[16]!==b||e[17]!==N||e[18]!==o?(x=t.jsxs(t.Fragment,{children:[S,b,N,o]}),e[16]=b,e[17]=N,e[18]=o,e[19]=x):x=e[19],x}function as(l,e){const r=l.isSavedBlock===!0,i=l.isMultivariate===!0;return Ce("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?jr:i?"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 wr(l){const e=Le.c(64),{section:r,raw:i,meta:m,sortableId:h,selected:v,onSelect:f,onDelete:d,onDuplicate:S,onMakeReusable:b,onToggleHidden:P,onToggleLazy:N,onAddVariant:y,onDetach:j}=l,o=i?Tn(i.__resolveType??""):!1;let x;e[0]!==r?(x=aa(r),e[0]=r,e[1]=x):x=e[1];const p=x;let O;e[2]!==h?(O={id:h,animateLayoutChanges:Tr},e[2]=h,e[3]=O):O=e[3];const{attributes:I,listeners:V,setNodeRef:c,transform:R,isDragging:Y}=Jn(O);let C;e[4]!==R?(C=Yn.Transform.toString(R?{...R,x:0}:null),e[4]=R,e[5]=C):C=e[5];const Q=Y?0:void 0;let D;e[6]!==C||e[7]!==Q?(D={transform:C,opacity:Q},e[6]=C,e[7]=Q,e[8]=D):D=e[8];const z=D;let M;e[9]!==r?(M=Sr(r),e[9]=r,e[10]=M):M=e[10];const U=M,ee="button",Se=0;let se;e[11]!==f?(se=K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),f())},e[11]=f,e[12]=se):se=e[12];const W=Y?"cursor-grabbing":"cursor-pointer";let ae;e[13]!==r||e[14]!==v||e[15]!==W?(ae=Ce("touch-none transition-colors",W,as(r,v)),e[13]=r,e[14]=v,e[15]=W,e[16]=ae):ae=e[16];let te;e[17]!==m||e[18]!==i||e[19]!==r?(te=t.jsx(ss,{section:r,raw:i,meta:m}),e[17]=m,e[18]=i,e[19]=r,e[20]=te):te=e[20];const E=!r.isMultivariate&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Ce("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:K=>{K.stopPropagation(),N()},onPointerDown:Dr,children:t.jsx(Ya,{className:Ce("h-3.5 w-3.5",o&&"text-yellow-500")})})}),t.jsx(rt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let le;e[21]!==P||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(le=!r.isMultivariate&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Ce("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:K=>{K.stopPropagation(),P()},onPointerDown:Cr,children:r.isHidden?t.jsx(Ja,{className:"h-3.5 w-3.5"}):t.jsx(Ua,{className:"h-3.5 w-3.5"})})}),t.jsx(rt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=P,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=le):le=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(zn,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Rr,onPointerDown:Nr,children:t.jsx(Vn,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let ne;e[26]!==S?(ne=K=>{K.stopPropagation(),S()},e[26]=S,e[27]=ne):ne=e[27];let re;e[28]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Wa,{className:"h-4 w-4"}),e[28]=re):re=e[28];let H;e[29]!==ne?(H=t.jsxs(nt,{onClick:ne,children:[re,"Duplicate"]}),e[29]=ne,e[30]=H):H=e[30];let $;e[31]!==p||e[32]!==y?($=p&&t.jsxs(nt,{className:tr,onClick:K=>{K.stopPropagation(),y()},children:[t.jsx(An,{className:"h-4 w-4"}),"Add variant"]}),e[31]=p,e[32]=y,e[33]=$):$=e[33];let B;e[34]!==U||e[35]!==b?(B=U&&t.jsxs(nt,{className:_r,onClick:K=>{K.stopPropagation(),b()},children:[t.jsx(Ut,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=U,e[35]=b,e[36]=B):B=e[36];let oe;e[37]!==j||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(oe=r.isSavedBlock===!0&&!r.isMultivariate&&t.jsxs(nt,{onClick:K=>{K.stopPropagation(),j()},children:[t.jsx(Ut,{className:"h-4 w-4"}),"Detach"]}),e[37]=j,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=oe):oe=e[40];let pe;e[41]!==d?(pe=K=>{K.stopPropagation(),d()},e[41]=d,e[42]=pe):pe=e[42];let he;e[43]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(Ln,{className:"h-4 w-4"}),e[43]=he):he=e[43];let de;e[44]!==pe?(de=t.jsxs(nt,{className:"text-destructive focus:text-destructive",onClick:pe,children:[he,"Delete"]}),e[44]=pe,e[45]=de):de=e[45];let ce;e[46]!==H||e[47]!==$||e[48]!==B||e[49]!==oe||e[50]!==de?(ce=t.jsxs(In,{children:[X,t.jsxs(Hn,{align:"end",className:"w-44",children:[H,$,B,oe,de]})]}),e[46]=H,e[47]=$,e[48]=B,e[49]=oe,e[50]=de,e[51]=ce):ce=e[51];let q;return e[52]!==I||e[53]!==V||e[54]!==f||e[55]!==c||e[56]!==z||e[57]!==ae||e[58]!==te||e[59]!==E||e[60]!==le||e[61]!==ce||e[62]!==se?(q=t.jsxs("div",{ref:c,style:z,...I,...V,role:ee,tabIndex:Se,onClick:f,onKeyDown:se,className:ae,children:[te,E,le,ce]}),e[52]=I,e[53]=V,e[54]=f,e[55]=c,e[56]=z,e[57]=ae,e[58]=te,e[59]=E,e[60]=le,e[61]=ce,e[62]=se,e[63]=q):q=e[63],q}function Nr(l){return l.stopPropagation()}function Rr(l){return l.stopPropagation()}function Cr(l){return l.stopPropagation()}function Dr(l){return l.stopPropagation()}function Tr(){return!1}function Pr(l){const e=Le.c(90),{listKey:r,rawSections:i,sections:m,meta:h,selectedIndex:v,onSelect:f,onReorder:d,onDelete:S,onDuplicate:b,onMakeReusable:P,onToggleHidden:N,onToggleLazy:y,onAddVariant:j,onDetach:o,onAddSection:x,canAddSection:p}=l,O=p===void 0?!0:p;let I;e[0]!==m.length?(I=()=>wn(m.length),e[0]=m.length,e[1]=I):I=e[1];const[V,c]=w.useState(I),[R,Y]=w.useState(null),[C,Q]=w.useState(r),[D,z]=w.useState(m.length),M=w.useRef(!1);C!==r?(Q(r),z(m.length),c(wn(m.length))):D!==m.length&&(z(m.length),c(A=>kr(A,m.length)));let U;e[2]===Symbol.for("react.memo_cache_sentinel")?(U={activationConstraint:{distance:8}},e[2]=U):U=e[2];let ee;e[3]===Symbol.for("react.memo_cache_sentinel")?(ee={coordinateGetter:Zn},e[3]=ee):ee=e[3];const Se=Un(_t(qn,U),_t(Wn,ee));let se;e[4]!==V?(se=V.map(Vr),e[4]=V,e[5]=se):se=e[5];const W=se;let ae;e[6]===Symbol.for("react.memo_cache_sentinel")?(ae=A=>{Y(String(A.active.id))},e[6]=ae):ae=e[6];const te=ae;let E;e[7]!==W||e[8]!==d?(E=A=>{Y(null);const{active:F,over:Z}=A;if(!Z||F.id===Z.id)return;const ze=W.indexOf(String(F.id)),He=W.indexOf(String(Z.id));ze===-1||He===-1||(c(We=>ns(mt([...We],ze,He))),M.current=!0,requestAnimationFrame(()=>{M.current=!1}),d?.(ze,He))},e[7]=W,e[8]=d,e[9]=E):E=e[9];const le=E;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{Y(null)},e[10]=X):X=e[10];const ne=X;let re,H,$,B,oe,pe,he,de,ce,q,K,De,ke,Ee,we;if(e[11]!==R||e[12]!==O||e[13]!==V||e[14]!==W||e[15]!==le||e[16]!==h||e[17]!==x||e[18]!==j||e[19]!==S||e[20]!==o||e[21]!==b||e[22]!==P||e[23]!==f||e[24]!==N||e[25]!==y||e[26]!==i||e[27]!==m||e[28]!==v||e[29]!==Se){Ee=Symbol.for("react.early_return_sentinel");e:{const A=F=>{M.current||f(F)};if(e[45]!==R||e[46]!==O||e[47]!==V||e[48]!==x||e[49]!==i||e[50]!==m){const F=R?V.find(Z=>Z.id===R):null;if(B=F!=null?m[F.index]:null,$=F!=null?i[F.index]:void 0,V.length===0){let Z;e[54]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Z):Z=e[54];const ze=!O;let He;e[55]===Symbol.for("react.memo_cache_sentinel")?(He=t.jsx(Wt,{size:14}),e[55]=He):He=e[55];let We;e[56]!==x||e[57]!==ze?(We=t.jsxs("div",{className:"space-y-2",children:[Z,t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:ze,onClick:x,children:[He,"Add section"]})]}),e[56]=x,e[57]=ze,e[58]=We):We=e[58],Ee=We;break e}ke=Ce(F&&"cursor-grabbing"),e[45]=R,e[46]=O,e[47]=V,e[48]=x,e[49]=i,e[50]=m,e[51]=$,e[52]=B,e[53]=ke}else $=e[51],B=e[52],ke=e[53];H=Qn,de=Se,ce=Xn,q=te,K=le,De=ne,re=Gn,pe=W,he=Qa,we="space-y-1",oe=V.map(F=>{const Z=m[F.index];return Z?t.jsx(wr,{sortableId:F.id,section:Z,raw:i[F.index],meta:h,selected:v===F.index,onSelect:()=>A(F.index),onDelete:()=>S(F.index),onDuplicate:()=>b(F.index),onMakeReusable:()=>P(F.index),onToggleHidden:()=>N(F.index),onToggleLazy:()=>y(F.index),onAddVariant:()=>j(F.index),onDetach:()=>o(F.index)},F.id):null})}e[11]=R,e[12]=O,e[13]=V,e[14]=W,e[15]=le,e[16]=h,e[17]=x,e[18]=j,e[19]=S,e[20]=o,e[21]=b,e[22]=P,e[23]=f,e[24]=N,e[25]=y,e[26]=i,e[27]=m,e[28]=v,e[29]=Se,e[30]=re,e[31]=H,e[32]=$,e[33]=B,e[34]=oe,e[35]=pe,e[36]=he,e[37]=de,e[38]=ce,e[39]=q,e[40]=K,e[41]=De,e[42]=ke,e[43]=Ee,e[44]=we}else re=e[30],H=e[31],$=e[32],B=e[33],oe=e[34],pe=e[35],he=e[36],de=e[37],ce=e[38],q=e[39],K=e[40],De=e[41],ke=e[42],Ee=e[43],we=e[44];if(Ee!==Symbol.for("react.early_return_sentinel"))return Ee;let Te;e[59]!==oe||e[60]!==we?(Te=t.jsx("div",{className:we,children:oe}),e[59]=oe,e[60]=we,e[61]=Te):Te=e[61];let $e;e[62]!==re||e[63]!==pe||e[64]!==he||e[65]!==Te?($e=t.jsx(re,{items:pe,strategy:he,children:Te}),e[62]=re,e[63]=pe,e[64]=he,e[65]=Te,e[66]=$e):$e=e[66];let Oe;e[67]!==$||e[68]!==B||e[69]!==h?(Oe=B?t.jsx("div",{className:Ce("cursor-grabbing shadow-lg ring-1 ring-border/60",as(B,!1)),children:t.jsx(ss,{section:B,raw:$,meta:h})}):null,e[67]=$,e[68]=B,e[69]=h,e[70]=Oe):Oe=e[70];let be;e[71]!==Oe?(be=t.jsx(es,{dropAnimation:null,children:Oe}),e[71]=Oe,e[72]=be):be=e[72];let Be;e[73]!==H||e[74]!==de||e[75]!==ce||e[76]!==q||e[77]!==K||e[78]!==De||e[79]!==$e||e[80]!==be?(Be=t.jsxs(H,{sensors:de,collisionDetection:ce,onDragStart:q,onDragEnd:K,onDragCancel:De,children:[$e,be]}),e[73]=H,e[74]=de,e[75]=ce,e[76]=q,e[77]=K,e[78]=De,e[79]=$e,e[80]=be,e[81]=Be):Be=e[81];const Pe=!O;let ue;e[82]===Symbol.for("react.memo_cache_sentinel")?(ue=t.jsx(Wt,{size:14}),e[82]=ue):ue=e[82];let ie;e[83]!==x||e[84]!==Pe?(ie=t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Pe,onClick:x,children:[ue,"Add section"]}),e[83]=x,e[84]=Pe,e[85]=ie):ie=e[85];let Ne;return e[86]!==ke||e[87]!==Be||e[88]!==ie?(Ne=t.jsxs("div",{className:ke,children:[Be,ie]}),e[86]=ke,e[87]=Be,e[88]=ie,e[89]=Ne):Ne=e[89],Ne}function Vr(l){return l.id}const Ar="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 Jt(l){const e=Le.c(5),{rule:r,matchers:i}=l,m=r?.__resolveType??"";let h;if(e[0]!==i||e[1]!==m){const S=i.find(b=>b.resolveType===m)?.iconName??nr(m);h=La(S),e[0]=i,e[1]=m,e[2]=h}else h=e[2];const v=h;if(!v)return null;let f;return e[3]!==v?(f=t.jsx(v,{size:14,className:"shrink-0"}),e[3]=v,e[4]=f):f=e[4],f}function Nn(l){return l.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
1
+ import{c as Le,r as w,j as t,B as Fe,i as qt,l as Ce,m as ta,t as fe,K as na}from"./index-C6QaS0Zh.js";import{r as sa,i as Tn,c as aa,G as ra,a as jt,b as oa,d as ia,e as la,f as ca,g as ua,h as da,j as ma,k as fa,l as pa,m as bt,p as xt,n as ha,o as Kt,q as Qe,s as vn,t as Sn,P as ga,v as Ft,w as va,x as Sa,y as ba,z as xa,A as ya,B as ja,C as _a,D as dt,E as ka,F as wa,H as Na,I as Ra,J as Ca,K as Da,L as Ta,M as Pa,N as Lt,O as Va,Q as bn,R as Aa,S as Ma,T as Ea,U as zt,V as $a,W as Oa,X as xn}from"./index-ki8HSB2c.js";import{t as Ba}from"./ChevronDown-DXOZkIso.js";import{n as Ka}from"./ChevronLeft-DPLHregZ.js";import{i as Pn}from"./ChevronRight-BkBgwZxs.js";import{n as Fa}from"./ChevronUp-BCwumcyZ.js";import{K as Ut,D as Vn,S as An,l as La,L as za,M as Ia}from"./agent-icon-BB2_1lHd.js";import{i as Ha}from"./Globe01-CQy0Cxa-.js";import{S as yt}from"./scroll-area-Dz-FqKWj.js";import{b as st,T as at,a as rt}from"./tooltip-BdbfQCYl.js";import{a as Mn,D as En,b as $n,e as On,c as Bn,d as Kn}from"./dialog-9Dal6l7D.js";import{I as Fn}from"./input-szhd6Snj.js";import{s as Ua,a as Wa}from"./Eye-IocHlobo.js";import{c as qa}from"./ZoomOut-DRnFWZo9.js";import{b as Ja}from"./Settings02-BynaGT2l.js";import{s as Wt}from"./Plus-DptVePQj.js";import{s as Ln}from"./Trash01-Ds3jbDQE.js";import{i as Ya}from"./Zap-B-ccy6C4.js";import{c as nt,a as zn,D as In,b as Hn,g as Za}from"./dropdown-menu-DveShRRm.js";import{u as Un,a as _t,K as Wn,P as qn,b as Jn,C as Yn,s as Zn,d as mt,D as Qn,c as Xn,S as Gn,v as Qa,e as es,h as Xa}from"./sortable.esm-DHMK7_tT.js";import{r as Ga,s as er,V as tr,a as nr,u as et,e as sr,S as ar,M as yn,f as tt,b as ts}from"./schema-form-Cg7Lxy8-.js";import{r as jn,u as rr,d as or,a as ir,i as lr,f as cr,P as ur,b as dr,S as mr}from"./page-seo-form--ih05Y7N.js";import{i as fr}from"./Tool01-hkwqrr6Q.js";import{AddSectionModal as pr}from"./add-section-modal-DpjAnzTC.js";import{c as hr}from"./save-referenced-block-Dw7QM0hK.js";import"./index-ARPJar1Z.js";import"./chat-context-CdOsOHQ0.js";import"./hooks-Gm6nJHH5.js";import"./use-mcp-client-DZQbnef-.js";import"./auth-DxKMCtEO.js";import"./decopilot-sse-pool-D8ZetksK.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-BCkbHrLW.js";import"./use-collections-DaAI2dS_.js";import"./use-ai-providers-CiBlqHeC.js";import"./studio-tools-CJMVZA0W.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-Bjk_kH1I.js";import"./drawer-DW4IYbB1.js";import"./collection-search-ClGGT1KV.js";import"./SearchMd-DmrRiPsU.js";import"./use-mcp-prompts-CDHTi3et.js";import"./X-CvnlrpyG.js";import"./shell-layout-BWQLmjyW.js";import"./avatar-CfKY2_hs.js";import"./User01-DJhz4tmk.js";import"./Users03-CjtA3d84.js";import"./Stars02-CJJhFv2L.js";import"./XClose-BbKrO-bh.js";import"./CheckCircle-BZlFJbF8.js";import"./FilterLines-dauCx8Za.js";import"./required-auth-layout-BbLd1LMa.js";import"./use-org-sso-BhXMb9mL.js";import"./SwitchHorizontal01-D04vL0_f.js";import"./ZapSquare-bUJqwnW3.js";import"./Star01-G7bzpuzw.js";import"./Upload01-Cuswrale.js";import"./AlertCircle-CKei65yQ.js";import"./form-6Nre8f-k.js";import"./label-Bjb_vEVQ.js";import"./select-FwtHY18v.js";import"./XCircle-CTJX6MKF.js";import"./tabs-CsXXbMGG.js";import"./toggle-group-CSMS4HAA.js";import"./use-deco-credits-C3sjfJyT.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CrUjfVJB.js";import"./use-registry-connections-DfipPXqa.js";import"./use-connection-z93iohVP.js";import"./useInfiniteQuery-CX9x55X-.js";import"./use-infinite-scroll-CUe3Elw1.js";import"./extract-connection-data-BL81V9PY.js";import"./card-DU2I8eHH.js";import"./integration-icon-XSMgSpds.js";import"./collection-tabs-xD0Ry7Iv.js";import"./badge-tlnu_6T3.js";import"./textarea-BTbunR8j.js";import"./connection-form-helpers-BqpyRjgd.js";import"./authenticate-and-persist-oauth-CXYJ_57C.js";import"./mcp-oauth-8Oqz2kjD.js";import"./useSuspenseInfiniteQuery-C_SaQkGF.js";import"./Monitor01-CF5y8J9X.js";import"./connect-desktop-dialog-BCsFp2qg.js";import"./decopilot-B2PnahSO.js";import"./checkbox-H7xxQ3iC.js";import"./skeleton-B8_-zyKb.js";import"./Key01-ktWRCkRP.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-PIk2gDH0.js";import"./ArrowUpRight-BygwtcZ2.js";import"./Stars01-BxW6Ze_W.js";import"./popover-CJ-idfVW.js";import"./command-CLZq7t6J.js";import"./index-DcLVAN0f.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-DFtMiuOm.js";import"./empty-state-b7tnb7q2.js";import"./toolbar-CvxN3T7P.js";import"./preview-dialog-WfNb4k8L.js";import"./LinkExternal01-BenQb5F0.js";import"./index-SIbEiNOY.js";import"./file-type-icon-hjib5alc.js";import"./LayoutLeft-TAhoC2xE.js";import"./use-mcp-tools-DOD2Zkcv.js";import"./types-D18PqArI.js";import"./use-capability-DH5i0nun.js";import"./shell-route-loading-Cf96p6By.js";import"./index-DllFGtwL.js";import"./alert-dialog-gK63ktIU.js";import"./switch-YOR9drgK.js";import"./Play-BrJBHlm8.js";import"./use-debounced-autosave-CaWQv8Ap.js";import"./index-DB4Y8lPy.js";import"./sidebar-LVNues-1.js";import"./sheet-BvSpiY2r.js";import"./search-input-DjVPTtCb.js";import"./github-repo-picker-CdGt5INt.js";import"./use-navigate-to-agent-DUbEZuBm.js";import"./Users01-D1GekRvz.js";import"./use-secrets-DCPSjnYq.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./view-mode-toggle-B1Thrh1l.js";import"./DotsVertical-DQDEDjEX.js";import"./select-model-Bf7O5MiJ.js";import"./use-automations-44dHfXzj.js";import"./monaco-editor-Bzp2tCW_.js";import"./automation-runs-DiHYOI-G.js";import"./table-COWO-rWc.js";import"./use-members-Cgp-qtNm.js";import"./use-org-auth-client-TLh9Nsd6.js";import"./task-status-D4qDcTy4.js";import"./automation-list-row-BYfl9414.js";import"./Globe04-CBuYvlRn.js";import"./HardDrive-DSj8WeP3.js";import"./Sun-CUZqy0kq.js";import"./Palette-ZSzAttfE.js";import"./Shield01-CGOi4o3B.js";import"./use-clock-tick-bD6VBNNM.js";import"./use-copy-_XYMvM2G.js";import"./content-blocks-o63cs2vh.js";import"./calendar-CaxcRF1k.js";import"./image-field-CfVmwwEw.js";import"./use-file-configs-CS1kf1Mx.js";function gr(l){const e=Le.c(38),{open:r,initialName:i,autoLabel:m,isPending:h,onSubmit:v,onOpenChange:f}=l,d=h===void 0?!1:h,[S,b]=w.useState(i),[P,N]=w.useState(r);r!==P&&(N(r),r&&b(i));let y;e[0]!==d||e[1]!==f?(y=ee=>{!ee&&!d&&f(!1)},e[0]=d,e[1]=f,e[2]=y):y=e[2];const j=y;let o;e[3]!==d||e[4]!==S||e[5]!==v?(o=async ee=>{ee.preventDefault(),!d&&await v(S.trim())},e[3]=d,e[4]=S,e[5]=v,e[6]=o):o=e[6];const x=o;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Mn,{children:"Rename variant"}),e[7]=p):p=e[7];const O=m||"the rule";let I;e[8]!==O?(I=t.jsxs(En,{children:[p,t.jsxs($n,{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:O}),"."]})]}),e[8]=O,e[9]=I):I=e[9];let V;e[10]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx("label",{htmlFor:"variant-rename-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[10]=V):V=e[10];let c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=ee=>b(ee.target.value),e[11]=c):c=e[11];let R;e[12]!==m||e[13]!==d||e[14]!==S?(R=t.jsxs("div",{className:"space-y-1.5 py-4",children:[V,t.jsx(Fn,{id:"variant-rename-name",value:S,onChange:c,placeholder:m,autoFocus:!0,disabled:d})]}),e[12]=m,e[13]=d,e[14]=S,e[15]=R):R=e[15];let Y;e[16]!==f?(Y=()=>f(!1),e[16]=f,e[17]=Y):Y=e[17];let C;e[18]!==d||e[19]!==Y?(C=t.jsx(Fe,{type:"button",variant:"outline",onClick:Y,disabled:d,children:"Cancel"}),e[18]=d,e[19]=Y,e[20]=C):C=e[20];let Q;e[21]!==d?(Q=d?t.jsxs(t.Fragment,{children:[t.jsx(qt,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=d,e[22]=Q):Q=e[22];let D;e[23]!==d||e[24]!==Q?(D=t.jsx(Fe,{type:"submit",disabled:d,children:Q}),e[23]=d,e[24]=Q,e[25]=D):D=e[25];let z;e[26]!==C||e[27]!==D?(z=t.jsxs(On,{children:[C,D]}),e[26]=C,e[27]=D,e[28]=z):z=e[28];let M;e[29]!==x||e[30]!==z||e[31]!==I||e[32]!==R?(M=t.jsx(Bn,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:x,children:[I,R,z]})}),e[29]=x,e[30]=z,e[31]=I,e[32]=R,e[33]=M):M=e[33];let U;return e[34]!==j||e[35]!==r||e[36]!==M?(U=t.jsx(Kn,{open:r,onOpenChange:j,children:M}),e[34]=j,e[35]=r,e[36]=M,e[37]=U):U=e[37],U}function It(l,e,r,i,m){const h={...l[e]};if(m.length>1){const v=h.sections,f=[...v?.variants??[]];f[i]&&(f[i]={...f[i],value:r}),h.sections={...v,variants:f}}else h.sections=r;return h}function vr(l){return structuredClone(l)}function Sr(l){return!l.isSavedBlock&&!l.isMultivariate&&!l.isHidden}function _n(l){const e=l.replace(/[^A-Za-z0-9_-]/g,"");return/^[A-Za-z]/.test(e)?e:e?`Block${e}`:""}function kn(l,e){const r=l.trim();return r?r.includes("/")?"Block name cannot contain slashes.":Object.hasOwn(e,r)?"A block with this name already exists.":/^[A-Za-z][A-Za-z0-9_-]*$/.test(r)?null:"Use letters, numbers, hyphens, or underscores. Must start with a letter.":"Block name is required."}function br(l){return l.schema?.definitions??l.schema?.$defs??{}}function xr(l,e){const r=br(e),i=r[btoa(l)];if(!i)return;let m=typeof i.image=="string"?i.image:void 0;if(!m&&Array.isArray(i.allOf)){const h=i.allOf.find(v=>typeof v.$ref=="string")?.$ref;if(typeof h=="string"){const v=h.replace("#/definitions/",""),f=r[v];m=typeof f?.image=="string"?f.image:void 0}}if(m?.includes("{{{"))return m}function yr(l,e){if(!e)return;const r=sa(l);if(!r)return;const i=xr(r.resolveType,e);if(!i)return;const m=Ga(i,r.data);if(m)return er(m)}const jr="text-global-section-fg hover:bg-global-section/12 dark:text-global-section-fg-dark dark:hover:bg-global-section/15",_r="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 wn(l){return Array.from({length:l},(e,r)=>({id:crypto.randomUUID(),index:r}))}function ns(l){return l.map((e,r)=>({...e,index:r}))}function kr(l,e){if(e===l.length)return l;if(e<l.length)return ns(l.slice(0,e));const r=Array.from({length:e-l.length},(i,m)=>({id:crypto.randomUUID(),index:l.length+m}));return[...l,...r]}function ss(l){const e=Le.c(20),{section:r,raw:i,meta:m}=l,h=r.isSavedBlock===!0,v=r.isMultivariate===!0;let f;e[0]!==m||e[1]!==i?(f=i&&m?yr(i,m):void 0,e[0]=m,e[1]=i,e[2]=f):f=e[2];const d=f;let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=t.jsx(qa,{className:"h-4 w-4 shrink-0 text-muted-foreground/40"}),e[3]=S):S=e[3];let b;e[4]!==d?(b=d&&t.jsx("img",{src:d,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[4]=d,e[5]=b):b=e[5];let P;e[6]!==v||e[7]!==h?(P=h?{color:ra}:v?{color:"oklch(0.65 0.15 160)"}:void 0,e[6]=v,e[7]=h,e[8]=P):P=e[8];let N;e[9]!==P?(N=t.jsx(Ut,{className:"h-4 w-4 shrink-0",style:P}),e[9]=P,e[10]=N):N=e[10];const y=r.isHidden&&"line-through opacity-50";let j;e[11]!==y?(j=Ce("min-w-0 flex-1 truncate text-sm font-medium",y),e[11]=y,e[12]=j):j=e[12];let o;e[13]!==r.label||e[14]!==j?(o=t.jsx("span",{className:j,children:r.label}),e[13]=r.label,e[14]=j,e[15]=o):o=e[15];let x;return e[16]!==b||e[17]!==N||e[18]!==o?(x=t.jsxs(t.Fragment,{children:[S,b,N,o]}),e[16]=b,e[17]=N,e[18]=o,e[19]=x):x=e[19],x}function as(l,e){const r=l.isSavedBlock===!0,i=l.isMultivariate===!0;return Ce("group flex select-none items-center gap-2 rounded-md px-2 py-2.5",e?"bg-accent text-accent-foreground":r?jr:i?"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 wr(l){const e=Le.c(64),{section:r,raw:i,meta:m,sortableId:h,selected:v,onSelect:f,onDelete:d,onDuplicate:S,onMakeReusable:b,onToggleHidden:P,onToggleLazy:N,onAddVariant:y,onDetach:j}=l,o=i?Tn(i.__resolveType??""):!1;let x;e[0]!==r?(x=aa(r),e[0]=r,e[1]=x):x=e[1];const p=x;let O;e[2]!==h?(O={id:h,animateLayoutChanges:Tr},e[2]=h,e[3]=O):O=e[3];const{attributes:I,listeners:V,setNodeRef:c,transform:R,isDragging:Y}=Jn(O);let C;e[4]!==R?(C=Yn.Transform.toString(R?{...R,x:0}:null),e[4]=R,e[5]=C):C=e[5];const Q=Y?0:void 0;let D;e[6]!==C||e[7]!==Q?(D={transform:C,opacity:Q},e[6]=C,e[7]=Q,e[8]=D):D=e[8];const z=D;let M;e[9]!==r?(M=Sr(r),e[9]=r,e[10]=M):M=e[10];const U=M,ee="button",Se=0;let se;e[11]!==f?(se=K=>{(K.key==="Enter"||K.key===" ")&&(K.preventDefault(),f())},e[11]=f,e[12]=se):se=e[12];const W=Y?"cursor-grabbing":"cursor-pointer";let ae;e[13]!==r||e[14]!==v||e[15]!==W?(ae=Ce("touch-none transition-colors",W,as(r,v)),e[13]=r,e[14]=v,e[15]=W,e[16]=ae):ae=e[16];let te;e[17]!==m||e[18]!==i||e[19]!==r?(te=t.jsx(ss,{section:r,raw:i,meta:m}),e[17]=m,e[18]=i,e[19]=r,e[20]=te):te=e[20];const E=!r.isMultivariate&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":o?"Disable async render":"Enable async render",className:Ce("h-7 w-7 shrink-0",o?"":"opacity-0 group-hover:opacity-100"),onClick:K=>{K.stopPropagation(),N()},onPointerDown:Dr,children:t.jsx(Ya,{className:Ce("h-3.5 w-3.5",o&&"text-yellow-500")})})}),t.jsx(rt,{side:"bottom",children:o?"Disable async render":"Enable async render"})]});let le;e[21]!==P||e[22]!==r.isHidden||e[23]!==r.isMultivariate?(le=!r.isMultivariate&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":r.isHidden?"Show section":"Hide section",className:Ce("h-7 w-7 shrink-0",r.isHidden?"opacity-100":"opacity-0 group-hover:opacity-100"),onClick:K=>{K.stopPropagation(),P()},onPointerDown:Cr,children:r.isHidden?t.jsx(Ja,{className:"h-3.5 w-3.5"}):t.jsx(Ua,{className:"h-3.5 w-3.5"})})}),t.jsx(rt,{side:"bottom",children:r.isHidden?"Show section":"Hide section"})]}),e[21]=P,e[22]=r.isHidden,e[23]=r.isMultivariate,e[24]=le):le=e[24];let X;e[25]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(zn,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Section actions",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100",onClick:Rr,onPointerDown:Nr,children:t.jsx(Vn,{className:"h-3.5 w-3.5"})})}),e[25]=X):X=e[25];let ne;e[26]!==S?(ne=K=>{K.stopPropagation(),S()},e[26]=S,e[27]=ne):ne=e[27];let re;e[28]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Wa,{className:"h-4 w-4"}),e[28]=re):re=e[28];let H;e[29]!==ne?(H=t.jsxs(nt,{onClick:ne,children:[re,"Duplicate"]}),e[29]=ne,e[30]=H):H=e[30];let $;e[31]!==p||e[32]!==y?($=p&&t.jsxs(nt,{className:tr,onClick:K=>{K.stopPropagation(),y()},children:[t.jsx(An,{className:"h-4 w-4"}),"Add variant"]}),e[31]=p,e[32]=y,e[33]=$):$=e[33];let B;e[34]!==U||e[35]!==b?(B=U&&t.jsxs(nt,{className:_r,onClick:K=>{K.stopPropagation(),b()},children:[t.jsx(Ut,{className:"h-4 w-4"}),"Make reusable"]}),e[34]=U,e[35]=b,e[36]=B):B=e[36];let oe;e[37]!==j||e[38]!==r.isMultivariate||e[39]!==r.isSavedBlock?(oe=r.isSavedBlock===!0&&!r.isMultivariate&&t.jsxs(nt,{onClick:K=>{K.stopPropagation(),j()},children:[t.jsx(Ut,{className:"h-4 w-4"}),"Detach"]}),e[37]=j,e[38]=r.isMultivariate,e[39]=r.isSavedBlock,e[40]=oe):oe=e[40];let pe;e[41]!==d?(pe=K=>{K.stopPropagation(),d()},e[41]=d,e[42]=pe):pe=e[42];let he;e[43]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(Ln,{className:"h-4 w-4"}),e[43]=he):he=e[43];let de;e[44]!==pe?(de=t.jsxs(nt,{className:"text-destructive focus:text-destructive",onClick:pe,children:[he,"Delete"]}),e[44]=pe,e[45]=de):de=e[45];let ce;e[46]!==H||e[47]!==$||e[48]!==B||e[49]!==oe||e[50]!==de?(ce=t.jsxs(In,{children:[X,t.jsxs(Hn,{align:"end",className:"w-44",children:[H,$,B,oe,de]})]}),e[46]=H,e[47]=$,e[48]=B,e[49]=oe,e[50]=de,e[51]=ce):ce=e[51];let q;return e[52]!==I||e[53]!==V||e[54]!==f||e[55]!==c||e[56]!==z||e[57]!==ae||e[58]!==te||e[59]!==E||e[60]!==le||e[61]!==ce||e[62]!==se?(q=t.jsxs("div",{ref:c,style:z,...I,...V,role:ee,tabIndex:Se,onClick:f,onKeyDown:se,className:ae,children:[te,E,le,ce]}),e[52]=I,e[53]=V,e[54]=f,e[55]=c,e[56]=z,e[57]=ae,e[58]=te,e[59]=E,e[60]=le,e[61]=ce,e[62]=se,e[63]=q):q=e[63],q}function Nr(l){return l.stopPropagation()}function Rr(l){return l.stopPropagation()}function Cr(l){return l.stopPropagation()}function Dr(l){return l.stopPropagation()}function Tr(){return!1}function Pr(l){const e=Le.c(90),{listKey:r,rawSections:i,sections:m,meta:h,selectedIndex:v,onSelect:f,onReorder:d,onDelete:S,onDuplicate:b,onMakeReusable:P,onToggleHidden:N,onToggleLazy:y,onAddVariant:j,onDetach:o,onAddSection:x,canAddSection:p}=l,O=p===void 0?!0:p;let I;e[0]!==m.length?(I=()=>wn(m.length),e[0]=m.length,e[1]=I):I=e[1];const[V,c]=w.useState(I),[R,Y]=w.useState(null),[C,Q]=w.useState(r),[D,z]=w.useState(m.length),M=w.useRef(!1);C!==r?(Q(r),z(m.length),c(wn(m.length))):D!==m.length&&(z(m.length),c(A=>kr(A,m.length)));let U;e[2]===Symbol.for("react.memo_cache_sentinel")?(U={activationConstraint:{distance:8}},e[2]=U):U=e[2];let ee;e[3]===Symbol.for("react.memo_cache_sentinel")?(ee={coordinateGetter:Zn},e[3]=ee):ee=e[3];const Se=Un(_t(qn,U),_t(Wn,ee));let se;e[4]!==V?(se=V.map(Vr),e[4]=V,e[5]=se):se=e[5];const W=se;let ae;e[6]===Symbol.for("react.memo_cache_sentinel")?(ae=A=>{Y(String(A.active.id))},e[6]=ae):ae=e[6];const te=ae;let E;e[7]!==W||e[8]!==d?(E=A=>{Y(null);const{active:F,over:Z}=A;if(!Z||F.id===Z.id)return;const ze=W.indexOf(String(F.id)),He=W.indexOf(String(Z.id));ze===-1||He===-1||(c(We=>ns(mt([...We],ze,He))),M.current=!0,requestAnimationFrame(()=>{M.current=!1}),d?.(ze,He))},e[7]=W,e[8]=d,e[9]=E):E=e[9];const le=E;let X;e[10]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{Y(null)},e[10]=X):X=e[10];const ne=X;let re,H,$,B,oe,pe,he,de,ce,q,K,De,ke,Ee,we;if(e[11]!==R||e[12]!==O||e[13]!==V||e[14]!==W||e[15]!==le||e[16]!==h||e[17]!==x||e[18]!==j||e[19]!==S||e[20]!==o||e[21]!==b||e[22]!==P||e[23]!==f||e[24]!==N||e[25]!==y||e[26]!==i||e[27]!==m||e[28]!==v||e[29]!==Se){Ee=Symbol.for("react.early_return_sentinel");e:{const A=F=>{M.current||f(F)};if(e[45]!==R||e[46]!==O||e[47]!==V||e[48]!==x||e[49]!==i||e[50]!==m){const F=R?V.find(Z=>Z.id===R):null;if(B=F!=null?m[F.index]:null,$=F!=null?i[F.index]:void 0,V.length===0){let Z;e[54]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:"No sections in this page."}),e[54]=Z):Z=e[54];const ze=!O;let He;e[55]===Symbol.for("react.memo_cache_sentinel")?(He=t.jsx(Wt,{size:14}),e[55]=He):He=e[55];let We;e[56]!==x||e[57]!==ze?(We=t.jsxs("div",{className:"space-y-2",children:[Z,t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:ze,onClick:x,children:[He,"Add section"]})]}),e[56]=x,e[57]=ze,e[58]=We):We=e[58],Ee=We;break e}ke=Ce(F&&"cursor-grabbing"),e[45]=R,e[46]=O,e[47]=V,e[48]=x,e[49]=i,e[50]=m,e[51]=$,e[52]=B,e[53]=ke}else $=e[51],B=e[52],ke=e[53];H=Qn,de=Se,ce=Xn,q=te,K=le,De=ne,re=Gn,pe=W,he=Qa,we="space-y-1",oe=V.map(F=>{const Z=m[F.index];return Z?t.jsx(wr,{sortableId:F.id,section:Z,raw:i[F.index],meta:h,selected:v===F.index,onSelect:()=>A(F.index),onDelete:()=>S(F.index),onDuplicate:()=>b(F.index),onMakeReusable:()=>P(F.index),onToggleHidden:()=>N(F.index),onToggleLazy:()=>y(F.index),onAddVariant:()=>j(F.index),onDetach:()=>o(F.index)},F.id):null})}e[11]=R,e[12]=O,e[13]=V,e[14]=W,e[15]=le,e[16]=h,e[17]=x,e[18]=j,e[19]=S,e[20]=o,e[21]=b,e[22]=P,e[23]=f,e[24]=N,e[25]=y,e[26]=i,e[27]=m,e[28]=v,e[29]=Se,e[30]=re,e[31]=H,e[32]=$,e[33]=B,e[34]=oe,e[35]=pe,e[36]=he,e[37]=de,e[38]=ce,e[39]=q,e[40]=K,e[41]=De,e[42]=ke,e[43]=Ee,e[44]=we}else re=e[30],H=e[31],$=e[32],B=e[33],oe=e[34],pe=e[35],he=e[36],de=e[37],ce=e[38],q=e[39],K=e[40],De=e[41],ke=e[42],Ee=e[43],we=e[44];if(Ee!==Symbol.for("react.early_return_sentinel"))return Ee;let Te;e[59]!==oe||e[60]!==we?(Te=t.jsx("div",{className:we,children:oe}),e[59]=oe,e[60]=we,e[61]=Te):Te=e[61];let $e;e[62]!==re||e[63]!==pe||e[64]!==he||e[65]!==Te?($e=t.jsx(re,{items:pe,strategy:he,children:Te}),e[62]=re,e[63]=pe,e[64]=he,e[65]=Te,e[66]=$e):$e=e[66];let Oe;e[67]!==$||e[68]!==B||e[69]!==h?(Oe=B?t.jsx("div",{className:Ce("cursor-grabbing shadow-lg ring-1 ring-border/60",as(B,!1)),children:t.jsx(ss,{section:B,raw:$,meta:h})}):null,e[67]=$,e[68]=B,e[69]=h,e[70]=Oe):Oe=e[70];let be;e[71]!==Oe?(be=t.jsx(es,{dropAnimation:null,children:Oe}),e[71]=Oe,e[72]=be):be=e[72];let Be;e[73]!==H||e[74]!==de||e[75]!==ce||e[76]!==q||e[77]!==K||e[78]!==De||e[79]!==$e||e[80]!==be?(Be=t.jsxs(H,{sensors:de,collisionDetection:ce,onDragStart:q,onDragEnd:K,onDragCancel:De,children:[$e,be]}),e[73]=H,e[74]=de,e[75]=ce,e[76]=q,e[77]=K,e[78]=De,e[79]=$e,e[80]=be,e[81]=Be):Be=e[81];const Pe=!O;let ue;e[82]===Symbol.for("react.memo_cache_sentinel")?(ue=t.jsx(Wt,{size:14}),e[82]=ue):ue=e[82];let ie;e[83]!==x||e[84]!==Pe?(ie=t.jsxs(Fe,{type:"button",variant:"outline",size:"sm",className:"mt-2 w-full",disabled:Pe,onClick:x,children:[ue,"Add section"]}),e[83]=x,e[84]=Pe,e[85]=ie):ie=e[85];let Ne;return e[86]!==ke||e[87]!==Be||e[88]!==ie?(Ne=t.jsxs("div",{className:ke,children:[Be,ie]}),e[86]=ke,e[87]=Be,e[88]=ie,e[89]=Ne):Ne=e[89],Ne}function Vr(l){return l.id}const Ar="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 Jt(l){const e=Le.c(5),{rule:r,matchers:i}=l,m=r?.__resolveType??"";let h;if(e[0]!==i||e[1]!==m){const S=i.find(b=>b.resolveType===m)?.iconName??nr(m);h=La(S),e[0]=i,e[1]=m,e[2]=h}else h=e[2];const v=h;if(!v)return null;let f;return e[3]!==v?(f=t.jsx(v,{size:14,className:"shrink-0"}),e[3]=v,e[4]=f):f=e[4],f}function Nn(l){return l.map(e=>`${e.label}|${e.rule?.__resolveType??""}`).join(`
2
2
  `)}function Ht(l){return l.map((e,r)=>({id:crypto.randomUUID(),index:r,variant:e}))}function Mr(l){return l.map((e,r)=>({...e,index:r}))}function Er(l){const e=Le.c(51),{entry:r,sortableId:i,isActive:m,canDelete:h,decofile:v,meta:f,matchers:d,onSelect:S,onRename:b,onDelete:P}=l;let N;e[0]!==i?(N={id:i,animateLayoutChanges:Br},e[0]=i,e[1]=N):N=e[1];const{attributes:y,listeners:j,setNodeRef:o,transform:x,isDragging:p}=Jn(N);let O;e[2]!==x?(O=Yn.Transform.toString(x?{...x,y:0}:null),e[2]=x,e[3]=O):O=e[3];const I=p?0:void 0;let V;e[4]!==O||e[5]!==I?(V={transform:O,opacity:I},e[4]=O,e[5]=I,e[6]=V):V=e[6];const c=V,R=f??void 0;let Y;e[7]!==v||e[8]!==r.variant.rule||e[9]!==R?(Y=jt(r.variant.rule,v,R),e[7]=v,e[8]=r.variant.rule,e[9]=R,e[10]=Y):Y=e[10];const C=Y,Q=m?rs:"text-muted-foreground hover:bg-muted hover:text-foreground",D=p?"cursor-grabbing":"cursor-grab";let z;e[11]!==Q||e[12]!==D?(z=Ce("group shrink-0 inline-flex items-center rounded-md transition-colors touch-none",Q,D),e[11]=Q,e[12]=D,e[13]=z):z=e[13];let M;e[14]!==C||e[15]!==d?(M=t.jsx(Jt,{rule:C,matchers:d}),e[14]=C,e[15]=d,e[16]=M):M=e[16];let U;e[17]!==r.variant.label?(U=t.jsx("span",{className:"truncate",children:r.variant.label}),e[17]=r.variant.label,e[18]=U):U=e[18];let ee;e[19]!==y||e[20]!==j||e[21]!==S||e[22]!==M||e[23]!==U?(ee=t.jsxs("button",{type:"button",...y,...j,onClick:S,className:"inline-flex items-center gap-1.5 h-8 pl-3 pr-1.5 text-sm font-medium cursor-[inherit]",children:[M,U]}),e[19]=y,e[20]=j,e[21]=S,e[22]=M,e[23]=U,e[24]=ee):ee=e[24];const Se=`Actions for ${r.variant.label}`,se=m&&"opacity-100";let W;e[25]!==se?(W=Ce("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]=W):W=e[26];let ae;e[27]===Symbol.for("react.memo_cache_sentinel")?(ae=t.jsx(Vn,{size:12}),e[27]=ae):ae=e[27];let te;e[28]!==Se||e[29]!==W?(te=t.jsx(zn,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":Se,onClick:Or,onPointerDown:$r,className:W,children:ae})}),e[28]=Se,e[29]=W,e[30]=te):te=e[30];let E;e[31]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(fr,{size:14}),e[31]=E):E=e[31];let le;e[32]!==b?(le=t.jsxs(nt,{onClick:b,children:[E,"Rename"]}),e[32]=b,e[33]=le):le=e[33];let X;e[34]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(Za,{}),e[34]=X):X=e[34];const ne=!h;let re;e[35]===Symbol.for("react.memo_cache_sentinel")?(re=t.jsx(Ln,{size:14}),e[35]=re):re=e[35];let H;e[36]!==P||e[37]!==ne?(H=t.jsxs(nt,{variant:"destructive",disabled:ne,onClick:P,children:[re,"Delete"]}),e[36]=P,e[37]=ne,e[38]=H):H=e[38];let $;e[39]!==le||e[40]!==H?($=t.jsxs(Hn,{align:"start",className:"w-36",children:[le,X,H]}),e[39]=le,e[40]=H,e[41]=$):$=e[41];let B;e[42]!==te||e[43]!==$?(B=t.jsxs(In,{children:[te,$]}),e[42]=te,e[43]=$,e[44]=B):B=e[44];let oe;return e[45]!==o||e[46]!==c||e[47]!==ee||e[48]!==B||e[49]!==z?(oe=t.jsxs("div",{ref:o,style:c,className:z,children:[ee,B]}),e[45]=o,e[46]=c,e[47]=ee,e[48]=B,e[49]=z,e[50]=oe):oe=e[50],oe}function $r(l){return l.stopPropagation()}function Or(l){return l.stopPropagation()}function Br(){return!1}function Kr(l){const e=Le.c(13),{variant:r,decofile:i,meta:m,matchers:h}=l,v=m??void 0;let f;e[0]!==i||e[1]!==v||e[2]!==r.rule?(f=jt(r.rule,i,v),e[0]=i,e[1]=v,e[2]=r.rule,e[3]=f):f=e[3];const d=f;let S;e[4]===Symbol.for("react.memo_cache_sentinel")?(S=Ce("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]=S):S=e[4];let b;e[5]!==d||e[6]!==h?(b=t.jsx(Jt,{rule:d,matchers:h}),e[5]=d,e[6]=h,e[7]=b):b=e[7];let P;e[8]!==r.label?(P=t.jsx("span",{className:"truncate",children:r.label}),e[8]=r.label,e[9]=P):P=e[9];let N;return e[10]!==b||e[11]!==P?(N=t.jsxs("div",{className:S,children:[b,P]}),e[10]=b,e[11]=P,e[12]=N):N=e[12],N}function Fr(l){const e=Le.c(77),{listKey:r,variants:i,activeIndex:m,decofile:h,meta:v,matchers:f,onSelect:d,onReorder:S,onRename:b,onDelete:P,onAdd:N}=l;let y;e[0]!==i?(y=()=>Ht(i),e[0]=i,e[1]=y):y=e[1];const[j,o]=w.useState(y),[x,p]=w.useState(null),[O,I]=w.useState(r),[V,c]=w.useState(i.length);let R;e[2]!==i?(R=()=>Nn(i),e[2]=i,e[3]=R):R=e[3];const[Y,C]=w.useState(R),Q=w.useRef(!1),D=Nn(i);O!==r?(I(r),c(i.length),C(D),o(Ht(i))):V!==i.length?(c(i.length),C(D),o(Ht(i))):Y!==D&&(C(D),o(ie=>i.map((Ne,A)=>({id:ie[A]?.id??crypto.randomUUID(),index:A,variant:Ne}))));let z;e[4]===Symbol.for("react.memo_cache_sentinel")?(z={activationConstraint:{distance:8}},e[4]=z):z=e[4];let M;e[5]===Symbol.for("react.memo_cache_sentinel")?(M={coordinateGetter:Zn},e[5]=M):M=e[5];const U=Un(_t(qn,z),_t(Wn,M));let ee;e[6]!==j?(ee=j.map(Lr),e[6]=j,e[7]=ee):ee=e[7];const Se=ee,se=i.length>1;let W;e[8]!==j?(W=ie=>{const Ne=String(ie.active.id);p(j.find(A=>A.id===Ne)??null)},e[8]=j,e[9]=W):W=e[9];const ae=W;let te;e[10]!==Se||e[11]!==S?(te=ie=>{p(null);const{active:Ne,over:A}=ie;if(!A||Ne.id===A.id)return;const F=Se.indexOf(String(Ne.id)),Z=Se.indexOf(String(A.id));F===-1||Z===-1||(o(ze=>Mr(mt([...ze],F,Z))),Q.current=!0,requestAnimationFrame(()=>{Q.current=!1}),S(F,Z))},e[10]=Se,e[11]=S,e[12]=te):te=e[12];const E=te;let le;e[13]===Symbol.for("react.memo_cache_sentinel")?(le=()=>{p(null)},e[13]=le):le=e[13];const X=le;let ne,re,H,$,B,oe,pe,he,de,ce,q,K;if(e[14]!==x||e[15]!==m||e[16]!==se||e[17]!==h||e[18]!==j||e[19]!==Se||e[20]!==E||e[21]!==ae||e[22]!==f||e[23]!==v||e[24]!==P||e[25]!==b||e[26]!==d||e[27]!==U){const ie=A=>{Q.current||d(A)};q="flex items-center border-b shrink-0";const Ne=x&&"cursor-grabbing";e[40]!==Ne?(ce=Ce("flex flex-1 min-w-0 items-center gap-1.5 pl-3 pr-2 py-2 overflow-x-auto",Ne),e[40]=Ne,e[41]=ce):ce=e[41],re=Qn,B=U,oe=Xn,pe=ae,he=E,de=X,ne=Gn,K=Se,H=Xa,$=j.map(A=>t.jsx(Er,{sortableId:A.id,entry:A,isActive:A.index===m,canDelete:se,decofile:h,meta:v,matchers:f,onSelect:()=>ie(A.index),onRename:()=>b(A.index),onDelete:()=>P(A.index)},A.id)),e[14]=x,e[15]=m,e[16]=se,e[17]=h,e[18]=j,e[19]=Se,e[20]=E,e[21]=ae,e[22]=f,e[23]=v,e[24]=P,e[25]=b,e[26]=d,e[27]=U,e[28]=ne,e[29]=re,e[30]=H,e[31]=$,e[32]=B,e[33]=oe,e[34]=pe,e[35]=he,e[36]=de,e[37]=ce,e[38]=q,e[39]=K}else ne=e[28],re=e[29],H=e[30],$=e[31],B=e[32],oe=e[33],pe=e[34],he=e[35],de=e[36],ce=e[37],q=e[38],K=e[39];let De;e[42]!==ne||e[43]!==H||e[44]!==$||e[45]!==K?(De=t.jsx(ne,{items:K,strategy:H,children:$}),e[42]=ne,e[43]=H,e[44]=$,e[45]=K,e[46]=De):De=e[46];let ke;e[47]!==x||e[48]!==h||e[49]!==f||e[50]!==v?(ke=x?t.jsx(Kr,{variant:x.variant,decofile:h,meta:v,matchers:f}):null,e[47]=x,e[48]=h,e[49]=f,e[50]=v,e[51]=ke):ke=e[51];let Ee;e[52]!==ke?(Ee=t.jsx(es,{dropAnimation:null,children:ke}),e[52]=ke,e[53]=Ee):Ee=e[53];let we;e[54]!==re||e[55]!==B||e[56]!==oe||e[57]!==pe||e[58]!==he||e[59]!==de||e[60]!==De||e[61]!==Ee?(we=t.jsxs(re,{sensors:B,collisionDetection:oe,onDragStart:pe,onDragEnd:he,onDragCancel:de,children:[De,Ee]}),e[54]=re,e[55]=B,e[56]=oe,e[57]=pe,e[58]=he,e[59]=de,e[60]=De,e[61]=Ee,e[62]=we):we=e[62];let Te;e[63]!==ce||e[64]!==we?(Te=t.jsx("div",{className:ce,children:we}),e[63]=ce,e[64]=we,e[65]=Te):Te=e[65];let $e;e[66]===Symbol.for("react.memo_cache_sentinel")?($e={color:Ar},e[66]=$e):$e=e[66];let Oe;e[67]===Symbol.for("react.memo_cache_sentinel")?(Oe=t.jsx(Wt,{size:14}),e[67]=Oe):Oe=e[67];let be;e[68]!==N?(be=t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-8 shrink-0 cursor-pointer",style:$e,onClick:N,children:Oe})}),e[68]=N,e[69]=be):be=e[69];let Be;e[70]===Symbol.for("react.memo_cache_sentinel")?(Be=t.jsx(rt,{side:"bottom",children:"Add variant"}),e[70]=Be):Be=e[70];let Pe;e[71]!==be?(Pe=t.jsx("div",{className:"shrink-0 pr-3 pl-1 py-2",children:t.jsxs(st,{children:[be,Be]})}),e[71]=be,e[72]=Pe):Pe=e[72];let ue;return e[73]!==q||e[74]!==Te||e[75]!==Pe?(ue=t.jsxs("div",{className:q,children:[Te,Pe]}),e[73]=q,e[74]=Te,e[75]=Pe,e[76]=ue):ue=e[76],ue}function Lr(l){return l.id}function zr(l){const e=Le.c(37),{open:r,onOpenChange:i,defaultBlockId:m,isPending:h,onSubmit:v}=l,f=m===void 0?"":m,d=h===void 0?!1:h,[S,b]=w.useState(f),[P,N]=w.useState(r);r!==P&&(N(r),r&&b(f));let y;e[0]!==d||e[1]!==i?(y=U=>{!U&&!d&&i(!1)},e[0]=d,e[1]=i,e[2]=y):y=e[2];const j=y;let o;e[3]!==S||e[4]!==d||e[5]!==v?(o=async U=>{U.preventDefault();const ee=S.trim();!ee||d||await v(ee)},e[3]=S,e[4]=d,e[5]=v,e[6]=o):o=e[6];const x=o;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsxs(En,{children:[t.jsx(Mn,{children:"Save as global"}),t.jsx($n,{children:"Save this section as a global block so it can be reused on other pages."})]}),e[7]=p):p=e[7];let O;e[8]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx("label",{htmlFor:"block-id",className:"text-sm font-medium",children:"Block name"}),e[8]=O):O=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=U=>b(U.target.value),e[9]=I):I=e[9];let V;e[10]!==S||e[11]!==d?(V=t.jsxs("div",{className:"py-4 space-y-2",children:[O,t.jsx(Fn,{id:"block-id",value:S,onChange:I,placeholder:"MyNewBlock",autoFocus:!0,disabled:d})]}),e[10]=S,e[11]=d,e[12]=V):V=e[12];let c;e[13]!==i?(c=()=>i(!1),e[13]=i,e[14]=c):c=e[14];let R;e[15]!==d||e[16]!==c?(R=t.jsx(Fe,{type:"button",variant:"outline",onClick:c,disabled:d,children:"Cancel"}),e[15]=d,e[16]=c,e[17]=R):R=e[17];let Y;e[18]!==S||e[19]!==d?(Y=!S.trim()||d,e[18]=S,e[19]=d,e[20]=Y):Y=e[20];let C;e[21]!==d?(C=d?t.jsxs(t.Fragment,{children:[t.jsx(qt,{size:14,className:"animate-spin"}),"Saving…"]}):"Save",e[21]=d,e[22]=C):C=e[22];let Q;e[23]!==Y||e[24]!==C?(Q=t.jsx(Fe,{type:"submit",disabled:Y,children:C}),e[23]=Y,e[24]=C,e[25]=Q):Q=e[25];let D;e[26]!==R||e[27]!==Q?(D=t.jsxs(On,{children:[R,Q]}),e[26]=R,e[27]=Q,e[28]=D):D=e[28];let z;e[29]!==x||e[30]!==D||e[31]!==V?(z=t.jsx(Bn,{className:"sm:max-w-md",children:t.jsxs("form",{onSubmit:x,children:[p,V,D]})}),e[29]=x,e[30]=D,e[31]=V,e[32]=z):z=e[32];let M;return e[33]!==j||e[34]!==r||e[35]!==z?(M=t.jsx(Kn,{open:r,onOpenChange:j,children:z}),e[33]=j,e[34]=r,e[35]=z,e[36]=M):M=e[36],M}function Rn(l){const e=Le.c(15),{schema:r,value:i,onChange:m,meta:h,decofile:v,onSaveReferencedBlock:f,sandbox:d}=l;let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S=[],e[0]=S):S=e[0];const[b,P]=w.useState(S);let N;e[1]!==b?(N=b.length>0&&t.jsxs("nav",{"aria-label":"Variant rule breadcrumb",className:"flex min-w-0 items-center gap-1 overflow-hidden text-xs",children:[t.jsx("button",{type:"button",onClick:()=>P([]),className:"flex shrink-0 items-center gap-0.5 rounded-md px-1 py-0.5 text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",title:"Back to rule",children:t.jsx(Ka,{className:"size-3.5"})}),b.map((o,x)=>{const p=x===b.length-1;return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[x>0&&t.jsx(Pn,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>P(b.slice(0,x+1)),title:o,className:Ce("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors hover:bg-accent hover:text-accent-foreground",p?"font-medium text-foreground":"text-muted-foreground"),children:o})]},`${o}-${x}`)})]}),e[1]=b,e[2]=N):N=e[2];let y;e[3]!==b||e[4]!==v||e[5]!==h||e[6]!==m||e[7]!==f||e[8]!==d||e[9]!==r||e[10]!==i?(y=t.jsx(ts,{schema:r,value:i,onChange:m,basePath:"",breadcrumbPath:b,onBreadcrumbChange:P,meta:h,decofile:v,onSaveReferencedBlock:f,sandbox:d}),e[3]=b,e[4]=v,e[5]=h,e[6]=m,e[7]=f,e[8]=d,e[9]=r,e[10]=i,e[11]=y):y=e[11];let j;return e[12]!==N||e[13]!==y?(j=t.jsxs("div",{className:"space-y-2",children:[N,y]}),e[12]=N,e[13]=y,e[14]=j):j=e[14],j}function Cn(l){const e=Le.c(21),{activeSchema:r,formValue:i,formResetKey:m,onFormChange:h,onBreadcrumbChange:v,breadcrumbPath:f,emptyMessage:d,beforeForm:S,seoResolveType:b,siteDefaultSeo:P,meta:N,decofile:y,onSaveReferencedBlock:j,sandbox:o}=l;let x;e[0]!==f?(x=f===void 0?[]:f,e[0]=f,e[1]=x):x=e[1];const p=x;let O;e[2]!==r||e[3]!==p||e[4]!==y||e[5]!==m||e[6]!==i||e[7]!==N||e[8]!==v||e[9]!==h||e[10]!==j||e[11]!==o||e[12]!==b||e[13]!==P?(O=r&&i?b?t.jsx(mr,{schema:r,resolveType:b,value:i,formResetKey:m,onChange:h,onBreadcrumbChange:v,siteDefaultSeo:P}):t.jsx(ts,{schema:r,value:i,onChange:h,basePath:"",breadcrumbPath:p,onBreadcrumbChange:v,meta:N,decofile:y,onSaveReferencedBlock:j,sandbox:o},m):null,e[2]=r,e[3]=p,e[4]=y,e[5]=m,e[6]=i,e[7]=N,e[8]=v,e[9]=h,e[10]=j,e[11]=o,e[12]=b,e[13]=P,e[14]=O):O=e[14];const I=O;let V;e[15]!==d||e[16]!==I?(V=I??t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:d}),e[15]=d,e[16]=I,e[17]=V):V=e[17];let c;return e[18]!==S||e[19]!==V?(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:[S,V]})}),e[18]=S,e[19]=V,e[20]=c):c=e[20],c}const Ir="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 Hr(l,e){return va(l,e,tt)}function Ur(l){const e=Le.c(13),{pageKey:r,initialName:i,initialPath:m,onFieldChange:h}=l,[v,f]=w.useState(i),[d,S]=w.useState(m),[b,P]=w.useState(r);b!==r&&(P(r),f(i),S(m));let N;e[0]!==h?(N=p=>{f(p.target.value),h("name",p.target.value)},e[0]=h,e[1]=N):N=e[1];let y;e[2]!==v||e[3]!==N?(y=t.jsx("input",{type:"text",value:v,onChange:N,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]=v,e[3]=N,e[4]=y):y=e[4];let j;e[5]!==h?(j=p=>{S(p.target.value),h("path",p.target.value)},e[5]=h,e[6]=j):j=e[6];let o;e[7]!==d||e[8]!==j?(o=t.jsx("input",{type:"text",value:d,onChange:j,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]=d,e[8]=j,e[9]=o):o=e[9];let x;return e[10]!==y||e[11]!==o?(x=t.jsxs("div",{className:"space-y-1",children:[y,o]}),e[10]=y,e[11]=o,e[12]=x):x=e[12],x}function Dn(l){const e=Le.c(6),{onClick:r}=l;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(An,{size:14}),e[0]=i):i=e[0];let m;e[1]!==r?(m=t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Add variant",className:"size-7 shrink-0 text-[oklch(0.65_0.15_160)]",onClick:r,children:i})}),e[1]=r,e[2]=m):m=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(rt,{side:"bottom",children:"Add variant"}),e[3]=h):h=e[3];let v;return e[4]!==m?(v=t.jsxs(st,{children:[m,h]}),e[4]=m,e[5]=v):v=e[5],v}function Tl({orgSlug:l,virtualMcpId:e,branch:r,previewReady:i=!0,previewUrl:m,currentPath:h,activePageBlockKey:v=null,activeGlobalBlockKey:f=null,externalSelectedIndex:d,onSaved:S,initialEditSeo:b=!1,onExitSeo:P,onViewJsonFile:N,onVariantPreviewOverride:y}){const j=i?{orgSlug:l,virtualMcpId:e,branch:r,previewUrl:m}:null,{data:o,isLoading:x}=oa(j),{data:p,isLoading:O}=ia(j),I=la(),V=I?.entity?.id===e?I.entity.metadata?.siteSlug??null:null,[c,R]=w.useState(null),[Y,C]=w.useState(null),[Q,D]=w.useState(null),[z,M]=w.useState(0),[U,ee]=w.useState(void 0),[Se,se]=w.useState(null),[W,ae]=w.useState(null),[te,E]=w.useState([]),[le,X]=w.useState(0),[ne,re]=w.useState(null),[H,$]=w.useState(null),[B,oe]=w.useState(!0),[pe,he]=w.useState(!1),[de,ce]=w.useState(!1),[q,K]=w.useState(b),[De,ke]=w.useState(b);b&&!De&&(ke(!0),K(!0),R(null),C(null),D(null),E([])),!b&&De&&ke(!1);const[Ee,we]=w.useState(null),[Te,$e]=w.useState(void 0),[Oe,be]=w.useState([]),[Be,Pe]=w.useState(0),[ue,ie]=w.useState(0),[Ne,A]=w.useState(null),[F,Z]=w.useState(null),[ze,He]=w.useState(null),We=ta(),os=`${l}/${e}/${r}`,kt=ca({orgSlug:l,virtualMcpId:e,branch:r}),[is,ls]=w.useState(h),[cs,us]=w.useState(v),[ds,ms]=w.useState(f);(is!==h||cs!==v||ds!==f)&&(queueMicrotask(()=>kt.flush()),ls(h),us(v),ms(f),R(null),C(null),D(null),M(0),se(null),ae(null),ie(0),A(null),Z(null),E([]),X(n=>n+1),K(!1),we(null),$e(void 0),be([]),Pe(n=>n+1));const Ve=ua({orgSlug:l,virtualMcpId:e,branch:r}),ft=hr((n,s)=>{Ve.mutate({blockKey:n,data:s},{onSuccess:()=>S?.(),onError:a=>fe.error(`Save failed: ${a.message}`)})}),Yt=da({orgSlug:l,virtualMcpId:e,branch:r}),[wt,Zt]=w.useState(!1),Nt=w.useRef(null),ot=w.useRef(null),it=w.useRef(null),Rt=w.useRef({}),qe=w.useRef({rawSections:[],parsedSections:[],decofile:{},activePageKey:null,pageVariants:[],variantIndex:0,sectionVariantIndex:0,selectedSectionIndex:null});if(!i||x||O)return t.jsx("div",{className:"h-full w-full flex items-center justify-center",children:t.jsx(qt,{size:20,className:"animate-spin text-muted-foreground"})});if(!o||!p)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=ma(o),ve=!!f,Ke=ve?null:fa(fs,h,v),_=ve?f:Ke?.key??null,Ct=ve&&f?o[f]:void 0,Qt=ve&&f&&Ct?pa(f,Ct):ve&&f?f:"",pt=!ve&&_&&o[_]?o[_]:null,Dt=q&&o&&p&&_&&Ke?jn(o,{kind:"page",pageKey:_,pageName:String(Ke.name??""),path:String(Ke.path??"")},p):null,ps=q?pt?.seo:void 0,Tt=Te!==void 0?Te:ps,hs=q?rr(Tt):void 0,gs=Dt?.seoTypeOptions??[],vs=q&&p?or(p):"",Xt=Ee??hs??{},Pt=q&&Dt?ir(Xt,Dt):null,Ss=q&&Pt&&lr(Tt)?bt(Pt,p):null,bs=q?cr(o,p)?.seoData:void 0,Ae=ve?[{label:"Default",sections:[{__resolveType:f}]}]:Hr(pt?.sections,o??{}),ht=Ae.length>1,_e=Math.min(z,Ae.length-1),Xe=Ae[_e],J=Xe?.sections??[],Re=xt(J,o),Gt=!ve&&ha(pt?.sections);if(ve&&f&&ze!==f){He(f);const n=J[0],s=Re[0];if(n&&s){R(0),ie(0),E([]);const a=et(n,s,o);a&&(C(a.data),D(a.resolveType),Z(null),A(null))}}!ve&&ze!==null&&He(null),qe.current={rawSections:J,parsedSections:Re,decofile:o??{},activePageKey:_,pageVariants:Ae,variantIndex:_e,sectionVariantIndex:ue,selectedSectionIndex:c};const xs=()=>({multivariate:Gt,index:_e,variants:Ae.map(n=>({rule:n.rule}))}),en=(n,s)=>{if(!y)return;if(!_||!Gt||n.length<=1){y(null);return}const a=bn(_,{multivariate:!0,index:s,variants:n},o,p);y(a.length>0?a:null)},lt=(n,s,a)=>{if(!y)return;if(!_){y(null);return}const u=xs(),g=bn(_,u,o,p);if(!n||s<0){y(g.length>0?g:null);return}const T=Aa({pageKey:_,page:u,sectionIndex:s,sectionLazy:Re[s]?.isLazy??!1,mvObj:n,selectedVariantIndex:a,decofile:o,meta:p}),k=[...g,...T];y(k.length>0?k:null)},Je=(n,s,a,u=c??-1,g=!1)=>{const T=Qe(n,s);if(!T){C(null),D(null),Z(null),A(null),g&&lt(null,u,a);return}const L=vn(T,tt)[a];if(!L){C(null),D(null),Z(null),A(null),g&&lt(null,u,a);return}const ge=Sa(L.value,o);C(ge?.data??null),D(ge?.resolveType??null);const{resolveType:G,formValue:me}=Kt(L.rule,o,p??void 0);Z(G),A(me),g&&lt(T,u,a)};if(d!==void 0&&d!==U&&(ee(d??null),typeof d=="number")){const n=J[d],s=Re[d];if(n&&s)if(R(d),ie(0),E([]),X(a=>a+1),s.isMultivariate)Je(n,s,0,d);else{const a=et(n,s,o);a?(C(a.data),D(a.resolveType)):(C(null),D(null)),Z(null),A(null)}}const gt={orgSlug:l,virtualMcpId:e,branch:r,previewUrl:m??void 0,siteSlug:V},Vt=Q&&p?bt(Q,p):null,Ie=(n,s)=>{if(!_)return;const a=It(o,_,n,_e,Ae);Ve.mutate({blockKey:_,data:a},{onSuccess:()=>s?.onSuccess?.()??S?.(),onError:u=>fe.error(`Save failed: ${u.message}`)})},ct=()=>{R(null),C(null),D(null),ie(0),A(null),Z(null),E([]),X(n=>n+1)},ys=(n,s)=>{Nt.current&&clearTimeout(Nt.current);const a=qe.current.sectionVariantIndex;Nt.current=setTimeout(()=>{const{rawSections:u,parsedSections:g,decofile:T,activePageKey:k,pageVariants:L,variantIndex:ge}=qe.current,G=u[s];if(!G)return;const me=g[s];if(!me)return;if(me.isSavedBlock){const ye=me.isLazy?G.section?.__resolveType??G.__resolveType:G.__resolveType;Ve.mutate({blockKey:ye,data:n},{onSuccess:()=>S?.(),onError:je=>fe.error(`Save failed: ${je.message}`)});return}if(!k)return;const xe={...T[k]},Me=[...u];if(me.isMultivariate){const ye=Qe(G,me);if(!ye||!k)return;const je=$a(ye,a,n);Me[s]=dt(G,me,je)}else if(me.isHidden){const ye=Tn(G.__resolveType),je=ye?{...G.section}:{...G},Ue=Array.isArray(je.variants)?[...je.variants]:[];Ue[0]&&(Ue[0]={...Ue[0],value:n}),je.variants=Ue,ye?Me[s]={...G,section:je}:Me[s]=je}else me.isLazy?Me[s]={...G,section:n}:Me[s]=n;if(L.length>1){const ye=xe.sections,je=[...ye?.variants??[]];je[ge]&&(je[ge]={...je[ge],value:Me}),xe.sections={...ye,variants:je}}else xe.sections=Me;Ve.mutate({blockKey:k,data:xe},{onSuccess:()=>S?.(),onError:ye=>fe.error(`Save failed: ${ye.message}`)})},zt)},js=n=>{R(n),ie(0),E([]),X(g=>g+1);const s=J[n],a=Re[n];if(!s||!a)return;if(a.isMultivariate){Je(s,a,0,n);return}const u=et(s,a,o);if(!u){C(null),D(null),Z(null),A(null),lt(null,n,0);return}C(u.data),D(u.resolveType),Z(null),A(null),lt(null,n,0)},tn=n=>{const s=n;C(s),c!==null&&ys(s,c)},At=n=>{if(!_||!o||!p||!Ke)return;const s={kind:"page",pageKey:_,pageName:String(Ke.name??""),path:String(Ke.path??"")},a=jn(o,s,p);a&&kt.save(_,()=>{const u=We.getQueryData(na.decofile(os))?.[_];if(!u||typeof u!="object"||u===null||Array.isArray(u))return null;const g={...u,...Rt.current};return Rt.current={},n?.raw!==void 0?{...g,seo:n.raw}:n?.inner!==void 0?dr(s,a,g,n.inner):g})},_s=(n,s)=>{_&&(Rt.current[n]=s,At())},ks=(n,s)=>{if(!_)return;const a=mt([...J],n,s);c!==null&&(c===n?R(s):n<c&&s>=c?R(c-1):n>c&&s<=c&&R(c+1)),Ie(a)},ws=n=>{if(!_)return;const s=J.filter((a,u)=>u!==n);c===n?ct():c!==null&&c>n&&R(c-1),Ie(s)},Ns=n=>{if(!_)return;const s=J[n];if(!s)return;const a=[...J];a.splice(n+1,0,vr(s)),c!==null&&c>n&&R(c+1),Ie(a)},Rs=n=>{if(!_)return;const s=J[n],a=Re[n];if(!s||!a||a.isMultivariate)return;const u=a.isHidden?Ca(s):Da(s);if(!u)return;const g=[...J];g[n]=u,c===n&&ct(),Ie(g)},Cs=n=>{if(!_)return;const s=J[n],a=Re[n];if(!s||!a||a.isMultivariate)return;const u=Ra(s);if(!u)return;const g=[...J];g[n]=u,c===n&&ct(),Ie(g)},Ds=n=>{if(!_)return;const s=J[n],a=Re[n];if(!s||!a?.isSavedBlock)return;const u=et(s,a,o);if(!u?.data)return;const{name:g,...T}=u.data,k=[...J];a.isLazy?k[n]={...s,section:T}:k[n]=T,c===n&&ct(),Ie(k)},Ts=n=>{if(!_)return;const s=[...J,{__resolveType:n.resolveType}],a=s.length-1;Ie(s,{onSuccess:()=>{he(!1),R(a),ie(0),E([]),X(k=>k+1);const u=s[a],g=xt(s,o)[a];if(!u||!g)return;if(g.isMultivariate){Je(u,g,0);return}const T=et(u,g,o);if(!T){C(null),D(null),Z(null),A(null);return}C(T.data),D(T.resolveType),Z(null),A(null)}})},Ps=n=>{if(c===null)return;const s=J[c],a=Re[c];!s||!a?.isMultivariate||(ie(n),E([]),X(u=>u+1),Je(s,a,n,c,!0))},Vs=n=>{if(c===null||!_)return;const s=J[c],a=Re[c];if(!s||!a?.isMultivariate)return;const u=Qe(s,a);if(!u)return;const g=wa(u,n);if(!g){fe.error("Cannot delete the only variant.");return}const T=[...J];T[c]=dt(s,a,g);const k=g.variants;let L=ue;n===ue?L=Math.min(n,k.length-1):n<ue&&(L=ue-1),ie(L),E([]),X(ge=>ge+1),Je(T[c],a,L),Ie(T)},As=n=>{if(c===null||!_)return;const s=J[c],a=Re[c];if(!s||!a?.isMultivariate)return;const u=Qe(s,a);if(!u)return;const g=Na(u,n),T=[...J];T[c]=dt(s,a,g);const k=n+1;ie(k),E([]),X(L=>L+1),Je(T[c],a,k),Ie(T)},Ms=(n,s)=>{if(c===null||!_||n===s)return;const a=J[c],u=Re[c];if(!a||!u?.isMultivariate)return;const g=Qe(a,u);if(!g)return;const T=_a(g,n,s),k=[...J];k[c]=dt(a,u,T);let L=ue;ue===n?L=s:n<ue&&s>=ue?L=ue-1:n>ue&&s<=ue&&(L=ue+1),ie(L),Je(k[c],u,L),Ie(k)},Mt=n=>{const s=n??c;if(s===null||!_)return;const a=J[s],u=Re[s];if(!a||!u)return;const g=ba(a,u);if(!g){fe.error("This section cannot have variants.");return}const T=[...J];T[s]=g.section;const k=xt(T,o)[s];if(!k?.isMultivariate){fe.error("Could not add variant.");return}R(s),ie(g.newVariantIndex),E([]),X(L=>L+1),Je(g.section,k,g.newVariantIndex,s),Ie(T)},Es=()=>{if(c===null||!_)return;const n=J[c],s=Re[c];if(!n||!s?.isMultivariate)return;const a=Qe(n,s);if(!a)return;const u=ka(n,s,a);if(!u){fe.error("Could not remove variants.");return}const g=[...J];g[c]=u;const T=xt(g,o)[c];if(!T)return;ie(0),Z(null),A(null),E([]),X(L=>L+1);const k=et(u,T,o);k?(C(k.data),D(k.resolveType)):(C(null),D(null)),lt(null,c,0),Ie(g)},$s=async n=>{if(ne===null||!_)return;const s=kn(n,o);if(s){fe.error(s);return}const a=J[ne],u=Re[ne];if(!a||!u)return;const g=et(a,u,o);if(!g){fe.error("This section cannot be saved as global.");return}const T={...g.data,name:n};try{await Ve.mutateAsync({blockKey:n,data:T});const k=[...J];k[ne]={__resolveType:n},await Ve.mutateAsync({blockKey:_,data:It(o,_,k,_e,Ae)}),c===ne&&ct(),re(null),fe.success(`Saved global block "${n}"`),S?.()}catch(k){fe.error(k instanceof Error?k.message:"Failed to save global block")}},nn=Xe?.rule;if(ht&&c===null&&W===null&&nn){const{resolveType:n,formValue:s}=Kt(nn,o??{},p??void 0);ae(n),se(s)}const vt=p?sr(p):[],Os=!ve&&!!(m&&p&&o),sn=W&&p?bt(W,p):null,Bs=()=>{ot.current&&(clearTimeout(ot.current),ot.current=null),it.current&&(clearTimeout(it.current),it.current=null)},an=async(n,s)=>{if(!(Oa(s,n,p)>0))try{await Yt.mutateAsync({blockKey:n})}catch(a){fe.error(a instanceof Error?a.message:"Could not delete matcher block")}},rn=n=>{ot.current&&clearTimeout(ot.current),ot.current=setTimeout(()=>{const{activePageKey:s,decofile:a,variantIndex:u}=qe.current;if(!s)return;const g={...a[s]},T={...g.sections},k=[...T.variants??[]],L=k[u],ge=L?.rule;if(Ft(ge,a,p)){const G=ge?.__resolveType??"",me=a[G],xe=typeof me?.name=="string"?me.name:G,{__resolveType:Me,...ye}=n;Ve.mutate({blockKey:G,data:Lt(Me??"",ye,xe)},{onSuccess:()=>S?.(),onError:je=>fe.error(`Save failed: ${je.message}`)});return}L&&(k[u]={...L,rule:n}),g.sections={...T,variants:k},Ve.mutate({blockKey:s,data:g},{onSuccess:()=>S?.(),onError:G=>fe.error(`Save failed: ${G.message}`)})},zt)},Ks=n=>{ae(n);const s=n?{__resolveType:n}:{__resolveType:xn};se({}),rn(s)},Fs=n=>{const s=n;se(s);const a=W?{__resolveType:W,...s}:{...s};rn(a)},on=n=>{it.current&&clearTimeout(it.current);const{selectedSectionIndex:s,sectionVariantIndex:a}=qe.current;s!==null&&(it.current=setTimeout(()=>{const{rawSections:u,parsedSections:g,decofile:T,activePageKey:k,pageVariants:L,variantIndex:ge}=qe.current;if(!k)return;const G=u[s],me=g[s];if(!G||!me?.isMultivariate)return;const xe=Qe(G,me);if(!xe)return;const Me=Ea(xe,a,n),ye=[...u];ye[s]=dt(G,me,Me);const je=It(T,k,ye,ge,L);Ve.mutate({blockKey:k,data:je},{onSuccess:()=>S?.(),onError:Ue=>fe.error(`Save failed: ${Ue.message}`)})},zt))},Ls=n=>{Z(n),A({}),on(n?{__resolveType:n}:{__resolveType:xn})},zs=n=>{const s=n;A(s);const a=F?{__resolveType:F,...s}:{...s};on(a)};if(!ve&&!Ke)return t.jsxs("div",{className:"h-full w-full flex items-center justify-center text-sm text-muted-foreground",children:["No page found for ",h]});if(ve&&!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 Ye=c!==null?Re[c]??null:null,ln=c!==null?J[c]:null,cn=ln&&Ye?.isMultivariate?Qe(ln,Ye):null,St=cn?vn(cn,tt):[],Et=Math.min(ue,Math.max(St.length-1,0)),$t=St[Et]??null,Ge=Ye?.isMultivariate===!0,un=c!==null&&Ye!==null,ut=un&&(Ge||!!(Vt&&Y)),Is=ut&&!ve&&Ye?.isSavedBlock===!0,Ze=ve||Is,Hs=ve?Qt:Ye?.label??"",dn=F&&p?bt(F,p):null,Ot=ut&&(!ve||te.length>0)?ve?[Qt,...te]:[Ke.name,Ye.label,...Ge&&$t?[$t.label]:[],...te]:[],Us=q&&Ke?[Ke.name,"SEO",...Oe]:[],mn=q?Us:Ze?Ot.length>0?Ot:[Hs]:Ot,fn=()=>{if(!_)return;const n=o[_],s=xa(n.sections,J);if(!s)return;const a=ya(s);Ve.mutate({blockKey:_,data:{...n,sections:s}},{onSuccess:()=>{M(a),R(null),C(null),D(null),E([]),se(null),ae(null)},onError:u=>fe.error(`Save failed: ${u.message}`)})},pn=(n,s,a)=>{if(!_)return;const u=o[_],g=u.sections;if(!g||typeof g!="object"||Array.isArray(g))return;const T=g;if(!Array.isArray(T.variants))return;const k=n([...T.variants]);if(!k)return;const L=Ma(T,k),ge={...o,[_]:{...u,sections:L}};Ve.mutate({blockKey:_,data:ge[_]},{onSuccess:()=>{s?.(),a&&an(a,ge)},onError:G=>fe.error(`Save failed: ${G.message}`)})},Ws=n=>{$(null),M(n),R(null),C(null),D(null),E([]);const s=Ae[n]?.rule,{resolveType:a,formValue:u}=Kt(s,o??{},p??void 0);ae(a),se(u),en(Ae.map(g=>({rule:g.rule})),n)},qs=(n,s)=>{if(n===s)return;let a=_e;_e===n?a=s:n<_e&&s>=_e?a=_e-1:n>_e&&s<=_e&&(a=_e+1),M(a);const u=mt(Ae.map(g=>({rule:g.rule})),n,s);en(u,a),pn(g=>mt(g,n,s))},Js=n=>{const s=Ae[n]?.rule,a=ja(s,o??{},p??void 0);pn(u=>u.length<=1?null:(u.splice(n,1),u),()=>{Ae.length-1===1?M(0):n<_e?M(_e-1):n===_e&&M(Math.max(0,n-1)),R(null),C(null),D(null),E([]),se(null),ae(null)},a)},Ys=async(n,s)=>{Bs();const a=qe.current.activePageKey,u=qe.current.decofile;if(!a)return;const g=u[a],T=g.sections;if(!T||typeof T!="object"||Array.isArray(T))return;const k=T;if(!Array.isArray(k.variants))return;const L=[...k.variants],ge=L[n];if(!ge?.rule||typeof ge.rule!="object"){fe.error("This variant has no matcher rule to rename.");return}const G=ge.rule,me=s.trim();Zt(!0);try{if(!me){if(!Ft(G,u,p)){$(null);return}const Bt=G.__resolveType??"";L[n]={...ge,rule:Ta(G,u,p)};const gn={...u,[a]:{...g,sections:{...k,variants:L}}};await Ve.mutateAsync({blockKey:a,data:gn[a]}),await an(Bt,gn),$(null),S?.();return}const xe=Pa(G,u,p);if(!xe){fe.error("Could not read this variant's matcher rule.");return}if(xe.blockKey){await Ve.mutateAsync({blockKey:xe.blockKey,data:Lt(xe.resolveType,xe.data,me)}),$(null),S?.();return}const Me=_n(me),ye=kn(Me,u);if(ye){fe.error(ye);return}const je=Lt(xe.resolveType,xe.data,me);let Ue=null;try{await Ve.mutateAsync({blockKey:Me,data:je}),Ue=Me,L[n]={...ge,rule:Va(Me)},await Ve.mutateAsync({blockKey:a,data:{...g,sections:{...k,variants:L}}}),Ue=null}catch(Bt){throw Ue&&await Yt.mutateAsync({blockKey:Ue}).catch(()=>{}),Bt}$(null),fe.success(`Saved matcher as global block "${me}"`),S?.()}catch(xe){fe.error(xe instanceof Error?xe.message:"Failed to rename variant")}finally{Zt(!1)}},hn=()=>{ct()},Zs=n=>{we(n),At({inner:n})},Qs=n=>{$e(n),At({raw:n})},Xs=()=>{we(null),be([])},Gs=()=>Pe(n=>n+1),ea=n=>{if(q){if(n===0){kt.flush(),K(!1),we(null),$e(void 0),be([]),Pe(a=>a+1),P?.();return}if(n===1){be([]),Pe(a=>a+1);return}be(Oe.slice(0,n-1)),Pe(a=>a+1);return}if(ve){E(te.slice(0,n)),X(a=>a+1);return}if(n===0){hn();return}if(n===1){E([]),X(a=>a+1);return}if(Ge&&n===2){E([]),X(a=>a+1);return}const s=Ge?2:1;E(te.slice(0,n-s))};return t.jsxs("div",{className:"flex h-full min-w-0 w-full flex-col",children:[t.jsx("div",{className:"shrink-0",children:Ze||ut||q?t.jsxs("div",{className:Ce("border-b px-3 py-2.5",Ze&&"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:[!ve&&ht&&Xe&&t.jsxs("button",{type:"button",onClick:hn,title:`Editing in variant: ${Xe.label}`,className:Ce("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",Ir),children:[t.jsx(Jt,{rule:jt(Xe.rule,o??{},p??void 0),matchers:vt}),t.jsx("span",{className:"max-w-[160px] truncate",children:Xe.label})]}),t.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:mn.map((n,s)=>{const a=s===mn.length-1;return t.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[s>0&&t.jsx(Pn,{className:"size-3 shrink-0 text-muted-foreground/60"}),t.jsx("button",{type:"button",onClick:()=>ea(s),title:n,className:Ce("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?Ze?"font-semibold text-global-section-fg dark:text-global-section-fg-dark":"font-medium text-foreground":Ze?"text-foreground/80":"text-muted-foreground",Ze?"hover:bg-global-section/15":"hover:bg-accent hover:text-accent-foreground"),children:n})]},`${n}-${s}`)})}),Ze&&t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx("span",{className:"shrink-0 cursor-help",children:t.jsx(Ha,{className:"size-4 text-global-section-fg dark:text-global-section-fg-dark"})})}),t.jsx(rt,{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."})]}),un&&!Ge&&!Ye?.isHidden&&_&&t.jsx(Dn,{onClick:()=>Mt()})]}),Ze&&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(Ur,{pageKey:_,initialName:Ke.name,initialPath:Ke.path,onFieldChange:_s})}),t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"Edit SEO",className:"size-7 shrink-0",onClick:()=>K(!0),children:t.jsx(za,{size:14})})}),t.jsx(rt,{side:"bottom",children:"Edit SEO"})]}),t.jsxs(st,{children:[t.jsx(at,{asChild:!0,children:t.jsx(Fe,{type:"button",variant:"ghost",size:"icon","aria-label":"View JSON",className:"size-7 shrink-0",onClick:()=>N&&_?N(_):ce(!0),children:t.jsx(Ia,{size:14})})}),t.jsx(rt,{side:"bottom",children:"View JSON"})]}),t.jsx(Dn,{onClick:fn})]})}),ht&&!ut&&!q&&_&&t.jsx(Fr,{listKey:_,variants:Ae,activeIndex:_e,decofile:o??{},meta:p,matchers:vt,onSelect:Ws,onReorder:qs,onRename:$,onDelete:Js,onAdd:fn}),q?t.jsx(yt,{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:pt&&_?t.jsx(ur,{rawSeo:Tt,innerSeo:Xt,defaultResolveType:vs,seoSchema:Ss,activeResolveType:Pt,seoTypeOptions:gs,formResetKey:Be,siteDefaultSeo:bs,onBreadcrumbChange:be,onPersistRaw:Qs,onInnerChange:Zs,onClearForm:Xs,onBumpFormKey:Gs}):t.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"SEO schema not found for this site."})})})}):ut?t.jsxs(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[Ge&&St.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(ar,{listKey:`${_??""}:${c??""}`,variants:St.map((n,s)=>({index:s,label:n.label})),selectedIndex:Et,onSelect:Ps,onDuplicate:As,onDelete:Vs,onRemoveAll:Es,onReorder:Ms,onAdd:()=>Mt()}),Ge&&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(yn,{currentRt:F??"",currentLabel:tt($t?.rule),matchers:vt,onSelect:Ls}),dn&&Ne&&t.jsx("div",{className:"pt-1",children:t.jsx(Rn,{schema:dn,value:Ne,onChange:zs,meta:p??void 0,decofile:o,onSaveReferencedBlock:ft,sandbox:gt},`${c??"none"}:${Et}:${F??""}`)})]})]}),t.jsx(Cn,{activeSchema:Vt,formValue:Y,formResetKey:le,onFormChange:tn,onBreadcrumbChange:E,breadcrumbPath:te,emptyMessage:"No editable fields for this variant.",meta:p,decofile:o,onSaveReferencedBlock:ft,sandbox:gt})]}):ve?t.jsx(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:t.jsx(Cn,{activeSchema:Vt,formValue:Y,formResetKey:le,onFormChange:tn,onBreadcrumbChange:E,breadcrumbPath:te,emptyMessage:"No editable fields for this global block.",meta:p,decofile:o,onSaveReferencedBlock:ft,sandbox:gt})}):t.jsxs(yt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:[ht&&W!==null&&t.jsxs("div",{className:Ce("px-3 border-b",B?"pt-3 pb-5 space-y-3":"py-2"),children:[t.jsxs("button",{type:"button",onClick:()=>oe(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":B,children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Variant rule"}),B?t.jsx(Fa,{className:"size-3.5 shrink-0 text-muted-foreground"}):t.jsx(Ba,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),B&&t.jsxs("div",{className:Ce("space-y-3",wt&&"pointer-events-none opacity-50"),children:[t.jsx(yn,{currentRt:W,currentLabel:Sn(Xe?.rule,o??{},tt,p??void 0),matchers:vt,onSelect:Ks}),sn&&Se&&t.jsx("div",{className:"space-y-3",children:t.jsx(Rn,{schema:sn,value:Se,onChange:Fs,meta:p??void 0,decofile:o,onSaveReferencedBlock:ft,sandbox:gt},`${_e}:${W??""}`)})]})]}),t.jsx("div",{className:"p-2 pt-3",children:t.jsx(Pr,{listKey:`${_??""}-${_e}`,rawSections:J,sections:Re,meta:p,selectedIndex:c,onSelect:js,onReorder:ks,onDelete:ws,onDuplicate:Ns,onMakeReusable:re,onToggleHidden:Rs,onToggleLazy:Cs,onAddVariant:Mt,onDetach:Ds,onAddSection:()=>he(!0),canAddSection:Os})})]}),t.jsx(zr,{open:ne!==null,onOpenChange:n=>{n||re(null)},defaultBlockId:ne!==null?_n(Re[ne]?.label??""):"",isPending:Ve.isPending,onSubmit:$s}),m&&t.jsx(pr,{open:pe,onOpenChange:he,meta:p,decofile:o,previewBaseUrl:m,onSelect:Ts}),de&&_&&o&&t.jsx(ga,{open:de,onOpenChange:ce,pageKey:_,decofile:o}),H!==null&&t.jsx(gr,{open:!0,initialName:Ft(Ae[H]?.rule,o??{},p??void 0)?Sn(Ae[H]?.rule,o??{},tt,p??void 0):"",autoLabel:tt(jt(Ae[H]?.rule,o??{},p??void 0)),isPending:wt,onSubmit:async n=>{await Ys(H,n)},onOpenChange:n=>{!n&&!wt&&$(null)}})]})}export{Tl as SectionsEditor};