decocms 3.68.1 → 3.69.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 (216) hide show
  1. package/dist/client/assets/{AlertCircle-B-Zk3zY-.js → AlertCircle-Dnqz3IxM.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DrUVVTac.js → ArrowUpRight-B2NXgTf2.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-DgjXE82G.js → CheckCircle-D9OslXZP.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-DAwDO8g3.js → ChevronDown-BldydMJ0.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-BoWRf6EK.js → ChevronLeft-CXmppBJO.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-CxzKR4UY.js → ChevronRight-BsknZQE_.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-Bu9JV4C-.js → ChevronUp-CjDXfs3K.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-CSx815oq.js → DotsVertical-Ci1mVPsb.js} +1 -1
  9. package/dist/client/assets/{Eye-Clz4yV9V.js → Eye-DifA9NHq.js} +1 -1
  10. package/dist/client/assets/{FilterLines-CCXAkAAh.js → FilterLines-CV07u96M.js} +1 -1
  11. package/dist/client/assets/{Globe01-rz2h7Ebm.js → Globe01-CMUrlGmF.js} +1 -1
  12. package/dist/client/assets/{Globe04-ZAH-y7Tv.js → Globe04-BplUDurZ.js} +1 -1
  13. package/dist/client/assets/{HardDrive-CdL1msYN.js → HardDrive-B6V7BYZB.js} +1 -1
  14. package/dist/client/assets/{Key01-Cd33I9n1.js → Key01-DGn_JEBu.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-Cx1gVHzQ.js → LayoutLeft-BI32Ru47.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-DQqosIE7.js → LinkExternal01-DwIqUvLe.js} +1 -1
  17. package/dist/client/assets/{Monitor01-DtUT2Llg.js → Monitor01-C-tOv611.js} +1 -1
  18. package/dist/client/assets/{Palette-CS46pFVA.js → Palette-pjBymHRy.js} +1 -1
  19. package/dist/client/assets/{Play-CFAWCyYY.js → Play-BEuZCxsN.js} +1 -1
  20. package/dist/client/assets/{Plus-Cl80ngk-.js → Plus-DHJbi1i9.js} +1 -1
  21. package/dist/client/assets/{SearchMd-DtbjJ0sS.js → SearchMd-yvCGxslh.js} +1 -1
  22. package/dist/client/assets/{Settings02-BX75SJ47.js → Settings02-BcW_Yd93.js} +1 -1
  23. package/dist/client/assets/{Shield01-CY7h3_lL.js → Shield01-DXFrycnj.js} +1 -1
  24. package/dist/client/assets/{Star01-CqiKSE8w.js → Star01-DxJIcjLz.js} +1 -1
  25. package/dist/client/assets/{Stars01-CfOrOYJQ.js → Stars01-Dr_rOBxK.js} +1 -1
  26. package/dist/client/assets/{Stars02-CCs6aX7m.js → Stars02-CB3UMWzf.js} +1 -1
  27. package/dist/client/assets/{Sun-0mP8ve2O.js → Sun-CTchQz03.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-BVb8cFOW.js → SwitchHorizontal01-Ca_h3hG5.js} +1 -1
  29. package/dist/client/assets/{Tool01-DpllcZ_x.js → Tool01-B4m3Gnpd.js} +1 -1
  30. package/dist/client/assets/{Trash01-B4p5GuSp.js → Trash01-BDNQcRq9.js} +1 -1
  31. package/dist/client/assets/{Upload01--GcqA8-Q.js → Upload01-CuyZwIAy.js} +1 -1
  32. package/dist/client/assets/{User01-DxuO8uwX.js → User01-kj3Bxvgl.js} +1 -1
  33. package/dist/client/assets/{Users01-a4XMjW3H.js → Users01-DM4FmEoT.js} +1 -1
  34. package/dist/client/assets/{Users03-D3FPHz00.js → Users03-CJ4lkyfr.js} +1 -1
  35. package/dist/client/assets/{X-ciDfeMTV.js → X-Botvp-t_.js} +1 -1
  36. package/dist/client/assets/{XCircle-DheND3p1.js → XCircle-CpovmLEO.js} +1 -1
  37. package/dist/client/assets/{XClose-BGdHen0O.js → XClose-CnYr1LOo.js} +1 -1
  38. package/dist/client/assets/{Zap-Dc-gCUi7.js → Zap-8NdOr1pq.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-BILpiibq.js → ZapSquare-ChOMpHGM.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-B_lAoymB.js → ZoomOut-DYeUJTmS.js} +1 -1
  41. package/dist/client/assets/{access-gate-DpAJKNDg.js → access-gate-lRgnLhCg.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-08fudMVv.js → add-section-modal-CZwFVJh7.js} +1 -1
  43. package/dist/client/assets/{agent-icon-CS5ajDLh.js → agent-icon-B1KjkGhC.js} +1 -1
  44. package/dist/client/assets/{agents-list-DxGlqMqe.js → agents-list-BeGasDr4.js} +1 -1
  45. package/dist/client/assets/{ai-providers-B7vfwAb0.js → ai-providers-DhEaZvB4.js} +1 -1
  46. package/dist/client/assets/{alert-C5GST-R3.js → alert-DVl9GMhN.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-BzcSSmOH.js → alert-dialog-DvJDYQsM.js} +1 -1
  48. package/dist/client/assets/app-editor-Dd12zl9_.js +1 -0
  49. package/dist/client/assets/{auth-D8scdv8L.js → auth-DA6X7KBB.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-DH4AcuId.js → auth-catchall-BljhiRu2.js} +1 -1
  51. package/dist/client/assets/{auth-split-layout-5KVfL-AQ.js → auth-split-layout-DeC-35_z.js} +1 -1
  52. package/dist/client/assets/{automation-list-row-BBCpkdMa.js → automation-list-row-BIiojY8I.js} +1 -1
  53. package/dist/client/assets/{automation-runs-C_CK9GUW.js → automation-runs-CHVaaxN6.js} +1 -1
  54. package/dist/client/assets/{automations-B_7k54-x.js → automations-BZ212IOj.js} +1 -1
  55. package/dist/client/assets/{avatar-CCN_co-X.js → avatar-D7wKrjgH.js} +1 -1
  56. package/dist/client/assets/{badge-BPsAZTXm.js → badge-Rj4w6Y9D.js} +1 -1
  57. package/dist/client/assets/{block-document-DLpzkGGl.js → block-document-Dr1GbIJR.js} +1 -1
  58. package/dist/client/assets/{brand-context-bYYUkcDs.js → brand-context-BHLNO4fC.js} +1 -1
  59. package/dist/client/assets/{buckets-C4Z9fF_s.js → buckets-C3GJftau.js} +1 -1
  60. package/dist/client/assets/{calendar-BCaGHasm.js → calendar-BETEvsL1.js} +1 -1
  61. package/dist/client/assets/{capability-load-error-B0DXeXNJ.js → capability-load-error-Caduk_d2.js} +1 -1
  62. package/dist/client/assets/{card-BTSltukm.js → card-BtNxdFil.js} +1 -1
  63. package/dist/client/assets/category-editor-D8faJ1-Q.js +1 -0
  64. package/dist/client/assets/{chat-context-BsFLDszr.js → chat-context-B_U1gcun.js} +1 -1
  65. package/dist/client/assets/{checkbox-M3DdO4ws.js → checkbox-CzoSEbjC.js} +1 -1
  66. package/dist/client/assets/{cli-auth-success-6Lg0rHoz.js → cli-auth-success-BaHruqex.js} +1 -1
  67. package/dist/client/assets/{collection-detail-BJzSsRXi.js → collection-detail-Dlkc-Hxo.js} +1 -1
  68. package/dist/client/assets/{collection-display-button-C4uiztpf.js → collection-display-button-4X_RKgcc.js} +1 -1
  69. package/dist/client/assets/{collection-search-lIRYT3yV.js → collection-search-BSHmVsv0.js} +1 -1
  70. package/dist/client/assets/{collection-tabs-DjP3Ny2m.js → collection-tabs-CghGabs6.js} +1 -1
  71. package/dist/client/assets/{command-CrEXCPCP.js → command-CYqVDIDi.js} +1 -1
  72. package/dist/client/assets/{connect-desktop-dialog-CRKR2Xhc.js → connect-desktop-dialog-Cq5se3ri.js} +1 -1
  73. package/dist/client/assets/{connection-card-Ci8mCMyz.js → connection-card-CzT4sqi7.js} +1 -1
  74. package/dist/client/assets/{connection-detail-Cg5wteNS.js → connection-detail-BCjmmJh1.js} +1 -1
  75. package/dist/client/assets/{connection-form-helpers-Dl_gZPK3.js → connection-form-helpers-CuaSwKDp.js} +1 -1
  76. package/dist/client/assets/{connections-DSdlpl8m.js → connections-BEh7d4ax.js} +1 -1
  77. package/dist/client/assets/{context-menu-9HQTa5U2.js → context-menu-CtPFsuQw.js} +1 -1
  78. package/dist/client/assets/{decopilot-Cd6VUSpu.js → decopilot-Bw9nv9Fa.js} +1 -1
  79. package/dist/client/assets/{decopilot-sse-pool-BP59aBkW.js → decopilot-sse-pool-DdZSTixQ.js} +1 -1
  80. package/dist/client/assets/{dialog-DXahQA5F.js → dialog-BMBVdX8K.js} +1 -1
  81. package/dist/client/assets/{domain-settings-B2G69X9h.js → domain-settings-GHKCO0j2.js} +1 -1
  82. package/dist/client/assets/{drawer-BBC9hSU8.js → drawer-TLQRWcN-.js} +1 -1
  83. package/dist/client/assets/{dropdown-menu-6REDhV5o.js → dropdown-menu-gXn3xVef.js} +1 -1
  84. package/dist/client/assets/{empty-state-DXDAVywR.js → empty-state-SvMp_sYN.js} +1 -1
  85. package/dist/client/assets/{extract-connection-data-CyP5_ll7.js → extract-connection-data-BsbTS0uC.js} +1 -1
  86. package/dist/client/assets/{file-explorer-DvIndLZ2.js → file-explorer-C5eBRtME.js} +1 -1
  87. package/dist/client/assets/{file-type-icon-CD_RZ8rl.js → file-type-icon-DURyeK9L.js} +1 -1
  88. package/dist/client/assets/{files-C7AHzVIO.js → files-B43hGcq-.js} +1 -1
  89. package/dist/client/assets/{form-C9CSHpUw.js → form-CdGhzS_x.js} +1 -1
  90. package/dist/client/assets/{general-Do4Aw_UB.js → general-D01YsmbR.js} +1 -1
  91. package/dist/client/assets/{github-repo-picker-Duq8-HaY.js → github-repo-picker-Db3xiFzy.js} +1 -1
  92. package/dist/client/assets/{hooks-C1I2Fhg2.js → hooks-DlDryoZW.js} +1 -1
  93. package/dist/client/assets/{image-field-CRd85u-i.js → image-field-ZYWbFFqt.js} +1 -1
  94. package/dist/client/assets/{import-from-deco-dialog-B7gbIQKu.js → import-from-deco-dialog-wt_cQutp.js} +1 -1
  95. package/dist/client/assets/{index-CN18RaKp.js → index-B66xjk-i.js} +1 -1
  96. package/dist/client/assets/{index-UgUz8dNz.js → index-BW5f_EaT.js} +4 -4
  97. package/dist/client/assets/{index-CVsiyRJv.js → index-C35Pm7iN.js} +1 -1
  98. package/dist/client/assets/{index-D6izOmjj.js → index-COlSsy5J.js} +3 -3
  99. package/dist/client/assets/{index-BrlqF8mC.js → index-C_H1H79r.js} +1 -1
  100. package/dist/client/assets/{index-B62gT9En.js → index-CkC7ek4r.js} +1 -1
  101. package/dist/client/assets/{index-VDwoBUQS.js → index-CvuV8zWk.js} +1 -1
  102. package/dist/client/assets/{index-CDIbVALl.js → index-D0cczQd_.js} +1 -1
  103. package/dist/client/assets/{index-DQcT764V.js → index-D4WUCfu0.js} +1 -1
  104. package/dist/client/assets/{index-CZ67kZ1v.js → index-DEanDL8Y.js} +1 -1
  105. package/dist/client/assets/{index-Dyus5M1c.js → index-DWvgpCdb.js} +1 -1
  106. package/dist/client/assets/{index-uQZXfeqC.js → index-H-_VOpOu.js} +1 -1
  107. package/dist/client/assets/{index-CflKuA1L.js → index-dlN4JEF9.js} +1 -1
  108. package/dist/client/assets/{index-redirect-IkyQEw8C.js → index-redirect-CDQ9iDF3.js} +1 -1
  109. package/dist/client/assets/{index-a_lJlgHU.js → index-swPX_OFH.js} +1 -1
  110. package/dist/client/assets/{input-DP3XvpLN.js → input-CuVtlRv5.js} +1 -1
  111. package/dist/client/assets/{integration-icon-DZ46sqDL.js → integration-icon-RqT66_6U.js} +1 -1
  112. package/dist/client/assets/{label-CVIIqU26.js → label-BCRIEPd0.js} +1 -1
  113. package/dist/client/assets/{login-D9Jd5dPi.js → login-ByPZpD-o.js} +1 -1
  114. package/dist/client/assets/{mcp-oauth-MmhxfzLz.js → mcp-oauth-kSTvScdZ.js} +1 -1
  115. package/dist/client/assets/{members-DY9kX_sz.js → members-AD1fVrNE.js} +1 -1
  116. package/dist/client/assets/{monaco-editor-BqXgJc7f.js → monaco-editor-DNLiFjHn.js} +1 -1
  117. package/dist/client/assets/{monitoring-stats-row-BsB6GRCy.js → monitoring-stats-row-Bsctnbru.js} +1 -1
  118. package/dist/client/assets/{oauth-callback-PLImtAXE.js → oauth-callback-B6I9yHDk.js} +1 -1
  119. package/dist/client/assets/{oauth-callback-ai-provider-BH-Rswm0.js → oauth-callback-ai-provider-D0iCPw3h.js} +1 -1
  120. package/dist/client/assets/{onboarding-DqZTmtt-.js → onboarding-1ssRVacT.js} +1 -1
  121. package/dist/client/assets/{org-install-Bt9032_8.js → org-install-r5xxUZ8-.js} +1 -1
  122. package/dist/client/assets/{org-layout-BFcVcec6.js → org-layout-i53vnou1.js} +1 -1
  123. package/dist/client/assets/{page-seo-form-BYKfoIdi.js → page-seo-form-BRpnzyUP.js} +1 -1
  124. package/dist/client/assets/page-seo-sheet-C8gLGTPM.js +1 -0
  125. package/dist/client/assets/{popover-B5LJwz0j.js → popover-rRtv1RUJ.js} +1 -1
  126. package/dist/client/assets/{post-editor-DHf_pKD_.js → post-editor-B3yACnM8.js} +1 -1
  127. package/dist/client/assets/{preview-dialog-NbAEidmd.js → preview-dialog-HeEAXFdp.js} +1 -1
  128. package/dist/client/assets/{primitives-C9XYnbHN.js → primitives-DOHAd4Be.js} +1 -1
  129. package/dist/client/assets/{profile-BIh6zBqL.js → profile-DxKVe_bi.js} +1 -1
  130. package/dist/client/assets/project-app-view-C1SP7U91.js +1 -0
  131. package/dist/client/assets/record-editor-CmQTYxNi.js +1 -0
  132. package/dist/client/assets/registry-BLAsKSMe.js +2 -0
  133. package/dist/client/assets/{registry-layout-CpLwJOk1.js → registry-layout-Cqo7HGa-.js} +1 -1
  134. package/dist/client/assets/{require-capability-BCughBI7.js → require-capability-GPOwZTVN.js} +1 -1
  135. package/dist/client/assets/{required-auth-layout-Czm4wEhq.js → required-auth-layout-D9YU16Eu.js} +1 -1
  136. package/dist/client/assets/{reset-password-CZGPwq_U.js → reset-password-BvvmcRor.js} +1 -1
  137. package/dist/client/assets/{roles-1pSXErEv.js → roles-BG01ewdV.js} +1 -1
  138. package/dist/client/assets/save-referenced-block-qVgXMpcz.js +1 -0
  139. package/dist/client/assets/{save-status-BbqkL83O.js → save-status-2WDTqRnj.js} +1 -1
  140. package/dist/client/assets/{schema-form-B4m0eDMT.js → schema-form-hXy8-pLC.js} +1 -1
  141. package/dist/client/assets/{scroll-area-D-wTiagO.js → scroll-area-DOnfhZQE.js} +1 -1
  142. package/dist/client/assets/{search-input-BpXZI4wE.js → search-input-Dh2xeHiv.js} +1 -1
  143. package/dist/client/assets/{secrets-e1cmnWWE.js → secrets-x-a9-QDY.js} +1 -1
  144. package/dist/client/assets/{sections-editor-BPDMVhPi.js → sections-editor-DpVqLaiP.js} +1 -1
  145. package/dist/client/assets/{select-CjjjXRUS.js → select-Dqs7Z4yG.js} +1 -1
  146. package/dist/client/assets/{select-model-DuC4X2jB.js → select-model-bXVR8jvT.js} +1 -1
  147. package/dist/client/assets/{seo-editor-DIker3a9.js → seo-editor-d5x7SvAU.js} +1 -1
  148. package/dist/client/assets/{settings-layout-becrO5TI.js → settings-layout-CpPje1Xl.js} +1 -1
  149. package/dist/client/assets/{settings-section-Cj3AwHej.js → settings-section-BqnJtUWr.js} +1 -1
  150. package/dist/client/assets/{sheet-CGQ0l6o4.js → sheet-Cn8FwYbD.js} +1 -1
  151. package/dist/client/assets/{shell-controls-rLEkFMFT.js → shell-controls-nCD3gP3E.js} +1 -1
  152. package/dist/client/assets/{shell-layout-BuKC3YO-.js → shell-layout-Cx--9PV8.js} +1 -1
  153. package/dist/client/assets/{shell-route-loading-CvANTPJP.js → shell-route-loading-Brmd2_HQ.js} +1 -1
  154. package/dist/client/assets/{sidebar-Bf91anCU.js → sidebar-D1LCPjC8.js} +1 -1
  155. package/dist/client/assets/{skeleton-C_vWUNwW.js → skeleton-Bo_6Cq99.js} +1 -1
  156. package/dist/client/assets/{sortable.esm-BDQeT5mM.js → sortable.esm-yJWb24sN.js} +1 -1
  157. package/dist/client/assets/{sso-s9GwOpzF.js → sso-DhhZEU-d.js} +1 -1
  158. package/dist/client/assets/{store-Bpiz0D_I.js → store-COjaCE4s.js} +1 -1
  159. package/dist/client/assets/store-registry-nvoM6APm.js +2 -0
  160. package/dist/client/assets/{studio-tools-BBnH3MVd.js → studio-tools-CyTucPcW.js} +1 -1
  161. package/dist/client/assets/{switch-D5j5jKzb.js → switch-CorAlxCf.js} +1 -1
  162. package/dist/client/assets/{table-HxKELBdZ.js → table-Gv4tJy7V.js} +1 -1
  163. package/dist/client/assets/{tabs-DY3LqT6S.js → tabs-DAvIQWby.js} +1 -1
  164. package/dist/client/assets/{task-status-D5hR8PPt.js → task-status-BfeF--n0.js} +1 -1
  165. package/dist/client/assets/{textarea-DNK54KKl.js → textarea-DsT2vsGj.js} +1 -1
  166. package/dist/client/assets/{toggle-group-CYBCkLka.js → toggle-group-WKZVvwQm.js} +1 -1
  167. package/dist/client/assets/{toolbar-L8diPmJo.js → toolbar-BfY48AQu.js} +1 -1
  168. package/dist/client/assets/{tooltip-Bk2FCtKr.js → tooltip-D5U362dF.js} +1 -1
  169. package/dist/client/assets/{types-CR3zyk0T.js → types-C-QYkfD4.js} +1 -1
  170. package/dist/client/assets/{use-ai-providers-BuPYcyWU.js → use-ai-providers-CLZQ64DO.js} +1 -1
  171. package/dist/client/assets/{use-automations-3CJWtIS7.js → use-automations-DNKM1hXI.js} +1 -1
  172. package/dist/client/assets/{use-capability-C1x5gZYr.js → use-capability-XIhIuFk7.js} +1 -1
  173. package/dist/client/assets/{use-clock-tick-CpGRUyLX.js → use-clock-tick-DkwKhG1v.js} +1 -1
  174. package/dist/client/assets/{use-collections-CCMEiGqY.js → use-collections-D4JsVK-B.js} +1 -1
  175. package/dist/client/assets/{use-connection-rF7aVJWi.js → use-connection-C7Z8M26w.js} +1 -1
  176. package/dist/client/assets/{use-copy-B9rnfiig.js → use-copy-CqTP6NE5.js} +1 -1
  177. package/dist/client/assets/{use-create-virtual-mcp-BnWFpzrZ.js → use-create-virtual-mcp-fk0U59RA.js} +1 -1
  178. package/dist/client/assets/{use-debounced-autosave-BoaPkBFT.js → use-debounced-autosave-B8dr6XMC.js} +1 -1
  179. package/dist/client/assets/{use-deco-credits-DkHNnq8a.js → use-deco-credits-Cm6qycwc.js} +1 -1
  180. package/dist/client/assets/{use-delete-connection-DfIaQmJb.js → use-delete-connection-DTrOkfly.js} +1 -1
  181. package/dist/client/assets/{use-file-configs-e6Y2envv.js → use-file-configs-DKTLvOxt.js} +1 -1
  182. package/dist/client/assets/{use-infinite-scroll-MECqtkyO.js → use-infinite-scroll-SjuQvrxH.js} +1 -1
  183. package/dist/client/assets/{use-join-requests-BWwov4uy.js → use-join-requests-DmU4yvI-.js} +1 -1
  184. package/dist/client/assets/{use-mcp-client-vlTb1_vQ.js → use-mcp-client-CK2bE_Wl.js} +1 -1
  185. package/dist/client/assets/{use-mcp-prompts-CGFuFPsL.js → use-mcp-prompts--L5Py2oF.js} +1 -1
  186. package/dist/client/assets/{use-mcp-tools-Dl-9pwtN.js → use-mcp-tools-B7wduqbV.js} +1 -1
  187. package/dist/client/assets/{use-members-DZbTKLCa.js → use-members-CYuArAru.js} +1 -1
  188. package/dist/client/assets/{use-navigate-to-agent-CKBlqEnY.js → use-navigate-to-agent-C2rXzvAb.js} +1 -1
  189. package/dist/client/assets/{use-org-auth-client-D79Jyhhp.js → use-org-auth-client-BYQp-Udb.js} +1 -1
  190. package/dist/client/assets/{use-org-sso-CGb3XUqQ.js → use-org-sso-Dh5HCYSJ.js} +1 -1
  191. package/dist/client/assets/{use-organization-roles-CyuVLsgC.js → use-organization-roles-BR95hkZY.js} +1 -1
  192. package/dist/client/assets/{use-organization-settings-BBq2AfS3.js → use-organization-settings-CiSDOMOC.js} +1 -1
  193. package/dist/client/assets/{use-registry-connections-Qh4o2c-N.js → use-registry-connections-rHz6zGP7.js} +1 -1
  194. package/dist/client/assets/{use-secrets-C45eD7gN.js → use-secrets-DLuniCTL.js} +1 -1
  195. package/dist/client/assets/{use-status-sounds-CqqJRu1j.js → use-status-sounds-BmR3uEUx.js} +1 -1
  196. package/dist/client/assets/{use-view-mode-CY-JucZM.js → use-view-mode-CCFkxJ0W.js} +1 -1
  197. package/dist/client/assets/{use-virtual-mcp-D63srVIz.js → use-virtual-mcp-DPWDEWCb.js} +1 -1
  198. package/dist/client/assets/useInfiniteQuery-BS_m7Y7W.js +1 -0
  199. package/dist/client/assets/{useRouterState-Cy8ALVZD.js → useRouterState-q7ojL5Do.js} +1 -1
  200. package/dist/client/assets/useSuspenseInfiniteQuery-CHHT-uCm.js +1 -0
  201. package/dist/client/assets/{view-mode-toggle-DNC_S7KK.js → view-mode-toggle-CeXLSv0R.js} +1 -1
  202. package/dist/client/index.html +1 -1
  203. package/dist/server/cli.js +525 -521
  204. package/dist/server/migrate.js +113 -109
  205. package/dist/server/server.js +368 -368
  206. package/package.json +1 -1
  207. package/dist/client/assets/app-editor-hpV9V9bT.js +0 -1
  208. package/dist/client/assets/category-editor-DDTndAHq.js +0 -1
  209. package/dist/client/assets/page-seo-sheet-Bpi2JjCw.js +0 -1
  210. package/dist/client/assets/project-app-view-Doem9rkZ.js +0 -1
  211. package/dist/client/assets/record-editor-C4dB5nQE.js +0 -1
  212. package/dist/client/assets/registry-Cbr661Wc.js +0 -2
  213. package/dist/client/assets/save-referenced-block-DcQjO7ah.js +0 -1
  214. package/dist/client/assets/store-registry-B0DZBOpl.js +0 -2
  215. package/dist/client/assets/useInfiniteQuery-Dtdh4OJ7.js +0 -1
  216. package/dist/client/assets/useSuspenseInfiniteQuery-DcCILGRB.js +0 -1
@@ -1 +1 @@
1
- import{r as te,c as Se,j as s,e as X,B as Re,n as Ae,m as Pt,K as Mt}from"./index-D6izOmjj.js";import{am as Ut,an as Vt,ao as Kt,ap as Ht,aq as Wt,ar as qt,ac as Yt,D as Gt,as as et,N as tt}from"./agent-icon-CS5ajDLh.js";import{C as Qt}from"./calendar-BCaGHasm.js";import{I as xe}from"./input-DP3XvpLN.js";import{L as me}from"./label-CVIIqU26.js";import{a as gt,b as xt,P as vt}from"./popover-B5LJwz0j.js";import{T as Xt}from"./textarea-DNK54KKl.js";import{b as Zt}from"./XCircle-DheND3p1.js";import{d as Jt}from"./SwitchHorizontal01-BVb8cFOW.js";import{v as en,y as tn,z as nn}from"./scroll-area-D-wTiagO.js";import{S as rn}from"./switch-D5j5jKzb.js";import{a as bt,b as jt,c as Nt,S as St,d as kt}from"./select-CjjjXRUS.js";import{u as sn,a as nt,K as on,P as ln,D as an,c as cn,S as un,v as fn,e as dn,d as rt,b as pn,C as mn,s as hn}from"./sortable.esm-BDQeT5mM.js";import{c as Tt}from"./ZoomOut-B_lAoymB.js";import{s as yn}from"./Plus-Cl80ngk-.js";import{s as Ct}from"./Trash01-B4p5GuSp.js";import{a as gn,b as xn,c as vn,D as bn}from"./dropdown-menu-6REDhV5o.js";import{i as Oe,_ as Pe,$ as st,o as We,l as qe,a0 as wt,a1 as jn,a2 as Me,a3 as Ee,a4 as Nn,q as it,a5 as Sn,a6 as kn}from"./index-UgUz8dNz.js";import{e as At,u as Tn,m as Cn,L as wn,F as An,I as ot}from"./image-field-CRd85u-i.js";import{t as _t}from"./ChevronDown-DAwDO8g3.js";import{i as It}from"./ChevronRight-CxzKR4UY.js";import{i as _n}from"./Globe01-rz2h7Ebm.js";import{T as In,b as Rn,a as On}from"./tooltip-Bk2FCtKr.js";import{i as $n}from"./ChevronUp-Bu9JV4C-.js";import{d as Fn}from"./Tool01-DpllcZ_x.js";import{b as Ln,C as Dn,a as Bn,e as En,c as zn,d as Pn}from"./command-CrEXCPCP.js";import{i as Mn}from"./Upload01--GcqA8-Q.js";import{c as Un}from"./use-file-configs-e6Y2envv.js";function Ye(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Oe(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function Vn(t){return t.includes("flags/multivariate")}function Kn(t){return qe(t)}function Hn(t,e){const n=[...t],r=new Set(n.map(l=>l.resolveType)),i=(l,o)=>{!l||r.has(l)||(r.add(l),n.push({resolveType:l,title:o??Kn(l)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const l=Ye(e.editorValue);l?.includes("/")&&i(l)}return n}function Wn(t,e,n){const r=e[0]?.resolveType??"";if(n)return n;if(!t||typeof t!="object"||Array.isArray(t))return r;const i=t,l=i.__resolveType;if(typeof l=="string"){if(Pe(l)){const f=e.find(y=>y.resolveType===l);return f?f.resolveType:l}const u=e.find(f=>st(f.resolveType,l));if(u)return u.resolveType;const m=e.find(f=>f.resolveType===l);if(m)return m.resolveType;if(l.includes("/"))return l}const o=typeof i.type=="string"?i.type:void 0;if(o){const u=e.find(m=>m.discriminatorValue===o||m.resolveType===o||st(m.resolveType,o));if(u)return u.resolveType}let a=r,c=-1;for(const u of e){if(!u.schema?.properties)continue;const f=Object.keys(u.schema.properties).filter(y=>!y.startsWith("__")&&y!=="@type"&&y!=="action"&&y!=="alt").filter(y=>i[y]!==void 0).length;f>0&&f>c&&(c=f,a=u.resolveType)}return c>0,a}function lt(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return n??null;const r=Ye(t);if(!r)return n??null;if(!e)return r.includes("/")?null:n??null;const i=We(r,e);return i||(r.includes("/")?null:n??null)}function qn(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const n={...t.properties};return delete n[e],{...t,properties:n}}function Rt(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Oe(e.__resolveType))return null;const n=e.section;return!n||typeof n!="object"||Array.isArray(n)?null:n}function Yn(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=Ye(n);return r&&Vn(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(i=>!i.startsWith("__")&&i!=="@type")}function Gn(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function Qn(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=e.find(i=>typeof i.value=="string");if(r)return r.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function Ot(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ot);const e=t;return e.__resolveType?Qn(e)??t:$t(e)}function $t(t){const e={};for(const[n,r]of Object.entries(t))e[n]=Ot(r);return e}function Xn(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function Ft(t){return t==null?"":Array.isArray(t)?t.map(Ft).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Ge(t,e){if(!t.includes("{"))return;const n=$t(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,l,o)=>{const a=(l??o??"").trim();return Ft(Xn(n,a))}).trim()||void 0}function Zn(t){return t.replace(/<[^>]*>/g,"").trim()}function Jn(t,e){if(e.includes("{"))return Ge(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const r=n.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(r)return r}}function je(t,e,n){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;const i=Rt(r);if(i&&(r=i),n?.titleBy){const o=Jn(r,n.titleBy);if(o)return o}for(const o of["name","label","title","alt","text","href","id","key"]){const a=r[o];if(typeof a=="string"&&a.trim()){const c=n?.properties?.[o]?.format;if(c==="rich-text"||c==="html"){const u=Zn(a);if(u)return u;continue}return a}if(Array.isArray(a)){const c=a.map(u=>u==null?"":String(u)).filter(Boolean).join(",");if(c)return c}}const l=r.__resolveType;if(typeof l=="string"&&l)return qe(l);if(n?.title){const o=Ge(n.title,r);if(o)return o;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function er(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const n=e.properties;return n?.mobile?"{{{image.mobile}}}":n?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function at(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=er(e);if(!n)return;const r=Ge(n,t);if(!r)return;const i=At(r)||r;return Gn(i)}function Lt(t){return t===wt||t===jn}function Ue(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function ze(t,e){const n=t.__resolveType??"";if(!n)return null;if(Oe(n)){const r=t.section??{};return Dt(r,e)}if(Lt(n)){const r=t.variants?.[0]?.value;return r?ze(r,e):null}return!Pe(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ue(n,e)}function Dt(t,e){const n=t.__resolveType??"";if(!n)return null;if(Lt(n)){const r=t.variants?.[0]?.value;return r?ze(r,e):null}return!Pe(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ue(n,e)}function tr(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!Pe(r)||!Object.hasOwn(e,r))return null;const i=Ue(r,e);return i?{blockKey:r,...i}:null}function Fs(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Ue(r,n)}if(e.isHidden){const l=(Oe(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return ze(l,n)}if(e.isLazy||Oe(t.__resolveType)){const r=t.section??{};return Dt(r,n)}return ze(t,n)}const nr=new Set(["http:","https:","mailto:","tel:","ftp:"]);function rr(t){if(t.startsWith("/")||t.startsWith(".")||t.startsWith("#"))return!0;try{const e=new URL(t,"https://placeholder.invalid");return nr.has(e.protocol)}catch{return!1}}function ge(t){const e=X.c(8),{active:n,label:r,onClick:i,children:l}=t,o=n?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let a;e[0]!==o?(a=Se("flex h-7 w-7 items-center justify-center rounded transition-colors cursor-pointer",o),e[0]=o,e[1]=a):a=e[1];let c;return e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==i||e[6]!==a?(c=s.jsx("button",{type:"button","aria-label":r,"aria-pressed":n,onMouseDown:sr,onClick:i,className:a,children:l}),e[2]=n,e[3]=l,e[4]=r,e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function sr(t){return t.preventDefault()}function ir({schema:t,value:e,onChange:n,path:r,label:i}){const l=typeof e=="string"?e:"",o=te.useRef(n);o.current=n;const a=en({extensions:[tn.configure({heading:{levels:[1,2,3]}})],content:l||"",editorProps:{attributes:{class:Se("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:c})=>{const u=c.getHTML();o.current(u==="<p></p>"?"":u)}});return a?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(me,{htmlFor:r,children:i}),t.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:t.description})]}),s.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[s.jsx(ge,{active:a.isActive("bold"),label:"Bold",onClick:()=>a.chain().focus().toggleBold().run(),children:s.jsx(Ut,{size:14})}),s.jsx(ge,{active:a.isActive("italic"),label:"Italic",onClick:()=>a.chain().focus().toggleItalic().run(),children:s.jsx(Vt,{size:14})}),s.jsx(ge,{active:a.isActive("underline"),label:"Underline",onClick:()=>a.chain().focus().toggleUnderline().run(),children:s.jsx(Kt,{size:14})}),s.jsx(ge,{active:a.isActive("strike"),label:"Strikethrough",onClick:()=>a.chain().focus().toggleStrike().run(),children:s.jsx(Ht,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("heading",{level:1}),label:"Heading 1",onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),children:s.jsx(Wt,{size:14})}),s.jsx(ge,{active:a.isActive("heading",{level:2}),label:"Heading 2",onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),children:s.jsx(qt,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("bulletList"),label:"Bullet list",onClick:()=>a.chain().focus().toggleBulletList().run(),children:s.jsx(Jt,{size:14})}),s.jsx(ge,{active:a.isActive("orderedList"),label:"Ordered list",onClick:()=>a.chain().focus().toggleOrderedList().run(),children:s.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("link"),label:"Link",onClick:()=>{const c=a.getAttributes("link").href,u=window.prompt("Link URL",c??"https://");u!==null&&(u===""?a.chain().focus().unsetLink().run():rr(u)&&a.chain().focus().setLink({href:u}).run())},children:s.jsx(Zt,{size:14})})]}),s.jsx(nn,{editor:a})]})]}):null}const Ce=t=>String(t).padStart(2,"0"),or="1900-01-01",lr="2099-12-31",ar="1900-01-01T00:00",cr="2099-12-31T23:59";function ur(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const n=new Date(t);return Number.isNaN(n.getTime())?"":`${n.getUTCFullYear()}-${Ce(n.getUTCMonth()+1)}-${Ce(n.getUTCDate())}`}function fr(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function dr(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Ce(e.getMonth()+1)}-${Ce(e.getDate())}T${Ce(e.getHours())}:${Ce(e.getMinutes())}`}function pr(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function mr(t){const e=X.c(29),{id:n,withTime:r,value:i,onChange:l}=t,[o,a]=te.useState(!1);let c;e[0]!==i||e[1]!==r?(c=r?dr(i):ur(i),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;let m;e[3]!==l||e[4]!==r?(m=w=>{l(r?pr(w.target.value):fr(w.target.value))},e[3]=l,e[4]=r,e[5]=m):m=e[5];const f=m;let y;if(e[6]!==i){const w=i?new Date(i):null;y=w&&!Number.isNaN(w.getTime())?w:null,e[6]=i,e[7]=y}else y=e[7];const g=y;let b;e[8]!==l||e[9]!==g||e[10]!==r?(b=w=>{w&&(r&&g?w.setHours(g.getHours(),g.getMinutes(),0,0):w.setHours(0,0,0,0),l(w.toISOString()),a(!1))},e[8]=l,e[9]=g,e[10]=r,e[11]=b):b=e[11];const p=b,v=r?"datetime-local":"date",h=r?ar:or,d=r?cr:lr;let x;e[12]!==f||e[13]!==n||e[14]!==u||e[15]!==v||e[16]!==h||e[17]!==d?(x=s.jsx(xe,{id:n,type:v,min:h,max:d,value:u,onChange:f,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=f,e[13]=n,e[14]=u,e[15]=v,e[16]=h,e[17]=d,e[18]=x):x=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(gt,{asChild:!0,children:s.jsx(Re,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:s.jsx(Yt,{className:"h-4 w-4"})})}),e[19]=k):k=e[19];const S=g??void 0;let T;e[20]!==p||e[21]!==S?(T=s.jsx(xt,{className:"w-auto p-0",align:"end",children:s.jsx(Qt,{mode:"single",selected:S,onSelect:p,initialFocus:!0})}),e[20]=p,e[21]=S,e[22]=T):T=e[22];let N;e[23]!==o||e[24]!==T?(N=s.jsxs(vt,{open:o,onOpenChange:a,children:[k,T]}),e[23]=o,e[24]=T,e[25]=N):N=e[25];let C;return e[26]!==N||e[27]!==x?(C=s.jsxs("div",{className:"flex gap-1",children:[x,N]}),e[26]=N,e[27]=x,e[28]=C):C=e[28],C}function Fe(t){const e=X.c(8),{htmlFor:n,label:r,description:i}=t;let l;e[0]!==n||e[1]!==r?(l=s.jsx(me,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=l):l=e[2];let o;e[3]!==i?(o=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs("div",{className:"space-y-0.5",children:[l,o]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function Le(t){const e=X.c(67),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=typeof r=="string"?r:"",c=n.format;if(c==="rich-text"||c==="rich-text-inline"||c==="html"){let p;return e[0]!==o||e[1]!==i||e[2]!==l||e[3]!==n||e[4]!==r?(p=s.jsx(ir,{schema:n,value:r,onChange:i,path:l,label:o}),e[0]=o,e[1]=i,e[2]=l,e[3]=n,e[4]=r,e[5]=p):p=e[5],p}if(c==="textarea"||c==="markdown"){let p;e[6]!==o||e[7]!==l||e[8]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[6]=o,e[7]=l,e[8]=n.description,e[9]=p):p=e[9];let v;e[10]!==i?(v=x=>i(x.target.value),e[10]=i,e[11]=v):v=e[11];let h;e[12]!==l||e[13]!==a||e[14]!==v?(h=s.jsx(Xt,{id:l,value:a,onChange:v,rows:4}),e[12]=l,e[13]=a,e[14]=v,e[15]=h):h=e[15];let d;return e[16]!==p||e[17]!==h?(d=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[16]=p,e[17]=h,e[18]=d):d=e[18],d}if(c==="date"||c==="date-time"){let p;e[19]!==o||e[20]!==l||e[21]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[19]=o,e[20]=l,e[21]=n.description,e[22]=p):p=e[22];const v=c==="date-time";let h;e[23]!==i||e[24]!==l||e[25]!==a||e[26]!==v?(h=s.jsx(mr,{id:l,withTime:v,value:a,onChange:i}),e[23]=i,e[24]=l,e[25]=a,e[26]=v,e[27]=h):h=e[27];let d;return e[28]!==p||e[29]!==h?(d=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[28]=p,e[29]=h,e[30]=d):d=e[30],d}if(c==="color-input"){let p;e[31]!==o||e[32]!==l||e[33]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[31]=o,e[32]=l,e[33]=n.description,e[34]=p):p=e[34];const v=a||"#000000";let h;e[35]!==i?(h=N=>i(N.target.value),e[35]=i,e[36]=h):h=e[36];let d;e[37]!==v||e[38]!==h?(d=s.jsx("input",{type:"color",value:v,onChange:h,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[37]=v,e[38]=h,e[39]=d):d=e[39];let x;e[40]!==i?(x=N=>i(N.target.value),e[40]=i,e[41]=x):x=e[41];let k;e[42]!==l||e[43]!==a||e[44]!==x?(k=s.jsx(xe,{id:l,value:a,onChange:x,placeholder:"#000000",className:"h-10 flex-1"}),e[42]=l,e[43]=a,e[44]=x,e[45]=k):k=e[45];let S;e[46]!==d||e[47]!==k?(S=s.jsxs("div",{className:"flex items-center gap-2",children:[d,k]}),e[46]=d,e[47]=k,e[48]=S):S=e[48];let T;return e[49]!==p||e[50]!==S?(T=s.jsxs("div",{className:"space-y-2",children:[p,S]}),e[49]=p,e[50]=S,e[51]=T):T=e[51],T}let u;e[52]!==o||e[53]!==l||e[54]!==n.description?(u=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[52]=o,e[53]=l,e[54]=n.description,e[55]=u):u=e[55];const m=c==="url"?"url":"text";let f;e[56]!==i?(f=p=>i(p.target.value),e[56]=i,e[57]=f):f=e[57];const y=n.default!=null?String(n.default):void 0;let g;e[58]!==l||e[59]!==a||e[60]!==m||e[61]!==f||e[62]!==y?(g=s.jsx(xe,{id:l,type:m,value:a,onChange:f,placeholder:y,className:"h-10"}),e[58]=l,e[59]=a,e[60]=m,e[61]=f,e[62]=y,e[63]=g):g=e[63];let b;return e[64]!==u||e[65]!==g?(b=s.jsxs("div",{className:"space-y-2",children:[u,g]}),e[64]=u,e[65]=g,e[66]=b):b=e[66],b}function hr(t){const e=X.c(17),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=typeof r=="number"?r:"";let c;e[0]!==o||e[1]!==l?(c=s.jsx(me,{htmlFor:l,children:o}),e[0]=o,e[1]=l,e[2]=c):c=e[2];let u;e[3]!==n.description?(u=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=u):u=e[4];let m;e[5]!==c||e[6]!==u?(m=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=m):m=e[7];let f;e[8]!==i?(f=b=>{const p=b.target.value;i(p===""?void 0:Number(p))},e[8]=i,e[9]=f):f=e[9];let y;e[10]!==a||e[11]!==l||e[12]!==f?(y=s.jsx(xe,{id:l,type:"number",value:a,onChange:f,className:"h-10"}),e[10]=a,e[11]=l,e[12]=f,e[13]=y):y=e[13];let g;return e[14]!==m||e[15]!==y?(g=s.jsxs("div",{className:"space-y-2",children:[m,y]}),e[14]=m,e[15]=y,e[16]=g):g=e[16],g}function yr(t){const e=X.c(17),{value:n,onChange:r,path:i,label:l,schema:o}=t,a=typeof n=="boolean"?n:!1;let c;e[0]!==l||e[1]!==i?(c=s.jsx(me,{htmlFor:i,children:l}),e[0]=l,e[1]=i,e[2]=c):c=e[2];let u;e[3]!==o.description?(u=o.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:o.description}),e[3]=o.description,e[4]=u):u=e[4];let m;e[5]!==c||e[6]!==u?(m=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=m):m=e[7];let f;e[8]!==r?(f=b=>r(b),e[8]=r,e[9]=f):f=e[9];let y;e[10]!==a||e[11]!==i||e[12]!==f?(y=s.jsx(rn,{id:i,checked:a,onCheckedChange:f}),e[10]=a,e[11]=i,e[12]=f,e[13]=y):y=e[13];let g;return e[14]!==m||e[15]!==y?(g=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m,y]}),e[14]=m,e[15]=y,e[16]=g):g=e[16],g}const Qe="__enum_empty__";function Xe(t){return t===""?Qe:String(t)}function gr(t,e){if(t===Qe)return"";const n=e.find(r=>Xe(r)===t);return n!==void 0?n:t}function xr(t,e){return t==null?e.some(n=>n==="")?Qe:void 0:Xe(t)}function vr(t){return t===""?"":String(t)}function br(t){const e=X.c(28),{schema:n,value:r,onChange:i,path:l,label:o}=t;let a;e[0]!==n.enum?(a=n.enum??[],e[0]=n.enum,e[1]=a):a=e[1];const c=a;let u;e[2]!==c||e[3]!==r?(u=xr(r,c),e[2]=c,e[3]=r,e[4]=u):u=e[4];const m=u;let f;e[5]!==o||e[6]!==l?(f=s.jsx(me,{htmlFor:l,children:o}),e[5]=o,e[6]=l,e[7]=f):f=e[7];let y;e[8]!==n.description?(y=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=y):y=e[9];let g;e[10]!==f||e[11]!==y?(g=s.jsxs("div",{className:"space-y-0.5",children:[f,y]}),e[10]=f,e[11]=y,e[12]=g):g=e[12];let b;e[13]!==i||e[14]!==c?(b=k=>i(gr(k,c)),e[13]=i,e[14]=c,e[15]=b):b=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(jt,{className:"h-10",children:s.jsx(Nt,{placeholder:"Select..."})}),e[16]=p):p=e[16];let v;e[17]!==c?(v=c.map(jr),e[17]=c,e[18]=v):v=e[18];let h;e[19]!==v?(h=s.jsx(St,{children:v}),e[19]=v,e[20]=h):h=e[20];let d;e[21]!==m||e[22]!==b||e[23]!==h?(d=s.jsxs(kt,{value:m,onValueChange:b,children:[p,h]}),e[21]=m,e[22]=b,e[23]=h,e[24]=d):d=e[24];let x;return e[25]!==d||e[26]!==g?(x=s.jsxs("div",{className:"space-y-2",children:[g,d]}),e[25]=d,e[26]=g,e[27]=x):x=e[27],x}function jr(t){const e=Xe(t);return s.jsx(bt,{value:e,children:vr(t)},e)}function Bt(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ne(t){return t.normalize("NFC").trim()}function ee(t,e){return Ne(t)===Ne(e)}function ct(t,e){return Ne(t).replace(/\s+/g,"").toLowerCase()===Ne(e).replace(/\s+/g,"").toLowerCase()}function De(t,e,n){const r=Ne(n);if(t.some(o=>ee(o,r)||ee(o,n)))return t;const i=[...t];return i.some(o=>ee(o,e))||i.push(e),i.push(n),i}function Nr(t,e,n){if(n.length===0)return n;const r=_e(t,e),i=n[0];return ee(i,r)||ee(i,t)?n.slice(1):n}function _e(t,e){return e.title??Bt(t)}function Ls(t,e){return e<=0?[]:t.slice(0,e)}function Ve(t,e){const n=Ne(e);return t.findIndex(r=>Ne(r)===n)}function ut(t,e){return t.type==="array"&&t.items||Me(t)?!0:Array.isArray(e)}function Sr(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function $e(t,e,n,r){if(r.length===0)return null;const i=r[0];for(const o of t){const a=e[o];if(!a||!ut(a,n[o]))continue;const c=_e(o,a);if(ee(i,c)||ee(i,o)||r.some(u=>ee(u,c)||ee(u,o)))return o}for(const o of t){const a=e[o];if(!a||!ut(a,n[o]))continue;const c=n[o];if(!Array.isArray(c))continue;const u=a.items;for(let m=0;m<c.length;m++){const f=je(c[m],m,u);if(ee(f,i))return o}}for(const o of t){const a=e[o];if(a?.type!=="object"||!a.properties)continue;const c=Object.keys(a.properties),u=Sr(n[o]),m=_e(o,a);if($e(c,a.properties,u,r)||(ee(i,m)||ee(i,o))&&$e(c,a.properties,u,r.slice(1)))return o}let l=null;for(const o of t){const a=e[o];if(a?.type!=="block-ref")continue;const c=_e(o,a);if(!(i!==c&&i!==o)){if(r.length>1){const u=n[o];if(u&&typeof u=="object"&&!Array.isArray(u)){const m=r[1];if(Object.keys(u).some(y=>!y.startsWith("__")&&(ct(Bt(y),m)||ct(y,m))))return o}}l||(l=o)}}return l||null}function kr(t,e,n,r){return $e(t,e,n,r)}function Tr(t,e,n,r,i){if(i.length===0||!n.properties)return!1;const l=Object.keys(n.properties);if($e(l,n.properties,r,i))return!0;const o=i[0];return!ee(o,e)&&!ee(o,t)?!1:i.length>1||$e(l,n.properties,r,i.slice(1))!==null}function Cr(t,e,n,r){if(e.length===0)return null;for(let l=0;l<e.length;l++){const o=e[l],a=n.findIndex((c,u)=>ee(je(c,u,r),o));if(a>=0)return{index:a,innerPath:e.slice(l+1)}}const i=e.findIndex(l=>ee(l,t));if(i>=0&&e.length>i+1){const l=e[i+1],o=n.findIndex((a,c)=>ee(je(a,c,r),l));if(o>=0)return{index:o,innerPath:e.slice(i+2)}}return null}function Ke(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===wt}function wr(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Ke(n.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Ke(n.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(n=>Ke(n.resolveType)):!1}function Ar(t,e){if(e==="global"||e==="sections"||Me(t))return!0;const n=t.type==="array"?t.items:void 0;return n?wr(n):!1}function ft(t){return Array.from({length:t},(e,n)=>({id:crypto.randomUUID(),index:n}))}function _r(t,e,n,r,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const l=t.__resolveType;if(typeof l=="string"&&n){const o=We(l,n);if(o?.properties&&Object.keys(o.properties).length>0)return o}}if(n&&r&&i){const o=We(r,n)?.properties?.[i]?.items;if(o?.properties&&Object.keys(o.properties).length>0)return{...o,titleBy:o.titleBy??e?.titleBy}}return e}function Ir(t){const e=t.split(".").filter(n=>!/^\d+$/.test(n));return e[e.length-1]??t}function Et(t){return t.map((e,n)=>({...e,index:n}))}function Rr(t,e){if(e===t.length)return t;if(e<t.length)return Et(t.slice(0,e));const n=Array.from({length:e-t.length},(r,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...n]}function Or(t){const e=X.c(8),{labelText:n,imageSrc:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Tt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let l;e[1]!==r?(l=r&&s.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=r,e[2]=l):l=e[2];let o;e[3]!==n?(o=s.jsx("span",{className:"min-w-0 truncate",children:n}),e[3]=n,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs(s.Fragment,{children:[i,s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[l,o]})]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function $r(t){const e=X.c(37),{sortableId:n,labelText:r,imageSrc:i,onOpen:l,onRemove:o}=t;let a;e[0]!==n?(a={id:n,animateLayoutChanges:Dr},e[0]=n,e[1]=a):a=e[1];const{attributes:c,listeners:u,setNodeRef:m,transform:f,isDragging:y}=pn(a);let g;e[2]!==f?(g=mn.Transform.toString(f?{...f,x:0}:null),e[2]=f,e[3]=g):g=e[3];const b=y?0:void 0;let p;e[4]!==g||e[5]!==b?(p={transform:g,opacity:b},e[4]=g,e[5]=b,e[6]=p):p=e[6];const v=p;let h;e[7]!==l?(h=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),l())},e[7]=l,e[8]=h):h=e[8];const d=y?"cursor-grabbing":"cursor-pointer";let x;e[9]!==d?(x=Se("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",d),e[9]=d,e[10]=x):x=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Tt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let S;e[12]!==i?(S=i&&s.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=S):S=e[13];let T;e[14]!==r?(T=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:r}),e[14]=r,e[15]=T):T=e[15];const N=`Open actions for ${r}`;let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(Gt,{size:14}),e[16]=C):C=e[16];let w;e[17]!==N?(w=s.jsx(gn,{asChild:!0,children:s.jsx(Re,{type:"button",variant:"ghost",size:"icon","aria-label":N,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:Lr,onPointerDown:Fr,children:C})}),e[17]=N,e[18]=w):w=e[18];let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Ct,{size:14}),e[19]=_):_=e[19];let j;e[20]!==o?(j=s.jsx(xn,{align:"end",children:s.jsxs(vn,{className:"text-destructive focus:text-destructive",onClick:o,children:[_,"Delete"]})}),e[20]=o,e[21]=j):j=e[21];let I;e[22]!==w||e[23]!==j?(I=s.jsxs(bn,{children:[w,j]}),e[22]=w,e[23]=j,e[24]=I):I=e[24];let R;return e[25]!==c||e[26]!==r||e[27]!==u||e[28]!==l||e[29]!==m||e[30]!==v||e[31]!==T||e[32]!==I||e[33]!==h||e[34]!==x||e[35]!==S?(R=s.jsxs("div",{ref:m,style:v,...c,...u,role:"button",tabIndex:0,onClick:l,onKeyDown:h,className:x,title:r,children:[k,S,T,I]}),e[25]=c,e[26]=r,e[27]=u,e[28]=l,e[29]=m,e[30]=v,e[31]=T,e[32]=I,e[33]=h,e[34]=x,e[35]=S,e[36]=R):R=e[36],R}function Fr(t){return t.stopPropagation()}function Lr(t){return t.stopPropagation()}function Dr(){return!1}function Be(t){const e=X.c(24),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,containerResolveType:y,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}=t,h=a===void 0?[]:a,d=Array.isArray(r)?r:[],x=n.items,k=Ir(l),S=Ar(n,k),T=Cr(o,h,d,x),N=T?.index??null,[C,w]=te.useState(()=>ft(d.length)),[_,j]=te.useState(null),[I,R]=te.useState(l),[B,P]=te.useState(d.length),M=te.useRef(!1);I!==l?(R(l),P(d.length),w(ft(d.length))):B!==d.length&&(P(d.length),w(A=>Rr(A,d.length)));let E;e[0]!==x?(E=(A,D)=>je(A,D,x),e[0]=x,e[1]=E):E=e[1];const O=E,ne=A=>{if(M.current)return;const D=O(d[A],A);c?.(De(h,o,D))},re=A=>{const D=[...d,A];i(D);const Q=D.length-1,H=je(A,Q,x);c?.(De(h,o,H))},Z=()=>{const A=x?.type,D=x?.default!==void 0?x.default:A==="object"?{}:A==="block-ref"?(()=>{const pe=x?.anyOfRefs?.[0]?.resolveType;return typeof pe!="string"||Ee(pe)?{}:{__resolveType:pe}})():A==="number"||A==="integer"?0:A==="boolean"?!1:A==="array"?[]:"",Q=[...d,D];i(Q);const H=Q.length-1,de=je(D,H,x);c?.(De(h,o,de))},U=()=>{if(S){if(!g){Ae.error("Start the preview dev server to add sections.");return}if(p){p({append:re});return}Ae.error("Section picker is not available in this editor.");return}Z()},W=A=>{if(i(d.filter((D,Q)=>Q!==A)),N===A){const D=O(d[A],A),Q=Ve(h,D);c?.(Q>=0?h.slice(0,Q):[])}},Y=(A,D)=>{const Q=[...d];if(Q[A]=D,i(Q),A===N&&N!==null){const H=O(d[A],A),de=je(D,A,x);if(H!==de){const pe=Ve(h,H);if(pe>=0){const Je=[...h];Je[pe]=de,c?.(Je)}}}};let $;e[2]===Symbol.for("react.memo_cache_sentinel")?($={activationConstraint:{distance:8}},e[2]=$):$=e[2];let V;e[3]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:hn},e[3]=V):V=e[3];const se=sn(nt(ln,$),nt(on,V)),F=C.map(Br);let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A=>{j(String(A.active.id))},e[4]=L):L=e[4];const G=L,le=A=>{j(null);const{active:D,over:Q}=A;if(!Q||D.id===Q.id)return;const H=F.indexOf(String(D.id)),de=F.indexOf(String(Q.id));H===-1||de===-1||(w(pe=>Et(rt([...pe],H,de))),i(rt([...d],H,de)),M.current=!0,requestAnimationFrame(()=>{M.current=!1}))};let J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=()=>{j(null)},e[5]=J):J=e[5];const he=J,ce=_?C.find(A=>A.id===_):null,ie=ce!=null?d[ce.index]:void 0,ye=ce!=null&&ie!==void 0?O(ie,ce.index):null,ae=ce!=null&&ie!==void 0?at(ie,x):void 0;if(N!==null&&N<d.length){const A=d[N],D=_r(A,x,u,y,k),Q=()=>{const H=O(A,N),de=De(h,o,H),pe=Ve(de,H);return pe>=0?de.slice(0,pe+1):de};return s.jsx("div",{className:"min-w-0",children:D?.type==="object"&&D.properties?s.jsx(Ze,{schema:D,value:A,onChange:H=>Y(N,H),basePath:`${l}.${N}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:H=>{c?.([...Q(),...H])},meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}):D?zt({schema:D,value:A,onChange:H=>Y(N,H),path:`${l}.${N}`,label:D.title??`Item ${N+1}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:H=>{c?.([...Q(),...H])},meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}):null})}const K="space-y-2";let q;e[6]!==o?(q=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[6]=o,e[7]=q):q=e[7];const z=d.length>0&&s.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:d.length});let oe;e[8]!==q||e[9]!==z?(oe=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[q,z]}),e[8]=q,e[9]=z,e[10]=oe):oe=e[10];let ue;e[11]!==n.description?(ue=n.description&&s.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=ue):ue=e[12];let ve;e[13]!==oe||e[14]!==ue?(ve=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[oe,ue]}),e[13]=oe,e[14]=ue,e[15]=ve):ve=e[15];const we=d.length>0&&s.jsx("div",{className:Se(_&&"cursor-grabbing"),children:s.jsxs(an,{sensors:se,collisionDetection:cn,onDragStart:G,onDragEnd:le,onDragCancel:he,children:[s.jsx(un,{items:F,strategy:fn,children:s.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:C.map(A=>{const D=d[A.index];if(D===void 0)return null;const Q=O(D,A.index),H=at(D,x);return s.jsx($r,{sortableId:A.id,labelText:Q,imageSrc:H,onOpen:()=>ne(A.index),onRemove:()=>W(A.index)},A.id)})})}),s.jsx(dn,{dropAnimation:null,children:ye?s.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:s.jsx(Or,{labelText:ye,imageSrc:ae})}):null})]})});let ke;e[16]===Symbol.for("react.memo_cache_sentinel")?(ke=s.jsx(yn,{size:14}),e[16]=ke):ke=e[16];const be=S?"Add section":"Add item";let fe;e[17]!==U||e[18]!==be?(fe=s.jsxs("button",{type:"button",onClick:U,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[ke,be]}),e[17]=U,e[18]=be,e[19]=fe):fe=e[19];let Te;return e[20]!==ve||e[21]!==we||e[22]!==fe?(Te=s.jsxs("div",{className:K,children:[ve,we,fe]}),e[20]=ve,e[21]=we,e[22]=fe,e[23]=Te):Te=e[23],Te}function Br(t){return t.id}function Er(t){const e=X.c(44),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:y,onAddSectionItem:g,onRequestAddSection:b,sandbox:p}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const h=v,[d,x]=te.useState(!1);let k;e[2]!==r?(k=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=k):k=e[3];const S=k;if(!n.properties)return null;let T;e[4]!==l?(T=l.split(".").pop()??l,e[4]=l,e[5]=T):T=e[5];const N=T;let C;e[6]!==h||e[7]!==N||e[8]!==o||e[9]!==S||e[10]!==n?(C=Tr(N,o,n,S,h),e[6]=h,e[7]=N,e[8]=o,e[9]=S,e[10]=n,e[11]=C):C=e[11];const _=d||C,j=`${l}-fields`;let I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=()=>x(zr),e[12]=I):I=e[12];let R;e[13]!==_?(R=s.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:_?s.jsx(_t,{size:16}):s.jsx(It,{size:16})}),e[13]=_,e[14]=R):R=e[14];let B;e[15]!==o?(B=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[15]=o,e[16]=B):B=e[16];let P;e[17]!==j||e[18]!==_||e[19]!==R||e[20]!==B?(P=s.jsxs("button",{type:"button","aria-expanded":_,"aria-controls":j,onClick:I,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[R,B]}),e[17]=j,e[18]=_,e[19]=R,e[20]=B,e[21]=P):P=e[21];let M;e[22]!==n.description?(M=n.description&&s.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=M):M=e[23];let E;e[24]!==h||e[25]!==j||e[26]!==m||e[27]!==_||e[28]!==u||e[29]!==S||e[30]!==g||e[31]!==c||e[32]!==i||e[33]!==b||e[34]!==f||e[35]!==l||e[36]!==y||e[37]!==p||e[38]!==n?(E=_&&s.jsx("div",{id:j,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:s.jsx(Ze,{schema:n,value:S,onChange:i,basePath:l,breadcrumbPath:h,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:y,onAddSectionItem:g,onRequestAddSection:b,sandbox:p})}),e[24]=h,e[25]=j,e[26]=m,e[27]=_,e[28]=u,e[29]=S,e[30]=g,e[31]=c,e[32]=i,e[33]=b,e[34]=f,e[35]=l,e[36]=y,e[37]=p,e[38]=n,e[39]=E):E=e[39];let O;return e[40]!==M||e[41]!==E||e[42]!==P?(O=s.jsxs("div",{className:"min-w-0 space-y-2",children:[P,M,E]}),e[40]=M,e[41]=E,e[42]=P,e[43]=O):O=e[43],O}function zr(t){return!t}function Pr(t){if(!t?.properties)return{};const e={};for(const[n,r]of Object.entries(t.properties))n.startsWith("__")||n==="@type"||(r.default!==void 0?e[n]=r.default:r.type==="boolean"?e[n]=!1:r.type==="string"?e[n]="":r.type==="number"||r.type==="integer"?e[n]=0:r.type==="object"&&(e[n]={}));return e}function Mr(t){const e=X.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(In,{asChild:!0,children:s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[s.jsx(_n,{size:11}),"Global"]})}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=s.jsxs(Rn,{children:[r,s.jsxs(On,{side:"top",className:"max-w-[260px]",children:["Edits the saved block “",n,"”. Changes apply everywhere this loader is referenced on your site."]})]}),e[1]=n,e[2]=i):i=e[2],i}function Ur(t){const e=X.c(28),{path:n,open:r,onOpenChange:i,title:l,nested:o,nestedBlockRef:a,globalBlockKey:c}=t,u=`${n}-loader-config`,m=a&&"ml-1";let f;e[0]!==m?(f=Se("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=()=>i(!r),e[2]=i,e[3]=r,e[4]=y):y=e[4];let g;e[5]!==r?(g=s.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?s.jsx(_t,{size:16}):s.jsx(It,{size:16})}),e[5]=r,e[6]=g):g=e[6];let b;e[7]!==l?(b=s.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:l}),e[7]=l,e[8]=b):b=e[8];let p;e[9]!==c?(p=c&&s.jsx(Mr,{blockKey:c}),e[9]=c,e[10]=p):p=e[10];let v;e[11]!==b||e[12]!==p?(v=s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,p]}),e[11]=b,e[12]=p,e[13]=v):v=e[13];let h;e[14]!==u||e[15]!==r||e[16]!==y||e[17]!==g||e[18]!==v?(h=s.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":u,onClick:y,className:"group flex w-full min-w-0 items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[g,v]}),e[14]=u,e[15]=r,e[16]=y,e[17]=g,e[18]=v,e[19]=h):h=e[19];let d;e[20]!==u||e[21]!==o||e[22]!==r?(d=r&&s.jsx("div",{id:u,className:"border-t border-border/60 px-4 pb-4 pt-3",children:s.jsx("div",{className:"border-l border-border/80 pl-4",children:o})}),e[20]=u,e[21]=o,e[22]=r,e[23]=d):d=e[23];let x;return e[24]!==f||e[25]!==h||e[26]!==d?(x=s.jsxs("div",{className:f,children:[h,d]}),e[24]=f,e[25]=h,e[26]=d,e[27]=x):x=e[27],x}function dt(t){const e=X.c(35),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,sandbox:y}=t,g=(n.anyOfRefs??[]).filter(Hr),b=m&&r?tr(r,m):null,p=b?.data??r,v=b?null:Rt(p),h=v??p,d=Hn(g,{savedBlockKey:b?.blockKey,editorValue:p}),x=d.length>0?Wn(p,d,b?.blockKey):d[0]?.resolveType??"",S=n.type==="block-ref"&&d.some(Kr);let T;e[0]!==o||e[1]!==l?(T=o??(l.includes(".")?l.split(".")[0]:l),e[0]=o,e[1]=l,e[2]=T):T=e[2];const N=T;let C;e[3]!==a?(C=a??[],e[3]=a,e[4]=C):C=e[4];const w=C,_=S&&w[0]===N?w.slice(1):w,j=S?$=>{c?.([N,...$])}:c,[I,R]=te.useState(x),[B,P]=te.useState(x);B!==x&&(P(x),R(x));const[M,E]=te.useState(()=>Yn(p,b?.blockKey));if(d.length>0){const $=I||x;let V;e[5]!==$?(V=z=>z.resolveType===$,e[5]=$,e[6]=V):V=e[6];const se=d.find(V),F=lt(p,u,se?.schema),L=qn(F??se?.schema??null,n.discriminatorKey),G=n.discriminatorKey,le=z=>{R(z);const oe=d.find(fe=>fe.resolveType===z),ue=lt(p,u,oe?.schema),ve=new Set(Object.keys((ue??oe?.schema)?.properties??{})),we=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},ke=Object.fromEntries(Object.entries(we).filter(fe=>{const[Te]=fe;return ve.has(Te)})),be={...Pr(oe?.schema),...ke};if(G){const fe=oe?.discriminatorValue??z;i({...be,[G]:fe});return}if(Ee(z)){i(be);return}i({...be,__resolveType:z})};let J;e[7]!==$||e[8]!==G||e[9]!==i?(J=z=>{if(G||!Ee($)||z===null||typeof z!="object"||Array.isArray(z)){i(z);return}const{__resolveType:oe,...ue}=z;i(ue)},e[7]=$,e[8]=G,e[9]=i,e[10]=J):J=e[10];const he=J,ce=L?.properties?s.jsx(Ze,{schema:L,value:h,onChange:z=>{if(b&&f){f(b.blockKey,z);return}if(v){i({...p,section:z});return}he(z)},basePath:l,breadcrumbPath:_,onBreadcrumbChange:j,meta:u,decofile:m,onSaveReferencedBlock:f,sandbox:y}):null;let ie;e[11]!==l?(ie=l.includes("."),e[11]=l,e[12]=ie):ie=e[12];const ye=ie;let ae;e[13]!==o||e[14]!==l?(ae=s.jsx(me,{htmlFor:l,children:o}),e[13]=o,e[14]=l,e[15]=ae):ae=e[15];let K;e[16]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(jt,{children:s.jsx(Nt,{placeholder:"Select..."})}),e[16]=K):K=e[16];let q;return e[17]!==n.description?(q=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[17]=n.description,e[18]=q):q=e[18],s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[ae,s.jsxs(kt,{value:$||void 0,onValueChange:le,children:[K,s.jsx(St,{children:d.map(Vr)})]}),q]}),ce&&(S?s.jsx(Ur,{path:l,open:M,onOpenChange:E,title:ye?"Configuration":"Loader configuration",nested:ce,nestedBlockRef:ye,globalBlockKey:b?.blockKey}):ce)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let O;e[19]!==o||e[20]!==l?(O=s.jsx(me,{htmlFor:l,children:o}),e[19]=o,e[20]=l,e[21]=O):O=e[21];const ne=r!=null?String(r):"";let re;e[22]!==i?(re=$=>i($.target.value),e[22]=i,e[23]=re):re=e[23];const Z=n.description??"";let U;e[24]!==l||e[25]!==ne||e[26]!==re||e[27]!==Z?(U=s.jsx("input",{id:l,type:"text",value:ne,onChange:re,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:Z}),e[24]=l,e[25]=ne,e[26]=re,e[27]=Z,e[28]=U):U=e[28];let W;e[29]!==n.description?(W=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[29]=n.description,e[30]=W):W=e[30];let Y;return e[31]!==O||e[32]!==U||e[33]!==W?(Y=s.jsxs("div",{className:"space-y-1.5",children:[O,U,W]}),e[31]=O,e[32]=U,e[33]=W,e[34]=Y):Y=e[34],Y}function Vr(t){const e=t.title&&!t.title.includes("/")?t.title:Nn(t.resolveType)??qe(t.resolveType);return s.jsx(bt,{value:t.resolveType,children:e},t.resolveType)}function Kr(t){return t.resolveType.includes("/")&&!Ee(t.resolveType)}function Hr(t){return t.resolveType!==""}function Wr(t){if(!Array.isArray(t))return[];const e=[];for(const n of t)if(typeof n=="string")e.push({value:n,label:n});else if(n&&typeof n=="object"&&"value"in n){const r=n;e.push({value:String(r.value),label:typeof r.label=="string"?r.label:String(r.value),image:typeof r.image=="string"?r.image:void 0})}return e}async function qr(t,e,n){const r={};n&&(r.term=n);const l=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,o=await fetch(l,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Failed to fetch dynamic options: ${o.status}`);const a=await o.json();return Wr(a)}function pt(t){const e=X.c(8),{path:n,label:r,description:i}=t;let l;e[0]!==r||e[1]!==n?(l=s.jsx(me,{htmlFor:n,children:r}),e[0]=r,e[1]=n,e[2]=l):l=e[2];let o;e[3]!==i?(o=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs("div",{className:"space-y-0.5",children:[l,o]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function Yr(t){const e=X.c(71),{schema:n,value:r,onChange:i,path:l,label:o,sandbox:a}=t,c=n.options,u=a?.previewUrl,[m,f]=te.useState(!1),[y,g]=te.useState(""),[b,p]=te.useState(""),v=te.useRef(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=F=>{g(F),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{p(F)},300)},e[0]=h):h=e[0];const d=h,x=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"";let k;e[1]!==b||e[2]!==c||e[3]!==x?(k=Mt.sandboxInvoke(x,`dynamic-options:${c??""}:${b}`),e[1]=b,e[2]=c,e[3]=x,e[4]=k):k=e[4];let S;e[5]!==b||e[6]!==c||e[7]!==u?(S=()=>qr(u,c,b||void 0),e[5]=b,e[6]=c,e[7]=u,e[8]=S):S=e[8];const T=!!u&&!!c&&m;let N;e[9]!==k||e[10]!==S||e[11]!==T?(N={queryKey:k,queryFn:S,enabled:T,staleTime:6e4,retry:1},e[9]=k,e[10]=S,e[11]=T,e[12]=N):N=e[12];const C=Pt(N);let w;e[13]!==C.data?(w=C.data??[],e[13]=C.data,e[14]=w):w=e[14];const _=w,j=typeof r=="string"?r:"";let I;if(e[15]!==j||e[16]!==_){let F;e[18]!==j?(F=L=>L.value===j,e[18]=j,e[19]=F):F=e[19],I=_.find(F),e[15]=j,e[16]=_,e[17]=I}else I=e[17];const R=I;if(!u||!c){let F;e[20]!==o||e[21]!==l||e[22]!==n.description?(F=s.jsx(pt,{path:l,label:o,description:n.description}),e[20]=o,e[21]=l,e[22]=n.description,e[23]=F):F=e[23];let L;e[24]!==i?(L=J=>i(J.target.value),e[24]=i,e[25]=L):L=e[25];let G;e[26]!==j||e[27]!==l||e[28]!==L?(G=s.jsx(xe,{id:l,type:"text",value:j,onChange:L}),e[26]=j,e[27]=l,e[28]=L,e[29]=G):G=e[29];let le;return e[30]!==G||e[31]!==F?(le=s.jsxs("div",{className:"space-y-2",children:[F,G]}),e[30]=G,e[31]=F,e[32]=le):le=e[32],le}let B;e[33]!==o||e[34]!==l||e[35]!==n.description?(B=s.jsx(pt,{path:l,label:o,description:n.description}),e[33]=o,e[34]=l,e[35]=n.description,e[36]=B):B=e[36];let P;e[37]!==j||e[38]!==R?(P=R?s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[R.image&&s.jsx("img",{src:R.image,alt:"",referrerPolicy:"no-referrer",className:"h-6 w-6 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:R.label??R.value})]}):j?s.jsx("span",{className:"truncate",children:j}):s.jsx("span",{className:"text-muted-foreground",children:"Select..."}),e[37]=j,e[38]=R,e[39]=P):P=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Fn,{className:"size-4 shrink-0 opacity-50"}),e[40]=M):M=e[40];let E;e[41]!==m||e[42]!==P?(E=s.jsx(gt,{asChild:!0,children:s.jsxs(Re,{variant:"outline",role:"combobox","aria-expanded":m,className:"h-10 w-full justify-between font-normal",children:[P,M]})}),e[41]=m,e[42]=P,e[43]=E):E=e[43];let O;e[44]===Symbol.for("react.memo_cache_sentinel")?(O={width:"var(--radix-popover-trigger-width)"},e[44]=O):O=e[44];let ne;e[45]!==y?(ne=s.jsx(Ln,{placeholder:"Search...",className:"h-9",value:y,onValueChange:d}),e[45]=y,e[46]=ne):ne=e[46];const re=C.isLoading?"Loading...":"No results found.";let Z;e[47]!==re?(Z=s.jsx(Dn,{children:re}),e[47]=re,e[48]=Z):Z=e[48];let U;if(e[49]!==j||e[50]!==i||e[51]!==_){let F;e[53]!==j||e[54]!==i?(F=L=>s.jsxs(Bn,{value:L.value,onSelect:()=>{i(L.value===j?"":L.value),f(!1)},children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[L.image&&s.jsx("img",{src:L.image,alt:"",referrerPolicy:"no-referrer",className:"h-9 w-9 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:L.label??L.value})]}),s.jsx($n,{className:Se("ml-auto size-4 shrink-0",j===L.value?"opacity-100":"opacity-0")})]},L.value),e[53]=j,e[54]=i,e[55]=F):F=e[55],U=_.map(F),e[49]=j,e[50]=i,e[51]=_,e[52]=U}else U=e[52];let W;e[56]!==U?(W=s.jsx(En,{children:U}),e[56]=U,e[57]=W):W=e[57];let Y;e[58]!==Z||e[59]!==W?(Y=s.jsxs(zn,{children:[Z,W]}),e[58]=Z,e[59]=W,e[60]=Y):Y=e[60];let $;e[61]!==ne||e[62]!==Y?($=s.jsx(xt,{className:"p-0",style:O,children:s.jsxs(Pn,{shouldFilter:!1,children:[ne,Y]})}),e[61]=ne,e[62]=Y,e[63]=$):$=e[63];let V;e[64]!==m||e[65]!==E||e[66]!==$?(V=s.jsxs(vt,{open:m,onOpenChange:f,children:[E,$]}),e[64]=m,e[65]=E,e[66]=$,e[67]=V):V=e[67];let se;return e[68]!==V||e[69]!==B?(se=s.jsxs("div",{className:"space-y-2",children:[B,V]}),e[68]=V,e[69]=B,e[70]=se):se=e[70],se}function mt(t){const e=X.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=s.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Gr(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Qr(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function ht(t){const e=X.c(79),{schema:n,value:r,onChange:i,path:l,label:o,sandbox:a}=t,c=n.format==="video-uri",u=At(r),[m,f]=te.useState(!1),[y,g]=te.useState(!1),b=u?Gr(u):"",p=b?Qr(b):"",v=Un(),h=Tn();let d;e[0]!==v.data?.configs?(d=v.data?.configs??[],e[0]=v.data?.configs,e[1]=d):d=e[1];const x=a?.siteSlug;let k;e[2]!==d||e[3]!==x?(k=Cn(d,x),e[2]=d,e[3]=x,e[4]=k):k=e[4];const S=k;let T;e[5]!==v.data?.configs||e[6]!==S?(T=function(){if(S)return S.id;const K=v.data?.configs??[];if(K.length===1)return K[0].id;if(K.length===0)return null;const q=typeof window<"u"?window.localStorage.getItem(wn):null;return K.some(z=>z.id===q)?q:null},e[5]=v.data?.configs,e[6]=S,e[7]=T):T=e[7];const N=T;let C;e[8]!==c||e[9]!==i||e[10]!==N||e[11]!==f||e[12]!==h?(C=async function(K){if(!K)return;let q=Array.from(K);if(q.length===0)return;if(c&&(q=q.filter(Xr),q.length===0)){Ae.error("Please drop a video file (mp4, webm, …).");return}const z=N();if(!z){f(!0);return}try{const oe=await h.mutateAsync({configId:z,file:q[0]});i(oe.publicUrl),q.length>1&&Ae.info(`Uploaded ${q[0].name}; extra files were ignored (single-select field).`)}catch(oe){const ue=oe;Ae.error(ue instanceof Error?ue.message:"Upload failed")}},e[8]=c,e[9]=i,e[10]=N,e[11]=f,e[12]=h,e[13]=C):C=e[13];const w=C;let _;e[14]!==g?(_=function(K){K.preventDefault(),K.dataTransfer.types.includes("Files")&&g(!0)},e[14]=g,e[15]=_):_=e[15];const j=_;let I;e[16]!==g?(I=function(K){K.currentTarget===K.target&&g(!1)},e[16]=g,e[17]=I):I=e[17];const R=I;let B;e[18]!==w||e[19]!==g?(B=function(K){K.preventDefault(),g(!1),w(K.dataTransfer.files)},e[18]=w,e[19]=g,e[20]=B):B=e[20];const P=B;let M;e[21]!==o||e[22]!==l?(M=s.jsx(me,{htmlFor:l,className:"text-muted-foreground",children:o}),e[21]=o,e[22]=l,e[23]=M):M=e[23];let E;e[24]!==n.description?(E=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=E):E=e[25];let O;e[26]!==E||e[27]!==M?(O=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[M,E]}),e[26]=E,e[27]=M,e[28]=O):O=e[28];const ne=y&&"border-primary ring-2 ring-primary/30",re=h.isPending&&"pointer-events-none opacity-60";let Z;e[29]!==ne||e[30]!==re?(Z=Se("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",ne,re),e[29]=ne,e[30]=re,e[31]=Z):Z=e[31];let U;e[32]!==p||e[33]!==b||e[34]!==c||e[35]!==f||e[36]!==u||e[37]!==h.isPending?(U=u?c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:s.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u)}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[s.jsx(et,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:b}),s.jsx(mt,{ext:p})]})]}):s.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[s.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:s.jsx(tt,{size:18,className:"text-muted-foreground"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:b}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),s.jsx(mt,{ext:p})]}):s.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[c?s.jsx(et,{size:20}):s.jsx(tt,{size:20}),s.jsx("span",{className:"text-sm font-medium",children:h.isPending?"Uploading…":c?"Drop a video here or click to browse":"Drop a file or click to browse"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[32]=p,e[33]=b,e[34]=c,e[35]=f,e[36]=u,e[37]=h.isPending,e[38]=U):U=e[38];let W;e[39]!==y?(W=y&&s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:s.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[39]=y,e[40]=W):W=e[40];let Y;e[41]!==R||e[42]!==j||e[43]!==P||e[44]!==Z||e[45]!==U||e[46]!==W?(Y=s.jsxs("div",{onDragOver:j,onDragLeave:R,onDrop:P,className:Z,children:[U,W]}),e[41]=R,e[42]=j,e[43]=P,e[44]=Z,e[45]=U,e[46]=W,e[47]=Y):Y=e[47];let $;e[48]!==i?($=ae=>i(ae.target.value),e[48]=i,e[49]=$):$=e[49];let V;e[50]!==l||e[51]!==u||e[52]!==$?(V=s.jsx(xe,{id:l,type:"url",value:u,onChange:$,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[50]=l,e[51]=u,e[52]=$,e[53]=V):V=e[53];let se;e[54]!==f?(se=()=>f(!0),e[54]=f,e[55]=se):se=e[55];let F;e[56]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(Mn,{size:14}),e[56]=F):F=e[56];const L=u?"Replace":"Browse";let G;e[57]!==se||e[58]!==L?(G=s.jsxs(Re,{type:"button",variant:"outline",size:"sm",onClick:se,className:"h-9 shrink-0",children:[F,L]}),e[57]=se,e[58]=L,e[59]=G):G=e[59];let le;e[60]!==i||e[61]!==u?(le=u&&s.jsx(Re,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":"Remove file",children:s.jsx(Ct,{size:14})}),e[60]=i,e[61]=u,e[62]=le):le=e[62];let J;e[63]!==V||e[64]!==G||e[65]!==le?(J=s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[V,G,le]}),e[63]=V,e[64]=G,e[65]=le,e[66]=J):J=e[66];let he;e[67]!==i?(he=ae=>i(ae),e[67]=i,e[68]=he):he=e[68];const ce=S?.id??null;let ie;e[69]!==m||e[70]!==f||e[71]!==he||e[72]!==ce?(ie=s.jsx(An,{open:m,onOpenChange:f,mode:"any",onSelect:he,lockedConfigId:ce}),e[69]=m,e[70]=f,e[71]=he,e[72]=ce,e[73]=ie):ie=e[73];let ye;return e[74]!==O||e[75]!==Y||e[76]!==J||e[77]!==ie?(ye=s.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[O,Y,J,ie]}),e[74]=O,e[75]=Y,e[76]=J,e[77]=ie,e[78]=ye):ye=e[78],ye}function Xr(t){return t.type.startsWith("video/")}const Zr="website/loaders/secret.ts";function Ie(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Jr(){return{__resolveType:Zr,name:"",encrypted:""}}function es(t){const{value:e,...n}=t;return n}function He(t){const e=X.c(45),{schema:n,value:r,onChange:i,label:l,path:o}=t;if(typeof r=="string"||r==null&&!Ie(r)){const N=typeof r=="string"?r:"";let C;e[0]!==l||e[1]!==o?(C=s.jsx(me,{htmlFor:o,className:"text-sm font-medium",children:l}),e[0]=l,e[1]=o,e[2]=C):C=e[2];let w;e[3]!==n.description?(w=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=w):w=e[4];let _;e[5]!==i?(_=R=>i(R.target.value),e[5]=i,e[6]=_):_=e[6];let j;e[7]!==o||e[8]!==N||e[9]!==_?(j=s.jsx(xe,{id:o,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:"Secret value",onChange:_,className:"h-10"}),e[7]=o,e[8]=N,e[9]=_,e[10]=j):j=e[10];let I;return e[11]!==C||e[12]!==w||e[13]!==j?(I=s.jsxs("div",{className:"space-y-2",children:[C,w,j]}),e[11]=C,e[12]=w,e[13]=j,e[14]=I):I=e[14],I}let a;e[15]!==r?(a=Ie(r)?r:Jr(),e[15]=r,e[16]=a):a=e[16];const c=a,u=typeof c.name=="string"?c.name:"",m=typeof c.encrypted=="string"&&c.encrypted,f=`${o}-name`;let y;e[17]!==l||e[18]!==f?(y=s.jsx(me,{htmlFor:f,className:"text-sm font-medium",children:l}),e[17]=l,e[18]=f,e[19]=y):y=e[19];let g;e[20]!==n.description?(g=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[20]=n.description,e[21]=g):g=e[21];const b=`${o}-name`;let p;e[22]!==c||e[23]!==i?(p=N=>i({...c,name:N.target.value}),e[22]=c,e[23]=i,e[24]=p):p=e[24];let v;e[25]!==u||e[26]!==b||e[27]!==p?(v=s.jsx(xe,{id:b,value:u,placeholder:"Secret name",onChange:p,className:"h-10"}),e[25]=u,e[26]=b,e[27]=p,e[28]=v):v=e[28];const h=`${o}-value`,d=m?"Leave blank to keep current value":"Secret value";let x;e[29]!==c||e[30]!==m||e[31]!==i?(x=N=>{const C=N.target.value;if(!C){i(m?es(c):c);return}i({...c,value:C})},e[29]=c,e[30]=m,e[31]=i,e[32]=x):x=e[32];let k;e[33]!==x||e[34]!==h||e[35]!==d?(k=s.jsx(xe,{id:h,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:d,onChange:x,className:"h-10"}),e[33]=x,e[34]=h,e[35]=d,e[36]=k):k=e[36];let S;e[37]!==m?(S=m&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"A secret value is stored."}),e[37]=m,e[38]=S):S=e[38];let T;return e[39]!==k||e[40]!==S||e[41]!==y||e[42]!==g||e[43]!==v?(T=s.jsxs("div",{className:"space-y-2",children:[y,g,v,k,S]}),e[39]=k,e[40]=S,e[41]=y,e[42]=g,e[43]=v,e[44]=T):T=e[44],T}function ts(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const n={};for(const[r,i]of Object.entries(e))r.startsWith("__")||(typeof i=="string"?n[r]={type:"string"}:typeof i=="number"?n[r]={type:"number"}:typeof i=="boolean"&&(n[r]={type:"boolean"}));return Object.keys(n).length>0?{type:"object",properties:n}:void 0}const ns=new Set(["__resolveType","@type"]);function rs(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return null;const e=t.anyOfRefs[0].resolveType;return e.endsWith("/multivariate/image.ts")?"image":e.endsWith("/multivariate/video.ts")||e.endsWith("/multivariate/file.ts")?"file":null}function ss(t){if(Me(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function yt(t){if(t.type==="array"&&t.items)return t;const e=t.items??ss(t);return e?{...t,type:"array",items:e}:null}function is(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function zt(t){const{schema:e,value:n}=t;if(it(n)){const o=Sn(n),a=yt(e);if(o!==null&&a)return s.jsx(Be,{...t,schema:a,value:o,onChange:c=>t.onChange(kn(n,c))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&Me(e)){const o=yt(e);if(o)return s.jsx(Be,{...t,schema:o,value:n,onChange:t.onChange},t.path)}if(Array.isArray(n)&&!it(n)&&e.type==="block-ref"){const o=ts(n);if(o){const a={...e,type:"array",items:o};return s.jsx(Be,{...t,schema:a,value:n,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||n!==null&&typeof n=="object"&&!Array.isArray(n)&&typeof n.__resolveType=="string"&&e.anyOfRefs){const o=rs(e);return o==="image"?s.jsx(ot,{...t},t.path):o==="file"?s.jsx(ht,{...t},t.path):e.anyOfRefs?s.jsx(dt,{...t},t.path):null}if(e.format==="image-uri")return s.jsx(ot,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return s.jsx(ht,{...t},t.path);if(e.format==="dynamic-options"&&e.options)return s.jsx(Yr,{...t},t.path);if(e.enum&&e.enum.length>0)return s.jsx(br,{...t},t.path);if(e.type==="anyOf")return s.jsx(dt,{...t},t.path);if(Ie(n)||e.format==="password"||n==null&&e.format==="password")return s.jsx(He,{...t},t.path);const r=n??is(e.type,e.default);if(r==null)return Ie(n)?s.jsx(He,{...t},t.path):null;if(Ie(r))return s.jsx(He,{...t,value:r},t.path);const i={...t,value:r},l=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(l==="array"||Array.isArray(r))return s.jsx(Be,{...i},t.path);switch(l){case"boolean":return s.jsx(yr,{...i},t.path);case"number":case"integer":return s.jsx(hr,{...i},t.path);case"string":{const o=e.format;return o==="color-input"?s.jsx(Le,{...i},t.path):o==="textarea"||o==="rich-text"||o==="html"?s.jsx(Le,{...i},t.path):s.jsx(Le,{...i},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?s.jsx(Er,{...i},t.path):null;default:return s.jsx(Le,{...i},t.path)}}function Ze(t){const e=X.c(16),{schema:n,value:r,onChange:i,basePath:l,breadcrumbPath:o,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:m,previewBaseUrl:f,onAddSectionItem:y,onRequestAddSection:g,sandbox:b}=t;let p,v;if(e[0]!==l||e[1]!==u||e[2]!==c||e[3]!==y||e[4]!==a||e[5]!==i||e[6]!==g||e[7]!==m||e[8]!==f||e[9]!==b||e[10]!==n.properties||e[11]!==o||e[12]!==r){v=Symbol.for("react.early_return_sentinel");e:{const h=o===void 0?[]:o,d=n.properties;if(!d){v=null;break e}const x=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},k=Object.keys(d).filter(j=>!ns.has(j)&&d[j]?.hidden!==!0);if(k.length===0){let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[15]=j):j=e[15],v=j;break e}const S=(j,I)=>{i({...x,[j]:I})},T=typeof x.__resolveType=="string"?x.__resolveType:void 0,N=h.length>0?kr(k,d,x,h):null,C=N?d[N]:null,w=N&&C?[N]:k,_=N&&C?Nr(N,C,h):h;p=s.jsx("div",{className:"min-w-0 space-y-6",children:w.map(j=>{const I=d[j];if(!I)return null;const R=l?`${l}.${j}`:j,B=_e(j,I);return zt({schema:I,value:x[j],onChange:P=>S(j,P),path:R,label:B,breadcrumbPath:_,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:m,containerResolveType:T,previewBaseUrl:f,onAddSectionItem:y,onRequestAddSection:g,sandbox:b})})})}e[0]=l,e[1]=u,e[2]=c,e[3]=y,e[4]=a,e[5]=i,e[6]=g,e[7]=m,e[8]=f,e[9]=b,e[10]=n.properties,e[11]=o,e[12]=r,e[13]=p,e[14]=v}else p=e[13],v=e[14];return v!==Symbol.for("react.early_return_sentinel")?v:p}export{Ze as S,zt as a,Ls as b,Le as c,Ge as r,Gn as s,Fs as u};
1
+ import{r as te,c as Se,j as s,e as X,B as Re,n as Ae,m as Pt,K as Mt}from"./index-COlSsy5J.js";import{am as Ut,an as Vt,ao as Kt,ap as Ht,aq as Wt,ar as qt,ac as Yt,D as Gt,as as et,N as tt}from"./agent-icon-B1KjkGhC.js";import{C as Qt}from"./calendar-BETEvsL1.js";import{I as xe}from"./input-CuVtlRv5.js";import{L as me}from"./label-BCRIEPd0.js";import{a as gt,b as xt,P as vt}from"./popover-rRtv1RUJ.js";import{T as Xt}from"./textarea-DsT2vsGj.js";import{b as Zt}from"./XCircle-CpovmLEO.js";import{d as Jt}from"./SwitchHorizontal01-Ca_h3hG5.js";import{v as en,y as tn,z as nn}from"./scroll-area-DOnfhZQE.js";import{S as rn}from"./switch-CorAlxCf.js";import{a as bt,b as jt,c as Nt,S as St,d as kt}from"./select-Dqs7Z4yG.js";import{u as sn,a as nt,K as on,P as ln,D as an,c as cn,S as un,v as fn,e as dn,d as rt,b as pn,C as mn,s as hn}from"./sortable.esm-yJWb24sN.js";import{c as Tt}from"./ZoomOut-DYeUJTmS.js";import{s as yn}from"./Plus-DHJbi1i9.js";import{s as Ct}from"./Trash01-BDNQcRq9.js";import{a as gn,b as xn,c as vn,D as bn}from"./dropdown-menu-gXn3xVef.js";import{i as Oe,_ as Pe,$ as st,o as We,l as qe,a0 as wt,a1 as jn,a2 as Me,a3 as Ee,a4 as Nn,q as it,a5 as Sn,a6 as kn}from"./index-BW5f_EaT.js";import{e as At,u as Tn,m as Cn,L as wn,F as An,I as ot}from"./image-field-ZYWbFFqt.js";import{t as _t}from"./ChevronDown-BldydMJ0.js";import{i as It}from"./ChevronRight-BsknZQE_.js";import{i as _n}from"./Globe01-CMUrlGmF.js";import{T as In,b as Rn,a as On}from"./tooltip-D5U362dF.js";import{i as $n}from"./ChevronUp-CjDXfs3K.js";import{d as Fn}from"./Tool01-B4m3Gnpd.js";import{b as Ln,C as Dn,a as Bn,e as En,c as zn,d as Pn}from"./command-CYqVDIDi.js";import{i as Mn}from"./Upload01-CuyZwIAy.js";import{c as Un}from"./use-file-configs-DKTLvOxt.js";function Ye(t){const e=t.__resolveType;if(typeof e!="string")return null;if(Oe(e)){const r=t.section?.__resolveType;return typeof r=="string"?r:e}return e}function Vn(t){return t.includes("flags/multivariate")}function Kn(t){return qe(t)}function Hn(t,e){const n=[...t],r=new Set(n.map(l=>l.resolveType)),i=(l,o)=>{!l||r.has(l)||(r.add(l),n.push({resolveType:l,title:o??Kn(l)}))};if(e.savedBlockKey&&i(e.savedBlockKey,e.savedBlockKey),e.editorValue&&typeof e.editorValue=="object"&&!Array.isArray(e.editorValue)){const l=Ye(e.editorValue);l?.includes("/")&&i(l)}return n}function Wn(t,e,n){const r=e[0]?.resolveType??"";if(n)return n;if(!t||typeof t!="object"||Array.isArray(t))return r;const i=t,l=i.__resolveType;if(typeof l=="string"){if(Pe(l)){const f=e.find(y=>y.resolveType===l);return f?f.resolveType:l}const u=e.find(f=>st(f.resolveType,l));if(u)return u.resolveType;const m=e.find(f=>f.resolveType===l);if(m)return m.resolveType;if(l.includes("/"))return l}const o=typeof i.type=="string"?i.type:void 0;if(o){const u=e.find(m=>m.discriminatorValue===o||m.resolveType===o||st(m.resolveType,o));if(u)return u.resolveType}let a=r,c=-1;for(const u of e){if(!u.schema?.properties)continue;const f=Object.keys(u.schema.properties).filter(y=>!y.startsWith("__")&&y!=="@type"&&y!=="action"&&y!=="alt").filter(y=>i[y]!==void 0).length;f>0&&f>c&&(c=f,a=u.resolveType)}return c>0,a}function lt(t,e,n){if(!t||typeof t!="object"||Array.isArray(t))return n??null;const r=Ye(t);if(!r)return n??null;if(!e)return r.includes("/")?null:n??null;const i=We(r,e);return i||(r.includes("/")?null:n??null)}function qn(t,e){if(!t?.properties||!e)return t??null;if(!(e in t.properties))return t;const n={...t.properties};return delete n[e],{...t,properties:n}}function Rt(t){if(!t||typeof t!="object"||Array.isArray(t))return null;const e=t;if(typeof e.__resolveType!="string"||!Oe(e.__resolveType))return null;const n=e.section;return!n||typeof n!="object"||Array.isArray(n)?null:n}function Yn(t,e){if(e)return!0;if(!t||typeof t!="object"||Array.isArray(t))return!1;const n=t,r=Ye(n);return r&&Vn(r)?Array.isArray(n.variants)&&n.variants.length>0:Object.keys(n).some(i=>!i.startsWith("__")&&i!=="@type")}function Gn(t){if(t?.trim())try{const e=new URL(t);return e.protocol!=="https:"?void 0:e.href}catch{return}}function Qn(t){if(Array.isArray(t.variants)){const e=t.variants,n=e.find(i=>i.rule?.__resolveType?.includes("always"));if(typeof n?.value=="string")return n.value;const r=e.find(i=>typeof i.value=="string");if(r)return r.value}if(typeof t.src=="string")return t.src;if(typeof t.url=="string")return t.url;if(typeof t.value=="string")return t.value}function Ot(t){if(typeof t=="string"||t==null||typeof t!="object")return t;if(Array.isArray(t))return t.map(Ot);const e=t;return e.__resolveType?Qn(e)??t:$t(e)}function $t(t){const e={};for(const[n,r]of Object.entries(t))e[n]=Ot(r);return e}function Xn(t,e){return e.split(".").reduce((n,r)=>{if(!(n==null||typeof n!="object"))return n[r]},t)}function Ft(t){return t==null?"":Array.isArray(t)?t.map(Ft).filter(Boolean).join(","):typeof t=="object"?"":String(t)}function Ge(t,e){if(!t.includes("{"))return;const n=$t(e);return t.replace(/\{\{\{([^}]+)\}\}\}|\{\{([^}]+)\}\}/g,(i,l,o)=>{const a=(l??o??"").trim();return Ft(Xn(n,a))}).trim()||void 0}function Zn(t){return t.replace(/<[^>]*>/g,"").trim()}function Jn(t,e){if(e.includes("{"))return Ge(e,t);const n=t[e];if(typeof n=="string"&&n)return n;if(Array.isArray(n)){const r=n.map(i=>i==null?"":String(i)).filter(Boolean).join(",");if(r)return r}}function je(t,e,n){if(typeof t=="string")return t.trim()?t:`Item ${e+1}`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(t&&typeof t=="object"&&!Array.isArray(t)){let r=t;const i=Rt(r);if(i&&(r=i),n?.titleBy){const o=Jn(r,n.titleBy);if(o)return o}for(const o of["name","label","title","alt","text","href","id","key"]){const a=r[o];if(typeof a=="string"&&a.trim()){const c=n?.properties?.[o]?.format;if(c==="rich-text"||c==="html"){const u=Zn(a);if(u)return u;continue}return a}if(Array.isArray(a)){const c=a.map(u=>u==null?"":String(u)).filter(Boolean).join(",");if(c)return c}}const l=r.__resolveType;if(typeof l=="string"&&l)return qe(l);if(n?.title){const o=Ge(n.title,r);if(o)return o;if(!n.title.includes("{"))return n.title}}return`Item ${e+1}`}function er(t){if(!t)return;if(typeof t.image=="string"&&t.image.includes("{"))return t.image;const e=t.properties?.image;if(!e)return;if(e.format==="image-uri")return"{{{image}}}";const n=e.properties;return n?.mobile?"{{{image.mobile}}}":n?.desktop?"{{{image.desktop}}}":"{{{image}}}"}function at(t,e){if(!t||typeof t!="object"||Array.isArray(t))return;const n=er(e);if(!n)return;const r=Ge(n,t);if(!r)return;const i=At(r)||r;return Gn(i)}function Lt(t){return t===wt||t===jn}function Ue(t,e){if(!Object.hasOwn(e,t))return null;const n=e[t]??{},r=n.__resolveType??t;return{data:{...n},resolveType:r}}function ze(t,e){const n=t.__resolveType??"";if(!n)return null;if(Oe(n)){const r=t.section??{};return Dt(r,e)}if(Lt(n)){const r=t.variants?.[0]?.value;return r?ze(r,e):null}return!Pe(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ue(n,e)}function Dt(t,e){const n=t.__resolveType??"";if(!n)return null;if(Lt(n)){const r=t.variants?.[0]?.value;return r?ze(r,e):null}return!Pe(n)||!Object.hasOwn(e,n)?{data:{...t},resolveType:n}:Ue(n,e)}function tr(t,e){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=t.__resolveType;if(typeof r!="string"||!Pe(r)||!Object.hasOwn(e,r))return null;const i=Ue(r,e);return i?{blockKey:r,...i}:null}function Fs(t,e,n){if(e.isMultivariate)return null;if(e.isSavedBlock){const r=e.isLazy?t.section?.__resolveType??t.__resolveType:t.__resolveType;return Ue(r,n)}if(e.isHidden){const l=(Oe(t.__resolveType)?t.section:t)?.variants?.[0]?.value??t;return ze(l,n)}if(e.isLazy||Oe(t.__resolveType)){const r=t.section??{};return Dt(r,n)}return ze(t,n)}const nr=new Set(["http:","https:","mailto:","tel:","ftp:"]);function rr(t){if(t.startsWith("/")||t.startsWith(".")||t.startsWith("#"))return!0;try{const e=new URL(t,"https://placeholder.invalid");return nr.has(e.protocol)}catch{return!1}}function ge(t){const e=X.c(8),{active:n,label:r,onClick:i,children:l}=t,o=n?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground";let a;e[0]!==o?(a=Se("flex h-7 w-7 items-center justify-center rounded transition-colors cursor-pointer",o),e[0]=o,e[1]=a):a=e[1];let c;return e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==i||e[6]!==a?(c=s.jsx("button",{type:"button","aria-label":r,"aria-pressed":n,onMouseDown:sr,onClick:i,className:a,children:l}),e[2]=n,e[3]=l,e[4]=r,e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function sr(t){return t.preventDefault()}function ir({schema:t,value:e,onChange:n,path:r,label:i}){const l=typeof e=="string"?e:"",o=te.useRef(n);o.current=n;const a=en({extensions:[tn.configure({heading:{levels:[1,2,3]}})],content:l||"",editorProps:{attributes:{class:Se("prose prose-sm dark:prose-invert max-w-none focus:outline-none","min-h-[80px] px-3 py-2")}},onUpdate:({editor:c})=>{const u=c.getHTML();o.current(u==="<p></p>"?"":u)}});return a?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx(me,{htmlFor:r,children:i}),t.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:t.description})]}),s.jsxs("div",{className:"overflow-hidden rounded-md border border-input",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 border-b border-border/60 bg-muted/30 px-1.5 py-1",children:[s.jsx(ge,{active:a.isActive("bold"),label:"Bold",onClick:()=>a.chain().focus().toggleBold().run(),children:s.jsx(Ut,{size:14})}),s.jsx(ge,{active:a.isActive("italic"),label:"Italic",onClick:()=>a.chain().focus().toggleItalic().run(),children:s.jsx(Vt,{size:14})}),s.jsx(ge,{active:a.isActive("underline"),label:"Underline",onClick:()=>a.chain().focus().toggleUnderline().run(),children:s.jsx(Kt,{size:14})}),s.jsx(ge,{active:a.isActive("strike"),label:"Strikethrough",onClick:()=>a.chain().focus().toggleStrike().run(),children:s.jsx(Ht,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("heading",{level:1}),label:"Heading 1",onClick:()=>a.chain().focus().toggleHeading({level:1}).run(),children:s.jsx(Wt,{size:14})}),s.jsx(ge,{active:a.isActive("heading",{level:2}),label:"Heading 2",onClick:()=>a.chain().focus().toggleHeading({level:2}).run(),children:s.jsx(qt,{size:14})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("bulletList"),label:"Bullet list",onClick:()=>a.chain().focus().toggleBulletList().run(),children:s.jsx(Jt,{size:14})}),s.jsx(ge,{active:a.isActive("orderedList"),label:"Ordered list",onClick:()=>a.chain().focus().toggleOrderedList().run(),children:s.jsx("span",{className:"text-[11px] font-semibold leading-none",children:"1."})}),s.jsx("div",{className:"mx-0.5 h-4 w-px bg-border"}),s.jsx(ge,{active:a.isActive("link"),label:"Link",onClick:()=>{const c=a.getAttributes("link").href,u=window.prompt("Link URL",c??"https://");u!==null&&(u===""?a.chain().focus().unsetLink().run():rr(u)&&a.chain().focus().setLink({href:u}).run())},children:s.jsx(Zt,{size:14})})]}),s.jsx(nn,{editor:a})]})]}):null}const Ce=t=>String(t).padStart(2,"0"),or="1900-01-01",lr="2099-12-31",ar="1900-01-01T00:00",cr="2099-12-31T23:59";function ur(t){if(!t)return"";const e=t.slice(0,10);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return e;const n=new Date(t);return Number.isNaN(n.getTime())?"":`${n.getUTCFullYear()}-${Ce(n.getUTCMonth()+1)}-${Ce(n.getUTCDate())}`}function fr(t){return!t||!/^\d{4}-\d{2}-\d{2}$/.test(t)?"":`${t}T00:00:00.000Z`}function dr(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":`${e.getFullYear()}-${Ce(e.getMonth()+1)}-${Ce(e.getDate())}T${Ce(e.getHours())}:${Ce(e.getMinutes())}`}function pr(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toISOString()}function mr(t){const e=X.c(29),{id:n,withTime:r,value:i,onChange:l}=t,[o,a]=te.useState(!1);let c;e[0]!==i||e[1]!==r?(c=r?dr(i):ur(i),e[0]=i,e[1]=r,e[2]=c):c=e[2];const u=c;let m;e[3]!==l||e[4]!==r?(m=w=>{l(r?pr(w.target.value):fr(w.target.value))},e[3]=l,e[4]=r,e[5]=m):m=e[5];const f=m;let y;if(e[6]!==i){const w=i?new Date(i):null;y=w&&!Number.isNaN(w.getTime())?w:null,e[6]=i,e[7]=y}else y=e[7];const g=y;let b;e[8]!==l||e[9]!==g||e[10]!==r?(b=w=>{w&&(r&&g?w.setHours(g.getHours(),g.getMinutes(),0,0):w.setHours(0,0,0,0),l(w.toISOString()),a(!1))},e[8]=l,e[9]=g,e[10]=r,e[11]=b):b=e[11];const p=b,v=r?"datetime-local":"date",h=r?ar:or,d=r?cr:lr;let x;e[12]!==f||e[13]!==n||e[14]!==u||e[15]!==v||e[16]!==h||e[17]!==d?(x=s.jsx(xe,{id:n,type:v,min:h,max:d,value:u,onChange:f,className:"h-10 flex-1 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:opacity-0"}),e[12]=f,e[13]=n,e[14]=u,e[15]=v,e[16]=h,e[17]=d,e[18]=x):x=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(gt,{asChild:!0,children:s.jsx(Re,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0","aria-label":"Open calendar",children:s.jsx(Yt,{className:"h-4 w-4"})})}),e[19]=k):k=e[19];const S=g??void 0;let T;e[20]!==p||e[21]!==S?(T=s.jsx(xt,{className:"w-auto p-0",align:"end",children:s.jsx(Qt,{mode:"single",selected:S,onSelect:p,initialFocus:!0})}),e[20]=p,e[21]=S,e[22]=T):T=e[22];let N;e[23]!==o||e[24]!==T?(N=s.jsxs(vt,{open:o,onOpenChange:a,children:[k,T]}),e[23]=o,e[24]=T,e[25]=N):N=e[25];let C;return e[26]!==N||e[27]!==x?(C=s.jsxs("div",{className:"flex gap-1",children:[x,N]}),e[26]=N,e[27]=x,e[28]=C):C=e[28],C}function Fe(t){const e=X.c(8),{htmlFor:n,label:r,description:i}=t;let l;e[0]!==n||e[1]!==r?(l=s.jsx(me,{htmlFor:n,children:r}),e[0]=n,e[1]=r,e[2]=l):l=e[2];let o;e[3]!==i?(o=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs("div",{className:"space-y-0.5",children:[l,o]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function Le(t){const e=X.c(67),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=typeof r=="string"?r:"",c=n.format;if(c==="rich-text"||c==="rich-text-inline"||c==="html"){let p;return e[0]!==o||e[1]!==i||e[2]!==l||e[3]!==n||e[4]!==r?(p=s.jsx(ir,{schema:n,value:r,onChange:i,path:l,label:o}),e[0]=o,e[1]=i,e[2]=l,e[3]=n,e[4]=r,e[5]=p):p=e[5],p}if(c==="textarea"||c==="markdown"){let p;e[6]!==o||e[7]!==l||e[8]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[6]=o,e[7]=l,e[8]=n.description,e[9]=p):p=e[9];let v;e[10]!==i?(v=x=>i(x.target.value),e[10]=i,e[11]=v):v=e[11];let h;e[12]!==l||e[13]!==a||e[14]!==v?(h=s.jsx(Xt,{id:l,value:a,onChange:v,rows:4}),e[12]=l,e[13]=a,e[14]=v,e[15]=h):h=e[15];let d;return e[16]!==p||e[17]!==h?(d=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[16]=p,e[17]=h,e[18]=d):d=e[18],d}if(c==="date"||c==="date-time"){let p;e[19]!==o||e[20]!==l||e[21]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[19]=o,e[20]=l,e[21]=n.description,e[22]=p):p=e[22];const v=c==="date-time";let h;e[23]!==i||e[24]!==l||e[25]!==a||e[26]!==v?(h=s.jsx(mr,{id:l,withTime:v,value:a,onChange:i}),e[23]=i,e[24]=l,e[25]=a,e[26]=v,e[27]=h):h=e[27];let d;return e[28]!==p||e[29]!==h?(d=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[28]=p,e[29]=h,e[30]=d):d=e[30],d}if(c==="color-input"){let p;e[31]!==o||e[32]!==l||e[33]!==n.description?(p=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[31]=o,e[32]=l,e[33]=n.description,e[34]=p):p=e[34];const v=a||"#000000";let h;e[35]!==i?(h=N=>i(N.target.value),e[35]=i,e[36]=h):h=e[36];let d;e[37]!==v||e[38]!==h?(d=s.jsx("input",{type:"color",value:v,onChange:h,className:"h-10 w-10 cursor-pointer rounded-lg border border-border bg-background p-1"}),e[37]=v,e[38]=h,e[39]=d):d=e[39];let x;e[40]!==i?(x=N=>i(N.target.value),e[40]=i,e[41]=x):x=e[41];let k;e[42]!==l||e[43]!==a||e[44]!==x?(k=s.jsx(xe,{id:l,value:a,onChange:x,placeholder:"#000000",className:"h-10 flex-1"}),e[42]=l,e[43]=a,e[44]=x,e[45]=k):k=e[45];let S;e[46]!==d||e[47]!==k?(S=s.jsxs("div",{className:"flex items-center gap-2",children:[d,k]}),e[46]=d,e[47]=k,e[48]=S):S=e[48];let T;return e[49]!==p||e[50]!==S?(T=s.jsxs("div",{className:"space-y-2",children:[p,S]}),e[49]=p,e[50]=S,e[51]=T):T=e[51],T}let u;e[52]!==o||e[53]!==l||e[54]!==n.description?(u=s.jsx(Fe,{htmlFor:l,label:o,description:n.description}),e[52]=o,e[53]=l,e[54]=n.description,e[55]=u):u=e[55];const m=c==="url"?"url":"text";let f;e[56]!==i?(f=p=>i(p.target.value),e[56]=i,e[57]=f):f=e[57];const y=n.default!=null?String(n.default):void 0;let g;e[58]!==l||e[59]!==a||e[60]!==m||e[61]!==f||e[62]!==y?(g=s.jsx(xe,{id:l,type:m,value:a,onChange:f,placeholder:y,className:"h-10"}),e[58]=l,e[59]=a,e[60]=m,e[61]=f,e[62]=y,e[63]=g):g=e[63];let b;return e[64]!==u||e[65]!==g?(b=s.jsxs("div",{className:"space-y-2",children:[u,g]}),e[64]=u,e[65]=g,e[66]=b):b=e[66],b}function hr(t){const e=X.c(17),{schema:n,value:r,onChange:i,path:l,label:o}=t,a=typeof r=="number"?r:"";let c;e[0]!==o||e[1]!==l?(c=s.jsx(me,{htmlFor:l,children:o}),e[0]=o,e[1]=l,e[2]=c):c=e[2];let u;e[3]!==n.description?(u=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=u):u=e[4];let m;e[5]!==c||e[6]!==u?(m=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=m):m=e[7];let f;e[8]!==i?(f=b=>{const p=b.target.value;i(p===""?void 0:Number(p))},e[8]=i,e[9]=f):f=e[9];let y;e[10]!==a||e[11]!==l||e[12]!==f?(y=s.jsx(xe,{id:l,type:"number",value:a,onChange:f,className:"h-10"}),e[10]=a,e[11]=l,e[12]=f,e[13]=y):y=e[13];let g;return e[14]!==m||e[15]!==y?(g=s.jsxs("div",{className:"space-y-2",children:[m,y]}),e[14]=m,e[15]=y,e[16]=g):g=e[16],g}function yr(t){const e=X.c(17),{value:n,onChange:r,path:i,label:l,schema:o}=t,a=typeof n=="boolean"?n:!1;let c;e[0]!==l||e[1]!==i?(c=s.jsx(me,{htmlFor:i,children:l}),e[0]=l,e[1]=i,e[2]=c):c=e[2];let u;e[3]!==o.description?(u=o.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:o.description}),e[3]=o.description,e[4]=u):u=e[4];let m;e[5]!==c||e[6]!==u?(m=s.jsxs("div",{className:"space-y-0.5",children:[c,u]}),e[5]=c,e[6]=u,e[7]=m):m=e[7];let f;e[8]!==r?(f=b=>r(b),e[8]=r,e[9]=f):f=e[9];let y;e[10]!==a||e[11]!==i||e[12]!==f?(y=s.jsx(rn,{id:i,checked:a,onCheckedChange:f}),e[10]=a,e[11]=i,e[12]=f,e[13]=y):y=e[13];let g;return e[14]!==m||e[15]!==y?(g=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m,y]}),e[14]=m,e[15]=y,e[16]=g):g=e[16],g}const Qe="__enum_empty__";function Xe(t){return t===""?Qe:String(t)}function gr(t,e){if(t===Qe)return"";const n=e.find(r=>Xe(r)===t);return n!==void 0?n:t}function xr(t,e){return t==null?e.some(n=>n==="")?Qe:void 0:Xe(t)}function vr(t){return t===""?"":String(t)}function br(t){const e=X.c(28),{schema:n,value:r,onChange:i,path:l,label:o}=t;let a;e[0]!==n.enum?(a=n.enum??[],e[0]=n.enum,e[1]=a):a=e[1];const c=a;let u;e[2]!==c||e[3]!==r?(u=xr(r,c),e[2]=c,e[3]=r,e[4]=u):u=e[4];const m=u;let f;e[5]!==o||e[6]!==l?(f=s.jsx(me,{htmlFor:l,children:o}),e[5]=o,e[6]=l,e[7]=f):f=e[7];let y;e[8]!==n.description?(y=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[8]=n.description,e[9]=y):y=e[9];let g;e[10]!==f||e[11]!==y?(g=s.jsxs("div",{className:"space-y-0.5",children:[f,y]}),e[10]=f,e[11]=y,e[12]=g):g=e[12];let b;e[13]!==i||e[14]!==c?(b=k=>i(gr(k,c)),e[13]=i,e[14]=c,e[15]=b):b=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(jt,{className:"h-10",children:s.jsx(Nt,{placeholder:"Select..."})}),e[16]=p):p=e[16];let v;e[17]!==c?(v=c.map(jr),e[17]=c,e[18]=v):v=e[18];let h;e[19]!==v?(h=s.jsx(St,{children:v}),e[19]=v,e[20]=h):h=e[20];let d;e[21]!==m||e[22]!==b||e[23]!==h?(d=s.jsxs(kt,{value:m,onValueChange:b,children:[p,h]}),e[21]=m,e[22]=b,e[23]=h,e[24]=d):d=e[24];let x;return e[25]!==d||e[26]!==g?(x=s.jsxs("div",{className:"space-y-2",children:[g,d]}),e[25]=d,e[26]=g,e[27]=x):x=e[27],x}function jr(t){const e=Xe(t);return s.jsx(bt,{value:e,children:vr(t)},e)}function Bt(t){return t.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[_-]/g," ").replace(/^\w/,e=>e.toUpperCase())}function Ne(t){return t.normalize("NFC").trim()}function ee(t,e){return Ne(t)===Ne(e)}function ct(t,e){return Ne(t).replace(/\s+/g,"").toLowerCase()===Ne(e).replace(/\s+/g,"").toLowerCase()}function De(t,e,n){const r=Ne(n);if(t.some(o=>ee(o,r)||ee(o,n)))return t;const i=[...t];return i.some(o=>ee(o,e))||i.push(e),i.push(n),i}function Nr(t,e,n){if(n.length===0)return n;const r=_e(t,e),i=n[0];return ee(i,r)||ee(i,t)?n.slice(1):n}function _e(t,e){return e.title??Bt(t)}function Ls(t,e){return e<=0?[]:t.slice(0,e)}function Ve(t,e){const n=Ne(e);return t.findIndex(r=>Ne(r)===n)}function ut(t,e){return t.type==="array"&&t.items||Me(t)?!0:Array.isArray(e)}function Sr(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)?t:{}}function $e(t,e,n,r){if(r.length===0)return null;const i=r[0];for(const o of t){const a=e[o];if(!a||!ut(a,n[o]))continue;const c=_e(o,a);if(ee(i,c)||ee(i,o)||r.some(u=>ee(u,c)||ee(u,o)))return o}for(const o of t){const a=e[o];if(!a||!ut(a,n[o]))continue;const c=n[o];if(!Array.isArray(c))continue;const u=a.items;for(let m=0;m<c.length;m++){const f=je(c[m],m,u);if(ee(f,i))return o}}for(const o of t){const a=e[o];if(a?.type!=="object"||!a.properties)continue;const c=Object.keys(a.properties),u=Sr(n[o]),m=_e(o,a);if($e(c,a.properties,u,r)||(ee(i,m)||ee(i,o))&&$e(c,a.properties,u,r.slice(1)))return o}let l=null;for(const o of t){const a=e[o];if(a?.type!=="block-ref")continue;const c=_e(o,a);if(!(i!==c&&i!==o)){if(r.length>1){const u=n[o];if(u&&typeof u=="object"&&!Array.isArray(u)){const m=r[1];if(Object.keys(u).some(y=>!y.startsWith("__")&&(ct(Bt(y),m)||ct(y,m))))return o}}l||(l=o)}}return l||null}function kr(t,e,n,r){return $e(t,e,n,r)}function Tr(t,e,n,r,i){if(i.length===0||!n.properties)return!1;const l=Object.keys(n.properties);if($e(l,n.properties,r,i))return!0;const o=i[0];return!ee(o,e)&&!ee(o,t)?!1:i.length>1||$e(l,n.properties,r,i.slice(1))!==null}function Cr(t,e,n,r){if(e.length===0)return null;for(let l=0;l<e.length;l++){const o=e[l],a=n.findIndex((c,u)=>ee(je(c,u,r),o));if(a>=0)return{index:a,innerPath:e.slice(l+1)}}const i=e.findIndex(l=>ee(l,t));if(i>=0&&e.length>i+1){const l=e[i+1],o=n.findIndex((a,c)=>ee(je(a,c,r),l));if(o>=0)return{index:o,innerPath:e.slice(i+2)}}return null}function Ke(t){return t.includes("/sections/")||t.includes("multivariate/section")||t===wt}function wr(t){if(t.type==="block-ref"&&t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Ke(n.resolveType));if(t.anyOfRefs?.length)return t.anyOfRefs.some(n=>Ke(n.resolveType));const e=t.properties?.__resolveType;return e?.type==="block-ref"&&e.anyOfRefs?.length?e.anyOfRefs.some(n=>Ke(n.resolveType)):!1}function Ar(t,e){if(e==="global"||e==="sections"||Me(t))return!0;const n=t.type==="array"?t.items:void 0;return n?wr(n):!1}function ft(t){return Array.from({length:t},(e,n)=>({id:crypto.randomUUID(),index:n}))}function _r(t,e,n,r,i){if(e?.type==="object"&&e.properties&&Object.keys(e.properties).length>0||e?.type==="block-ref"&&e.anyOfRefs?.length)return e;if(t!=null&&typeof t=="object"&&!Array.isArray(t)){const l=t.__resolveType;if(typeof l=="string"&&n){const o=We(l,n);if(o?.properties&&Object.keys(o.properties).length>0)return o}}if(n&&r&&i){const o=We(r,n)?.properties?.[i]?.items;if(o?.properties&&Object.keys(o.properties).length>0)return{...o,titleBy:o.titleBy??e?.titleBy}}return e}function Ir(t){const e=t.split(".").filter(n=>!/^\d+$/.test(n));return e[e.length-1]??t}function Et(t){return t.map((e,n)=>({...e,index:n}))}function Rr(t,e){if(e===t.length)return t;if(e<t.length)return Et(t.slice(0,e));const n=Array.from({length:e-t.length},(r,i)=>({id:crypto.randomUUID(),index:t.length+i}));return[...t,...n]}function Or(t){const e=X.c(8),{labelText:n,imageSrc:r}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Tt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[0]=i):i=e[0];let l;e[1]!==r?(l=r&&s.jsx("img",{src:r,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[1]=r,e[2]=l):l=e[2];let o;e[3]!==n?(o=s.jsx("span",{className:"min-w-0 truncate",children:n}),e[3]=n,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs(s.Fragment,{children:[i,s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2.5 text-sm",children:[l,o]})]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function $r(t){const e=X.c(37),{sortableId:n,labelText:r,imageSrc:i,onOpen:l,onRemove:o}=t;let a;e[0]!==n?(a={id:n,animateLayoutChanges:Dr},e[0]=n,e[1]=a):a=e[1];const{attributes:c,listeners:u,setNodeRef:m,transform:f,isDragging:y}=pn(a);let g;e[2]!==f?(g=mn.Transform.toString(f?{...f,x:0}:null),e[2]=f,e[3]=g):g=e[3];const b=y?0:void 0;let p;e[4]!==g||e[5]!==b?(p={transform:g,opacity:b},e[4]=g,e[5]=b,e[6]=p):p=e[6];const v=p;let h;e[7]!==l?(h=B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),l())},e[7]=l,e[8]=h):h=e[8];const d=y?"cursor-grabbing":"cursor-pointer";let x;e[9]!==d?(x=Se("group flex min-w-0 items-center gap-2.5 rounded-lg px-2 py-2.5 hover:bg-accent hover:text-accent-foreground touch-none",d),e[9]=d,e[10]=x):x=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Tt,{className:"size-3.5 shrink-0 text-muted-foreground/40"}),e[11]=k):k=e[11];let S;e[12]!==i?(S=i&&s.jsx("img",{src:i,alt:"",referrerPolicy:"no-referrer",className:"h-12 max-w-[100px] shrink-0 rounded object-cover"}),e[12]=i,e[13]=S):S=e[13];let T;e[14]!==r?(T=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:r}),e[14]=r,e[15]=T):T=e[15];const N=`Open actions for ${r}`;let C;e[16]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(Gt,{size:14}),e[16]=C):C=e[16];let w;e[17]!==N?(w=s.jsx(gn,{asChild:!0,children:s.jsx(Re,{type:"button",variant:"ghost",size:"icon","aria-label":N,className:"size-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:Lr,onPointerDown:Fr,children:C})}),e[17]=N,e[18]=w):w=e[18];let _;e[19]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(Ct,{size:14}),e[19]=_):_=e[19];let j;e[20]!==o?(j=s.jsx(xn,{align:"end",children:s.jsxs(vn,{className:"text-destructive focus:text-destructive",onClick:o,children:[_,"Delete"]})}),e[20]=o,e[21]=j):j=e[21];let I;e[22]!==w||e[23]!==j?(I=s.jsxs(bn,{children:[w,j]}),e[22]=w,e[23]=j,e[24]=I):I=e[24];let R;return e[25]!==c||e[26]!==r||e[27]!==u||e[28]!==l||e[29]!==m||e[30]!==v||e[31]!==T||e[32]!==I||e[33]!==h||e[34]!==x||e[35]!==S?(R=s.jsxs("div",{ref:m,style:v,...c,...u,role:"button",tabIndex:0,onClick:l,onKeyDown:h,className:x,title:r,children:[k,S,T,I]}),e[25]=c,e[26]=r,e[27]=u,e[28]=l,e[29]=m,e[30]=v,e[31]=T,e[32]=I,e[33]=h,e[34]=x,e[35]=S,e[36]=R):R=e[36],R}function Fr(t){return t.stopPropagation()}function Lr(t){return t.stopPropagation()}function Dr(){return!1}function Be(t){const e=X.c(24),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,containerResolveType:y,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}=t,h=a===void 0?[]:a,d=Array.isArray(r)?r:[],x=n.items,k=Ir(l),S=Ar(n,k),T=Cr(o,h,d,x),N=T?.index??null,[C,w]=te.useState(()=>ft(d.length)),[_,j]=te.useState(null),[I,R]=te.useState(l),[B,P]=te.useState(d.length),M=te.useRef(!1);I!==l?(R(l),P(d.length),w(ft(d.length))):B!==d.length&&(P(d.length),w(A=>Rr(A,d.length)));let E;e[0]!==x?(E=(A,D)=>je(A,D,x),e[0]=x,e[1]=E):E=e[1];const O=E,ne=A=>{if(M.current)return;const D=O(d[A],A);c?.(De(h,o,D))},re=A=>{const D=[...d,A];i(D);const Q=D.length-1,H=je(A,Q,x);c?.(De(h,o,H))},Z=()=>{const A=x?.type,D=x?.default!==void 0?x.default:A==="object"?{}:A==="block-ref"?(()=>{const pe=x?.anyOfRefs?.[0]?.resolveType;return typeof pe!="string"||Ee(pe)?{}:{__resolveType:pe}})():A==="number"||A==="integer"?0:A==="boolean"?!1:A==="array"?[]:"",Q=[...d,D];i(Q);const H=Q.length-1,de=je(D,H,x);c?.(De(h,o,de))},U=()=>{if(S){if(!g){Ae.error("Start the preview dev server to add sections.");return}if(p){p({append:re});return}Ae.error("Section picker is not available in this editor.");return}Z()},W=A=>{if(i(d.filter((D,Q)=>Q!==A)),N===A){const D=O(d[A],A),Q=Ve(h,D);c?.(Q>=0?h.slice(0,Q):[])}},Y=(A,D)=>{const Q=[...d];if(Q[A]=D,i(Q),A===N&&N!==null){const H=O(d[A],A),de=je(D,A,x);if(H!==de){const pe=Ve(h,H);if(pe>=0){const Je=[...h];Je[pe]=de,c?.(Je)}}}};let $;e[2]===Symbol.for("react.memo_cache_sentinel")?($={activationConstraint:{distance:8}},e[2]=$):$=e[2];let V;e[3]===Symbol.for("react.memo_cache_sentinel")?(V={coordinateGetter:hn},e[3]=V):V=e[3];const se=sn(nt(ln,$),nt(on,V)),F=C.map(Br);let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A=>{j(String(A.active.id))},e[4]=L):L=e[4];const G=L,le=A=>{j(null);const{active:D,over:Q}=A;if(!Q||D.id===Q.id)return;const H=F.indexOf(String(D.id)),de=F.indexOf(String(Q.id));H===-1||de===-1||(w(pe=>Et(rt([...pe],H,de))),i(rt([...d],H,de)),M.current=!0,requestAnimationFrame(()=>{M.current=!1}))};let J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=()=>{j(null)},e[5]=J):J=e[5];const he=J,ce=_?C.find(A=>A.id===_):null,ie=ce!=null?d[ce.index]:void 0,ye=ce!=null&&ie!==void 0?O(ie,ce.index):null,ae=ce!=null&&ie!==void 0?at(ie,x):void 0;if(N!==null&&N<d.length){const A=d[N],D=_r(A,x,u,y,k),Q=()=>{const H=O(A,N),de=De(h,o,H),pe=Ve(de,H);return pe>=0?de.slice(0,pe+1):de};return s.jsx("div",{className:"min-w-0",children:D?.type==="object"&&D.properties?s.jsx(Ze,{schema:D,value:A,onChange:H=>Y(N,H),basePath:`${l}.${N}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:H=>{c?.([...Q(),...H])},meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}):D?zt({schema:D,value:A,onChange:H=>Y(N,H),path:`${l}.${N}`,label:D.title??`Item ${N+1}`,breadcrumbPath:T?.innerPath??[],onBreadcrumbChange:H=>{c?.([...Q(),...H])},meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:g,onAddSectionItem:b,onRequestAddSection:p,sandbox:v}):null})}const K="space-y-2";let q;e[6]!==o?(q=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[6]=o,e[7]=q):q=e[7];const z=d.length>0&&s.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:d.length});let oe;e[8]!==q||e[9]!==z?(oe=s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[q,z]}),e[8]=q,e[9]=z,e[10]=oe):oe=e[10];let ue;e[11]!==n.description?(ue=n.description&&s.jsx("p",{className:"break-words text-xs leading-normal text-muted-foreground",children:n.description}),e[11]=n.description,e[12]=ue):ue=e[12];let ve;e[13]!==oe||e[14]!==ue?(ve=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[oe,ue]}),e[13]=oe,e[14]=ue,e[15]=ve):ve=e[15];const we=d.length>0&&s.jsx("div",{className:Se(_&&"cursor-grabbing"),children:s.jsxs(an,{sensors:se,collisionDetection:cn,onDragStart:G,onDragEnd:le,onDragCancel:he,children:[s.jsx(un,{items:F,strategy:fn,children:s.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border/50 p-1.5",children:C.map(A=>{const D=d[A.index];if(D===void 0)return null;const Q=O(D,A.index),H=at(D,x);return s.jsx($r,{sortableId:A.id,labelText:Q,imageSrc:H,onOpen:()=>ne(A.index),onRemove:()=>W(A.index)},A.id)})})}),s.jsx(dn,{dropAnimation:null,children:ye?s.jsx("div",{className:"flex min-w-0 items-center gap-2.5 rounded-lg border border-border/60 bg-background px-2 py-2.5 shadow-lg ring-1 ring-border/60",children:s.jsx(Or,{labelText:ye,imageSrc:ae})}):null})]})});let ke;e[16]===Symbol.for("react.memo_cache_sentinel")?(ke=s.jsx(yn,{size:14}),e[16]=ke):ke=e[16];const be=S?"Add section":"Add item";let fe;e[17]!==U||e[18]!==be?(fe=s.jsxs("button",{type:"button",onClick:U,className:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-border/60 py-2.5 text-sm text-muted-foreground transition-colors hover:border-border hover:bg-muted/30",children:[ke,be]}),e[17]=U,e[18]=be,e[19]=fe):fe=e[19];let Te;return e[20]!==ve||e[21]!==we||e[22]!==fe?(Te=s.jsxs("div",{className:K,children:[ve,we,fe]}),e[20]=ve,e[21]=we,e[22]=fe,e[23]=Te):Te=e[23],Te}function Br(t){return t.id}function Er(t){const e=X.c(44),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:y,onAddSectionItem:g,onRequestAddSection:b,sandbox:p}=t;let v;e[0]!==a?(v=a===void 0?[]:a,e[0]=a,e[1]=v):v=e[1];const h=v,[d,x]=te.useState(!1);let k;e[2]!==r?(k=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},e[2]=r,e[3]=k):k=e[3];const S=k;if(!n.properties)return null;let T;e[4]!==l?(T=l.split(".").pop()??l,e[4]=l,e[5]=T):T=e[5];const N=T;let C;e[6]!==h||e[7]!==N||e[8]!==o||e[9]!==S||e[10]!==n?(C=Tr(N,o,n,S,h),e[6]=h,e[7]=N,e[8]=o,e[9]=S,e[10]=n,e[11]=C):C=e[11];const _=d||C,j=`${l}-fields`;let I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=()=>x(zr),e[12]=I):I=e[12];let R;e[13]!==_?(R=s.jsx("span",{className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors group-hover:text-accent-foreground",children:_?s.jsx(_t,{size:16}):s.jsx(It,{size:16})}),e[13]=_,e[14]=R):R=e[14];let B;e[15]!==o?(B=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:o}),e[15]=o,e[16]=B):B=e[16];let P;e[17]!==j||e[18]!==_||e[19]!==R||e[20]!==B?(P=s.jsxs("button",{type:"button","aria-expanded":_,"aria-controls":j,onClick:I,className:"group flex w-full min-w-0 items-center gap-2 rounded-md py-1.5 pr-2 text-left transition-colors hover:bg-accent hover:text-accent-foreground",children:[R,B]}),e[17]=j,e[18]=_,e[19]=R,e[20]=B,e[21]=P):P=e[21];let M;e[22]!==n.description?(M=n.description&&s.jsx("p",{className:"break-words pl-9 text-xs leading-normal text-muted-foreground",children:n.description}),e[22]=n.description,e[23]=M):M=e[23];let E;e[24]!==h||e[25]!==j||e[26]!==m||e[27]!==_||e[28]!==u||e[29]!==S||e[30]!==g||e[31]!==c||e[32]!==i||e[33]!==b||e[34]!==f||e[35]!==l||e[36]!==y||e[37]!==p||e[38]!==n?(E=_&&s.jsx("div",{id:j,className:"ml-3 min-w-0 max-w-full overflow-hidden border-l border-border/80 pl-5",children:s.jsx(Ze,{schema:n,value:S,onChange:i,basePath:l,breadcrumbPath:h,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,previewBaseUrl:y,onAddSectionItem:g,onRequestAddSection:b,sandbox:p})}),e[24]=h,e[25]=j,e[26]=m,e[27]=_,e[28]=u,e[29]=S,e[30]=g,e[31]=c,e[32]=i,e[33]=b,e[34]=f,e[35]=l,e[36]=y,e[37]=p,e[38]=n,e[39]=E):E=e[39];let O;return e[40]!==M||e[41]!==E||e[42]!==P?(O=s.jsxs("div",{className:"min-w-0 space-y-2",children:[P,M,E]}),e[40]=M,e[41]=E,e[42]=P,e[43]=O):O=e[43],O}function zr(t){return!t}function Pr(t){if(!t?.properties)return{};const e={};for(const[n,r]of Object.entries(t.properties))n.startsWith("__")||n==="@type"||(r.default!==void 0?e[n]=r.default:r.type==="boolean"?e[n]=!1:r.type==="string"?e[n]="":r.type==="number"||r.type==="integer"?e[n]=0:r.type==="object"&&(e[n]={}));return e}function Mr(t){const e=X.c(3),{blockKey:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(In,{asChild:!0,children:s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-global-section/14 px-1.5 py-0.5 text-[11px] font-medium text-global-section-fg dark:text-global-section-fg-dark",children:[s.jsx(_n,{size:11}),"Global"]})}),e[0]=r):r=e[0];let i;return e[1]!==n?(i=s.jsxs(Rn,{children:[r,s.jsxs(On,{side:"top",className:"max-w-[260px]",children:["Edits the saved block “",n,"”. Changes apply everywhere this loader is referenced on your site."]})]}),e[1]=n,e[2]=i):i=e[2],i}function Ur(t){const e=X.c(28),{path:n,open:r,onOpenChange:i,title:l,nested:o,nestedBlockRef:a,globalBlockKey:c}=t,u=`${n}-loader-config`,m=a&&"ml-1";let f;e[0]!==m?(f=Se("rounded-lg border border-border/80 bg-muted/30",m),e[0]=m,e[1]=f):f=e[1];let y;e[2]!==i||e[3]!==r?(y=()=>i(!r),e[2]=i,e[3]=r,e[4]=y):y=e[4];let g;e[5]!==r?(g=s.jsx("span",{className:"flex size-6 shrink-0 items-center justify-center text-muted-foreground transition-colors group-hover:text-foreground",children:r?s.jsx(_t,{size:16}):s.jsx(It,{size:16})}),e[5]=r,e[6]=g):g=e[6];let b;e[7]!==l?(b=s.jsx("span",{className:"truncate text-xs font-medium tracking-wide text-muted-foreground uppercase",children:l}),e[7]=l,e[8]=b):b=e[8];let p;e[9]!==c?(p=c&&s.jsx(Mr,{blockKey:c}),e[9]=c,e[10]=p):p=e[10];let v;e[11]!==b||e[12]!==p?(v=s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[b,p]}),e[11]=b,e[12]=p,e[13]=v):v=e[13];let h;e[14]!==u||e[15]!==r||e[16]!==y||e[17]!==g||e[18]!==v?(h=s.jsxs("button",{type:"button","aria-expanded":r,"aria-controls":u,onClick:y,className:"group flex w-full min-w-0 items-center gap-2 rounded-lg px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[g,v]}),e[14]=u,e[15]=r,e[16]=y,e[17]=g,e[18]=v,e[19]=h):h=e[19];let d;e[20]!==u||e[21]!==o||e[22]!==r?(d=r&&s.jsx("div",{id:u,className:"border-t border-border/60 px-4 pb-4 pt-3",children:s.jsx("div",{className:"border-l border-border/80 pl-4",children:o})}),e[20]=u,e[21]=o,e[22]=r,e[23]=d):d=e[23];let x;return e[24]!==f||e[25]!==h||e[26]!==d?(x=s.jsxs("div",{className:f,children:[h,d]}),e[24]=f,e[25]=h,e[26]=d,e[27]=x):x=e[27],x}function dt(t){const e=X.c(35),{schema:n,value:r,onChange:i,path:l,label:o,breadcrumbPath:a,onBreadcrumbChange:c,meta:u,decofile:m,onSaveReferencedBlock:f,sandbox:y}=t,g=(n.anyOfRefs??[]).filter(Hr),b=m&&r?tr(r,m):null,p=b?.data??r,v=b?null:Rt(p),h=v??p,d=Hn(g,{savedBlockKey:b?.blockKey,editorValue:p}),x=d.length>0?Wn(p,d,b?.blockKey):d[0]?.resolveType??"",S=n.type==="block-ref"&&d.some(Kr);let T;e[0]!==o||e[1]!==l?(T=o??(l.includes(".")?l.split(".")[0]:l),e[0]=o,e[1]=l,e[2]=T):T=e[2];const N=T;let C;e[3]!==a?(C=a??[],e[3]=a,e[4]=C):C=e[4];const w=C,_=S&&w[0]===N?w.slice(1):w,j=S?$=>{c?.([N,...$])}:c,[I,R]=te.useState(x),[B,P]=te.useState(x);B!==x&&(P(x),R(x));const[M,E]=te.useState(()=>Yn(p,b?.blockKey));if(d.length>0){const $=I||x;let V;e[5]!==$?(V=z=>z.resolveType===$,e[5]=$,e[6]=V):V=e[6];const se=d.find(V),F=lt(p,u,se?.schema),L=qn(F??se?.schema??null,n.discriminatorKey),G=n.discriminatorKey,le=z=>{R(z);const oe=d.find(fe=>fe.resolveType===z),ue=lt(p,u,oe?.schema),ve=new Set(Object.keys((ue??oe?.schema)?.properties??{})),we=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:{},ke=Object.fromEntries(Object.entries(we).filter(fe=>{const[Te]=fe;return ve.has(Te)})),be={...Pr(oe?.schema),...ke};if(G){const fe=oe?.discriminatorValue??z;i({...be,[G]:fe});return}if(Ee(z)){i(be);return}i({...be,__resolveType:z})};let J;e[7]!==$||e[8]!==G||e[9]!==i?(J=z=>{if(G||!Ee($)||z===null||typeof z!="object"||Array.isArray(z)){i(z);return}const{__resolveType:oe,...ue}=z;i(ue)},e[7]=$,e[8]=G,e[9]=i,e[10]=J):J=e[10];const he=J,ce=L?.properties?s.jsx(Ze,{schema:L,value:h,onChange:z=>{if(b&&f){f(b.blockKey,z);return}if(v){i({...p,section:z});return}he(z)},basePath:l,breadcrumbPath:_,onBreadcrumbChange:j,meta:u,decofile:m,onSaveReferencedBlock:f,sandbox:y}):null;let ie;e[11]!==l?(ie=l.includes("."),e[11]=l,e[12]=ie):ie=e[12];const ye=ie;let ae;e[13]!==o||e[14]!==l?(ae=s.jsx(me,{htmlFor:l,children:o}),e[13]=o,e[14]=l,e[15]=ae):ae=e[15];let K;e[16]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(jt,{children:s.jsx(Nt,{placeholder:"Select..."})}),e[16]=K):K=e[16];let q;return e[17]!==n.description?(q=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[17]=n.description,e[18]=q):q=e[18],s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[ae,s.jsxs(kt,{value:$||void 0,onValueChange:le,children:[K,s.jsx(St,{children:d.map(Vr)})]}),q]}),ce&&(S?s.jsx(Ur,{path:l,open:M,onOpenChange:E,title:ye?"Configuration":"Loader configuration",nested:ce,nestedBlockRef:ye,globalBlockKey:b?.blockKey}):ce)]})}if(n.anyOfRefs&&n.anyOfRefs.length>0)return null;let O;e[19]!==o||e[20]!==l?(O=s.jsx(me,{htmlFor:l,children:o}),e[19]=o,e[20]=l,e[21]=O):O=e[21];const ne=r!=null?String(r):"";let re;e[22]!==i?(re=$=>i($.target.value),e[22]=i,e[23]=re):re=e[23];const Z=n.description??"";let U;e[24]!==l||e[25]!==ne||e[26]!==re||e[27]!==Z?(U=s.jsx("input",{id:l,type:"text",value:ne,onChange:re,className:"w-full rounded-md border bg-background px-3 py-1.5 text-sm",placeholder:Z}),e[24]=l,e[25]=ne,e[26]=re,e[27]=Z,e[28]=U):U=e[28];let W;e[29]!==n.description?(W=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[29]=n.description,e[30]=W):W=e[30];let Y;return e[31]!==O||e[32]!==U||e[33]!==W?(Y=s.jsxs("div",{className:"space-y-1.5",children:[O,U,W]}),e[31]=O,e[32]=U,e[33]=W,e[34]=Y):Y=e[34],Y}function Vr(t){const e=t.title&&!t.title.includes("/")?t.title:Nn(t.resolveType)??qe(t.resolveType);return s.jsx(bt,{value:t.resolveType,children:e},t.resolveType)}function Kr(t){return t.resolveType.includes("/")&&!Ee(t.resolveType)}function Hr(t){return t.resolveType!==""}function Wr(t){if(!Array.isArray(t))return[];const e=[];for(const n of t)if(typeof n=="string")e.push({value:n,label:n});else if(n&&typeof n=="object"&&"value"in n){const r=n;e.push({value:String(r.value),label:typeof r.label=="string"?r.label:String(r.value),image:typeof r.image=="string"?r.image:void 0})}return e}async function qr(t,e,n){const r={};n&&(r.term=n);const l=`${t.replace(/\/+$/,"")}/deco/invoke/${e}`,o=await fetch(l,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Failed to fetch dynamic options: ${o.status}`);const a=await o.json();return Wr(a)}function pt(t){const e=X.c(8),{path:n,label:r,description:i}=t;let l;e[0]!==r||e[1]!==n?(l=s.jsx(me,{htmlFor:n,children:r}),e[0]=r,e[1]=n,e[2]=l):l=e[2];let o;e[3]!==i?(o=i&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:i}),e[3]=i,e[4]=o):o=e[4];let a;return e[5]!==l||e[6]!==o?(a=s.jsxs("div",{className:"space-y-0.5",children:[l,o]}),e[5]=l,e[6]=o,e[7]=a):a=e[7],a}function Yr(t){const e=X.c(71),{schema:n,value:r,onChange:i,path:l,label:o,sandbox:a}=t,c=n.options,u=a?.previewUrl,[m,f]=te.useState(!1),[y,g]=te.useState(""),[b,p]=te.useState(""),v=te.useRef(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=F=>{g(F),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{p(F)},300)},e[0]=h):h=e[0];const d=h,x=a?`${a.orgSlug}/${a.virtualMcpId}/${a.branch}`:"";let k;e[1]!==b||e[2]!==c||e[3]!==x?(k=Mt.sandboxInvoke(x,`dynamic-options:${c??""}:${b}`),e[1]=b,e[2]=c,e[3]=x,e[4]=k):k=e[4];let S;e[5]!==b||e[6]!==c||e[7]!==u?(S=()=>qr(u,c,b||void 0),e[5]=b,e[6]=c,e[7]=u,e[8]=S):S=e[8];const T=!!u&&!!c&&m;let N;e[9]!==k||e[10]!==S||e[11]!==T?(N={queryKey:k,queryFn:S,enabled:T,staleTime:6e4,retry:1},e[9]=k,e[10]=S,e[11]=T,e[12]=N):N=e[12];const C=Pt(N);let w;e[13]!==C.data?(w=C.data??[],e[13]=C.data,e[14]=w):w=e[14];const _=w,j=typeof r=="string"?r:"";let I;if(e[15]!==j||e[16]!==_){let F;e[18]!==j?(F=L=>L.value===j,e[18]=j,e[19]=F):F=e[19],I=_.find(F),e[15]=j,e[16]=_,e[17]=I}else I=e[17];const R=I;if(!u||!c){let F;e[20]!==o||e[21]!==l||e[22]!==n.description?(F=s.jsx(pt,{path:l,label:o,description:n.description}),e[20]=o,e[21]=l,e[22]=n.description,e[23]=F):F=e[23];let L;e[24]!==i?(L=J=>i(J.target.value),e[24]=i,e[25]=L):L=e[25];let G;e[26]!==j||e[27]!==l||e[28]!==L?(G=s.jsx(xe,{id:l,type:"text",value:j,onChange:L}),e[26]=j,e[27]=l,e[28]=L,e[29]=G):G=e[29];let le;return e[30]!==G||e[31]!==F?(le=s.jsxs("div",{className:"space-y-2",children:[F,G]}),e[30]=G,e[31]=F,e[32]=le):le=e[32],le}let B;e[33]!==o||e[34]!==l||e[35]!==n.description?(B=s.jsx(pt,{path:l,label:o,description:n.description}),e[33]=o,e[34]=l,e[35]=n.description,e[36]=B):B=e[36];let P;e[37]!==j||e[38]!==R?(P=R?s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[R.image&&s.jsx("img",{src:R.image,alt:"",referrerPolicy:"no-referrer",className:"h-6 w-6 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:R.label??R.value})]}):j?s.jsx("span",{className:"truncate",children:j}):s.jsx("span",{className:"text-muted-foreground",children:"Select..."}),e[37]=j,e[38]=R,e[39]=P):P=e[39];let M;e[40]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsx(Fn,{className:"size-4 shrink-0 opacity-50"}),e[40]=M):M=e[40];let E;e[41]!==m||e[42]!==P?(E=s.jsx(gt,{asChild:!0,children:s.jsxs(Re,{variant:"outline",role:"combobox","aria-expanded":m,className:"h-10 w-full justify-between font-normal",children:[P,M]})}),e[41]=m,e[42]=P,e[43]=E):E=e[43];let O;e[44]===Symbol.for("react.memo_cache_sentinel")?(O={width:"var(--radix-popover-trigger-width)"},e[44]=O):O=e[44];let ne;e[45]!==y?(ne=s.jsx(Ln,{placeholder:"Search...",className:"h-9",value:y,onValueChange:d}),e[45]=y,e[46]=ne):ne=e[46];const re=C.isLoading?"Loading...":"No results found.";let Z;e[47]!==re?(Z=s.jsx(Dn,{children:re}),e[47]=re,e[48]=Z):Z=e[48];let U;if(e[49]!==j||e[50]!==i||e[51]!==_){let F;e[53]!==j||e[54]!==i?(F=L=>s.jsxs(Bn,{value:L.value,onSelect:()=>{i(L.value===j?"":L.value),f(!1)},children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[L.image&&s.jsx("img",{src:L.image,alt:"",referrerPolicy:"no-referrer",className:"h-9 w-9 shrink-0 rounded object-cover"}),s.jsx("span",{className:"truncate",children:L.label??L.value})]}),s.jsx($n,{className:Se("ml-auto size-4 shrink-0",j===L.value?"opacity-100":"opacity-0")})]},L.value),e[53]=j,e[54]=i,e[55]=F):F=e[55],U=_.map(F),e[49]=j,e[50]=i,e[51]=_,e[52]=U}else U=e[52];let W;e[56]!==U?(W=s.jsx(En,{children:U}),e[56]=U,e[57]=W):W=e[57];let Y;e[58]!==Z||e[59]!==W?(Y=s.jsxs(zn,{children:[Z,W]}),e[58]=Z,e[59]=W,e[60]=Y):Y=e[60];let $;e[61]!==ne||e[62]!==Y?($=s.jsx(xt,{className:"p-0",style:O,children:s.jsxs(Pn,{shouldFilter:!1,children:[ne,Y]})}),e[61]=ne,e[62]=Y,e[63]=$):$=e[63];let V;e[64]!==m||e[65]!==E||e[66]!==$?(V=s.jsxs(vt,{open:m,onOpenChange:f,children:[E,$]}),e[64]=m,e[65]=E,e[66]=$,e[67]=V):V=e[67];let se;return e[68]!==V||e[69]!==B?(se=s.jsxs("div",{className:"space-y-2",children:[B,V]}),e[68]=V,e[69]=B,e[70]=se):se=e[70],se}function mt(t){const e=X.c(2),{ext:n}=t;if(!n)return null;let r;return e[0]!==n?(r=s.jsx("span",{className:"shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium uppercase text-muted-foreground",children:n}),e[0]=n,e[1]=r):r=e[1],r}function Gr(t){try{const e=new URL(t).pathname;return decodeURIComponent(e.split("/").pop()??t)}catch{return t.split("/").pop()??t}}function Qr(t){const e=t.lastIndexOf(".");return e<0||e===t.length-1?"":t.slice(e+1).toLowerCase()}function ht(t){const e=X.c(79),{schema:n,value:r,onChange:i,path:l,label:o,sandbox:a}=t,c=n.format==="video-uri",u=At(r),[m,f]=te.useState(!1),[y,g]=te.useState(!1),b=u?Gr(u):"",p=b?Qr(b):"",v=Un(),h=Tn();let d;e[0]!==v.data?.configs?(d=v.data?.configs??[],e[0]=v.data?.configs,e[1]=d):d=e[1];const x=a?.siteSlug;let k;e[2]!==d||e[3]!==x?(k=Cn(d,x),e[2]=d,e[3]=x,e[4]=k):k=e[4];const S=k;let T;e[5]!==v.data?.configs||e[6]!==S?(T=function(){if(S)return S.id;const K=v.data?.configs??[];if(K.length===1)return K[0].id;if(K.length===0)return null;const q=typeof window<"u"?window.localStorage.getItem(wn):null;return K.some(z=>z.id===q)?q:null},e[5]=v.data?.configs,e[6]=S,e[7]=T):T=e[7];const N=T;let C;e[8]!==c||e[9]!==i||e[10]!==N||e[11]!==f||e[12]!==h?(C=async function(K){if(!K)return;let q=Array.from(K);if(q.length===0)return;if(c&&(q=q.filter(Xr),q.length===0)){Ae.error("Please drop a video file (mp4, webm, …).");return}const z=N();if(!z){f(!0);return}try{const oe=await h.mutateAsync({configId:z,file:q[0]});i(oe.publicUrl),q.length>1&&Ae.info(`Uploaded ${q[0].name}; extra files were ignored (single-select field).`)}catch(oe){const ue=oe;Ae.error(ue instanceof Error?ue.message:"Upload failed")}},e[8]=c,e[9]=i,e[10]=N,e[11]=f,e[12]=h,e[13]=C):C=e[13];const w=C;let _;e[14]!==g?(_=function(K){K.preventDefault(),K.dataTransfer.types.includes("Files")&&g(!0)},e[14]=g,e[15]=_):_=e[15];const j=_;let I;e[16]!==g?(I=function(K){K.currentTarget===K.target&&g(!1)},e[16]=g,e[17]=I):I=e[17];const R=I;let B;e[18]!==w||e[19]!==g?(B=function(K){K.preventDefault(),g(!1),w(K.dataTransfer.files)},e[18]=w,e[19]=g,e[20]=B):B=e[20];const P=B;let M;e[21]!==o||e[22]!==l?(M=s.jsx(me,{htmlFor:l,className:"text-muted-foreground",children:o}),e[21]=o,e[22]=l,e[23]=M):M=e[23];let E;e[24]!==n.description?(E=n.description&&s.jsx("p",{className:"text-xs leading-normal text-muted-foreground",children:n.description}),e[24]=n.description,e[25]=E):E=e[25];let O;e[26]!==E||e[27]!==M?(O=s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[M,E]}),e[26]=E,e[27]=M,e[28]=O):O=e[28];const ne=y&&"border-primary ring-2 ring-primary/30",re=h.isPending&&"pointer-events-none opacity-60";let Z;e[29]!==ne||e[30]!==re?(Z=Se("group relative w-full overflow-hidden rounded-xl border border-border/60 bg-muted/30 transition",ne,re),e[29]=ne,e[30]=re,e[31]=Z):Z=e[31];let U;e[32]!==p||e[33]!==b||e[34]!==c||e[35]!==f||e[36]!==u||e[37]!==h.isPending?(U=u?c?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative h-40 w-full overflow-hidden bg-black",children:s.jsx("video",{src:u,preload:"metadata",className:"h-full w-full object-contain"},u)}),s.jsxs("div",{className:"flex items-center gap-2 border-t border-border/60 bg-background/50 px-3 py-2",children:[s.jsx(et,{size:14,className:"shrink-0 text-muted-foreground"}),s.jsx("p",{className:"min-w-0 flex-1 truncate text-xs text-muted-foreground",children:b}),s.jsx(mt,{ext:p})]})]}):s.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[s.jsx("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-md bg-background",children:s.jsx(tt,{size:18,className:"text-muted-foreground"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:b}),s.jsx("p",{className:"truncate text-xs text-muted-foreground",children:u})]}),s.jsx(mt,{ext:p})]}):s.jsxs("button",{type:"button",onClick:()=>f(!0),className:"flex w-full flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground hover:bg-muted/60 hover:text-foreground",children:[c?s.jsx(et,{size:20}):s.jsx(tt,{size:20}),s.jsx("span",{className:"text-sm font-medium",children:h.isPending?"Uploading…":c?"Drop a video here or click to browse":"Drop a file or click to browse"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"Up to 100 MB"})]}),e[32]=p,e[33]=b,e[34]=c,e[35]=f,e[36]=u,e[37]=h.isPending,e[38]=U):U=e[38];let W;e[39]!==y?(W=y&&s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center bg-primary/10 backdrop-blur-[1px]",children:s.jsx("span",{className:"rounded-md bg-background px-3 py-1.5 text-xs font-medium shadow",children:"Drop to upload"})}),e[39]=y,e[40]=W):W=e[40];let Y;e[41]!==R||e[42]!==j||e[43]!==P||e[44]!==Z||e[45]!==U||e[46]!==W?(Y=s.jsxs("div",{onDragOver:j,onDragLeave:R,onDrop:P,className:Z,children:[U,W]}),e[41]=R,e[42]=j,e[43]=P,e[44]=Z,e[45]=U,e[46]=W,e[47]=Y):Y=e[47];let $;e[48]!==i?($=ae=>i(ae.target.value),e[48]=i,e[49]=$):$=e[49];let V;e[50]!==l||e[51]!==u||e[52]!==$?(V=s.jsx(xe,{id:l,type:"url",value:u,onChange:$,placeholder:"https://...",className:"h-9 min-w-0 flex-1"}),e[50]=l,e[51]=u,e[52]=$,e[53]=V):V=e[53];let se;e[54]!==f?(se=()=>f(!0),e[54]=f,e[55]=se):se=e[55];let F;e[56]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(Mn,{size:14}),e[56]=F):F=e[56];const L=u?"Replace":"Browse";let G;e[57]!==se||e[58]!==L?(G=s.jsxs(Re,{type:"button",variant:"outline",size:"sm",onClick:se,className:"h-9 shrink-0",children:[F,L]}),e[57]=se,e[58]=L,e[59]=G):G=e[59];let le;e[60]!==i||e[61]!==u?(le=u&&s.jsx(Re,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(""),className:"h-9 shrink-0","aria-label":"Remove file",children:s.jsx(Ct,{size:14})}),e[60]=i,e[61]=u,e[62]=le):le=e[62];let J;e[63]!==V||e[64]!==G||e[65]!==le?(J=s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-2",children:[V,G,le]}),e[63]=V,e[64]=G,e[65]=le,e[66]=J):J=e[66];let he;e[67]!==i?(he=ae=>i(ae),e[67]=i,e[68]=he):he=e[68];const ce=S?.id??null;let ie;e[69]!==m||e[70]!==f||e[71]!==he||e[72]!==ce?(ie=s.jsx(An,{open:m,onOpenChange:f,mode:"any",onSelect:he,lockedConfigId:ce}),e[69]=m,e[70]=f,e[71]=he,e[72]=ce,e[73]=ie):ie=e[73];let ye;return e[74]!==O||e[75]!==Y||e[76]!==J||e[77]!==ie?(ye=s.jsxs("div",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)] gap-2",children:[O,Y,J,ie]}),e[74]=O,e[75]=Y,e[76]=J,e[77]=ie,e[78]=ye):ye=e[78],ye}function Xr(t){return t.type.startsWith("video/")}const Zr="website/loaders/secret.ts";function Ie(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t.__resolveType;return typeof e=="string"&&(e.endsWith("/secret.ts")||e.includes("loaders/secret"))}function Jr(){return{__resolveType:Zr,name:"",encrypted:""}}function es(t){const{value:e,...n}=t;return n}function He(t){const e=X.c(45),{schema:n,value:r,onChange:i,label:l,path:o}=t;if(typeof r=="string"||r==null&&!Ie(r)){const N=typeof r=="string"?r:"";let C;e[0]!==l||e[1]!==o?(C=s.jsx(me,{htmlFor:o,className:"text-sm font-medium",children:l}),e[0]=l,e[1]=o,e[2]=C):C=e[2];let w;e[3]!==n.description?(w=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[3]=n.description,e[4]=w):w=e[4];let _;e[5]!==i?(_=R=>i(R.target.value),e[5]=i,e[6]=_):_=e[6];let j;e[7]!==o||e[8]!==N||e[9]!==_?(j=s.jsx(xe,{id:o,type:"password",value:N,autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:"Secret value",onChange:_,className:"h-10"}),e[7]=o,e[8]=N,e[9]=_,e[10]=j):j=e[10];let I;return e[11]!==C||e[12]!==w||e[13]!==j?(I=s.jsxs("div",{className:"space-y-2",children:[C,w,j]}),e[11]=C,e[12]=w,e[13]=j,e[14]=I):I=e[14],I}let a;e[15]!==r?(a=Ie(r)?r:Jr(),e[15]=r,e[16]=a):a=e[16];const c=a,u=typeof c.name=="string"?c.name:"",m=typeof c.encrypted=="string"&&c.encrypted,f=`${o}-name`;let y;e[17]!==l||e[18]!==f?(y=s.jsx(me,{htmlFor:f,className:"text-sm font-medium",children:l}),e[17]=l,e[18]=f,e[19]=y):y=e[19];let g;e[20]!==n.description?(g=n.description&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.description}),e[20]=n.description,e[21]=g):g=e[21];const b=`${o}-name`;let p;e[22]!==c||e[23]!==i?(p=N=>i({...c,name:N.target.value}),e[22]=c,e[23]=i,e[24]=p):p=e[24];let v;e[25]!==u||e[26]!==b||e[27]!==p?(v=s.jsx(xe,{id:b,value:u,placeholder:"Secret name",onChange:p,className:"h-10"}),e[25]=u,e[26]=b,e[27]=p,e[28]=v):v=e[28];const h=`${o}-value`,d=m?"Leave blank to keep current value":"Secret value";let x;e[29]!==c||e[30]!==m||e[31]!==i?(x=N=>{const C=N.target.value;if(!C){i(m?es(c):c);return}i({...c,value:C})},e[29]=c,e[30]=m,e[31]=i,e[32]=x):x=e[32];let k;e[33]!==x||e[34]!==h||e[35]!==d?(k=s.jsx(xe,{id:h,type:"password",autoComplete:"new-password",autoCorrect:"off",spellCheck:!1,placeholder:d,onChange:x,className:"h-10"}),e[33]=x,e[34]=h,e[35]=d,e[36]=k):k=e[36];let S;e[37]!==m?(S=m&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"A secret value is stored."}),e[37]=m,e[38]=S):S=e[38];let T;return e[39]!==k||e[40]!==S||e[41]!==y||e[42]!==g||e[43]!==v?(T=s.jsxs("div",{className:"space-y-2",children:[y,g,v,k,S]}),e[39]=k,e[40]=S,e[41]=y,e[42]=g,e[43]=v,e[44]=T):T=e[44],T}function ts(t){const e=t.length>0?t[0]:void 0;if(e==null||typeof e!="object"||Array.isArray(e))return;const n={};for(const[r,i]of Object.entries(e))r.startsWith("__")||(typeof i=="string"?n[r]={type:"string"}:typeof i=="number"?n[r]={type:"number"}:typeof i=="boolean"&&(n[r]={type:"boolean"}));return Object.keys(n).length>0?{type:"object",properties:n}:void 0}const ns=new Set(["__resolveType","@type"]);function rs(t){if(t.type!=="block-ref"||!t.anyOfRefs?.length||t.anyOfRefs.length!==1)return null;const e=t.anyOfRefs[0].resolveType;return e.endsWith("/multivariate/image.ts")?"image":e.endsWith("/multivariate/video.ts")||e.endsWith("/multivariate/file.ts")?"file":null}function ss(t){if(Me(t))for(const e of t.anyOfRefs??[]){const i=e.schema?.properties?.variants?.items?.properties?.value;if(i?.type==="array"&&i.items)return i.items}}function yt(t){if(t.type==="array"&&t.items)return t;const e=t.items??ss(t);return e?{...t,type:"array",items:e}:null}function is(t,e){if(e!==void 0)return e;switch(t){case"string":return"";case"number":case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return null}}function zt(t){const{schema:e,value:n}=t;if(it(n)){const o=Sn(n),a=yt(e);if(o!==null&&a)return s.jsx(Be,{...t,schema:a,value:o,onChange:c=>t.onChange(kn(n,c))},t.path)}if(Array.isArray(n)&&e.type==="block-ref"&&Me(e)){const o=yt(e);if(o)return s.jsx(Be,{...t,schema:o,value:n,onChange:t.onChange},t.path)}if(Array.isArray(n)&&!it(n)&&e.type==="block-ref"){const o=ts(n);if(o){const a={...e,type:"array",items:o};return s.jsx(Be,{...t,schema:a,value:n,onChange:t.onChange},t.path)}}if(e.type==="block-ref"||n!==null&&typeof n=="object"&&!Array.isArray(n)&&typeof n.__resolveType=="string"&&e.anyOfRefs){const o=rs(e);return o==="image"?s.jsx(ot,{...t},t.path):o==="file"?s.jsx(ht,{...t},t.path):e.anyOfRefs?s.jsx(dt,{...t},t.path):null}if(e.format==="image-uri")return s.jsx(ot,{...t},t.path);if(e.format==="file-uri"||e.format==="video-uri")return s.jsx(ht,{...t},t.path);if(e.format==="dynamic-options"&&e.options)return s.jsx(Yr,{...t},t.path);if(e.enum&&e.enum.length>0)return s.jsx(br,{...t},t.path);if(e.type==="anyOf")return s.jsx(dt,{...t},t.path);if(Ie(n)||e.format==="password"||n==null&&e.format==="password")return s.jsx(He,{...t},t.path);const r=n??is(e.type,e.default);if(r==null)return Ie(n)?s.jsx(He,{...t},t.path):null;if(Ie(r))return s.jsx(He,{...t,value:r},t.path);const i={...t,value:r},l=n==null?e.type??typeof r:Array.isArray(r)?"array":typeof r;if(l==="array"||Array.isArray(r))return s.jsx(Be,{...i},t.path);switch(l){case"boolean":return s.jsx(yr,{...i},t.path);case"number":case"integer":return s.jsx(hr,{...i},t.path);case"string":{const o=e.format;return o==="color-input"?s.jsx(Le,{...i},t.path):o==="textarea"||o==="rich-text"||o==="html"?s.jsx(Le,{...i},t.path):s.jsx(Le,{...i},t.path)}case"object":return r!==null&&typeof r=="object"&&!Array.isArray(r)?s.jsx(Er,{...i},t.path):null;default:return s.jsx(Le,{...i},t.path)}}function Ze(t){const e=X.c(16),{schema:n,value:r,onChange:i,basePath:l,breadcrumbPath:o,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:m,previewBaseUrl:f,onAddSectionItem:y,onRequestAddSection:g,sandbox:b}=t;let p,v;if(e[0]!==l||e[1]!==u||e[2]!==c||e[3]!==y||e[4]!==a||e[5]!==i||e[6]!==g||e[7]!==m||e[8]!==f||e[9]!==b||e[10]!==n.properties||e[11]!==o||e[12]!==r){v=Symbol.for("react.early_return_sentinel");e:{const h=o===void 0?[]:o,d=n.properties;if(!d){v=null;break e}const x=r!=null&&typeof r=="object"&&!Array.isArray(r)?r:{},k=Object.keys(d).filter(j=>!ns.has(j)&&d[j]?.hidden!==!0);if(k.length===0){let j;e[15]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No editable fields on this section."}),e[15]=j):j=e[15],v=j;break e}const S=(j,I)=>{i({...x,[j]:I})},T=typeof x.__resolveType=="string"?x.__resolveType:void 0,N=h.length>0?kr(k,d,x,h):null,C=N?d[N]:null,w=N&&C?[N]:k,_=N&&C?Nr(N,C,h):h;p=s.jsx("div",{className:"min-w-0 space-y-6",children:w.map(j=>{const I=d[j];if(!I)return null;const R=l?`${l}.${j}`:j,B=_e(j,I);return zt({schema:I,value:x[j],onChange:P=>S(j,P),path:R,label:B,breadcrumbPath:_,onBreadcrumbChange:a,meta:c,decofile:u,onSaveReferencedBlock:m,containerResolveType:T,previewBaseUrl:f,onAddSectionItem:y,onRequestAddSection:g,sandbox:b})})})}e[0]=l,e[1]=u,e[2]=c,e[3]=y,e[4]=a,e[5]=i,e[6]=g,e[7]=m,e[8]=f,e[9]=b,e[10]=n.properties,e[11]=o,e[12]=r,e[13]=p,e[14]=v}else p=e[13],v=e[14];return v!==Symbol.for("react.early_return_sentinel")?v:p}export{Ze as S,zt as a,Ls as b,Le as c,Ge as r,Gn as s,Fs as u};
@@ -1,4 +1,4 @@
1
- import{e as P,r as M,s as xc,w as ah,x as ch,j as p,B as lr,v as Ol,bI as bc,bJ as uh,aO as dh,af as rn,bK as fh,c as Z,t as hh,P as $t,M as Ot,U as kr,_ as ph,ai as mh,V as hn,bL as kc,T as Sc,p as zt,F as gh,a as yh,K as Kt,n as zi,m as Co,f as Ln,a1 as xh,ac as vc,bM as To,ah as bh,bN as Ut}from"./index-D6izOmjj.js";import{f as kh,M as Sh,d as vh,ae as wh,V as Ch,U as Th,T as Nh,aa 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-CS5ajDLh.js";import{t as Fs}from"./Stars01-CfOrOYJQ.js";import{a as Tc,t as jh,d as Nc,b as Er}from"./XCircle-DheND3p1.js";import{i as No}from"./ChevronUp-Bu9JV4C-.js";import{i as Il}from"./ChevronRight-CxzKR4UY.js";import{a as Mc,s as Dh}from"./Eye-Clz4yV9V.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-CpGRUyLX.js";import{u as Oc}from"./use-copy-B9rnfiig.js";import{T as sn,a as on,b as ln}from"./tooltip-Bk2FCtKr.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-CD_RZ8rl.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-CR3zyk0T.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-BsFLDszr.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-C1I2Fhg2.js";import{u as Uh}from"./studio-tools-BBnH3MVd.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{d as Gh,u as jc,j as Xh}from"./use-mcp-client-vlTb1_vQ.js";import{i as Dc}from"./AlertCircle-B-Zk3zY-.js";import{s as Jr,t as Pc}from"./Star01-CqiKSE8w.js";import{s as Yh}from"./XClose-BGdHen0O.js";import{n as Bi}from"./ZapSquare-BILpiibq.js";import{n as Lc,i as Qh}from"./Globe01-rz2h7Ebm.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-DpllcZ_x.js";import{b as jl,a as tp}from"./ZoomOut-B_lAoymB.js";import{i as Gn}from"./Monitor01-DtUT2Llg.js";import{i as np}from"./SearchMd-DtbjJ0sS.js";import{i as rp}from"./Upload01--GcqA8-Q.js";import{b as sp,c as ip}from"./shell-layout-BuKC3YO-.js";import{n as _c}from"./LinkExternal01-DQqosIE7.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-CGQ0l6o4.js";import{I as Sr}from"./integration-icon-DZ46sqDL.js";import{a as up}from"./use-virtual-mcp-D63srVIz.js";import{i as dp}from"./ArrowUpRight-DrUVVTac.js";import{a as Ao}from"./Users03-D3FPHz00.js";import{a as ot}from"./Palette-CS46pFVA.js";import{m as $c}from"./use-navigate-to-agent-CKBlqEnY.js";import{a as fp}from"./use-connection-rF7aVJWi.js";import{a as hp}from"./Stars02-CCs6aX7m.js";import{g as pp}from"./use-mcp-prompts-CGFuFPsL.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-DXahQA5F.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-C9CSHpUw.js";import{I as Np}from"./input-DP3XvpLN.js";import{t as Mp}from"./ChevronDown-DAwDO8g3.js";import{e as Ep}from"./select-CjjjXRUS.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{e as P,r as M,s as xc,w as ah,x as ch,j as p,B as lr,v as Ol,bI as bc,bJ as uh,aO as dh,af as rn,bK as fh,c as Z,t as hh,P as $t,M as Ot,U as kr,_ as ph,ai as mh,V as hn,bL as kc,T as Sc,p as zt,F as gh,a as yh,K as Kt,n as zi,m as Co,f as Ln,a1 as xh,ac as vc,bM as To,ah as bh,bN as Ut}from"./index-COlSsy5J.js";import{f as kh,M as Sh,d as vh,ae as wh,V as Ch,U as Th,T as Nh,aa 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-B1KjkGhC.js";import{t as Fs}from"./Stars01-Dr_rOBxK.js";import{a as Tc,t as jh,d as Nc,b as Er}from"./XCircle-CpovmLEO.js";import{i as No}from"./ChevronUp-CjDXfs3K.js";import{i as Il}from"./ChevronRight-BsknZQE_.js";import{a as Mc,s as Dh}from"./Eye-DifA9NHq.js";import{a as Pt,u as Ec,t as Ac,c as Rl}from"./use-clock-tick-DkwKhG1v.js";import{u as Oc}from"./use-copy-CqTP6NE5.js";import{T as sn,a as on,b as ln}from"./tooltip-D5U362dF.js";import{M as Mo,I as Ic,F as Ph}from"./file-type-icon-DURyeK9L.js";import{c as Lh}from"./content-blocks-o63cs2vh.js";import{g as Rc,M as _h}from"./types-C-QYkfD4.js";import{S as $h,f as _n,h as zh,c as Eo,a as Bh,u as Fh}from"./chat-context-B_U1gcun.js";import{c as Hh,r as Vh,R as Wh}from"./hooks-DlDryoZW.js";import{u as Uh}from"./studio-tools-CyTucPcW.js";import{f as qh,k as Kh,l as Jh}from"./tab-id-BptcWVWa.js";import{d as Gh,u as jc,j as Xh}from"./use-mcp-client-CK2bE_Wl.js";import{i as Dc}from"./AlertCircle-Dnqz3IxM.js";import{s as Jr,t as Pc}from"./Star01-DxJIcjLz.js";import{s as Yh}from"./XClose-CnYr1LOo.js";import{n as Bi}from"./ZapSquare-ChOMpHGM.js";import{n as Lc,i as Qh}from"./Globe01-CMUrlGmF.js";import{b as Zh,i as ep,a as Ar}from"./Tool01-B4m3Gnpd.js";import{b as jl,a as tp}from"./ZoomOut-DYeUJTmS.js";import{i as Gn}from"./Monitor01-C-tOv611.js";import{i as np}from"./SearchMd-yvCGxslh.js";import{i as rp}from"./Upload01-CuyZwIAy.js";import{b as sp,c as ip}from"./shell-layout-Cx--9PV8.js";import{n as _c}from"./LinkExternal01-DwIqUvLe.js";import{b as op,S as lp,c as ap,d as cp}from"./sheet-Cn8FwYbD.js";import{I as Sr}from"./integration-icon-RqT66_6U.js";import{a as up}from"./use-virtual-mcp-DPWDEWCb.js";import{i as dp}from"./ArrowUpRight-B2NXgTf2.js";import{a as Ao}from"./Users03-CJ4lkyfr.js";import{a as ot}from"./Palette-pjBymHRy.js";import{m as $c}from"./use-navigate-to-agent-C2rXzvAb.js";import{a as fp}from"./use-connection-C7Z8M26w.js";import{a as hp}from"./Stars02-CB3UMWzf.js";import{g as pp}from"./use-mcp-prompts--L5Py2oF.js";import{a as mp,D as gp,e as yp,c as xp,d as bp}from"./dialog-BMBVdX8K.js";import{a as kp,F as Sp,b as vp,c as wp,d as Cp,f as Tp}from"./form-CdGhzS_x.js";import{I as Np}from"./input-CuVtlRv5.js";import{t as Mp}from"./ChevronDown-BldydMJ0.js";import{e as Ep}from"./select-Dqs7Z4yG.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{e as b,c as w,j as a,l as j}from"./index-D6izOmjj.js";import{i as N}from"./SearchMd-DtbjJ0sS.js";function S(f){const e=b.c(17),{value:l,onChange:c,placeholder:g,onKeyDown:d,className:u,isSearching:p,disabled:i}=f,m=g===void 0?"Search...":g,x=i&&"pointer-events-none opacity-50";let t;e[0]!==u||e[1]!==x?(t=w("flex items-center gap-4 rounded-lg bg-background dark:bg-input/30 px-3 h-8 card-shadow","focus-within:border-ring focus-within:ring-ring/20 focus-within:ring-[2px]","transition-[color,box-shadow]",x,u),e[0]=u,e[1]=x,e[2]=t):t=e[2];let n;e[3]!==p?(n=p?a.jsx(j,{size:16,className:"animate-spin text-muted-foreground/75 shrink-0"}):a.jsx(N,{size:16,className:"text-muted-foreground/75 shrink-0"}),e[3]=p,e[4]=n):n=e[4];let s;e[5]!==c?(s=h=>c(h.target.value),e[5]=c,e[6]=s):s=e[6];let o;e[7]!==i||e[8]!==d||e[9]!==m||e[10]!==s||e[11]!==l?(o=a.jsx("input",{type:"text",value:l,onChange:s,onKeyDown:d,placeholder:m,disabled:i,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[7]=i,e[8]=d,e[9]=m,e[10]=s,e[11]=l,e[12]=o):o=e[12];let r;return e[13]!==t||e[14]!==n||e[15]!==o?(r=a.jsxs("label",{className:t,children:[n,o]}),e[13]=t,e[14]=n,e[15]=o,e[16]=r):r=e[16],r}export{S};
1
+ import{e as b,c as w,j as a,l as j}from"./index-COlSsy5J.js";import{i as N}from"./SearchMd-yvCGxslh.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};