@vellumai/web 0.11.7-staging.1 → 0.11.7

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 (297) hide show
  1. package/dist/assets/{a2a-invite-BG2srB8l.js → a2a-invite-CalxmT9U.js} +1 -1
  2. package/dist/assets/{about-page-DjQBOkob.js → about-page-oelEgoKN.js} +1 -1
  3. package/dist/assets/{account-page-CwogL0Kz.js → account-page-DoWCrccl.js} +1 -1
  4. package/dist/assets/{account-shell-CWXjq2ej.js → account-shell-D6h6YPdW.js} +1 -1
  5. package/dist/assets/acp-run-detail-panel-BqBDl6QB.js +5 -0
  6. package/dist/assets/activity-steps-panel-C5Nlm1Ax.js +1 -0
  7. package/dist/assets/{add-credits-modal-DE_wGp3t.js → add-credits-modal-Clc-YWYG.js} +1 -1
  8. package/dist/assets/ai-page-DtRit5K4.js +1 -0
  9. package/dist/assets/{android-billing-handoff-DYRUkuq4.js → android-billing-handoff-D6KkZQcR.js} +1 -1
  10. package/dist/assets/{api-key-screen-BgmfpQwf.js → api-key-screen-BWXzfFaa.js} +1 -1
  11. package/dist/assets/{app-info-BADbcXSH.js → app-info-BzVdvgJM.js} +1 -1
  12. package/dist/assets/archive-redirect-page-DD3q7S_q.js +1 -0
  13. package/dist/assets/{assistant-status-panel-BGTMhPVr.js → assistant-status-panel-i2Q5Ng1C.js} +1 -1
  14. package/dist/assets/{auth-welcome-screen-DEaRtq6O.js → auth-welcome-screen-ghh-qFOz.js} +1 -1
  15. package/dist/assets/avatar-random-BEjqLOzH.js +1 -0
  16. package/dist/assets/background-task-detail-panel-igcj1myW.js +1 -0
  17. package/dist/assets/billing-page-BtVWtaxz.js +3 -0
  18. package/dist/assets/{billing-redirect-page-BUWlrUKX.js → billing-redirect-page-DaIhDbvM.js} +1 -1
  19. package/dist/assets/{bookmarks-page-Dh3gScqi.js → bookmarks-page-CvCqY1u_.js} +1 -1
  20. package/dist/assets/{bundle-confirm-page-cmqY9QqX.js → bundle-confirm-page-DuW3Ltpg.js} +1 -1
  21. package/dist/assets/channel-transcript-panel-C5dxI2kC.js +1 -0
  22. package/dist/assets/channels-page-route-CaZZgVvj.js +1 -0
  23. package/dist/assets/{checkout-continuation-CFAf_YzF.js → checkout-continuation-gyr3KRhJ.js} +1 -1
  24. package/dist/assets/{checkout-page-lzWoFsCx.js → checkout-page-CpaWMY_L.js} +1 -1
  25. package/dist/assets/checkout-return-target-uGUiSRvm.js +1 -0
  26. package/dist/assets/{command-palette-DTyDlxan.js → command-palette-Dqv1yvzc.js} +1 -1
  27. package/dist/assets/{command-palette-window-page-D6EOoO37.js → command-palette-window-page-C4vKhArq.js} +1 -1
  28. package/dist/assets/{community-page-DTTodb1d.js → community-page-xiwPgo2f.js} +1 -1
  29. package/dist/assets/companion-layout-BgFk39Te.js +1 -0
  30. package/dist/assets/companion-surface-page-BE_GKIQH.js +1 -0
  31. package/dist/assets/{connect-page-DcvBA4Oi.js → connect-page-1WOW2Uyb.js} +1 -1
  32. package/dist/assets/{consent-controls-BdBt8PvQ.js → consent-controls-RsRyTWzn.js} +1 -1
  33. package/dist/assets/{contacts-rWJ8WW7q.js → contacts-DY80_acF.js} +1 -1
  34. package/dist/assets/{contacts-CvzAe9KC.js → contacts-O_w2EdRt.js} +1 -1
  35. package/dist/assets/contacts-gateway-aq64PPDs.js +1 -0
  36. package/dist/assets/contacts-page-route-fh_BygpY.js +1 -0
  37. package/dist/assets/{credential-entry-page-Br-h4ohy.js → credential-entry-page-CHyGUHNE.js} +1 -1
  38. package/dist/assets/credentials-page-u4m5eB0e.js +1 -0
  39. package/dist/assets/{csv-preview-BmGd5GvO.js → csv-preview-D1DFyAyk.js} +1 -1
  40. package/dist/assets/danger-zone-redirect-page-pm7xtA64.js +1 -0
  41. package/dist/assets/debug-page-BiRFASyO.js +4 -0
  42. package/dist/assets/deploy-dialogs-BQGFr3pp.js +1 -0
  43. package/dist/assets/{detail-card-BWAdYYsU.js → detail-card-BTciodin.js} +1 -1
  44. package/dist/assets/{detail-drawer-DVRLdKH6.js → detail-drawer-svbxV7k9.js} +1 -1
  45. package/dist/assets/{detail-panel-stop-button-Ec_O0FsT.js → detail-panel-stop-button-DvPi_A52.js} +1 -1
  46. package/dist/assets/developer-page-YJ4ePRAY.js +1 -0
  47. package/dist/assets/devices-redirect-page-Bc3d-ANN.js +1 -0
  48. package/dist/assets/dictation-overlay-page-CV5-bWnC.js +1 -0
  49. package/dist/assets/{document-viewer-page-2ypPIt0f.js → document-viewer-page-B9aeVcPf.js} +1 -1
  50. package/dist/assets/{emails-page-B62WLfUs.js → emails-page-DuxmJeBh.js} +1 -1
  51. package/dist/assets/environment-store-Cb7OK6xz.js +1 -0
  52. package/dist/assets/{esm-CIxL6Kea.js → esm-BFMxsKfC.js} +2 -2
  53. package/dist/assets/{esm-CjMeaTEw.js → esm-BWaPHKOl.js} +2 -2
  54. package/dist/assets/esm-B_9x3_5A.js +2 -0
  55. package/dist/assets/{esm-D_v5tFl3.js → esm-BmkPJcrm.js} +1 -1
  56. package/dist/assets/{esm-DDqr6fmx.js → esm-C8_GJq6u.js} +1 -1
  57. package/dist/assets/esm-CvsVyyLL.js +2 -0
  58. package/dist/assets/esm-D8F0P9NS.js +1 -0
  59. package/dist/assets/esm-DLD7mc5e.js +2 -0
  60. package/dist/assets/esm-lFkAo6qR.js +2 -0
  61. package/dist/assets/{file-editor-CDGUDFoJ.js → file-editor-qyflOek_.js} +1 -1
  62. package/dist/assets/general-page-CplJ3sOI.js +1 -0
  63. package/dist/assets/{hatching-screen-9rpuz0wC.js → hatching-screen-tqPPQDHG.js} +1 -1
  64. package/dist/assets/home-page-route-CMsbxqsW.js +1 -0
  65. package/dist/assets/{hosting-screen-BNfcYeZc.js → hosting-screen-7idZudJ8.js} +1 -1
  66. package/dist/assets/identity-page-route-C4EAb-ac.js +7 -0
  67. package/dist/assets/index-2ECSWhtU.css +2 -0
  68. package/dist/assets/index-7XDiAJ-A.js +357 -0
  69. package/dist/assets/inspect-page-DsXykArJ.js +9 -0
  70. package/dist/assets/integrations-page-CmMVSsvu.js +1 -0
  71. package/dist/assets/{intelligence-BGwrywAc.js → intelligence-DwVUW6jm.js} +1 -1
  72. package/dist/assets/{intelligence-CiHR5tCj.js → intelligence-JlruxYAh.js} +1 -1
  73. package/dist/assets/{intelligence-layout-BPHznVLK.js → intelligence-layout-DKknlxHu.js} +1 -1
  74. package/dist/assets/keyboard-shortcuts-redirect-page-CFu5x117.js +1 -0
  75. package/dist/assets/{latest-assistant-text-CHdsnShy.js → latest-assistant-text-CVRVSoFg.js} +2 -2
  76. package/dist/assets/{library-detail-page-BjvON63o.js → library-detail-page-CKFkI0QY.js} +1 -1
  77. package/dist/assets/{library-page-BNsPqJb4.js → library-page-dIrR1lib.js} +1 -1
  78. package/dist/assets/login-page-Bca-1DK6.js +1 -0
  79. package/dist/assets/logout-page-BzAORi0q.js +1 -0
  80. package/dist/assets/{logs-layout-sBHkwmuK.js → logs-layout-BsqrLQee.js} +1 -1
  81. package/dist/assets/markdown-preview-DLXGytZI.js +1 -0
  82. package/dist/assets/{media-preview-Dp_Ohj3P.js → media-preview-daMlnyj8.js} +1 -1
  83. package/dist/assets/memory-page-route-CX1I7izG.js +2 -0
  84. package/dist/assets/memory-router-playground-page-Mk3rfyGO.js +1 -0
  85. package/dist/assets/{message-files-panel-DYuk1i1H.js → message-files-panel-D-C9C2PJ.js} +1 -1
  86. package/dist/assets/{metric-card-D68AKIAM.js → metric-card-Bij5WGzs.js} +1 -1
  87. package/dist/assets/{notifications-page-D7Dw0oH6.js → notifications-page-C6zUs2x1.js} +1 -1
  88. package/dist/assets/{oauth-complete-page-CnK3ee01.js → oauth-complete-page-CuNDqPAt.js} +1 -1
  89. package/dist/assets/{oauth-popup-complete-page--j9eevP9.js → oauth-popup-complete-page-hRc3yLWH.js} +1 -1
  90. package/dist/assets/{page-shell-CwFMHnxU.js → page-shell-DtdXurhX.js} +1 -1
  91. package/dist/assets/{pairing-page-BRPrbdWT.js → pairing-page-CwLe0EJV.js} +1 -1
  92. package/dist/assets/password-reset-page-C7qvqEJQ.js +1 -0
  93. package/dist/assets/pdf-file-preview-DbwHMWey.js +1 -0
  94. package/dist/assets/pdf.worker.min-Dr1KORA9.mjs +31 -0
  95. package/dist/assets/{personality-page-DJVyEe5m.js → personality-page-Ci_b1dH9.js} +1 -1
  96. package/dist/assets/plans-page-CyqILV_j.js +1 -0
  97. package/dist/assets/{platform-loopback-page-D2hnF-6j.js → platform-loopback-page-CgXx1oDQ.js} +1 -1
  98. package/dist/assets/{plugin-detail-page-BxckOMbK.js → plugin-detail-page-CvC_LUz2.js} +1 -1
  99. package/dist/assets/plugins-page-9LuPE9IY.js +1 -0
  100. package/dist/assets/{preview-error-5Hqa2QOK.js → preview-error-DbAQP8oG.js} +1 -1
  101. package/dist/assets/privacy-page-OIOZKgWi.js +1 -0
  102. package/dist/assets/privacy-screen-DFnrbIrM.js +1 -0
  103. package/dist/assets/{provider-callback-page-B6YzW_3J.js → provider-callback-page-DGVehvIp.js} +1 -1
  104. package/dist/assets/{provider-key-D5nnrPPW.js → provider-key-CUAJZvaQ.js} +1 -1
  105. package/dist/assets/{provider-signup-page-DlESwxat.js → provider-signup-page-B5gnrbym.js} +1 -1
  106. package/dist/assets/{provisioning-targets-BwRmWHCY.js → provisioning-targets-BbLfumae.js} +1 -1
  107. package/dist/assets/{quick-input-page-DdS8Ya9c.js → quick-input-page-Ccy-FS5S.js} +1 -1
  108. package/dist/assets/{research-mock-page-4EEr0WVh.js → research-mock-page-DqfkGU9x.js} +1 -1
  109. package/dist/assets/research-onboarding-route-D3qFv6SM.js +50 -0
  110. package/dist/assets/review-terms-screen-BD3wP3KC.js +1 -0
  111. package/dist/assets/schedules-B_SL_iV4.js +1 -0
  112. package/dist/assets/schedules-page-D64tvhuZ.js +1 -0
  113. package/dist/assets/security-redirect-page-CWR-HICc.js +1 -0
  114. package/dist/assets/select-assistant-screen-SfWB0oQ2.js +1 -0
  115. package/dist/assets/{self-hosted-servers-D61iCe1r.js → self-hosted-servers-BHF9gq8j.js} +1 -1
  116. package/dist/assets/{service-form-controls-CffsytNz.js → service-form-controls-DNfWnjSp.js} +1 -1
  117. package/dist/assets/{setting-row-CSNsQ0ef.js → setting-row-DRwmii99.js} +1 -1
  118. package/dist/assets/settings-divider-X9YnFIFQ.js +1 -0
  119. package/dist/assets/settings-gjWN0WQO.js +3 -0
  120. package/dist/assets/settings-iLTzqZW8.js +3 -0
  121. package/dist/assets/settings-layout-C2Um5qit.js +1 -0
  122. package/dist/assets/share-feedback-modal-BzV03dUO.js +2 -0
  123. package/dist/assets/{sidebar-tree-ZPuFWd8L.js → sidebar-tree-C1t1xfKD.js} +1 -1
  124. package/dist/assets/{signup-page-DiLyBF-_.js → signup-page-Dyhm65FW.js} +1 -1
  125. package/dist/assets/{signup-shell-CY6NA0p0.js → signup-shell-CSThcwPa.js} +1 -1
  126. package/dist/assets/skill-detail-page-Cja0k8_e.js +2 -0
  127. package/dist/assets/skill-detail-panel-BIOL410z.js +1 -0
  128. package/dist/assets/skill-removal-dialog-bN91N7f8.js +1 -0
  129. package/dist/assets/skills-page-CYogTXmH.js +1 -0
  130. package/dist/assets/{sounds-page-yAwMH4xw.js → sounds-page-DAy2o3wO.js} +1 -1
  131. package/dist/assets/{start-screen-B1Uc7S-6.js → start-screen-DyyYavfM.js} +1 -1
  132. package/dist/assets/{stt-language-picker-modal-DyydP36W.js → stt-language-picker-modal-CpGwbd4g.js} +1 -1
  133. package/dist/assets/subagent-detail-panel-330bH7ee.js +4 -0
  134. package/dist/assets/superpowers-page-D6wv3GWO.js +1 -0
  135. package/dist/assets/system-events-page-CFN8tMUJ.js +1 -0
  136. package/dist/assets/system-events-redirect-page-BarOgFkA.js +1 -0
  137. package/dist/assets/{text-preview-C1ye4KZC.js → text-preview-CZeqyzdw.js} +1 -1
  138. package/dist/assets/{theme-stage-page-Dtdm0G4w.js → theme-stage-page-Pcnh0PTQ.js} +1 -1
  139. package/dist/assets/{tiptap-document-editor-mKYn2fin.js → tiptap-document-editor-ZZmtZ799.js} +3 -3
  140. package/dist/assets/tool-detail-panel-BgCSb_m5.js +12 -0
  141. package/dist/assets/{trait-cycle-row-Cz3jk7-7.js → trait-cycle-row-BWNJ21g4.js} +1 -1
  142. package/dist/assets/upgrade-cancel-page-ByVEWPeH.js +1 -0
  143. package/dist/assets/{upgrade-success-page-CmDLrmA6.js → upgrade-success-page-iAPLJbee.js} +1 -1
  144. package/dist/assets/usage-redirect-page-BHd-7in5.js +1 -0
  145. package/dist/assets/{use-assistant-identity-details-VmKyMMkK.js → use-assistant-identity-details-oVmPdjVe.js} +1 -1
  146. package/dist/assets/use-checkout-dismiss-refresh-BO2cN2i8.js +1 -0
  147. package/dist/assets/{use-edge-swipe-back-Dmrjwtqi.js → use-edge-swipe-back-CzESg8qG.js} +2 -2
  148. package/dist/assets/{use-hotkey-recorder-pYZHrA6s.js → use-hotkey-recorder-CY089_4p.js} +1 -1
  149. package/dist/assets/use-invite-link-dialog-Ck-LquhT.js +1 -0
  150. package/dist/assets/{use-platform-assistant-id-C1Q0d0Do.js → use-platform-assistant-id-DcVWp7KY.js} +1 -1
  151. package/dist/assets/use-return-to-short-circuit-NDSwANeI.js +1 -0
  152. package/dist/assets/{use-side-list-room-CWZO9QuZ.js → use-side-list-room-DQbUPFcU.js} +1 -1
  153. package/dist/assets/use-skill-actions-CNBx-WS1.js +1 -0
  154. package/dist/assets/use-skill-detail-files-BGIXJykk.js +1 -0
  155. package/dist/assets/use-supports-credentials-settings-C6S_OHMP.js +1 -0
  156. package/dist/assets/use-transcript-message-by-id-Dqm1PMu3.js +1 -0
  157. package/dist/assets/vendor-WUN87CSE.js +385 -0
  158. package/dist/assets/voice-page-nBfEMyWs.js +1 -0
  159. package/dist/assets/{weather-forecast-display-q4i0rBmL.js → weather-forecast-display-B6j-V-yS.js} +1 -1
  160. package/dist/assets/{web-C5RZo6Cu.js → web-CE-RjE8i.js} +1 -1
  161. package/dist/assets/{web-BeH1ODMG.js → web-Cv_J7__I.js} +1 -1
  162. package/dist/assets/{web-B95SBXmi.js → web-Cw24uxYA.js} +1 -1
  163. package/dist/assets/{web-CIu_CBvE.js → web-DDFO9PaS.js} +1 -1
  164. package/dist/assets/{web-CKRg3MHw.js → web-DL2rv-Fb.js} +1 -1
  165. package/dist/assets/{web-Di12DIkw.js → web-DPEGYPrR.js} +1 -1
  166. package/dist/assets/{web-C-zG7hIH.js → web-Q8lSPj8Z.js} +1 -1
  167. package/dist/assets/{web-BNH9zOVU.js → web-kKGZ0Pbn.js} +1 -1
  168. package/dist/assets/{web-BYYrjr3T.js → web-pwf5Vh3V.js} +1 -1
  169. package/dist/assets/welcome-screen-BrwdmDqM.js +1 -0
  170. package/dist/assets/{workflow-detail-panel-Bun0h2gw.js → workflow-detail-panel-DcTQSyju.js} +1 -1
  171. package/dist/assets/workspace-page-Dwfwnkh5.js +1 -0
  172. package/dist/index.html +3 -3
  173. package/package.json +1 -1
  174. package/dist/assets/acp-run-detail-panel-DWLndpqU.js +0 -5
  175. package/dist/assets/activity-steps-panel-Ry9AZgWU.js +0 -1
  176. package/dist/assets/ai-page-B7MqZXa-.js +0 -1
  177. package/dist/assets/archive-redirect-page-TpAi8l5m.js +0 -1
  178. package/dist/assets/avatar-random-Ms0xoZYV.js +0 -1
  179. package/dist/assets/background-task-detail-panel-CocEZnBB.js +0 -1
  180. package/dist/assets/billing-page-9dilDYF6.js +0 -3
  181. package/dist/assets/channel-transcript-panel-B-fzqLZP.js +0 -1
  182. package/dist/assets/channels-page-route-DBlQswJi.js +0 -1
  183. package/dist/assets/checkout-return-target-DX9db8gK.js +0 -1
  184. package/dist/assets/companion-surface-page-DVzsRqfX.js +0 -1
  185. package/dist/assets/contacts-gateway-CM8x4x9t.js +0 -1
  186. package/dist/assets/contacts-page-route-ehyacJJt.js +0 -1
  187. package/dist/assets/credentials-page-DjIR49jh.js +0 -1
  188. package/dist/assets/danger-zone-redirect-page-BcdDFitQ.js +0 -1
  189. package/dist/assets/debug-page-BjeHHi72.js +0 -4
  190. package/dist/assets/deploy-dialogs-BKzgBqnk.js +0 -1
  191. package/dist/assets/developer-page-Bjm9VNgE.js +0 -1
  192. package/dist/assets/devices-redirect-page-BN_kM9bK.js +0 -1
  193. package/dist/assets/dictation-overlay-page-CJX5EmO_.js +0 -1
  194. package/dist/assets/environment-store-BZtUrBww.js +0 -1
  195. package/dist/assets/esm-Ct7gk9cJ.js +0 -2
  196. package/dist/assets/esm-CwYjRgBz.js +0 -2
  197. package/dist/assets/esm-DcGjzNqL.js +0 -2
  198. package/dist/assets/esm-UN_1DrQ6.js +0 -1
  199. package/dist/assets/esm-Xi5brEbq.js +0 -2
  200. package/dist/assets/general-page-BzQJtIpg.js +0 -1
  201. package/dist/assets/home-page-route-BQxZVA7I.js +0 -1
  202. package/dist/assets/identity-page-route-Daxeea6z.js +0 -7
  203. package/dist/assets/index-BBTJC9X3.js +0 -357
  204. package/dist/assets/index-D-nuAcII.css +0 -2
  205. package/dist/assets/inspect-page-BrINFSDY.js +0 -9
  206. package/dist/assets/integrations-page-7FifAn0a.js +0 -1
  207. package/dist/assets/keyboard-shortcuts-redirect-page-DCeElrOI.js +0 -1
  208. package/dist/assets/login-page-DHzEr67a.js +0 -1
  209. package/dist/assets/logout-page-Cmnd4XAr.js +0 -1
  210. package/dist/assets/markdown-preview-BqsOdbTw.js +0 -1
  211. package/dist/assets/memory-page-route--rSislKU.js +0 -2
  212. package/dist/assets/memory-router-playground-page-QXoS49RD.js +0 -1
  213. package/dist/assets/password-reset-page-BwK_1xFg.js +0 -1
  214. package/dist/assets/pdf-file-preview-7EhxC2AI.js +0 -1
  215. package/dist/assets/plans-page-CLUnU8h9.js +0 -1
  216. package/dist/assets/plugins-page-DeTuyacm.js +0 -1
  217. package/dist/assets/privacy-page-HIRYmYkC.js +0 -1
  218. package/dist/assets/privacy-screen-Dxmw1gDC.js +0 -1
  219. package/dist/assets/research-onboarding-route-vTNU2CW9.js +0 -50
  220. package/dist/assets/review-terms-screen-EC_EUgDO.js +0 -1
  221. package/dist/assets/schedules-C-f1hDgN.js +0 -1
  222. package/dist/assets/schedules-page-B6RIbZ8m.js +0 -1
  223. package/dist/assets/security-redirect-page-C5IIt5g1.js +0 -1
  224. package/dist/assets/select-assistant-screen-BgCavCxS.js +0 -1
  225. package/dist/assets/settings-Bv4B7bkB.js +0 -3
  226. package/dist/assets/settings-Ms9dA3Cb.js +0 -3
  227. package/dist/assets/settings-divider-Vn0TE-Mn.js +0 -1
  228. package/dist/assets/settings-layout-NvzuoM5H.js +0 -1
  229. package/dist/assets/share-feedback-modal-nK59XSQk.js +0 -2
  230. package/dist/assets/skill-detail-page-Dx_rRk64.js +0 -2
  231. package/dist/assets/skill-detail-panel-Cjto80ED.js +0 -1
  232. package/dist/assets/skills-BWIQJK0w.js +0 -1
  233. package/dist/assets/skills-page-yNxo7PJH.js +0 -1
  234. package/dist/assets/subagent-detail-panel-1QDrfsxW.js +0 -4
  235. package/dist/assets/superpowers-page-D15g4czV.js +0 -1
  236. package/dist/assets/system-events-page-jIh7Fg4r.js +0 -1
  237. package/dist/assets/system-events-redirect-page-cAhBrtsp.js +0 -1
  238. package/dist/assets/tool-detail-panel-C2jn8-1x.js +0 -12
  239. package/dist/assets/upgrade-cancel-page-8_sAFQGV.js +0 -1
  240. package/dist/assets/usage-redirect-page-DXn_MtMy.js +0 -1
  241. package/dist/assets/use-checkout-dismiss-refresh-6dzNGv06.js +0 -1
  242. package/dist/assets/use-invite-link-dialog-CC4gh2RZ.js +0 -1
  243. package/dist/assets/use-return-to-short-circuit-CaipcLE0.js +0 -1
  244. package/dist/assets/use-skill-actions-BsdvJMpe.js +0 -1
  245. package/dist/assets/use-skill-detail-files-czywu0rA.js +0 -1
  246. package/dist/assets/use-supports-credentials-settings-B2w1IF9Y.js +0 -1
  247. package/dist/assets/use-transcript-message-by-id-BkBVx2Ox.js +0 -1
  248. package/dist/assets/vendor-BBRT_WdZ.js +0 -385
  249. package/dist/assets/voice-page-4-0OuITA.js +0 -1
  250. package/dist/assets/welcome-screen-CeO4nf82.js +0 -1
  251. package/dist/assets/workspace-page-mPk7uSGj.js +0 -1
  252. /package/dist/assets/{account-DpAwa65_.js → account-B6zEi6O8.js} +0 -0
  253. /package/dist/assets/{account-FRFDU8hs.js → account-WSklJ2-s.js} +0 -0
  254. /package/dist/assets/{app-types-CxDtkda0.js → app-types-BSxLQFrc.js} +0 -0
  255. /package/dist/assets/{build.umd-BK2uygbM.js → build.umd-CJjt7Lfj.js} +0 -0
  256. /package/dist/assets/{channels-B2E8acC6.js → channels-Dv8-4WT6.js} +0 -0
  257. /package/dist/assets/{channels-Cl60C6Ve.js → channels-NP4ODNxS.js} +0 -0
  258. /package/dist/assets/{chat-DYVg4UMd.js → chat-CuSRAhBb.js} +0 -0
  259. /package/dist/assets/{chat-qfibhWrm.js → chat-Dw-Xoh_r.js} +0 -0
  260. /package/dist/assets/{common-CMx1oWlk.js → common-BZmEPLQq.js} +0 -0
  261. /package/dist/assets/{common-Cvdz1bSr.js → common-wNADLj0r.js} +0 -0
  262. /package/dist/assets/{credential-requests-KJuDe1Th.js → credential-requests-DQ9WS6Rl.js} +0 -0
  263. /package/dist/assets/{credential-requests-M3nwbYv2.js → credential-requests-DUwvVpZo.js} +0 -0
  264. /package/dist/assets/{definitions-BCXSWaCU.js → definitions-BTBjNf1i.js} +0 -0
  265. /package/dist/assets/{definitions-DWEBPiP4.js → definitions-Dz0UVs0Z.js} +0 -0
  266. /package/dist/assets/{diff-rows-CkvlunhT.js → diff-rows-DzBJ95DT.js} +0 -0
  267. /package/dist/assets/{emoji-catalog-data-DcnzfAnv.js → emoji-catalog-data-a3DXKyhe.js} +0 -0
  268. /package/dist/assets/{format-countdown-Bm0cUR53.js → format-countdown-Cge3iaM1.js} +0 -0
  269. /package/dist/assets/{home-CfkNV23Y.js → home-BWUNWNMl.js} +0 -0
  270. /package/dist/assets/{home-Cg418xAf.js → home-DJ6q91Qp.js} +0 -0
  271. /package/dist/assets/{library-R5BcofgZ.js → library-Bu_eLt14.js} +0 -0
  272. /package/dist/assets/{library-DpI_3XlQ.js → library-Diqzwx-J.js} +0 -0
  273. /package/dist/assets/{link-click-1phDc74T.js → link-click-DpfLT-iQ.js} +0 -0
  274. /package/dist/assets/{logs-CBTKjeAO.js → logs-Bs19Ze4Q.js} +0 -0
  275. /package/dist/assets/{logs-DLsVoubE.js → logs-FJQpRVDW.js} +0 -0
  276. /package/dist/assets/{machine-sizes-BW-s6s5z.js → machine-sizes-C3ptouhz.js} +0 -0
  277. /package/dist/assets/{onboarding-4bnTgMz4.js → onboarding-BbtVI8KM.js} +0 -0
  278. /package/dist/assets/{onboarding-tc5zaeEq.js → onboarding-BoaKLlZ5.js} +0 -0
  279. /package/dist/assets/{onboarding-step-layout-Caq-AfwL.js → onboarding-step-layout-BlSoa02H.js} +0 -0
  280. /package/dist/assets/{page-empty-state-Bvn1J-m4.js → page-empty-state-BrGkTMcK.js} +0 -0
  281. /package/dist/assets/{pdf-BwS2m0XD.js → pdf-fWDhmWcw.js} +0 -0
  282. /package/dist/assets/{plugin-attribution-Dt4SOljB.js → plugin-attribution-c6x0DrZM.js} +0 -0
  283. /package/dist/assets/{profile-metadata-BG4G_07I.js → profile-metadata-Bk4pj7o_.js} +0 -0
  284. /package/dist/assets/{radio-card-nav-C7WQFCun.js → radio-card-nav-DlRweN3g.js} +0 -0
  285. /package/dist/assets/{remote-web-YzTMn6Av.js → remote-web-9YsnKwue.js} +0 -0
  286. /package/dist/assets/{remote-web-DH8Jm1os.js → remote-web-bapYzahN.js} +0 -0
  287. /package/dist/assets/{schedules-iytF8Rfk.js → schedules-CYD1CzCP.js} +0 -0
  288. /package/dist/assets/{schedules--WcHZLt-.js → schedules-DhwNRBkz.js} +0 -0
  289. /package/dist/assets/{skill-icon-BD5uPL1w.js → skill-icon-Me8DDEMt.js} +0 -0
  290. /package/dist/assets/{status-badge-pill-Cj5B-jwU.js → status-badge-pill-BAkXhxwa.js} +0 -0
  291. /package/dist/assets/{terminal-D8e9KyzK.js → terminal-7pMYRiby.js} +0 -0
  292. /package/dist/assets/{terminal-CfVsrnxa.js → terminal-BMbpDjYx.js} +0 -0
  293. /package/dist/assets/{use-truncated-blob-text-DusFJInu.js → use-truncated-blob-text-DLF_hf3O.js} +0 -0
  294. /package/dist/assets/{workspace-B8aSS_ao.js → workspace-BAHtR2RN.js} +0 -0
  295. /package/dist/assets/{workspace-BWvf_x4h.js → workspace-BnkQd2SU.js} +0 -0
  296. /package/dist/assets/{xterm-eWwMNYm5.js → xterm-DfM4JBPp.js} +0 -0
  297. /package/dist/assets/{xterm-addon-fit-CKJrvAeW.js → xterm-addon-fit-DuBTfuI9.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{o as e,r as t,t as n}from"./rolldown-runtime-BM3Ffeng.js";import{An as r,D as i,Dn as a,Fn as o,Mn as s,Nn as c,O as l,On as u,Pn as d,jn as f,kn as p}from"./vendor-BBRT_WdZ.js";import{b as m,t as h,y as g}from"./react-DPM_L_aA.js";import{an as _,or as v,xi as y,zt as b}from"./icons-CSdHOix6.js";import{xy as x}from"./index-BBTJC9X3.js";var ee=y(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),te=y(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),ne=y(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),S=e(m(),1),re=e(g(),1),C=h(),ie=l();function w(e){this.content=e}w.prototype={constructor:w,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new w(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new w(n)},addToStart:function(e,t){return new w([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new w(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new w(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=w.from(e),e.size?new w(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=w.from(e),e.size?new w(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=w.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},w.from=function(e){if(e instanceof w)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new w(t)};function ae(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&ce(e.charCodeAt(r-1))&&se(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ae(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function oe(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&ce(e.charCodeAt(i-1))&&se(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=oe(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function se(e){return e>=56320&&e<57344}function ce(e){return e>=55296&&e<56320}var T=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.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 RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ae(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return oe(this,e,t,n)}findIndex(e){if(e==0)return ue(0,e);if(e==this.size)return ue(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ue(t+1,i):ue(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};T.empty=new T([],0);var le={index:0,offset:0};function ue(e,t){return le.index=e,le.offset=t,le}function de(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!de(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!de(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var E=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||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&&de(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 RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};E.none=[];var fe=class extends Error{},D=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=me(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(pe(this.content,t+this.openStart,n+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(T.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};D.empty=new D(T.empty,0,0);function pe(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(pe(a.content,t-i-1,n-i-1)))}function me(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=me(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function he(e,t,n){if(n.openStart>e.depth)throw new fe(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new fe(`Inconsistent open depths`);return ge(e,t,n,0)}function ge(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ge(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return xe(a,Ce(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return xe(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=we(n,e);return xe(a,Se(e,i,o,t,r))}}function _e(e,t){if(!t.type.compatibleContent(e.type))throw new fe(`Cannot join `+t.type.name+` onto `+e.type.name)}function ve(e,t,n){let r=e.node(n);return _e(r,t.node(n)),r}function ye(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function be(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ye(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ye(i.child(e),r);t&&t.depth==n&&t.textOffset&&ye(t.nodeBefore,r)}function xe(e,t){if(!e.type.validContent(t))throw new fe(`Invalid content for node `+e.type.name);return e.copy(t)}function Se(e,t,n,r,i){let a=e.depth>i&&ve(e,t,i+1),o=r.depth>i&&ve(n,r,i+1),s=[];return be(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(_e(a,o),ye(xe(a,Se(e,t,n,r,i+1)),s)):(a&&ye(xe(a,Ce(e,t,i+1)),s),be(t,n,i,s),o&&ye(xe(o,Ce(n,r,i+1)),s)),be(r,null,i,s),new T(s)}function Ce(e,t,n){let r=[];return be(null,e,n,r),e.depth>n&&ye(xe(ve(e,t,n+1),Ce(e,t,n+1)),r),be(t,null,n,r),new T(r)}function we(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(T.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Te=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,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 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 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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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 n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return E.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ke(this,e,n);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(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Oe.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Oe.set(t,r=new Ee);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%De,i}},Ee=class{constructor(){this.elts=[],this.i=0}},De=12,Oe=new WeakMap,ke=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},Ae=Object.create(null),je=class e{constructor(e,t,n,r=E.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||T.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,n,r=0){this.content.nodesBetween(e,t,n,r,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,n,r){return this.content.textBetween(e,t,n,r)}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,n){return this.type==e&&de(this.attrs,t||e.defaultAttrs||Ae)&&E.sameSet(this.marks,n||E.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}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,n=!1){if(e==t)return D.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new D(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return he(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Te.resolveCached(this,e)}resolveNoCache(e){return Te.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),Ne(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=T.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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=E.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!E.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=T.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};je.prototype.text=void 0;var Me=class e extends je{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ne(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(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,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 Ne(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Pe=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Fe(t,n);if(r.next==null)return e.empty;let i=Ie(r);r.next&&r.err(`Unexpected trailing text`);let a=Ke(Ue(i));return qe(a,r),a}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,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return T.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
1
+ import{o as e,r as t,t as n}from"./rolldown-runtime-BM3Ffeng.js";import{An as r,Fn as i,In as a,Mn as o,Nn as s,O as c,On as l,Pn as u,jn as d,k as f,kn as p}from"./vendor-WUN87CSE.js";import{b as m,t as h,y as g}from"./react-DPM_L_aA.js";import{an as _,or as v,xi as y,zt as b}from"./icons-CSdHOix6.js";import{Dy as x}from"./index-7XDiAJ-A.js";var ee=y(`bold`,[[`path`,{d:`M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8`,key:`mg9rjx`}]]),te=y(`italic`,[[`line`,{x1:`19`,x2:`10`,y1:`4`,y2:`4`,key:`15jd3p`}],[`line`,{x1:`14`,x2:`5`,y1:`20`,y2:`20`,key:`bu0au3`}],[`line`,{x1:`15`,x2:`9`,y1:`4`,y2:`20`,key:`uljnxc`}]]),ne=y(`strikethrough`,[[`path`,{d:`M16 4H9a3 3 0 0 0-2.83 4`,key:`43sutm`}],[`path`,{d:`M14 12a4 4 0 0 1 0 8H6`,key:`nlfj13`}],[`line`,{x1:`4`,x2:`20`,y1:`12`,y2:`12`,key:`1e0a9i`}]]),S=e(m(),1),re=e(g(),1),C=h(),ie=f();function w(e){this.content=e}w.prototype={constructor:w,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new w(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new w(n)},addToStart:function(e,t){return new w([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new w(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new w(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=w.from(e),e.size?new w(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=w.from(e),e.size?new w(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=w.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},w.from=function(e){if(e instanceof w)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new w(t)};function ae(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&ce(e.charCodeAt(r-1))&&se(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=ae(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function oe(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&ce(e.charCodeAt(i-1))&&se(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=oe(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function se(e){return e>=56320&&e<57344}function ce(e){return e>=55296&&e<56320}var T=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.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 RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return ae(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return oe(this,e,t,n)}findIndex(e){if(e==0)return ue(0,e);if(e==this.size)return ue(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?ue(t+1,i):ue(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};T.empty=new T([],0);var le={index:0,offset:0};function ue(e,t){return le.index=e,le.offset=t,le}function de(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!de(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!de(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var E=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else !n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||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&&de(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 RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};E.none=[];var fe=class extends Error{},D=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=me(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(pe(this.content,t+this.openStart,n+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(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(T.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};D.empty=new D(T.empty,0,0);function pe(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(pe(a.content,t-i-1,n-i-1)))}function me(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=me(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function he(e,t,n){if(n.openStart>e.depth)throw new fe(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new fe(`Inconsistent open depths`);return ge(e,t,n,0)}function ge(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=ge(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return xe(a,Ce(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return xe(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=we(n,e);return xe(a,Se(e,i,o,t,r))}}function _e(e,t){if(!t.type.compatibleContent(e.type))throw new fe(`Cannot join `+t.type.name+` onto `+e.type.name)}function ve(e,t,n){let r=e.node(n);return _e(r,t.node(n)),r}function ye(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function be(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(ye(e.nodeAfter,r),a++));for(let e=a;e<o;e++)ye(i.child(e),r);t&&t.depth==n&&t.textOffset&&ye(t.nodeBefore,r)}function xe(e,t){if(!e.type.validContent(t))throw new fe(`Invalid content for node `+e.type.name);return e.copy(t)}function Se(e,t,n,r,i){let a=e.depth>i&&ve(e,t,i+1),o=r.depth>i&&ve(n,r,i+1),s=[];return be(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(_e(a,o),ye(xe(a,Se(e,t,n,r,i+1)),s)):(a&&ye(xe(a,Ce(e,t,i+1)),s),be(t,n,i,s),o&&ye(xe(o,Ce(n,r,i+1)),s)),be(r,null,i,s),new T(s)}function Ce(e,t,n){let r=[];return be(null,e,n,r),e.depth>n&&ye(xe(ve(e,t,n+1),Ce(e,t,n+1)),r),be(t,null,n,r),new T(r)}function we(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(T.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var Te=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,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 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 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 n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}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 n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return E.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}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 n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new ke(this,e,n);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(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=Oe.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else Oe.set(t,r=new Ee);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%De,i}},Ee=class{constructor(){this.elts=[],this.i=0}},De=12,Oe=new WeakMap,ke=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}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)}},Ae=Object.create(null),je=class e{constructor(e,t,n,r=E.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||T.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,n,r=0){this.content.nodesBetween(e,t,n,r,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,n,r){return this.content.textBetween(e,t,n,r)}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,n){return this.type==e&&de(this.attrs,t||e.defaultAttrs||Ae)&&E.sameSet(this.marks,n||E.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}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,n=!1){if(e==t)return D.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new D(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return he(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return Te.resolveCached(this,e)}resolveNoCache(e){return Te.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}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()+`)`),Ne(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=T.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.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=E.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!E.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.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(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=T.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};je.prototype.text=void 0;var Me=class e extends je{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Ne(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(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,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 Ne(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var Pe=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new Fe(t,n);if(r.next==null)return e.empty;let i=Ie(r);r.next&&r.err(`Unexpected trailing text`);let a=Ke(Ue(i));return qe(a,r),a}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,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}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 n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return T.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
2
2
  `)}};Pe.empty=new Pe(!0);var Fe=class{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 SyntaxError(e+` (in content expression '`+this.string+`')`)}};function Ie(e){let t=[];do t.push(Le(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function Le(e){let t=[];do t.push(Re(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Re(e){let t=He(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Be(e,t);else break;return t}function ze(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Be(e,t){let n=ze(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:ze(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Ve(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function He(e){if(e.eat(`(`)){let t=Ie(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Ve(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Ue(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function We(e,t){return t-e}function Ge(e,t){let n=[];return r(t),n.sort(We);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function Ke(e){let t=Object.create(null);return n(Ge(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);Ge(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new Pe(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(We);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function qe(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Je(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Ye(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Xe(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function Ze(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new et(e,r,t[r]);return n}var Qe=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=Ze(e,n.attrs),this.defaultAttrs=Je(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Pe.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:Ye(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new je(this,this.computeAttrs(e),T.from(t),E.setFrom(n))}createChecked(e=null,t,n){return t=T.from(t),this.checkContent(t),new je(this,this.computeAttrs(e),t,E.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=T.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(T.empty,!0);return i?new je(this,e,t.append(i),E.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Xe(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 n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:E.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function $e(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var et=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?$e(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},tt=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=Ze(e,r.attrs),this.excluded=null;let i=Je(this.attrs);this.instance=i?new E(this,i):null}create(e=null){return!e&&this.instance?this.instance:new E(this,Ye(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),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){Xe(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},nt=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=w.from(e.nodes),t.marks=w.from(e.marks||{}),this.nodes=Qe.compile(this.spec.nodes,this),this.marks=tt.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=Pe.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?rt(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:rt(this,n.split(` `))}this.nodeFromJSON=e=>je.fromJSON(this,e),this.markFromJSON=e=>E.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Qe))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new Me(n,n.defaultAttrs,e,E.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 RangeError(`Unknown node type: `+e);return t}};function rt(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function it(e){return e.tag!=null}function at(e){return e.style!=null}var ot=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(it(e))this.tags.push(e);else if(at(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new ht(this,t,!1);return n.addAll(e,E.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ht(this,t,!0);return n.addAll(e,E.none,t.from,t.to),D.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(_t(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=vt(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=vt(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},st={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},ct={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},lt={ol:!0,ul:!0},ut=1,dt=2,ft=4;function pt(e,t,n){return t==null?e&&e.whitespace==`pre`?ut|dt:n&~ft:(t?ut:0)|(t===`full`?dt:0)}var mt=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=E.none,this.match=i||(a&ft?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(T.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ut)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=T.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(T.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&&!st.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},ht=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=pt(null,t.preserveWhitespace,0)|(n?ft:0);i=r?new mt(r.type,r.attrs,E.none,!0,t.topMatch||r.type.contentMatch,a):n?new mt(null,null,E.none,!0,null,a):new mt(e.schema.topNodeType,null,E.none,!0,null,a),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 n=e.nodeValue,r=this.top,i=r.options&dt?`full`:this.localPreserveWS||(r.options&ut)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
3
3
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;lt.hasOwnProperty(a)&&this.parser.normalizeLists&&gt(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:ct.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(st.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}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 n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),n.consuming===!1)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),n,e.nodeName==`BR`)||this.leafFallback(e,n);else{let e=this.enter(a,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let o=this.top;if(a&&a.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;typeof t.contentElement==`string`?r=e.querySelector(t.contentElement):typeof t.contentElement==`function`?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(o)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let a=n?e.childNodes[n]:e.firstChild,o=r==null?null:e.childNodes[r];a!=o;a=a.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(a,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,a=0;t>=0;t--){let o=this.nodes[t],s=o.findWrapping(e);if(s&&(!r||r.length>s.length+a)&&(r=s,i=o,!s.length))break;if(o.solid){if(n)break;a+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&=t.match.matchType(e.type);let n=E.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):yt(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&=this.enterInner(e,t,n,!0,r),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let o=pt(e,i,a.options);a.options&ft&&a.content.length==0&&(o|=ft);let s=E.none;return n=n.filter(t=>(a.type?a.type.allowsMarkType(t.type):yt(t.type,e))?(s=t.addToSet(s),!1):!0),this.nodes.push(new mt(e,t,s,r,null,o)),this.open++,n}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;else this.localPreserveWS&&(this.nodes[t].options|=ut);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].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,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].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(`/`),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,a=(e,o)=>{for(;e>=0;e--){let s=t[e];if(s==``){if(e==t.length-1||e==0)continue;for(;o>=i;o--)if(a(e-1,o))return!0;return!1}else{let e=o>0||o==0&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}};function gt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=t.nodeType==1?t.nodeName.toLowerCase():null;e&&lt.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):e==`li`?n=t:e&&(n=null)}}function _t(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function vt(e){let t={};for(let n in e)t[n]=e[n];return t}function yt(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=e=>{a.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||a.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}var bt=class e{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||=St(t).createDocumentFragment();let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,a=0;for(;n<i.length&&a<e.marks.length;){let t=e.marks[a];if(!this.marks[t.type.name]){a++;continue}if(!t.eq(i[n][0])||t.type.spec.spanning===!1)break;n++,a++}for(;n<i.length;)r=i.pop()[1];for(;a<e.marks.length;){let n=e.marks[a++],o=this.serializeMark(n,e.isInline,t);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return St(t).createTextNode(e.text);let{dom:n,contentDOM:r}=Et(St(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError(`Content hole not allowed in a leaf node spec`);this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&Et(St(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return typeof t==`string`?{dom:e.createTextNode(t)}:Et(e,t,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(e){let t=xt(e.nodes);return t.text||=e=>e.text,t}static marksFromSchema(e){return xt(e.marks)}};function xt(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function St(e){return e.document||window.document}var Ct=new WeakMap;function wt(e){let t=Ct.get(e);return t===void 0&&Ct.set(e,t=Tt(e)),t}function Tt(e){let t=null;function n(e){if(e&&typeof e==`object`)if(Array.isArray(e))if(typeof e[0]==`string`)t||=[],t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}function Et(e,t,n,r){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let i=t[0],a;if(typeof i!=`string`)throw RangeError(`Invalid array passed to renderSpec`);if(r&&(a=wt(r))&&a.indexOf(t)>-1)throw RangeError(`Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.`);let o=i.indexOf(` `);o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,c=n?e.createElementNS(n,i):e.createElement(i),l=t[1],u=1;if(l&&typeof l==`object`&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let e in l)if(l[e]!=null){let t=e.indexOf(` `);t>0?c.setAttributeNS(e.slice(0,t),e.slice(t+1),l[e]):e==`style`&&c.style?c.style.cssText=l[e]:c.setAttribute(e,l[e])}}for(let i=u;i<t.length;i++){let a=t[i];if(a===0){if(i<t.length-1||i>u)throw RangeError(`Content hole must be the only child of its parent node`);return{dom:c,contentDOM:c}}else if(typeof a==`string`)c.appendChild(e.createTextNode(a));else{let{dom:t,contentDOM:i}=Et(e,a,n,r);if(c.appendChild(t),i){if(s)throw RangeError(`Multiple content holes`);s=i}}}return{dom:c,contentDOM:s}}var Dt=65535,Ot=2**16;function kt(e,t){return e+t*Ot}function At(e){return e&Dt}function jt(e){return(e-(e&Dt))/Ot}var Mt=1,Nt=2,Pt=4,Ft=8,It=class{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&Ft)>0}get deletedBefore(){return(this.delInfo&(Mt|Pt))>0}get deletedAfter(){return(this.delInfo&(Nt|Pt))>0}get deletedAcross(){return(this.delInfo&Pt)>0}},Lt=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(e){let t=0,n=At(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[e*3+2]-this.ranges[e*3+1];return this.ranges[n*3]+t+jt(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,a=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?r:0);if(s>e)break;let c=this.ranges[o+i],l=this.ranges[o+a],u=s+c;if(e<=u){let i=c?e==s?-1:e==u?1:t:t,a=s+r+(i<0?0:l);if(n)return a;let d=e==(t<0?s:u)?null:kt(o/3,e-s),f=e==s?Nt:e==u?Mt:Pt;return(t<0?e!=s:e!=u)&&(f|=Ft),new It(a,f,d)}r+=l-c}return n?e+r:new It(e+r,0,null)}touches(e,t){let n=0,r=At(t),i=this.inverted?2:1,a=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let o=this.ranges[t]-(this.inverted?n:0);if(o>e)break;let s=this.ranges[t+i];if(e<=o+s&&t==r*3)return!0;n+=this.ranges[t+a]-s}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let a=this.ranges[r],o=a-(this.inverted?i:0),s=a+(this.inverted?0:i),c=this.ranges[r+t],l=this.ranges[r+n];e(o,o+c,s,s+l),i+=l-c}}invert(){return new e(this.ranges,!this.inverted)}toString(){return(this.inverted?`-`:``)+JSON.stringify(this.ranges)}static offset(t){return t==0?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}};Lt.empty=new Lt([]);var Rt=class e{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new e(this._maps,this.mirror,t,n)}appendMap(e,t){this.ownData||=(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?n+r: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.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?n-r-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(i.recover!=null){let t=this.getMirror(n);if(t!=null&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new It(e,r,null)}},zt=Object.create(null),Bt=class{getMap(){return Lt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError(`Invalid input for Step.fromJSON`);let n=zt[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in zt)throw RangeError(`Duplicate use of step JSON ID `+e);return zt[e]=t,t.prototype.jsonID=e,t}},Vt=class e{constructor(e,t){this.doc=e,this.failed=t}static ok(t){return new e(t,null)}static fail(t){return new e(null,t)}static fromReplace(t,n,r,i){try{return e.ok(t.replace(n,r,i))}catch(t){if(t instanceof fe)return e.fail(t.message);throw t}}};function Ht(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let a=e.child(i);a.content.size&&(a=a.copy(Ht(a.content,t,a))),a.isInline&&(a=t(a,n,i)),r.push(a)}return T.fromArray(r)}var Ut=class e extends Bt{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new D(Ht(t.content,(e,t)=>!e.isAtom||!t.type.allowsMarkType(this.mark.type)?e:e.mark(this.mark.addToSet(e.marks)),r),t.openStart,t.openEnd);return Vt.fromReplace(e,this.from,this.to,i)}invert(){return new Wt(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`addMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for AddMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Bt.jsonID(`addMark`,Ut);var Wt=class e extends Bt{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new D(Ht(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return Vt.fromReplace(e,this.from,this.to,n)}invert(){return new Ut(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:`removeMark`,mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for RemoveMarkStep.fromJSON`);return new e(n.from,n.to,t.markFromJSON(n.mark))}};Bt.jsonID(`removeMark`,Wt);var Gt=class e extends Bt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Vt.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Vt.fromReplace(e,this.pos,this.pos+1,new D(T.from(n),0,+!t.isLeaf))}invert(t){let n=t.nodeAt(this.pos);if(n){let t=this.mark.addToSet(n.marks);if(t.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(t))return new e(this.pos,n.marks[r]);return new e(this.pos,this.mark)}}return new Kt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`addNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for AddNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Bt.jsonID(`addNodeMark`,Gt);var Kt=class e extends Bt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Vt.fail(`No node at mark step's position`);let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Vt.fromReplace(e,this.pos,this.pos+1,new D(T.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Gt(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.mark)}toJSON(){return{stepType:`removeNodeMark`,pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for RemoveNodeMarkStep.fromJSON`);return new e(n.pos,t.markFromJSON(n.mark))}};Bt.jsonID(`removeNodeMark`,Kt);var qt=class e extends Bt{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Yt(e,this.from,this.to)?Vt.fail(`Structure replace would overwrite content`):Vt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Lt([this.from,this.to-this.from,this.slice.size])}invert(t){return new e(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.to,-1),r=this.from==this.to&&e.MAP_BIAS<0?n:t.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new e(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(t){if(!(t instanceof e)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?D.empty:new D(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new e(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?D.empty:new D(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new e(t.from,this.to,n,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`)throw RangeError(`Invalid input for ReplaceStep.fromJSON`);return new e(n.from,n.to,D.fromJSON(t,n.slice),!!n.structure)}};qt.MAP_BIAS=1,Bt.jsonID(`replace`,qt);var Jt=class e extends Bt{constructor(e,t,n,r,i,a,o=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=a,this.structure=o}apply(e){if(this.structure&&(Yt(e,this.from,this.gapFrom)||Yt(e,this.gapTo,this.to)))return Vt.fail(`Structure gap-replace would overwrite content`);let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Vt.fail(`Gap is not a flat range`);let n=this.slice.insertAt(this.insert,t.content);return n?Vt.fromReplace(e,this.from,this.to,n):Vt.fail(`Content does not fit in gap`)}getMap(){return new Lt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new e(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||a>r.pos?null:new e(n.pos,r.pos,i,a,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(t,n){if(typeof n.from!=`number`||typeof n.to!=`number`||typeof n.gapFrom!=`number`||typeof n.gapTo!=`number`||typeof n.insert!=`number`)throw RangeError(`Invalid input for ReplaceAroundStep.fromJSON`);return new e(n.from,n.to,n.gapFrom,n.gapTo,D.fromJSON(t,n.slice),n.insert,!!n.structure)}};Bt.jsonID(`replaceAround`,Jt);function Yt(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let e=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Xt(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(e,c,l)=>{if(!e.isInline)return;let u=e.marks;if(!r.isInSet(u)&&l.type.allowsMarkType(r.type)){let l=Math.max(c,t),d=Math.min(c+e.nodeSize,n),f=r.addToSet(u);for(let e=0;e<u.length;e++)u[e].isInSet(f)||(o&&o.to==l&&o.mark.eq(u[e])?o.to=d:i.push(o=new Wt(l,d,u[e])));s&&s.to==l?s.to=d:a.push(s=new Ut(l,d,r))}}),i.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}function Zt(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(e,o)=>{if(!e.isInline)return;a++;let s=null;if(r instanceof tt){let t=e.marks,n;for(;n=r.isInSet(t);)(s||=[]).push(n),t=n.removeFromSet(t)}else r?r.isInSet(e.marks)&&(s=[r]):s=e.marks;if(s&&s.length){let r=Math.min(o+e.nodeSize,n);for(let e=0;e<s.length;e++){let n=s[e],c;for(let e=0;e<i.length;e++){let t=i[e];t.step==a-1&&n.eq(i[e].style)&&(c=t)}c?(c.to=r,c.step=a):i.push({style:n,from:Math.max(o,t),to:r,step:a})}}}),i.forEach(t=>e.step(new Wt(t.from,t.to,t.style)))}function Qt(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let t=0;t<a.childCount;t++){let c=a.child(t),l=s+c.nodeSize,u=r.matchType(c.type);if(!u)o.push(new qt(s,l,D.empty));else{r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Wt(s,l,c.marks[t]));if(i&&c.isText&&n.whitespace!=`pre`){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(c.text);)r||=new D(T.from(n.schema.text(` `,n.allowedMarks(c.marks))),0,0),o.push(new qt(s+e.index,s+e.index+e[0].length,r))}}s=l}if(!r.validEnd){let t=r.fillBefore(T.empty,!0);e.replace(s,s,new D(t,0,0))}for(let t=o.length-1;t>=0;t--)e.step(o[t])}function $t(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function en(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let a=e.$from.node(n),o=e.$from.index(n)+r,s=e.$to.indexAfter(n)-i;if(n<e.depth&&a.canReplace(o,s,t))return n;if(n==0||a.type.spec.isolating||!$t(a,o,s))break;o&&(r=1),s<a.childCount&&(i=1)}return null}function tn(e,t,n){let{$from:r,$to:i,depth:a}=t,o=r.before(a+1),s=i.after(a+1),c=o,l=s,u=T.empty,d=0;for(let e=a,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=T.from(r.node(e).copy(u)),d++):c--;let f=T.empty,p=0;for(let e=a,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,f=T.from(i.node(e).copy(f)),p++):l++;e.step(new Jt(c,l,o,s,new D(u.append(f),d,p),u.size-d,!0))}function nn(e,t,n=null,r=e){let i=an(e,t),a=i&&on(r,t);return a?i.map(rn).concat({type:t,attrs:n}).concat(a.map(rn)):null}function rn(e){return{type:e,attrs:null}}function an(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.contentMatchAt(r).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return n.canReplaceWith(r,i,o)?a:null}function on(e,t){let{parent:n,startIndex:r,endIndex:i}=e,a=n.child(r),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let s=(o.length?o[o.length-1]:t).contentMatch;for(let e=r;s&&e<i;e++)s=s.matchType(n.child(e).type);return!s||!s.validEnd?null:o}function sn(e,t,n){let r=T.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError(`Wrapper type given to Transform.wrap does not form valid content of its parent wrapper`)}r=T.from(n[e].type.create(n[e].attrs,r))}let i=t.start,a=t.end;e.step(new Jt(i,a,i,a,new D(r,0,0),n.length,!0))}function cn(e,t,n,r,i){if(!r.isTextblock)throw RangeError(`Type given to setBlockType should be a textblock`);let a=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let o=typeof i==`function`?i(t):i;if(t.isTextblock&&!t.hasMarkup(r,o)&&dn(e.doc,e.mapping.slice(a).map(n),r)){let i=null;if(r.schema.linebreakReplacement){let e=r.whitespace==`pre`,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?i=!1:!e&&t&&(i=!0)}i===!1&&un(e,t,n,a),Qt(e,e.mapping.slice(a).map(n,1),r,void 0,i===null);let s=e.mapping.slice(a),c=s.map(n,1),l=s.map(n+t.nodeSize,1);return e.step(new Jt(c,l,c+1,l-1,new D(T.from(r.create(o,null,t.marks)),0,0),1,!0)),i===!0&&ln(e,t,n,a),!1}})}function ln(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function un(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+a);e.replaceWith(i,i+1,t.type.schema.text(`
@@ -99,7 +99,7 @@ ${t.renderChildren(e.content||[],`
99
99
  `);s+=e.type===`paragraph`?`
100
100
 
101
101
  ${n}`:`
102
- ${n}`}}),s}function lf(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var V=class e extends Sd{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function uf(e){return new Td({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=R(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Eu(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:df,getOwnPropertySymbols:ff}=Object,{hasOwnProperty:pf}=Object.prototype;function mf(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function hf(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function gf(e){return e?.[Symbol.toStringTag]}function _f(e){return df(e).concat(ff(e))}var vf=Object.hasOwn||((e,t)=>pf.call(e,t));function yf(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var bf=`__v`,xf=`__o`,Sf=`_owner`,{getOwnPropertyDescriptor:Cf,keys:wf}=Object;function Tf(e,t){return e.byteLength===t.byteLength&&Rf(new Uint8Array(e),new Uint8Array(t))}function Ef(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Df(e,t){return e.byteLength===t.byteLength&&Rf(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Of(e,t){return yf(e.getTime(),t.getTime())}function kf(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Af(e,t){return e===t}function jf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Mf=yf;function Nf(e,t,n){let r=wf(e),i=r.length;if(wf(t).length!==i)return!1;for(;i-- >0;)if(!Bf(e,t,n,r[i]))return!1;return!0}function Pf(e,t,n){let r=_f(e),i=r.length;if(_f(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Bf(e,t,n,a)||(o=Cf(e,a),s=Cf(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Ff(e,t){return yf(e.valueOf(),t.valueOf())}function If(e,t){return e.source===t.source&&e.flags===t.flags}function Lf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Rf(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function zf(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Bf(e,t,n,r){return(r===Sf||r===xf||r===bf)&&(e.$$typeof||t.$$typeof)?!0:vf(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Vf=`[object ArrayBuffer]`,Hf=`[object Arguments]`,Uf=`[object Boolean]`,Wf=`[object DataView]`,Gf=`[object Date]`,Kf=`[object Error]`,qf=`[object Map]`,Jf=`[object Number]`,Yf=`[object Object]`,Xf=`[object RegExp]`,Zf=`[object Set]`,Qf=`[object String]`,$f={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},ep=`[object URL]`,tp=Object.prototype.toString;function np({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=tp.call(h);if(b===Gf)return r(h,g,_);if(b===Xf)return u(h,g,_);if(b===qf)return o(h,g,_);if(b===Zf)return d(h,g,_);if(b===Yf)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===ep)return p(h,g,_);if(b===Kf)return i(h,g,_);if(b===Hf)return c(h,g,_);if($f[b])return f(h,g,_);if(b===Vf)return e(h,g,_);if(b===Wf)return n(h,g,_);if(b===Uf||b===Jf||b===Qf)return l(h,g,_);if(m){let e=m[b];if(!e){let t=gf(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function rp({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Tf,areArraysEqual:n?Pf:Ef,areDataViewsEqual:Df,areDatesEqual:Of,areErrorsEqual:kf,areFunctionsEqual:Af,areMapsEqual:n?mf(jf,Pf):jf,areNumbersEqual:Mf,areObjectsEqual:n?Pf:Nf,arePrimitiveWrappersEqual:Ff,areRegExpsEqual:If,areSetsEqual:n?mf(Lf,Pf):Lf,areTypedArraysEqual:n?mf(Rf,Pf):Rf,areUrlsEqual:zf,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=hf(r.areArraysEqual),t=hf(r.areMapsEqual),n=hf(r.areObjectsEqual),i=hf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function ip(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function ap({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var op=sp();sp({strict:!0}),sp({circular:!0}),sp({circular:!0,strict:!0}),sp({createInternalComparator:()=>yf}),sp({strict:!0,createInternalComparator:()=>yf}),sp({circular:!0,createInternalComparator:()=>yf}),sp({circular:!0,createInternalComparator:()=>yf,strict:!0});function sp(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=np(rp(e));return ap({circular:t,comparator:a,createState:r,equals:n?n(a):ip(a),strict:i})}var cp=n((e=>{var t=m(),n=l();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,l){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),l!==void 0&&f.hasValue){var t=f.value;if(l(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return l!==void 0&&l(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,l]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),lp=n(((e,t)=>{t.exports=cp()}))(),up=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},dp=({contentComponent:e})=>{let t=(0,ie.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,C.jsx)(C.Fragment,{children:Object.values(t)})};function fp(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:re.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var pp=class extends S.Component{constructor(e){super(e),this.editorContentRef=S.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=fp(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`div`,{ref:up(t,this.editorContentRef),...n}),e?.contentComponent&&(0,C.jsx)(dp,{contentComponent:e.contentComponent})]})}},mp=(0,S.forwardRef)((e,t)=>{let n=S.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return S.createElement(pp,{key:n,innerRef:t,...e})}),hp=S.memo(mp),gp=typeof window<`u`?S.useLayoutEffect:S.useEffect,_p=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function vp(e){let[t]=(0,S.useState)(()=>new _p(e.editor)),n=(0,lp.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??op);return gp(()=>t.watch(e.editor),[e.editor,t]),(0,S.useDebugValue)(n),n}var yp=!1,bp=typeof window>`u`,xp=bp||!!(typeof window<`u`&&window.next),Sp=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return bp?(t&&yp&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):xp&&e===void 0&&(t=!1,yp&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),t?this.createEditor():null}createEditor(){return new qd({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Cp(e={},t=[]){let n=(0,S.useRef)(e);n.current=e;let[r]=(0,S.useState)(()=>new Sp(n)),i=(0,ie.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,S.useDebugValue)(i),(0,S.useEffect)(r.onRender(t)),vp({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var wp=(0,S.createContext)({editor:null});wp.Consumer;var Tp=()=>(0,S.useContext)(wp),Ep=(0,S.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Dp=()=>(0,S.useContext)(Ep);S.forwardRef((e,t)=>{let{onDragStart:n}=Dp();return(0,C.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),S.createContext({markViewContentRef:()=>{}});var Op=(0,S.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Op.displayName=`TiptapContext`;var kp=()=>(0,S.useContext)(Op);function Ap({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,S.useMemo)(()=>({editor:r}),[r]),a=(0,S.useMemo)(()=>({editor:r}),[r]);return(0,C.jsx)(wp.Provider,{value:a,children:(0,C.jsx)(Op.Provider,{value:i,children:n})})}Ap.displayName=`Tiptap`;function jp({...e}){let{editor:t}=kp();return(0,C.jsx)(hp,{editor:t,...e})}jp.displayName=`Tiptap.Content`,Object.assign(Ap,{Content:jp});var Mp,Np;if(typeof WeakMap<`u`){let e=new WeakMap;Mp=t=>e.get(t),Np=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Mp=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Np=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var H=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Mp(e)||Np(e,Pp(e))}};function Pp(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=Fp(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new H(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&Ip(s,o,e),s}function Fp(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function Ip(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=Lp(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function Lp(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Rp(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var zp=new M(`selectingCells`);function Bp(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function Vp(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function Hp(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function Up(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=Bp(t.$head)||Wp(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function Wp(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function Gp(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function Kp(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function qp(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Jp(e,t,n){let r=e.node(-1),i=H.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function Yp(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function Xp(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function Zp(e,t,n){let r=Rp(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var U=class e extends O{constructor(e,t=e){let n=e.node(-1),r=H.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Hn(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(Gp(r)&&Gp(i)&&qp(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return k.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=H.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=Yp(e,0,l)),u>0&&(e=Yp(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(T.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new D(T.from(o),1,1)}replace(e,t=D.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?D.empty:t)}let i=O.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new D(T.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=H.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=H.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=H.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=H.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new Qp(this.$anchorCell.pos,this.$headCell.pos)}};U.prototype.visible=!1,O.jsonID(`cell`,U);var Qp=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&qp(t,n)?new U(t,n):O.near(n,1)}};function $p(e){if(!(e.selection instanceof U))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(Ms.node(n,n+e.nodeSize,{class:`selectedCell`}))}),F.create(e.doc,t)}function em({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function tm({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function nm(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof A&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=U.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=U.rowSelection(e,e)}else if(!n){let e=H.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=U.create(i,t+1,n)}}else r instanceof k&&em(r)?a=k.create(i,r.from):r instanceof k&&tm(r)&&(a=k.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var rm=new M(`fix-tables`);function im(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?im(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function am(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=om(e,t,r,n))};return t?t.doc!=e.doc&&im(t.doc,e.doc,0,r):e.doc.descendants(r),n}function om(e,t,n,r){let i=H.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,Yp(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=Rp(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(rm,{fixTables:!0})}function sm(e){let t=e.selection,n=Up(e),r=n.node(-1),i=n.start(-1),a=H.get(r);return{...t instanceof U?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function cm(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;Zp(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,Xp(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?Rp(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function lm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e);t(cm(e.tr,n,n.left))}return!0}function um(e,t){if(!Hp(e))return!1;if(t){let n=sm(e);t(cm(e.tr,n,n.right))}return!0}function dm(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,Yp(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function fm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;dm(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=H.get(e)}t(r)}return!0}function pm(e,t,n){let r=Rp(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function mm(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;pm(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?Rp(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,Rp(r.type.schema).row.create(null,o)),e}function hm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e);t(mm(e.tr,n,n.top))}return!0}function gm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e);t(mm(e.tr,n,n.bottom))}return!0}function _m(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function vm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;_m(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=H.get(n.table)}t(r)}return!0}function ym(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function bm({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function xm(e,t){let n=e.selection;if(!(n instanceof U)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=sm(e),{map:i}=r;if(bm(i,r))return!1;if(t){let n=e.tr,a={},o=T.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{ym(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...Xp(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=ym(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new U(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Sm(e,t){let n=Rp(e.schema);return Cm(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Cm(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof U){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=Vp(r.$from),!i)return!1;a=Bp(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=sm(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof U&&u.setSelection(new U(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function wm(e,t){return function(n,r){if(!Hp(n))return!1;let i=Up(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof U?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Tm(e){return function(t,n){if(!Hp(t))return!1;if(n){let r=Rp(t.schema),i=sm(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Em(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Dm(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Tm(e):function(t,n){if(!Hp(t))return!1;if(n){let r=Rp(t.schema),i=sm(t),a=t.tr,o=Em(`row`,i,r),s=Em(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Dm(`row`,{useDeprecatedLogic:!0}),Dm(`column`,{useDeprecatedLogic:!0});var Om=Dm(`cell`,{useDeprecatedLogic:!0});function km(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function Am(e){return function(t,n){if(!Hp(t))return!1;let r=km(Up(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(k.between(e,Kp(e))).scrollIntoView())}return!0}}function jm(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Mm(e,t){let n=e.selection;if(!(n instanceof U))return!1;if(t){let r=e.tr,i=Rp(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new D(i,0,0))}),r.docChanged&&t(r)}return!0}function Nm(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Fm(Rp(o).row,new D(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Fm(Rp(o).row,new D(t,n,r)).content:t);else return null;return Pm(o,s)}function Pm(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(T.empty),n[i]<r){let a=Rp(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(T.from(o))}return{height:t.length,width:r,rows:t}}function Fm(e,t){let n=e.createAndFill();return new Bn(n).replace(0,n.content.size,t).doc}function Im({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(Yp(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(T.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(T.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Lm(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=Rp(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,T.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function Rm(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function zm(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,Yp(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(Yp(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function Bm(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=H.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=H.get(a),f=d.mapping.maps.length}Lm(d,o,a,n,l,u,f)&&p(),Rm(d,o,a,n,c,l,s,f)&&p(),Rm(d,o,a,n,c,l,u,f)&&p(),zm(d,o,a,n,s,u,c,f)&&p(),zm(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new D(i.rows[e-s],0,0))}p(),d.setSelection(new U(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var Vm=Pc({ArrowLeft:Um(`horiz`,-1),ArrowRight:Um(`horiz`,1),ArrowUp:Um(`vert`,-1),ArrowDown:Um(`vert`,1),"Shift-ArrowLeft":Wm(`horiz`,-1),"Shift-ArrowRight":Wm(`horiz`,1),"Shift-ArrowUp":Wm(`vert`,-1),"Shift-ArrowDown":Wm(`vert`,1),Backspace:Mm,"Mod-Backspace":Mm,Delete:Mm,"Mod-Delete":Mm});function Hm(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Um(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof U)return Hm(n,r,O.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=Jm(i,e,t);if(o==null)return!1;if(e==`horiz`)return Hm(n,r,O.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=Jp(i,e,t),s;return s=a?O.near(a,1):t<0?O.near(n.doc.resolve(i.before(-1)),-1):O.near(n.doc.resolve(i.after(-1)),1),Hm(n,r,s)}}}function Wm(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof U)o=a;else{let r=Jm(i,e,t);if(r==null)return!1;o=new U(n.doc.resolve(r))}let s=Jp(o.$headCell,e,t);return s?Hm(n,r,new U(o.$anchorCell,s)):!1}}function Gm(e,t){let n=e.state.doc,r=Bp(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new U(r))),!0):!1}function Km(e,t,n){if(!Hp(e.state))return!1;let r=Nm(n),i=e.state.selection;if(i instanceof U){r||={width:1,height:1,rows:[T.from(Fm(Rp(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=H.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Im(r,o.right-o.left,o.bottom-o.top),Bm(e.state,e.dispatch,a,o,r),!0}else if(r){let t=Up(e.state),n=t.start(-1);return Bm(e.state,e.dispatch,n,H.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function qm(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=Ym(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof U)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=Bp(e.state.selection.$anchor))!=null&&Xm(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=Xm(e,n),i=zp.getState(e.state)==null;if(!r||!qp(t,r))if(i)r=t;else return;let a=new U(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(zp,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),zp.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(zp,-1))}function o(r){let o=r,s=zp.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(Ym(e,o.target)!=n&&(c=Xm(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function Jm(e,t,n){if(!(e.state.selection instanceof k))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function Ym(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function Xm(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Bp(e.state.doc.resolve(r))||Bp(e.state.doc.resolve(i))}var Zm=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),Qm(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,Qm(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function Qm(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var $m=new M(`tableColumnResizing`);function eh({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Zm,lastColumnResizable:i=!0}={}){let a=new j({key:$m,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=Rp(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new th(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=$m.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{nh(t,n,e,i)},mouseleave:e=>{rh(e)},mousedown:(e,r)=>{ih(e,r,t,n)}},decorations:e=>{let t=$m.getState(e);if(t&&t.activeHandle>-1)return ph(e,t.activeHandle)},nodeViews:{}}});return a}var th=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta($m);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return Gp(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function nh(e,t,n,r){if(!e.editable)return;let i=$m.getState(e.state);if(i&&!i.dragging){let a=oh(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=sh(e,t,`left`,n):i-t.clientX<=n&&(o=sh(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=H.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}lh(e,o)}}}function rh(e){if(!e.editable)return;let t=$m.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&lh(e,-1)}function ih(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=$m.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=ah(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta($m,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=$m.getState(e.state);r?.dragging&&(uh(e,r.activeHandle,ch(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta($m,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=$m.getState(e.state);if(i&&i.dragging){let a=ch(i.dragging,t,n);dh(e,i.activeHandle,a,r)}}return dh(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function ah(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function oh(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function sh(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=Bp(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=H.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function ch(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function lh(e,t){e.dispatch(e.state.tr.setMeta($m,{setHandle:t}))}function uh(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=H.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():fh(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function dh(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=H.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&Qm(a,c.firstChild,c,r,s,n)}function fh(e){return Array(e).fill(0)}function ph(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return F.empty;let a=H.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,$m.getState(e)?.dragging&&n.push(Ms.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(Ms.widget(s,c))}}return F.create(e.doc,n)}function mh({allowTableNodeSelection:e=!1}={}){return new j({key:zp,state:{init(){return null},apply(e,t){let n=e.getMeta(zp);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:$p,handleDOMEvents:{mousedown:qm},createSelectionBetween(e){return zp.getState(e.state)==null?null:e.state.selection},handleTripleClick:Gm,handleKeyDown:Vm,handlePaste:Km},appendTransaction(t,n,r){return nm(r,am(r,n),e)}})}function hh(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var gh=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&ol(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(r(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(d(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(c(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(a(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(o(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(u(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(f(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Hu(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof A){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof U){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():hh(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&p(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},_h=e=>new j({key:typeof e.pluginKey==`string`?new M(e.pluginKey):e.pluginKey,view:t=>new gh({view:t,...e})});B.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[_h({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var vh=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return yu(e,{textSerializers:bu(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(r(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(d(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(c(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(a(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(o(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(u(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(f(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=Hu(this.view,e.from,e.to);p({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},yh=e=>new j({key:typeof e.pluginKey==`string`?new M(e.pluginKey):e.pluginKey,view:t=>new vh({view:t,...e})});B.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[yh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function bh(e,t){return e??new M(t)}var xh=typeof window<`u`?S.useLayoutEffect:S.useEffect,Sh=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),Ch=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),wh=new Set([`children`,`className`,`style`]),Th=new Set([`tabIndex`]),Eh=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Dh={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function Oh(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function kh(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function Ah(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Eh.has(e)}function jh(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Mh(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Dh[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Nh(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function Ph(e){return Th.has(e)}function Fh(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function Ih(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function Lh(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||Ch.has(e)?String(t):`${t}px`}function Rh(e,t){Sh.has(t)||e.style.removeProperty(jh(t))}function zh(e,t,n){Sh.has(t)||e.style.setProperty(jh(t),Lh(t,n))}function Bh(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(wh.has(r)||!Ah(r)||Oh(r,t[r])||Oh(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=kh(r);if(a==null||a===!1){Ph(r)&&Ih(e,r),e.removeAttribute(o);return}if(a===!0){Ph(r)&&Fh(e,r,!0),e.setAttribute(o,``);return}if(Ph(r)){Fh(e,r,a);return}e.setAttribute(o,String(a))})}function Vh(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function Hh(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){Rh(e,t);return}zh(e,t,a)}})}function Uh(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!Oh(t,n))return;let{eventName:i,options:a}=Mh(t),o=t=>{n(Nh(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Wh(e,t){let n=(0,S.useRef)({}),r=(0,S.useRef)([]);xh(()=>{let i=n.current;return Vh(e,i.className,t.className),Hh(e,i.style,t.style),Bh(e,i,t),r.current=Uh(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var Gh=S.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,S.useRef)(document.createElement(`div`)),f=(0,S.useRef)(bh(e,`bubbleMenu`)).current;Wh(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Tp(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,S.useRef)(h);g.current=h;let[_,v]=(0,S.useState)(!1),y=(0,S.useRef)(!0);return(0,S.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=_h({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,S.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,re.createPortal)(c,d.current)});S.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,S.useRef)(document.createElement(`div`)),d=(0,S.useRef)(bh(e,`floatingMenu`)).current;Wh(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Tp(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,S.useRef)(m);h.current=m;let[g,_]=(0,S.useState)(!1),v=(0,S.useRef)(!0);return(0,S.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=yh({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,S.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,re.createPortal)(s,u.current)});var Kh=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,qh=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,Jh=`numeric`,Yh=`ascii`,Xh=`alpha`,Zh=`asciinumeric`,Qh=`alphanumeric`,$h=`domain`,eg=`emoji`,tg=`scheme`,ng=`slashscheme`,rg=`whitespace`;function ig(e,t){return e in t||(t[e]=[]),t[e]}function ag(e,t,n){t[Jh]&&(t[Zh]=!0,t[Qh]=!0),t[Yh]&&(t[Zh]=!0,t[Xh]=!0),t[Zh]&&(t[Qh]=!0),t[Xh]&&(t[Qh]=!0),t[Qh]&&(t[$h]=!0),t[eg]&&(t[$h]=!0);for(let r in t){let t=ig(r,n);t.indexOf(e)<0&&t.push(e)}}function og(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function sg(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}sg.groups={},sg.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=sg.groups;let i;return t&&t.j?i=t:(i=new sg(t),n&&r&&ag(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=sg.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new sg,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new sg,a&&(r&&(o.t&&typeof o.t==`string`?ag(a,Object.assign(og(o.t,r),n),r):n&&ag(a,n,r)),o.t=a),i.j[e]=o,o}};var W=(e,t,n,r,i)=>e.ta(t,n,r,i),G=(e,t,n,r,i)=>e.tr(t,n,r,i),cg=(e,t,n,r,i)=>e.ts(t,n,r,i),K=(e,t,n,r,i)=>e.tt(t,n,r,i),lg=`WORD`,ug=`UWORD`,dg=`ASCIINUMERICAL`,fg=`ALPHANUMERICAL`,pg=`LOCALHOST`,mg=`TLD`,hg=`UTLD`,gg=`SCHEME`,_g=`SLASH_SCHEME`,vg=`NUM`,yg=`WS`,bg=`NL`,xg=`OPENBRACE`,Sg=`CLOSEBRACE`,Cg=`OPENBRACKET`,wg=`CLOSEBRACKET`,Tg=`OPENPAREN`,Eg=`CLOSEPAREN`,Dg=`OPENANGLEBRACKET`,Og=`CLOSEANGLEBRACKET`,kg=`FULLWIDTHLEFTPAREN`,Ag=`FULLWIDTHRIGHTPAREN`,jg=`LEFTCORNERBRACKET`,Mg=`RIGHTCORNERBRACKET`,Ng=`LEFTWHITECORNERBRACKET`,Pg=`RIGHTWHITECORNERBRACKET`,Fg=`FULLWIDTHLESSTHAN`,Ig=`FULLWIDTHGREATERTHAN`,Lg=`AMPERSAND`,Rg=`APOSTROPHE`,zg=`ASTERISK`,Bg=`AT`,Vg=`BACKSLASH`,Hg=`BACKTICK`,Ug=`CARET`,Wg=`COLON`,Gg=`COMMA`,Kg=`DOLLAR`,qg=`DOT`,Jg=`EQUALS`,Yg=`EXCLAMATION`,Xg=`HYPHEN`,Zg=`PERCENT`,Qg=`PIPE`,$g=`PLUS`,e_=`POUND`,t_=`QUERY`,n_=`QUOTE`,r_=`FULLWIDTHMIDDLEDOT`,i_=`SEMI`,a_=`SLASH`,o_=`TILDE`,s_=`UNDERSCORE`,c_=`EMOJI`,l_=`SYM`,u_=Object.freeze({__proto__:null,ALPHANUMERICAL:fg,AMPERSAND:Lg,APOSTROPHE:Rg,ASCIINUMERICAL:dg,ASTERISK:zg,AT:Bg,BACKSLASH:Vg,BACKTICK:Hg,CARET:Ug,CLOSEANGLEBRACKET:Og,CLOSEBRACE:Sg,CLOSEBRACKET:wg,CLOSEPAREN:Eg,COLON:Wg,COMMA:Gg,DOLLAR:Kg,DOT:qg,EMOJI:c_,EQUALS:Jg,EXCLAMATION:Yg,FULLWIDTHGREATERTHAN:Ig,FULLWIDTHLEFTPAREN:kg,FULLWIDTHLESSTHAN:Fg,FULLWIDTHMIDDLEDOT:r_,FULLWIDTHRIGHTPAREN:Ag,HYPHEN:Xg,LEFTCORNERBRACKET:jg,LEFTWHITECORNERBRACKET:Ng,LOCALHOST:pg,NL:bg,NUM:vg,OPENANGLEBRACKET:Dg,OPENBRACE:xg,OPENBRACKET:Cg,OPENPAREN:Tg,PERCENT:Zg,PIPE:Qg,PLUS:$g,POUND:e_,QUERY:t_,QUOTE:n_,RIGHTCORNERBRACKET:Mg,RIGHTWHITECORNERBRACKET:Pg,SCHEME:gg,SEMI:i_,SLASH:a_,SLASH_SCHEME:_g,SYM:l_,TILDE:o_,TLD:mg,UNDERSCORE:s_,UTLD:hg,UWORD:ug,WORD:lg,WS:yg}),d_=/[a-z]/,f_=/\p{L}/u,p_=/\p{Emoji}/u,m_=/\d/,h_=/\s/,g_=`\r`,__=`
102
+ ${n}`}}),s}function lf(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var V=class e extends Sd{constructor(){super(...arguments),this.type=`node`}static create(t={}){return new e(typeof t==`function`?t():t)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function uf(e){return new Td({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=R(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Eu(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:df,getOwnPropertySymbols:ff}=Object,{hasOwnProperty:pf}=Object.prototype;function mf(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function hf(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function gf(e){return e?.[Symbol.toStringTag]}function _f(e){return df(e).concat(ff(e))}var vf=Object.hasOwn||((e,t)=>pf.call(e,t));function yf(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var bf=`__v`,xf=`__o`,Sf=`_owner`,{getOwnPropertyDescriptor:Cf,keys:wf}=Object;function Tf(e,t){return e.byteLength===t.byteLength&&Rf(new Uint8Array(e),new Uint8Array(t))}function Ef(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Df(e,t){return e.byteLength===t.byteLength&&Rf(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Of(e,t){return yf(e.getTime(),t.getTime())}function kf(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function Af(e,t){return e===t}function jf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var Mf=yf;function Nf(e,t,n){let r=wf(e),i=r.length;if(wf(t).length!==i)return!1;for(;i-- >0;)if(!Bf(e,t,n,r[i]))return!1;return!0}function Pf(e,t,n){let r=_f(e),i=r.length;if(_f(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Bf(e,t,n,a)||(o=Cf(e,a),s=Cf(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Ff(e,t){return yf(e.valueOf(),t.valueOf())}function If(e,t){return e.source===t.source&&e.flags===t.flags}function Lf(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Rf(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function zf(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Bf(e,t,n,r){return(r===Sf||r===xf||r===bf)&&(e.$$typeof||t.$$typeof)?!0:vf(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var Vf=`[object ArrayBuffer]`,Hf=`[object Arguments]`,Uf=`[object Boolean]`,Wf=`[object DataView]`,Gf=`[object Date]`,Kf=`[object Error]`,qf=`[object Map]`,Jf=`[object Number]`,Yf=`[object Object]`,Xf=`[object RegExp]`,Zf=`[object Set]`,Qf=`[object String]`,$f={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},ep=`[object URL]`,tp=Object.prototype.toString;function np({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=tp.call(h);if(b===Gf)return r(h,g,_);if(b===Xf)return u(h,g,_);if(b===qf)return o(h,g,_);if(b===Zf)return d(h,g,_);if(b===Yf)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===ep)return p(h,g,_);if(b===Kf)return i(h,g,_);if(b===Hf)return c(h,g,_);if($f[b])return f(h,g,_);if(b===Vf)return e(h,g,_);if(b===Wf)return n(h,g,_);if(b===Uf||b===Jf||b===Qf)return l(h,g,_);if(m){let e=m[b];if(!e){let t=gf(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function rp({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Tf,areArraysEqual:n?Pf:Ef,areDataViewsEqual:Df,areDatesEqual:Of,areErrorsEqual:kf,areFunctionsEqual:Af,areMapsEqual:n?mf(jf,Pf):jf,areNumbersEqual:Mf,areObjectsEqual:n?Pf:Nf,arePrimitiveWrappersEqual:Ff,areRegExpsEqual:If,areSetsEqual:n?mf(Lf,Pf):Lf,areTypedArraysEqual:n?mf(Rf,Pf):Rf,areUrlsEqual:zf,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=hf(r.areArraysEqual),t=hf(r.areMapsEqual),n=hf(r.areObjectsEqual),i=hf(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function ip(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function ap({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var op=sp();sp({strict:!0}),sp({circular:!0}),sp({circular:!0,strict:!0}),sp({createInternalComparator:()=>yf}),sp({strict:!0,createInternalComparator:()=>yf}),sp({circular:!0,createInternalComparator:()=>yf}),sp({circular:!0,createInternalComparator:()=>yf,strict:!0});function sp(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=np(rp(e));return ap({circular:t,comparator:a,createState:r,equals:n?n(a):ip(a),strict:i})}var cp=n((e=>{var t=m(),n=f();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),lp=n(((e,t)=>{t.exports=cp()}))(),up=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},dp=({contentComponent:e})=>{let t=(0,ie.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,C.jsx)(C.Fragment,{children:Object.values(t)})};function fp(){let e=new Set,t={};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:re.createPortal(r.reactElement,r.element,n)},e.forEach(e=>e())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(e=>e())}}}var pp=class extends S.Component{constructor(e){super(e),this.editorContentRef=S.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=fp(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`div`,{ref:up(t,this.editorContentRef),...n}),e?.contentComponent&&(0,C.jsx)(dp,{contentComponent:e.contentComponent})]})}},mp=(0,S.forwardRef)((e,t)=>{let n=S.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return S.createElement(pp,{key:n,innerRef:t,...e})}),hp=S.memo(mp),gp=typeof window<`u`?S.useLayoutEffect:S.useEffect,_p=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e=()=>{this.transactionNumber+=1,this.subscribers.forEach(e=>e())},t=this.editor;return t.on(`transaction`,e),()=>{t.off(`transaction`,e)}}}};function vp(e){let[t]=(0,S.useState)(()=>new _p(e.editor)),n=(0,lp.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??op);return gp(()=>t.watch(e.editor),[e.editor,t]),(0,S.useDebugValue)(n),n}var yp=!1,bp=typeof window>`u`,xp=bp||!!(typeof window<`u`&&window.next),Sp=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return bp?(t&&yp&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),t=!1):xp&&e===void 0&&(t=!1,yp&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),t?this.createEditor():null}createEditor(){return new qd({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length?e.extensions.every((e,n)=>e===t.extensions?.[n]):!1:e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Cp(e={},t=[]){let n=(0,S.useRef)(e);n.current=e;let[r]=(0,S.useState)(()=>new Sp(n)),i=(0,ie.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,S.useDebugValue)(i),(0,S.useEffect)(r.onRender(t)),vp({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var wp=(0,S.createContext)({editor:null});wp.Consumer;var Tp=()=>(0,S.useContext)(wp),Ep=(0,S.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Dp=()=>(0,S.useContext)(Ep);S.forwardRef((e,t)=>{let{onDragStart:n}=Dp();return(0,C.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),S.createContext({markViewContentRef:()=>{}});var Op=(0,S.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});Op.displayName=`TiptapContext`;var kp=()=>(0,S.useContext)(Op);function Ap({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,S.useMemo)(()=>({editor:r}),[r]),a=(0,S.useMemo)(()=>({editor:r}),[r]);return(0,C.jsx)(wp.Provider,{value:a,children:(0,C.jsx)(Op.Provider,{value:i,children:n})})}Ap.displayName=`Tiptap`;function jp({...e}){let{editor:t}=kp();return(0,C.jsx)(hp,{editor:t,...e})}jp.displayName=`Tiptap.Content`,Object.assign(Ap,{Content:jp});var Mp,Np;if(typeof WeakMap<`u`){let e=new WeakMap;Mp=t=>e.get(t),Np=(t,n)=>(e.set(t,n),n)}else{let e=[],t=0;Mp=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},Np=(n,r)=>(t==10&&(t=0),e[t++]=n,e[t++]=r)}var H=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){let n=this.map[t];if(n!=e)continue;let r=t%this.width,i=t/this.width|0,a=r+1,o=i+1;for(let e=1;a<this.width&&this.map[t+e]==n;e++)a++;for(let e=1;o<this.height&&this.map[t+this.width*e]==n;e++)o++;return{left:r,top:i,right:a,bottom:o}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){let{left:r,right:i,top:a,bottom:o}=this.findCell(e);return t==`horiz`?(n<0?r==0:i==this.width)?null:this.map[a*this.width+(n<0?r-1:i)]:(n<0?a==0:o==this.height)?null:this.map[r+this.width*(n<0?a-1:o)]}rectBetween(e,t){let{left:n,right:r,top:i,bottom:a}=this.findCell(e),{left:o,right:s,top:c,bottom:l}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(i,c),right:Math.max(r,s),bottom:Math.max(a,l)}}cellsInRect(e){let t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let i=e.left;i<e.right;i++){let a=r*this.width+i,o=this.map[a];n[o]||(n[o]=!0,!(i==e.left&&i&&this.map[a-1]==o||r==e.top&&r&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,i=0;;r++){let a=i+n.child(r).nodeSize;if(r==e){let n=t+e*this.width,r=(e+1)*this.width;for(;n<r&&this.map[n]<i;)n++;return n==r?a-1:this.map[n]}i=a}}static get(e){return Mp(e)||Np(e,Pp(e))}};function Pp(e){if(e.type.spec.tableRole!=`table`)throw RangeError(`Not a table node: `+e.type.name);let t=Fp(e),n=e.childCount,r=[],i=0,a=null,o=[];for(let e=0,i=t*n;e<i;e++)r[e]=0;for(let s=0,c=0;s<n;s++){let l=e.child(s);c++;for(let e=0;;e++){for(;i<r.length&&r[i]!=0;)i++;if(e==l.childCount)break;let u=l.child(e),{colspan:d,rowspan:f,colwidth:p}=u.attrs;for(let e=0;e<f;e++){if(e+s>=n){(a||=[]).push({type:`overlong_rowspan`,pos:c,n:f-e});break}let l=i+e*t;for(let e=0;e<d;e++){r[l+e]==0?r[l+e]=c:(a||=[]).push({type:`collision`,row:s,pos:c,n:d-e});let n=p&&p[e];if(n){let r=(l+e)%t*2,i=o[r];i==null||i!=n&&o[r+1]==1?(o[r]=n,o[r+1]=1):i==n&&o[r+1]++}}}i+=d,c+=u.nodeSize}let u=(s+1)*t,d=0;for(;i<u;)r[i++]==0&&d++;d&&(a||=[]).push({type:`missing`,row:s,n:d}),c++}(t===0||n===0)&&(a||=[]).push({type:`zero_sized`});let s=new H(t,n,r,a),c=!1;for(let e=0;!c&&e<o.length;e+=2)o[e]!=null&&o[e+1]<n&&(c=!0);return c&&Ip(s,o,e),s}function Fp(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){let i=e.child(r),a=0;if(n)for(let t=0;t<r;t++){let n=e.child(t);for(let e=0;e<n.childCount;e++){let i=n.child(e);t+i.attrs.rowspan>r&&(a+=i.attrs.colspan)}}for(let e=0;e<i.childCount;e++){let t=i.child(e);a+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function Ip(e,t,n){e.problems||=[];let r={};for(let i=0;i<e.map.length;i++){let a=e.map[i];if(r[a])continue;r[a]=!0;let o=n.nodeAt(a);if(!o)throw RangeError(`No cell with offset ${a} found`);let s=null,c=o.attrs;for(let n=0;n<c.colspan;n++){let r=t[(i+n)%e.width*2];r!=null&&(!c.colwidth||c.colwidth[n]!=r)&&((s||=Lp(c))[n]=r)}s&&e.problems.unshift({type:`colwidth mismatch`,pos:a,colwidth:s})}}function Lp(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Rp(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(let n in e.nodes){let r=e.nodes[n],i=r.spec.tableRole;i&&(t[i]=r)}}return t}var zp=new M(`selectingCells`);function Bp(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole==`row`)return e.node(0).resolve(e.before(t+1));return null}function Vp(e){for(let t=e.depth;t>0;t--){let n=e.node(t).type.spec.tableRole;if(n===`cell`||n===`header_cell`)return e.node(t)}return null}function Hp(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if(t.node(e).type.spec.tableRole==`row`)return!0;return!1}function Up(e){let t=e.selection;if(`$anchorCell`in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if(`node`in t&&t.node&&t.node.type.spec.tableRole==`cell`)return t.$anchor;let n=Bp(t.$head)||Wp(t.$head);if(n)return n;throw RangeError(`No cell found around position ${t.head}`)}function Wp(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){let r=t.type.spec.tableRole;if(r==`cell`||r==`header_cell`)return e.doc.resolve(n-t.nodeSize)}}function Gp(e){return e.parent.type.spec.tableRole==`row`&&!!e.nodeAfter}function Kp(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function qp(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Jp(e,t,n){let r=e.node(-1),i=H.get(r),a=e.start(-1),o=i.nextCell(e.pos-a,t,n);return o==null?null:e.node(0).resolve(a+o)}function Yp(e,t,n=1){let r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function Xp(e,t,n=1){let r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}function Zp(e,t,n){let r=Rp(t.type.schema).header_cell;for(let i=0;i<e.height;i++)if(t.nodeAt(e.map[n+i*e.width]).type!=r)return!1;return!0}var U=class e extends O{constructor(e,t=e){let n=e.node(-1),r=H.get(n),i=e.start(-1),a=r.rectBetween(e.pos-i,t.pos-i),o=e.node(0),s=r.cellsInRect(a).filter(e=>e!=t.pos-i);s.unshift(t.pos-i);let c=s.map(e=>{let t=n.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let r=i+e+1;return new Hn(o.resolve(r),o.resolve(r+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,n){let r=t.resolve(n.map(this.$anchorCell.pos)),i=t.resolve(n.map(this.$headCell.pos));if(Gp(r)&&Gp(i)&&qp(r,i)){let t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,i):t&&this.isColSelection()?e.colSelection(r,i):new e(r,i)}return k.between(r,i)}content(){let e=this.$anchorCell.node(-1),t=H.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},a=[];for(let n=r.top;n<r.bottom;n++){let o=[];for(let a=n*t.width+r.left,s=r.left;s<r.right;s++,a++){let n=t.map[a];if(i[n])continue;i[n]=!0;let s=t.findCell(n),c=e.nodeAt(n);if(!c)throw RangeError(`No cell with offset ${n} found`);let l=r.left-s.left,u=s.right-r.right;if(l>0||u>0){let e=c.attrs;if(l>0&&(e=Yp(e,0,l)),u>0&&(e=Yp(e,e.colspan-u,u)),s.left<r.left){if(c=c.type.createAndFill(e),!c)throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else c=c.type.create(e,c.content)}if(s.top<r.top||s.bottom>r.bottom){let e={...c.attrs,rowspan:Math.min(s.bottom,r.bottom)-Math.max(s.top,r.top)};c=s.top<r.top?c.type.createAndFill(e):c.type.create(e,c.content)}o.push(c)}a.push(e.child(n).copy(T.from(o)))}let o=this.isColSelection()&&this.isRowSelection()?e:a;return new D(T.from(o),1,1)}replace(e,t=D.empty){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:a,$to:o}=r[i],s=e.mapping.slice(n);e.replace(s.map(a.pos),s.map(o.pos),i?D.empty:t)}let i=O.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new D(T.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),n=H.get(t),r=this.$anchorCell.start(-1),i=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<i.length;n++)e(t.nodeAt(i[n]),r+i[n])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){let r=t.node(-1),i=H.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.top<=s.top?(o.top>0&&(t=c.resolve(a+i.map[o.left])),s.bottom<i.height&&(n=c.resolve(a+i.map[i.width*(i.height-1)+s.right-1]))):(s.top>0&&(n=c.resolve(a+i.map[s.left])),o.bottom<i.height&&(t=c.resolve(a+i.map[i.width*(i.height-1)+o.right-1]))),new e(t,n)}isRowSelection(){let e=this.$anchorCell.node(-1),t=H.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),i=t.colCount(this.$headCell.pos-n);if(Math.min(r,i)>0)return!1;let a=r+this.$anchorCell.nodeAfter.attrs.colspan,o=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,o)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){let r=t.node(-1),i=H.get(r),a=t.start(-1),o=i.findCell(t.pos-a),s=i.findCell(n.pos-a),c=t.node(0);return o.left<=s.left?(o.left>0&&(t=c.resolve(a+i.map[o.top*i.width])),s.right<i.width&&(n=c.resolve(a+i.map[i.width*(s.top+1)-1]))):(s.left>0&&(n=c.resolve(a+i.map[s.top*i.width])),o.right<i.width&&(t=c.resolve(a+i.map[i.width*(o.top+1)-1]))),new e(t,n)}toJSON(){return{type:`cell`,anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new Qp(this.$anchorCell.pos,this.$headCell.pos)}};U.prototype.visible=!1,O.jsonID(`cell`,U);var Qp=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),n=e.resolve(this.head);return t.parent.type.spec.tableRole==`row`&&n.parent.type.spec.tableRole==`row`&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&qp(t,n)?new U(t,n):O.near(n,1)}};function $p(e){if(!(e.selection instanceof U))return null;let t=[];return e.selection.forEachCell((e,n)=>{t.push(Ms.node(n,n+e.nodeSize,{class:`selectedCell`}))}),F.create(e.doc,t)}function em({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,i=e.depth;for(;i>=0&&!(e.after(i+1)<e.end(i));i--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(i).type.spec.tableRole)}function tm({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){let r=e.node(t);if(r.type.spec.tableRole===`cell`||r.type.spec.tableRole===`header_cell`){n=r;break}}for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.spec.tableRole===`cell`||n.type.spec.tableRole===`header_cell`){r=n;break}}return n!==r&&t.parentOffset===0}function nm(e,t,n){let r=(t||e).selection,i=(t||e).doc,a,o;if(r instanceof A&&(o=r.node.type.spec.tableRole)){if(o==`cell`||o==`header_cell`)a=U.create(i,r.from);else if(o==`row`){let e=i.resolve(r.from+1);a=U.rowSelection(e,e)}else if(!n){let e=H.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];a=U.create(i,t+1,n)}}else r instanceof k&&em(r)?a=k.create(i,r.from):r instanceof k&&tm(r)&&(a=k.create(i,r.$from.start(),r.$from.end()));return a&&(t||=e.tr).setSelection(a),t}var rm=new M(`fix-tables`);function im(e,t,n,r){let i=e.childCount,a=t.childCount;outer:for(let o=0,s=0;o<a;o++){let a=t.child(o);for(let t=s,r=Math.min(i,o+3);t<r;t++)if(e.child(t)==a){s=t+1,n+=a.nodeSize;continue outer}r(a,n),s<i&&e.child(s).sameMarkup(a)?im(e.child(s),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function am(e,t){let n,r=(t,r)=>{t.type.spec.tableRole==`table`&&(n=om(e,t,r,n))};return t?t.doc!=e.doc&&im(t.doc,e.doc,0,r):e.doc.descendants(r),n}function om(e,t,n,r){let i=H.get(t);if(!i.problems)return r;r||=e.tr;let a=[];for(let e=0;e<i.height;e++)a.push(0);for(let e=0;e<i.problems.length;e++){let o=i.problems[e];if(o.type==`collision`){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,Yp(i,i.colspan-o.n,o.n))}else if(o.type==`missing`)a[o.row]+=o.n;else if(o.type==`overlong_rowspan`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if(o.type==`colwidth mismatch`){let e=t.nodeAt(o.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if(o.type==`zero_sized`){let e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let o,s;for(let e=0;e<a.length;e++)a[e]&&(o??=e,s=e);for(let c=0,l=n+1;c<i.height;c++){let n=t.child(c),i=l+n.nodeSize,u=a[c];if(u>0){let t=`cell`;n.firstChild&&(t=n.firstChild.type.spec.tableRole);let a=[];for(let n=0;n<u;n++){let n=Rp(e.schema)[t].createAndFill();n&&a.push(n)}let d=(c==0||o==c-1)&&s==c?l+1:i-1;r.insert(r.mapping.map(d),a)}l=i}return r.setMeta(rm,{fixTables:!0})}function sm(e){let t=e.selection,n=Up(e),r=n.node(-1),i=n.start(-1),a=H.get(r);return{...t instanceof U?a.rectBetween(t.$anchorCell.pos-i,t.$headCell.pos-i):a.findCell(n.pos-i),tableStart:i,map:a,table:r}}function cm(e,{map:t,tableStart:n,table:r},i){let a=i>0?-1:0;Zp(t,r,i+a)&&(a=i==0||i==t.width?null:0);for(let o=0;o<t.height;o++){let s=o*t.width+i;if(i>0&&i<t.width&&t.map[s-1]==t.map[s]){let a=t.map[s],c=r.nodeAt(a);e.setNodeMarkup(e.mapping.map(n+a),null,Xp(c.attrs,i-t.colCount(a))),o+=c.attrs.rowspan-1}else{let c=a==null?Rp(r.type.schema).cell:r.nodeAt(t.map[s+a]).type,l=t.positionAt(o,i,r);e.insert(e.mapping.map(n+l),c.createAndFill())}}return e}function lm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e);t(cm(e.tr,n,n.left))}return!0}function um(e,t){if(!Hp(e))return!1;if(t){let n=sm(e);t(cm(e.tr,n,n.right))}return!0}function dm(e,{map:t,table:n,tableStart:r},i){let a=e.mapping.maps.length;for(let o=0;o<t.height;){let s=o*t.width+i,c=t.map[s],l=n.nodeAt(c),u=l.attrs;if(i>0&&t.map[s-1]==c||i<t.width-1&&t.map[s+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(r+c),null,Yp(u,i-t.colCount(c)));else{let t=e.mapping.slice(a).map(r+c);e.delete(t,t+l.nodeSize)}o+=u.rowspan}}function fm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let e=n.right-1;dm(r,n,e),e!=n.left;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=H.get(e)}t(r)}return!0}function pm(e,t,n){let r=Rp(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(t.nodeAt(e.map[i+n*e.width])?.type!=r)return!1;return!0}function mm(e,{map:t,tableStart:n,table:r},i){let a=n;for(let e=0;e<i;e++)a+=r.child(e).nodeSize;let o=[],s=i>0?-1:0;pm(t,r,i+s)&&(s=i==0||i==t.height?null:0);for(let a=0,c=t.width*i;a<t.width;a++,c++)if(i>0&&i<t.height&&t.map[c]==t.map[c-t.width]){let i=t.map[c],o=r.nodeAt(i).attrs;e.setNodeMarkup(n+i,null,{...o,rowspan:o.rowspan+1}),a+=o.colspan-1}else{let e=(s==null?Rp(r.type.schema).cell:r.nodeAt(t.map[c+s*t.width])?.type)?.createAndFill();e&&o.push(e)}return e.insert(a,Rp(r.type.schema).row.create(null,o)),e}function hm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e);t(mm(e.tr,n,n.top))}return!0}function gm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e);t(mm(e.tr,n,n.bottom))}return!0}function _m(e,{map:t,table:n,tableStart:r},i){let a=0;for(let e=0;e<i;e++)a+=n.child(e).nodeSize;let o=a+n.child(i).nodeSize,s=e.mapping.maps.length;e.delete(a+r,o+r);let c=new Set;for(let a=0,o=i*t.width;a<t.width;a++,o++){let l=t.map[o];if(!c.has(l)){if(c.add(l),i>0&&l==t.map[o-t.width]){let t=n.nodeAt(l).attrs;e.setNodeMarkup(e.mapping.slice(s).map(l+r),null,{...t,rowspan:t.rowspan-1}),a+=t.colspan-1}else if(i<t.height&&l==t.map[o+t.width]){let o=n.nodeAt(l),c=o.attrs,u=o.type.create({...c,rowspan:o.attrs.rowspan-1},o.content),d=t.positionAt(i+1,a,n);e.insert(e.mapping.slice(s).map(r+d),u),a+=c.colspan-1}}}}function vm(e,t){if(!Hp(e))return!1;if(t){let n=sm(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;_m(r,n,e),e!=n.top;e--){let e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw RangeError(`No table found`);n.table=e,n.map=H.get(n.table)}t(r)}return!0}function ym(e){let t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function bm({width:e,height:t,map:n},r){let i=r.top*e+r.left,a=i,o=(r.bottom-1)*e+r.left,s=i+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[a]==n[a-1]||r.right<e&&n[s]==n[s+1])return!0;a+=e,s+=e}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[i]==n[i-e]||r.bottom<t&&n[o]==n[o+e])return!0;i++,o++}return!1}function xm(e,t){let n=e.selection;if(!(n instanceof U)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=sm(e),{map:i}=r;if(bm(i,r))return!1;if(t){let n=e.tr,a={},o=T.empty,s,c;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){let l=i.map[e*i.width+t],u=r.table.nodeAt(l);if(!(a[l]||!u))if(a[l]=!0,s==null)s=l,c=u;else{ym(u)||(o=o.append(u.content));let e=n.mapping.map(l+r.tableStart);n.delete(e,e+u.nodeSize)}}if(s==null||c==null)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...Xp(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),o.size>0){let e=s+1+c.content.size,t=ym(c)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,o)}n.setSelection(new U(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function Sm(e,t){let n=Rp(e.schema);return Cm(({node:e})=>n[e.type.spec.tableRole])(e,t)}function Cm(e){return(t,n)=>{let r=t.selection,i,a;if(r instanceof U){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,a=r.$anchorCell.pos}else{if(i=Vp(r.$from),!i)return!1;a=Bp(r.$from)?.pos}if(i==null||a==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let o=i.attrs,s=[],c=o.colwidth;o.rowspan>1&&(o={...o,rowspan:1}),o.colspan>1&&(o={...o,colspan:1});let l=sm(t),u=t.tr;for(let e=0;e<l.right-l.left;e++)s.push(c?{...o,colwidth:c&&c[e]?[c[e]]:null}:o);let d;for(let t=l.top;t<l.bottom;t++){let n=l.map.positionAt(t,l.left,l.table);t==l.top&&(n+=i.nodeSize);for(let r=l.left,a=0;r<l.right;r++,a++)r==l.left&&t==l.top||u.insert(d=u.mapping.map(n+l.tableStart,1),e({node:i,row:t,col:r}).createAndFill(s[a]))}u.setNodeMarkup(a,e({node:i,row:l.top,col:l.left}),s[0]),r instanceof U&&u.setSelection(new U(u.doc.resolve(r.$anchorCell.pos),d?u.doc.resolve(d):void 0)),n(u)}return!0}}function wm(e,t){return function(n,r){if(!Hp(n))return!1;let i=Up(n);if(i.nodeAfter.attrs[e]===t)return!1;if(r){let a=n.tr;n.selection instanceof U?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&a.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):a.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[e]:t}),r(a)}return!0}}function Tm(e){return function(t,n){if(!Hp(t))return!1;if(n){let r=Rp(t.schema),i=sm(t),a=t.tr,o=i.map.cellsInRect(e==`column`?{left:i.left,top:0,right:i.right,bottom:i.map.height}:e==`row`?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),s=o.map(e=>i.table.nodeAt(e));for(let e=0;e<o.length;e++)s[e].type==r.header_cell&&a.setNodeMarkup(i.tableStart+o[e],r.cell,s[e].attrs);if(a.steps.length===0)for(let e=0;e<o.length;e++)a.setNodeMarkup(i.tableStart+o[e],r.header_cell,s[e].attrs);n(a)}return!0}}function Em(e,t,n){let r=t.map.cellsInRect({left:0,top:0,right:e==`row`?t.map.width:1,bottom:e==`column`?t.map.height:1});for(let e=0;e<r.length;e++){let i=t.table.nodeAt(r[e]);if(i&&i.type!==n.header_cell)return!1}return!0}function Dm(e,t){return t||={useDeprecatedLogic:!1},t.useDeprecatedLogic?Tm(e):function(t,n){if(!Hp(t))return!1;if(n){let r=Rp(t.schema),i=sm(t),a=t.tr,o=Em(`row`,i,r),s=Em(`column`,i,r),c=(e===`column`?o:e===`row`&&s)?1:0,l=e==`column`?{left:0,top:c,right:1,bottom:i.map.height}:e==`row`?{left:c,top:0,right:i.map.width,bottom:1}:i,u=e==`column`?s?r.cell:r.header_cell:e==`row`?o?r.cell:r.header_cell:r.cell;i.map.cellsInRect(l).forEach(e=>{let t=e+i.tableStart,n=a.doc.nodeAt(t);n&&a.setNodeMarkup(t,u,n.attrs)}),n(a)}return!0}}Dm(`row`,{useDeprecatedLogic:!0}),Dm(`column`,{useDeprecatedLogic:!0});var Om=Dm(`cell`,{useDeprecatedLogic:!0});function km(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){let r=e.node(-1).child(t),i=r.lastChild;if(i)return n-1-i.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){let e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}function Am(e){return function(t,n){if(!Hp(t))return!1;let r=km(Up(t),e);if(r==null)return!1;if(n){let e=t.doc.resolve(r);n(t.tr.setSelection(k.between(e,Kp(e))).scrollIntoView())}return!0}}function jm(e,t){let n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole==`table`)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Mm(e,t){let n=e.selection;if(!(n instanceof U))return!1;if(t){let r=e.tr,i=Rp(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(i)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new D(i,0,0))}),r.docChanged&&t(r)}return!0}function Nm(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole==`table`);)n--,r--,t=t.child(0).content;let i=t.child(0),a=i.type.spec.tableRole,o=i.type.schema,s=[];if(a==`row`)for(let e=0;e<t.childCount;e++){let i=t.child(e).content,a=e?0:Math.max(0,n-1),c=e<t.childCount-1?0:Math.max(0,r-1);(a||c)&&(i=Fm(Rp(o).row,new D(i,a,c)).content),s.push(i)}else if(a==`cell`||a==`header_cell`)s.push(n||r?Fm(Rp(o).row,new D(t,n,r)).content:t);else return null;return Pm(o,s)}function Pm(e,t){let n=[];for(let e=0;e<t.length;e++){let r=t[e];for(let t=r.childCount-1;t>=0;t--){let{rowspan:i,colspan:a}=r.child(t).attrs;for(let t=e;t<e+i;t++)n[t]=(n[t]||0)+a}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let i=0;i<n.length;i++)if(i>=t.length&&t.push(T.empty),n[i]<r){let a=Rp(e).cell.createAndFill(),o=[];for(let e=n[i];e<r;e++)o.push(a);t[i]=t[i].append(T.from(o))}return{height:t.length,width:r,rows:t}}function Fm(e,t){let n=e.createAndFill();return new Bn(n).replace(0,n.content.size,t).doc}function Im({width:e,height:t,rows:n},r,i){if(e!=r){let t=[],i=[];for(let e=0;e<n.length;e++){let a=n[e],o=[];for(let n=t[e]||0,i=0;n<r;i++){let s=a.child(i%a.childCount);n+s.attrs.colspan>r&&(s=s.type.createChecked(Yp(s.attrs,s.attrs.colspan,n+s.attrs.colspan-r),s.content)),o.push(s),n+=s.attrs.colspan;for(let n=1;n<s.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+s.attrs.colspan}i.push(T.from(o))}n=i,e=r}if(t!=i){let e=[];for(let r=0,a=0;r<i;r++,a++){let o=[],s=n[a%t];for(let e=0;e<s.childCount;e++){let t=s.child(e);r+t.attrs.rowspan>i&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,i-t.attrs.rowspan)},t.content)),o.push(t)}e.push(T.from(o))}n=e,t=i}return{width:e,height:t,rows:n}}function Lm(e,t,n,r,i,a,o){let s=e.doc.type.schema,c=Rp(s),l,u;if(i>t.width)for(let a=0,s=0;a<t.height;a++){let d=n.child(a);s+=d.nodeSize;let f=[],p;p=d.lastChild==null||d.lastChild.type==c.cell?l||=c.cell.createAndFill():u||=c.header_cell.createAndFill();for(let e=t.width;e<i;e++)f.push(p);e.insert(e.mapping.slice(o).map(s-1+r),f)}if(a>t.height){let s=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,i);e++){let i=e>=t.width?!1:n.nodeAt(t.map[r+e]).type==c.header_cell;s.push(i?u||=c.header_cell.createAndFill():l||=c.cell.createAndFill())}let d=c.row.create(null,T.from(s)),f=[];for(let e=t.height;e<a;e++)f.push(d);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||u)}function Rm(e,t,n,r,i,a,o,s){if(o==0||o==t.height)return!1;let c=!1;for(let l=i;l<a;l++){let i=o*t.width+l,a=t.map[i];if(t.map[i-t.width]==a){c=!0;let i=n.nodeAt(a),{top:u,left:d}=t.findCell(a);e.setNodeMarkup(e.mapping.slice(s).map(a+r),null,{...i.attrs,rowspan:o-u}),e.insert(e.mapping.slice(s).map(t.positionAt(o,d,n)),i.type.createAndFill({...i.attrs,rowspan:u+i.attrs.rowspan-o})),l+=i.attrs.colspan-1}}return c}function zm(e,t,n,r,i,a,o,s){if(o==0||o==t.width)return!1;let c=!1;for(let l=i;l<a;l++){let i=l*t.width+o,a=t.map[i];if(t.map[i-1]==a){c=!0;let i=n.nodeAt(a),u=t.colCount(a),d=e.mapping.slice(s).map(a+r);e.setNodeMarkup(d,null,Yp(i.attrs,o-u,i.attrs.colspan-(o-u))),e.insert(d+i.nodeSize,i.type.createAndFill(Yp(i.attrs,0,o-u))),l+=i.attrs.rowspan-1}}return c}function Bm(e,t,n,r,i){let a=n?e.doc.nodeAt(n-1):e.doc;if(!a)throw Error(`No table found`);let o=H.get(a),{top:s,left:c}=r,l=c+i.width,u=s+i.height,d=e.tr,f=0;function p(){if(a=n?d.doc.nodeAt(n-1):d.doc,!a)throw Error(`No table found`);o=H.get(a),f=d.mapping.maps.length}Lm(d,o,a,n,l,u,f)&&p(),Rm(d,o,a,n,c,l,s,f)&&p(),Rm(d,o,a,n,c,l,u,f)&&p(),zm(d,o,a,n,s,u,c,f)&&p(),zm(d,o,a,n,s,u,l,f)&&p();for(let e=s;e<u;e++){let t=o.positionAt(e,c,a),r=o.positionAt(e,l,a);d.replace(d.mapping.slice(f).map(t+n),d.mapping.slice(f).map(r+n),new D(i.rows[e-s],0,0))}p(),d.setSelection(new U(d.doc.resolve(n+o.positionAt(s,c,a)),d.doc.resolve(n+o.positionAt(u-1,l-1,a)))),t(d)}var Vm=Pc({ArrowLeft:Um(`horiz`,-1),ArrowRight:Um(`horiz`,1),ArrowUp:Um(`vert`,-1),ArrowDown:Um(`vert`,1),"Shift-ArrowLeft":Wm(`horiz`,-1),"Shift-ArrowRight":Wm(`horiz`,1),"Shift-ArrowUp":Wm(`vert`,-1),"Shift-ArrowDown":Wm(`vert`,1),Backspace:Mm,"Mod-Backspace":Mm,Delete:Mm,"Mod-Delete":Mm});function Hm(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function Um(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection;if(a instanceof U)return Hm(n,r,O.near(a.$headCell,t));if(e!=`horiz`&&!a.empty)return!1;let o=Jm(i,e,t);if(o==null)return!1;if(e==`horiz`)return Hm(n,r,O.near(n.doc.resolve(a.head+t),t));{let i=n.doc.resolve(o),a=Jp(i,e,t),s;return s=a?O.near(a,1):t<0?O.near(n.doc.resolve(i.before(-1)),-1):O.near(n.doc.resolve(i.after(-1)),1),Hm(n,r,s)}}}function Wm(e,t){return(n,r,i)=>{if(!i)return!1;let a=n.selection,o;if(a instanceof U)o=a;else{let r=Jm(i,e,t);if(r==null)return!1;o=new U(n.doc.resolve(r))}let s=Jp(o.$headCell,e,t);return s?Hm(n,r,new U(o.$anchorCell,s)):!1}}function Gm(e,t){let n=e.state.doc,r=Bp(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new U(r))),!0):!1}function Km(e,t,n){if(!Hp(e.state))return!1;let r=Nm(n),i=e.state.selection;if(i instanceof U){r||={width:1,height:1,rows:[T.from(Fm(Rp(e.state.schema).cell,n))]};let t=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),o=H.get(t).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=Im(r,o.right-o.left,o.bottom-o.top),Bm(e.state,e.dispatch,a,o,r),!0}else if(r){let t=Up(e.state),n=t.start(-1);return Bm(e.state,e.dispatch,n,H.get(t.node(-1)).findCell(t.pos-n),r),!0}else return!1}function qm(e,t){if(t.button!=0||t.ctrlKey||t.metaKey)return;let n=Ym(e,t.target),r;if(t.shiftKey&&e.state.selection instanceof U)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=Bp(e.state.selection.$anchor))!=null&&Xm(e,t)?.pos!=r.pos)i(r,t),t.preventDefault();else if(!n)return;function i(t,n){let r=Xm(e,n),i=zp.getState(e.state)==null;if(!r||!qp(t,r))if(i)r=t;else return;let a=new U(t,r);if(i||!e.state.selection.eq(a)){let n=e.state.tr.setSelection(a);i&&n.setMeta(zp,t.pos),e.dispatch(n)}}function a(){e.root.removeEventListener(`mouseup`,a),e.root.removeEventListener(`dragstart`,a),e.root.removeEventListener(`mousemove`,o),zp.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(zp,-1))}function o(r){let o=r,s=zp.getState(e.state),c;if(s!=null)c=e.state.doc.resolve(s);else if(Ym(e,o.target)!=n&&(c=Xm(e,t),!c))return a();c&&i(c,o)}e.root.addEventListener(`mouseup`,a),e.root.addEventListener(`dragstart`,a),e.root.addEventListener(`mousemove`,o)}function Jm(e,t,n){if(!(e.state.selection instanceof k))return null;let{$head:r}=e.state.selection;for(let i=r.depth-1;i>=0;i--){let a=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:a.childCount))return null;if(a.type.spec.tableRole==`cell`||a.type.spec.tableRole==`header_cell`){let a=r.before(i),o=t==`vert`?n>0?`down`:`up`:n>0?`right`:`left`;return e.endOfTextblock(o)?a:null}}return null}function Ym(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName==`TD`||t.nodeName==`TH`)return t;return null}function Xm(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Bp(e.state.doc.resolve(r))||Bp(e.state.doc.resolve(i))}var Zm=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement(`div`),this.dom.className=`tableWrapper`,this.table=this.dom.appendChild(document.createElement(`table`)),this.table.style.setProperty(`--default-cell-min-width`,`${t}px`),this.colgroup=this.table.appendChild(document.createElement(`colgroup`)),Qm(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement(`tbody`))}update(e){return e.type==this.node.type?(this.node=e,Qm(e,this.colgroup,this.table,this.defaultCellMinWidth),!0):!1}ignoreMutation(e){return e.type==`attributes`&&(e.target==this.table||this.colgroup.contains(e.target))}};function Qm(e,t,n,r,i,a){let o=0,s=!0,c=t.firstChild,l=e.firstChild;if(l){for(let e=0,n=0;e<l.childCount;e++){let{colspan:u,colwidth:d}=l.child(e).attrs;for(let e=0;e<u;e++,n++){let l=i==n?a:d&&d[e],u=l?l+`px`:``;if(o+=l||r,l||(s=!1),c)c.style.width!=u&&(c.style.width=u),c=c.nextSibling;else{let e=document.createElement(`col`);e.style.width=u,t.appendChild(e)}}}for(;c;){var u;let e=c.nextSibling;(u=c.parentNode)==null||u.removeChild(c),c=e}s?(n.style.width=o+`px`,n.style.minWidth=``):(n.style.width=``,n.style.minWidth=o+`px`)}}var $m=new M(`tableColumnResizing`);function eh({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Zm,lastColumnResizable:i=!0}={}){let a=new j({key:$m,state:{init(e,t){var i;let o=(i=a.spec)==null||(i=i.props)==null?void 0:i.nodeViews,s=Rp(t.schema).table.name;return r&&o&&(o[s]=(e,t)=>new r(e,n,t)),new th(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{let t=$m.getState(e);return t&&t.activeHandle>-1?{class:`resize-cursor`}:{}},handleDOMEvents:{mousemove:(t,n)=>{nh(t,n,e,i)},mouseleave:e=>{rh(e)},mousedown:(e,r)=>{ih(e,r,t,n)}},decorations:e=>{let t=$m.getState(e);if(t&&t.activeHandle>-1)return ph(e,t.activeHandle)},nodeViews:{}}});return a}var th=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let n=this,r=t.getMeta($m);if(r&&r.setHandle!=null)return new e(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return Gp(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function nh(e,t,n,r){if(!e.editable)return;let i=$m.getState(e.state);if(i&&!i.dragging){let a=oh(t.target),o=-1;if(a){let{left:r,right:i}=a.getBoundingClientRect();t.clientX-r<=n?o=sh(e,t,`left`,n):i-t.clientX<=n&&(o=sh(e,t,`right`,n))}if(o!=i.activeHandle){if(!r&&o!==-1){let t=e.state.doc.resolve(o),n=t.node(-1),r=H.get(n),i=t.start(-1);if(r.colCount(t.pos-i)+t.nodeAfter.attrs.colspan-1==r.width-1)return}lh(e,o)}}}function rh(e){if(!e.editable)return;let t=$m.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&lh(e,-1)}function ih(e,t,n,r){if(!e.editable)return!1;let i=e.dom.ownerDocument.defaultView??window,a=$m.getState(e.state);if(!a||a.activeHandle==-1||a.dragging)return!1;let o=e.state.doc.nodeAt(a.activeHandle),s=ah(e,a.activeHandle,o.attrs);e.dispatch(e.state.tr.setMeta($m,{setDragging:{startX:t.clientX,startWidth:s}}));function c(t){i.removeEventListener(`mouseup`,c),i.removeEventListener(`mousemove`,l);let r=$m.getState(e.state);r?.dragging&&(uh(e,r.activeHandle,ch(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta($m,{setDragging:null})))}function l(t){if(!t.which)return c(t);let i=$m.getState(e.state);if(i&&i.dragging){let a=ch(i.dragging,t,n);dh(e,i.activeHandle,a,r)}}return dh(e,a.activeHandle,s,r),i.addEventListener(`mouseup`,c),i.addEventListener(`mousemove`,l),t.preventDefault(),!0}function ah(e,t,{colspan:n,colwidth:r}){let i=r&&r[r.length-1];if(i)return i;let a=e.domAtPos(t),o=a.node.childNodes[a.offset].offsetWidth,s=n;if(r)for(let e=0;e<n;e++)r[e]&&(o-=r[e],s--);return o/s}function oh(e){for(;e&&e.nodeName!=`TD`&&e.nodeName!=`TH`;)e=e.classList&&e.classList.contains(`ProseMirror`)?null:e.parentNode;return e}function sh(e,t,n,r){let i=n==`right`?-r:r,a=e.posAtCoords({left:t.clientX+i,top:t.clientY});if(!a)return-1;let{pos:o}=a,s=Bp(e.state.doc.resolve(o));if(!s)return-1;if(n==`right`)return s.pos;let c=H.get(s.node(-1)),l=s.start(-1),u=c.map.indexOf(s.pos-l);return u%c.width==0?-1:l+c.map[u-1]}function ch(e,t,n){let r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function lh(e,t){e.dispatch(e.state.tr.setMeta($m,{setHandle:t}))}function uh(e,t,n){let r=e.state.doc.resolve(t),i=r.node(-1),a=H.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let e=0;e<a.height;e++){let t=e*a.width+s;if(e&&a.map[t]==a.map[t-a.width])continue;let r=a.map[t],l=i.nodeAt(r).attrs,u=l.colspan==1?0:s-a.colCount(r);if(l.colwidth&&l.colwidth[u]==n)continue;let d=l.colwidth?l.colwidth.slice():fh(l.colspan);d[u]=n,c.setNodeMarkup(o+r,null,{...l,colwidth:d})}c.docChanged&&e.dispatch(c)}function dh(e,t,n,r){let i=e.state.doc.resolve(t),a=i.node(-1),o=i.start(-1),s=H.get(a).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1,c=e.domAtPos(i.start(-1)).node;for(;c&&c.nodeName!=`TABLE`;)c=c.parentNode;c&&Qm(a,c.firstChild,c,r,s,n)}function fh(e){return Array(e).fill(0)}function ph(e,t){let n=[],r=e.doc.resolve(t),i=r.node(-1);if(!i)return F.empty;let a=H.get(i),o=r.start(-1),s=a.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<a.height;t++){let r=s+t*a.width;if((s==a.width-1||a.map[r]!=a.map[r+1])&&(t==0||a.map[r]!=a.map[r-a.width])){let t=a.map[r],s=o+t+i.nodeAt(t).nodeSize-1,c=document.createElement(`div`);c.className=`column-resize-handle`,$m.getState(e)?.dragging&&n.push(Ms.node(o+t,o+t+i.nodeAt(t).nodeSize,{class:`column-resize-dragging`})),n.push(Ms.widget(s,c))}}return F.create(e.doc,n)}function mh({allowTableNodeSelection:e=!1}={}){return new j({key:zp,state:{init(){return null},apply(e,t){let n=e.getMeta(zp);if(n!=null)return n==-1?null:n;if(t==null||!e.docChanged)return t;let{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:$p,handleDOMEvents:{mousedown:qm},createSelectionBetween(e){return zp.getState(e.state)==null?null:e.state.selection},handleTripleClick:Gm,handleKeyDown:Vm,handlePaste:Km},appendTransaction(t,n,r){return nm(r,am(r,n),e)}})}function hh(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var gh=class{constructor({editor:e,element:t,view:n,pluginKey:r=`bubbleMenu`,updateDelay:i=250,resizeDelay:a=60,shouldShow:o,appendTo:s,getReferencedVirtualElement:c,options:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&ol(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.show(),this.updatePosition()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=l?.scrollTarget??window,this.getReferencedVirtualElement=c,this.floatingUIOptions={...this.floatingUIOptions,...l},this.element.tabIndex=0,o&&(this.shouldShow=o),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(d(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(i(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(u(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(l(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(a(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(p(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(o(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=Hu(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof A){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof U){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():hh(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){if(!this.isVisible)return;let e=this.virtualElement;e&&r(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(!(!this.isVisible||this.editor.isDestroyed||!this.element.isConnected)){if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()}})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},_h=e=>new j({key:typeof e.pluginKey==`string`?new M(e.pluginKey):e.pluginKey,view:t=>new gh({view:t,...e})});B.create({name:`bubbleMenu`,addOptions(){return{element:null,pluginKey:`bubbleMenu`,updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[_h({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var vh=class{constructor({editor:e,element:t,view:n,pluginKey:r=`floatingMenu`,updateDelay:i=250,resizeDelay:a=60,options:o,appendTo:s,shouldShow:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(this.pluginKey);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`?this.updateOptions(t.options):t===`hide`?this.hide():t===`show`&&(this.updatePosition(),this.show())},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.pluginKey=r,this.updateDelay=i,this.resizeDelay=a,this.appendTo=s,this.scrollTarget=o?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,c&&(this.shouldShow=c),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return yu(e,{textSerializers:bu(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(d(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(i(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(u(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(l(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(a(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(p(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(o(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(s(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){if(!this.view?.dom?.parentNode)return;let{selection:e}=this.editor.state,t=Hu(this.view,e.from,e.to);r({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&=(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},yh=e=>new j({key:typeof e.pluginKey==`string`?new M(e.pluginKey):e.pluginKey,view:t=>new vh({view:t,...e})});B.create({name:`floatingMenu`,addOptions(){return{element:null,options:{},pluginKey:`floatingMenu`,updateDelay:void 0,resizeDelay:void 0,appendTo:void 0,shouldShow:null}},addCommands(){return{updateFloatingMenuPosition:()=>({tr:e,dispatch:t})=>(t&&e.setMeta(this.options.pluginKey,`updatePosition`),!0)}},addProseMirrorPlugins(){return this.options.element?[yh({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,resizeDelay:this.options.resizeDelay,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});function bh(e,t){return e??new M(t)}var xh=typeof window<`u`?S.useLayoutEffect:S.useEffect,Sh=new Set([`left`,`opacity`,`position`,`top`,`visibility`,`width`]),Ch=new Set(`animationIterationCount.aspectRatio.borderImageOutset.borderImageSlice.borderImageWidth.columnCount.columns.fillOpacity.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineClamp.lineHeight.opacity.order.orphans.scale.stopOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeOpacity.strokeWidth.tabSize.widows.zIndex.zoom`.split(`.`)),wh=new Set([`children`,`className`,`style`]),Th=new Set([`tabIndex`]),Eh=new Set([`accessKey`,`autoCapitalize`,`contentEditable`,`contextMenu`,`dir`,`draggable`,`enterKeyHint`,`hidden`,`id`,`lang`,`nonce`,`role`,`slot`,`spellCheck`,`tabIndex`,`title`,`translate`]),Dh={Blur:`focusout`,DoubleClick:`dblclick`,Focus:`focusin`,MouseEnter:`mouseenter`,MouseLeave:`mouseleave`};function Oh(e,t){return/^on[A-Z]/.test(e)&&typeof t==`function`}function kh(e){return e.startsWith(`aria-`)||e.startsWith(`data-`),e}function Ah(e){return e.startsWith(`aria-`)||e.startsWith(`data-`)||Eh.has(e)}function jh(e){return e.startsWith(`--`)?e:e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Mh(e){let t=e.endsWith(`Capture`),n=(t?e.slice(0,-7):e).slice(2);return{eventName:Dh[n]??n.toLowerCase(),options:t?{capture:!0}:void 0}}function Nh(e,t){let n=t.defaultPrevented,r=!1,i=Object.create(t);return Object.defineProperties(i,{nativeEvent:{value:t},currentTarget:{value:e},target:{value:t.target},persist:{value:()=>void 0},isDefaultPrevented:{value:()=>n},isPropagationStopped:{value:()=>r},preventDefault:{value:()=>{n=!0,t.preventDefault()}},stopPropagation:{value:()=>{r=!0,t.stopPropagation()}}}),i}function Ph(e){return Th.has(e)}function Fh(e,t,n){if(t===`tabIndex`){e.tabIndex=Number(n);return}e[t]=n}function Ih(e,t){if(t===`tabIndex`){e.removeAttribute(`tabindex`);return}let n=e[t];if(typeof n==`boolean`){e[t]=!1;return}if(typeof n==`number`){e[t]=0;return}e[t]=``}function Lh(e,t){return typeof t!=`number`||t===0||e.startsWith(`--`)||Ch.has(e)?String(t):`${t}px`}function Rh(e,t){Sh.has(t)||e.style.removeProperty(jh(t))}function zh(e,t,n){Sh.has(t)||e.style.setProperty(jh(t),Lh(t,n))}function Bh(e,t,n){new Set([...Object.keys(t),...Object.keys(n)]).forEach(r=>{if(wh.has(r)||!Ah(r)||Oh(r,t[r])||Oh(r,n[r]))return;let i=t[r],a=n[r];if(i===a)return;let o=kh(r);if(a==null||a===!1){Ph(r)&&Ih(e,r),e.removeAttribute(o);return}if(a===!0){Ph(r)&&Fh(e,r,!0),e.setAttribute(o,``);return}if(Ph(r)){Fh(e,r,a);return}e.setAttribute(o,String(a))})}function Vh(e,t,n){if(t!==n){if(n){e.className=n;return}e.removeAttribute(`class`)}}function Hh(e,t,n){let r=t??{},i=n??{};new Set([...Object.keys(r),...Object.keys(i)]).forEach(t=>{let n=r[t],a=i[t];if(n!==a){if(a==null){Rh(e,t);return}zh(e,t,a)}})}function Uh(e,t,n){t.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)});let r=[];return Object.entries(n).forEach(([t,n])=>{if(!Oh(t,n))return;let{eventName:i,options:a}=Mh(t),o=t=>{n(Nh(e,t))};e.addEventListener(i,o,a),r.push({eventName:i,listener:o,options:a})}),r}function Wh(e,t){let n=(0,S.useRef)({}),r=(0,S.useRef)([]);xh(()=>{let i=n.current;return Vh(e,i.className,t.className),Hh(e,i.style,t.style),Bh(e,i,t),r.current=Uh(e,r.current,t),n.current=t,()=>{r.current.forEach(({eventName:t,listener:n,options:r})=>{e.removeEventListener(t,n,r)}),r.current=[]}},[e,t])}var Gh=S.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,getReferencedVirtualElement:o,options:s,children:c,...l},u)=>{let d=(0,S.useRef)(document.createElement(`div`)),f=(0,S.useRef)(bh(e,`bubbleMenu`)).current;Wh(d.current,l),typeof u==`function`?u(d.current):u&&(u.current=d.current);let{editor:p}=Tp(),m=t||p,h={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:f,shouldShow:a,getReferencedVirtualElement:o,options:s},g=(0,S.useRef)(h);g.current=h;let[_,v]=(0,S.useState)(!1),y=(0,S.useRef)(!0);return(0,S.useEffect)(()=>{if(m?.isDestroyed)return;if(!m){console.warn(`BubbleMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=d.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=_h({...g.current,editor:m,element:e});m.registerPlugin(t);let n=g.current.pluginKey;return y.current=!0,v(!0),()=>{v(!1),m.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[m]),(0,S.useEffect)(()=>{if(!(!_||!m||m.isDestroyed)){if(y.current){y.current=!1;return}m.view.dispatch(m.state.tr.setMeta(f,{type:`updateOptions`,options:g.current}))}},[_,m,n,r,a,s,i,o,f]),(0,re.createPortal)(c,d.current)});S.forwardRef(({pluginKey:e,editor:t,updateDelay:n,resizeDelay:r,appendTo:i,shouldShow:a=null,options:o,children:s,...c},l)=>{let u=(0,S.useRef)(document.createElement(`div`)),d=(0,S.useRef)(bh(e,`floatingMenu`)).current;Wh(u.current,c),typeof l==`function`?l(u.current):l&&(l.current=u.current);let{editor:f}=Tp(),p=t||f,m={updateDelay:n,resizeDelay:r,appendTo:i,pluginKey:d,shouldShow:a,options:o},h=(0,S.useRef)(m);h.current=m;let[g,_]=(0,S.useState)(!1),v=(0,S.useRef)(!0);return(0,S.useEffect)(()=>{if(p?.isDestroyed)return;if(!p){console.warn(`FloatingMenu component is not rendered inside of an editor component or does not have editor prop.`);return}let e=u.current;e.style.visibility=`hidden`,e.style.position=`absolute`;let t=yh({...h.current,editor:p,element:e});p.registerPlugin(t);let n=h.current.pluginKey;return v.current=!0,_(!0),()=>{_(!1),p.unregisterPlugin(n),window.requestAnimationFrame(()=>{e.parentNode&&e.parentNode.removeChild(e)})}},[p]),(0,S.useEffect)(()=>{if(!(!g||!p||p.isDestroyed)){if(v.current){v.current=!1;return}p.view.dispatch(p.state.tr.setMeta(d,{type:`updateOptions`,options:h.current}))}},[g,p,n,r,a,o,i,d]),(0,re.createPortal)(s,u.current)});var Kh=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,qh=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,Jh=`numeric`,Yh=`ascii`,Xh=`alpha`,Zh=`asciinumeric`,Qh=`alphanumeric`,$h=`domain`,eg=`emoji`,tg=`scheme`,ng=`slashscheme`,rg=`whitespace`;function ig(e,t){return e in t||(t[e]=[]),t[e]}function ag(e,t,n){t[Jh]&&(t[Zh]=!0,t[Qh]=!0),t[Yh]&&(t[Zh]=!0,t[Xh]=!0),t[Zh]&&(t[Qh]=!0),t[Xh]&&(t[Qh]=!0),t[Qh]&&(t[$h]=!0),t[eg]&&(t[$h]=!0);for(let r in t){let t=ig(r,n);t.indexOf(e)<0&&t.push(e)}}function og(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function sg(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}sg.groups={},sg.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=sg.groups;let i;return t&&t.j?i=t:(i=new sg(t),n&&r&&ag(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=sg.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new sg,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new sg,a&&(r&&(o.t&&typeof o.t==`string`?ag(a,Object.assign(og(o.t,r),n),r):n&&ag(a,n,r)),o.t=a),i.j[e]=o,o}};var W=(e,t,n,r,i)=>e.ta(t,n,r,i),G=(e,t,n,r,i)=>e.tr(t,n,r,i),cg=(e,t,n,r,i)=>e.ts(t,n,r,i),K=(e,t,n,r,i)=>e.tt(t,n,r,i),lg=`WORD`,ug=`UWORD`,dg=`ASCIINUMERICAL`,fg=`ALPHANUMERICAL`,pg=`LOCALHOST`,mg=`TLD`,hg=`UTLD`,gg=`SCHEME`,_g=`SLASH_SCHEME`,vg=`NUM`,yg=`WS`,bg=`NL`,xg=`OPENBRACE`,Sg=`CLOSEBRACE`,Cg=`OPENBRACKET`,wg=`CLOSEBRACKET`,Tg=`OPENPAREN`,Eg=`CLOSEPAREN`,Dg=`OPENANGLEBRACKET`,Og=`CLOSEANGLEBRACKET`,kg=`FULLWIDTHLEFTPAREN`,Ag=`FULLWIDTHRIGHTPAREN`,jg=`LEFTCORNERBRACKET`,Mg=`RIGHTCORNERBRACKET`,Ng=`LEFTWHITECORNERBRACKET`,Pg=`RIGHTWHITECORNERBRACKET`,Fg=`FULLWIDTHLESSTHAN`,Ig=`FULLWIDTHGREATERTHAN`,Lg=`AMPERSAND`,Rg=`APOSTROPHE`,zg=`ASTERISK`,Bg=`AT`,Vg=`BACKSLASH`,Hg=`BACKTICK`,Ug=`CARET`,Wg=`COLON`,Gg=`COMMA`,Kg=`DOLLAR`,qg=`DOT`,Jg=`EQUALS`,Yg=`EXCLAMATION`,Xg=`HYPHEN`,Zg=`PERCENT`,Qg=`PIPE`,$g=`PLUS`,e_=`POUND`,t_=`QUERY`,n_=`QUOTE`,r_=`FULLWIDTHMIDDLEDOT`,i_=`SEMI`,a_=`SLASH`,o_=`TILDE`,s_=`UNDERSCORE`,c_=`EMOJI`,l_=`SYM`,u_=Object.freeze({__proto__:null,ALPHANUMERICAL:fg,AMPERSAND:Lg,APOSTROPHE:Rg,ASCIINUMERICAL:dg,ASTERISK:zg,AT:Bg,BACKSLASH:Vg,BACKTICK:Hg,CARET:Ug,CLOSEANGLEBRACKET:Og,CLOSEBRACE:Sg,CLOSEBRACKET:wg,CLOSEPAREN:Eg,COLON:Wg,COMMA:Gg,DOLLAR:Kg,DOT:qg,EMOJI:c_,EQUALS:Jg,EXCLAMATION:Yg,FULLWIDTHGREATERTHAN:Ig,FULLWIDTHLEFTPAREN:kg,FULLWIDTHLESSTHAN:Fg,FULLWIDTHMIDDLEDOT:r_,FULLWIDTHRIGHTPAREN:Ag,HYPHEN:Xg,LEFTCORNERBRACKET:jg,LEFTWHITECORNERBRACKET:Ng,LOCALHOST:pg,NL:bg,NUM:vg,OPENANGLEBRACKET:Dg,OPENBRACE:xg,OPENBRACKET:Cg,OPENPAREN:Tg,PERCENT:Zg,PIPE:Qg,PLUS:$g,POUND:e_,QUERY:t_,QUOTE:n_,RIGHTCORNERBRACKET:Mg,RIGHTWHITECORNERBRACKET:Pg,SCHEME:gg,SEMI:i_,SLASH:a_,SLASH_SCHEME:_g,SYM:l_,TILDE:o_,TLD:mg,UNDERSCORE:s_,UTLD:hg,UWORD:ug,WORD:lg,WS:yg}),d_=/[a-z]/,f_=/\p{L}/u,p_=/\p{Emoji}/u,m_=/\d/,h_=/\s/,g_=`\r`,__=`
103
103
  `,v_=`️`,y_=`‍`,b_=``,x_=null,S_=null;function C_(e=[]){let t={};sg.groups=t;let n=new sg;x_??=D_(Kh),S_??=D_(qh),K(n,`'`,Rg),K(n,`{`,xg),K(n,`}`,Sg),K(n,`[`,Cg),K(n,`]`,wg),K(n,`(`,Tg),K(n,`)`,Eg),K(n,`<`,Dg),K(n,`>`,Og),K(n,`(`,kg),K(n,`)`,Ag),K(n,`「`,jg),K(n,`」`,Mg),K(n,`『`,Ng),K(n,`』`,Pg),K(n,`<`,Fg),K(n,`>`,Ig),K(n,`&`,Lg),K(n,`*`,zg),K(n,`@`,Bg),K(n,"`",Hg),K(n,`^`,Ug),K(n,`:`,Wg),K(n,`,`,Gg),K(n,`$`,Kg),K(n,`.`,qg),K(n,`=`,Jg),K(n,`!`,Yg),K(n,`-`,Xg),K(n,`%`,Zg),K(n,`|`,Qg),K(n,`+`,$g),K(n,`#`,e_),K(n,`?`,t_),K(n,`"`,n_),K(n,`/`,a_),K(n,`;`,i_),K(n,`~`,o_),K(n,`_`,s_),K(n,`\\`,Vg),K(n,`・`,r_);let r=G(n,m_,vg,{[Jh]:!0});G(r,m_,r);let i=G(r,d_,dg,{[Zh]:!0}),a=G(r,f_,fg,{[Qh]:!0}),o=G(n,d_,lg,{[Yh]:!0});G(o,m_,i),G(o,d_,o),G(i,m_,i),G(i,d_,i);let s=G(n,f_,ug,{[Xh]:!0});G(s,d_),G(s,m_,a),G(s,f_,s),G(a,m_,a),G(a,d_),G(a,f_,a);let c=K(n,__,bg,{[rg]:!0}),l=K(n,g_,yg,{[rg]:!0}),u=G(n,h_,yg,{[rg]:!0});K(n,b_,u),K(l,__,c),K(l,b_,u),G(l,h_,u),K(u,g_),K(u,__),G(u,h_,u),K(u,b_,u);let d=G(n,p_,c_,{[eg]:!0});K(d,`#`),G(d,p_,d),K(d,v_,d);let f=K(d,y_);K(f,`#`),G(f,p_,d);let p=[[d_,o],[m_,i]],m=[[d_,null],[f_,s],[m_,a]];for(let e=0;e<x_.length;e++)E_(n,x_[e],mg,lg,p);for(let e=0;e<S_.length;e++)E_(n,S_[e],hg,ug,m);ag(mg,{tld:!0,ascii:!0},t),ag(hg,{utld:!0,alpha:!0},t),E_(n,`file`,gg,lg,p),E_(n,`mailto`,gg,lg,p),E_(n,`http`,_g,lg,p),E_(n,`https`,_g,lg,p),E_(n,`ftp`,_g,lg,p),E_(n,`ftps`,_g,lg,p),ag(gg,{scheme:!0,ascii:!0},t),ag(_g,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[tg]:!0}:{[ng]:!0};r.indexOf(`-`)>=0?i[$h]=!0:d_.test(r)?m_.test(r)?i[Zh]=!0:i[Yh]=!0:i[Jh]=!0,cg(n,r,r,i)}return cg(n,`localhost`,pg,{ascii:!0}),n.jd=new sg(l_),{start:n,tokens:Object.assign({groups:t},u_)}}function w_(e,t){let n=T_(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function T_(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function E_(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new sg(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new sg(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function D_(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var O_={defaultProtocol:`http`,events:null,format:A_,formatHref:A_,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function k_(e,t=null){let n=Object.assign({},O_);e&&(n=Object.assign(n,e instanceof k_?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}k_.prototype={o:O_,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:O_[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function A_(e){return e}function j_(e,t){this.t=`token`,this.v=e,this.tk=t}j_.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=O_.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function M_(e,t){class n extends j_{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var N_=M_(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),P_=M_(`text`),F_=M_(`nl`),I_=M_(`url`,{isLink:!0,toHref(e=O_.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==pg&&e[1].t===Wg}}),L_=e=>new sg(e);function R_({groups:e}){let t=e.domain.concat([Lg,zg,Bg,Vg,Hg,Ug,Kg,Jg,Xg,vg,Zg,Qg,$g,e_,a_,l_,o_,s_]),n=[Rg,Wg,Gg,qg,Yg,Zg,t_,n_,i_,Dg,Og,xg,Sg,wg,Cg,Tg,Eg,kg,Ag,jg,Mg,Ng,Pg,Fg,Ig],r=[Lg,Rg,zg,Vg,Hg,Ug,Kg,Jg,Xg,xg,Sg,Zg,Qg,$g,e_,t_,a_,l_,o_,s_],i=L_(),a=K(i,o_);W(a,r,a),W(a,e.domain,a);let o=L_(),s=L_(),c=L_();W(i,e.domain,o),W(i,e.scheme,s),W(i,e.slashscheme,c),W(o,r,a),W(o,e.domain,o);let l=K(o,Bg);K(a,Bg,l),K(s,Bg,l),K(c,Bg,l);let u=K(a,qg);W(u,r,a),W(u,e.domain,a);let d=L_();W(l,e.domain,d),W(d,e.domain,d);let f=K(d,qg);W(f,e.domain,d);let p=L_(N_);W(f,e.tld,p),W(f,e.utld,p),K(l,pg,p);let m=K(d,Xg);K(m,Xg,m),W(m,e.domain,d),W(p,e.domain,d),K(p,qg,f),K(p,Xg,m);let h=K(o,Xg),g=K(o,qg);K(h,Xg,h),W(h,e.domain,o),W(g,r,a),W(g,e.domain,o);let _=L_(I_);W(g,e.tld,_),W(g,e.utld,_),W(_,e.domain,o),W(_,r,a),K(_,qg,g),K(_,Xg,h),K(_,Bg,l);let v=K(_,Wg),y=L_(I_);W(v,e.numeric,y);let b=L_(I_),x=L_();W(b,t,b),W(b,n,x),W(x,t,b),W(x,n,x),K(_,a_,b),K(y,a_,b);let ee=K(s,Wg),te=K(K(K(c,Wg),a_),a_);W(s,e.domain,o),K(s,qg,g),K(s,Xg,h),W(c,e.domain,o),K(c,qg,g),K(c,Xg,h),W(ee,e.domain,b),K(ee,a_,b),K(ee,t_,b),W(te,e.domain,b),W(te,t,b),K(te,a_,b);let ne=[[xg,Sg],[Cg,wg],[Tg,Eg],[Dg,Og],[kg,Ag],[jg,Mg],[Ng,Pg],[Fg,Ig]];for(let e=0;e<ne.length;e++){let[r,i]=ne[e],a=K(b,r);K(x,r,a);let o=L_(I_);W(a,t,o);let s=L_();W(a,n,s),K(a,i,b),W(o,t,o),W(o,n,s),W(s,t,o),W(s,n,s),K(o,i,b),K(s,i,b)}return K(i,pg,_),K(i,bg,F_),{start:i,tokens:u_}}function z_(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(B_(P_,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(B_(e,t,r))}}return o.length>0&&a.push(B_(P_,t,o)),a}function B_(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var V_=typeof console<`u`&&console&&console.warn||(()=>{}),H_=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,q={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function U_(){return sg.groups={},q.scanner=null,q.parser=null,q.tokenQueue=[],q.pluginQueue=[],q.customSchemes=[],q.initialized=!1,q}function W_(e,t=!1){if(q.initialized&&V_(`linkifyjs: already initialized - will not register custom scheme "${e}" ${H_}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
104
104
  1. Must only contain digits, lowercase ASCII letters or "-"
105
105
  2. Cannot start or end with "-"
@@ -179,7 +179,7 @@ ${t.innerHTML}
179
179
  `),e.text(t.textContent,!1),e.ensureNewLine(),e.write("```"),e.closeBlock(t)},parse:{setup(e){e.set({langPrefix:this.options.languageClassPrefix??`language-`})},updateDOM(e){e.innerHTML=e.innerHTML.replace(/\n<\/code><\/pre>/g,`</code></pre>`)}}}}}}),jD=V.create({name:`hardBreak`}).extend({addStorage(){return{markdown:{serialize(e,t,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=t.type){e.write(e.inTable?TD.storage.markdown.serialize.call(this,e,t,n):`\\
180
180
  `);return}},parse:{}}}}}),MD=V.create({name:`heading`}).extend({addStorage(){return{markdown:{serialize:rD.nodes.heading,parse:{}}}}}),ND=V.create({name:`horizontalRule`}).extend({addStorage(){return{markdown:{serialize:rD.nodes.horizontal_rule,parse:{}}}}}),PD=V.create({name:`image`}).extend({addStorage(){return{markdown:{serialize:rD.nodes.image,parse:{}}}}}),FD=V.create({name:`listItem`}).extend({addStorage(){return{markdown:{serialize:rD.nodes.list_item,parse:{}}}}}),ID=V.create({name:`orderedList`});function LD(e,t,n){let r=0;for(;n-r>0&&t.child(n-r-1).type.name===e.type.name;r++);return r}var RD=ID.extend({addStorage(){return{markdown:{serialize(e,t,n,r){let i=t.attrs.start||1,a=String(i+t.childCount-1).length,o=e.repeat(` `,a+2),s=LD(t,n,r)%2?`) `:`. `;e.renderList(t,o,t=>{let n=String(i+t);return e.repeat(` `,a-n.length)+n+s})},parse:{}}}}}),zD=V.create({name:`paragraph`}).extend({addStorage(){return{markdown:{serialize:rD.nodes.paragraph,parse:{}}}}});function BD(e){var t;return(e==null||(t=e.content)==null?void 0:t.content)??[]}var VD=V.create({name:`table`}).extend({addStorage(){return{markdown:{serialize(e,t,n){if(!UD(t)){TD.storage.markdown.serialize.call(this,e,t,n);return}e.inTable=!0,t.forEach((t,n,r)=>{if(e.write(`| `),t.forEach((t,n,r)=>{r&&e.write(` | `);let i=t.firstChild;i.textContent.trim()&&e.renderInline(i)}),e.write(` |`),e.ensureNewLine(),!r){let n=Array.from({length:t.childCount}).map(()=>`---`).join(` | `);e.write(`| ${n} |`),e.ensureNewLine()}}),e.closeBlock(t),e.inTable=!1},parse:{}}}}});function HD(e){return e.attrs.colspan>1||e.attrs.rowspan>1}function UD(e){let t=BD(e),n=t[0],r=t.slice(1);return!(BD(n).some(e=>e.type.name!==`tableHeader`||HD(e)||e.childCount>1)||r.some(e=>BD(e).some(e=>e.type.name===`tableHeader`||HD(e)||e.childCount>1)))}var WD=[OD,kD,AD,jD,MD,ND,TD,PD,FD,RD,zD,VD,V.create({name:`taskItem`}).extend({addStorage(){return{markdown:{serialize(e,t){let n=t.attrs.checked?`[x]`:`[ ]`;e.write(`${n} `),e.renderContent(t)},parse:{updateDOM(e){[...e.querySelectorAll(`.task-list-item`)].forEach(e=>{let t=e.querySelector(`input`);e.setAttribute(`data-type`,`taskItem`),t&&(e.setAttribute(`data-checked`,t.checked),t.remove())})}}}}}}),V.create({name:`taskList`}).extend({addStorage(){return{markdown:{serialize:kD.storage.markdown.serialize,parse:{setup(e){e.use(sD.default)},updateDOM(e){[...e.querySelectorAll(`.contains-task-list`)].forEach(e=>{e.setAttribute(`data-type`,`taskList`)})}}}}}}),V.create({name:`text`}).extend({addStorage(){return{markdown:{serialize(e,t){e.text(SD(t.text))},parse:{}}}}}),Cd.create({name:`bold`}).extend({addStorage(){return{markdown:{serialize:rD.marks.strong,parse:{}}}}}),Cd.create({name:`code`}).extend({addStorage(){return{markdown:{serialize:rD.marks.code,parse:{}}}}}),yD,Cd.create({name:`italic`}).extend({addStorage(){return{markdown:{serialize:rD.marks.em,parse:{}}}}}),Cd.create({name:`link`}).extend({addStorage(){return{markdown:{serialize:rD.marks.link,parse:{}}}}}),Cd.create({name:`strike`}).extend({addStorage(){return{markdown:{serialize:{open:`~~`,close:`~~`,expelEnclosingWhitespace:!0},parse:{}}}}})];function GD(e){let t=e.storage?.markdown,n=WD.find(t=>t.name===e.name)?.storage.markdown;return t||n?{...n,...t}:null}var KD=class{constructor(e){uD(this,`editor`,null),this.editor=e}serialize(e){let t=new vD(this.nodes,this.marks,{hardBreakNodeName:jD.name});return t.renderContent(e),t.out}get nodes(){return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(e=>[e,this.serializeNode(TD)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`node`&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(yD)])),...Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type===`mark`&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[])}}serializeNode(e){var t;return(t=GD(e))==null||(t=t.serialize)==null?void 0:t.bind({editor:this.editor,options:e.options})}serializeMark(e){let t=GD(e)?.serialize;return t?{...t,open:typeof t.open==`function`?t.open.bind({editor:this.editor,options:e.options}):t.open,close:typeof t.close==`function`?t.close.bind({editor:this.editor,options:e.options}):t.close}:null}},qD=class{constructor(e,t){uD(this,`editor`,null),uD(this,`md`,null);let{html:n,linkify:r,breaks:i}=t;this.editor=e,this.md=this.withPatchedRenderer(GE({html:n,linkify:r,breaks:i}))}parse(e){let{inline:t}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e==`string`){this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=GD(e))==null||(t=t.parse)==null||(t=t.setup)==null?void 0:t.call({editor:this.editor,options:e.options},this.md)});let n=xD(this.md.render(e));return this.editor.extensionManager.extensions.forEach(e=>{var t;return(t=GD(e))==null||(t=t.parse)==null||(t=t.updateDOM)==null?void 0:t.call({editor:this.editor,options:e.options},n)}),this.normalizeDOM(n,{inline:t,content:e}),n.innerHTML}return e}normalizeDOM(e,t){let{inline:n,content:r}=t;return this.normalizeBlocks(e),e.querySelectorAll(`*`).forEach(e=>{e.nextSibling?.nodeType===Node.TEXT_NODE&&!e.closest(`pre`)&&(e.nextSibling.textContent=e.nextSibling.textContent.replace(/^\n/,``))}),n&&this.normalizeInline(e,r),e}normalizeBlocks(e){let t=Object.values(this.editor.schema.nodes).filter(e=>e.isBlock).map(e=>e.spec.parseDOM?.map(e=>e.tag)).flat().filter(Boolean).join(`,`);t&&[...e.querySelectorAll(t)].forEach(e=>{e.parentElement.matches(`p`)&&CD(e)})}normalizeInline(e,t){var n;if((n=e.firstElementChild)!=null&&n.matches(`p`)){let n=e.firstElementChild,{nextElementSibling:r}=n,i=t.match(/^\s+/)?.[0]??``,a=r?``:t.match(/\s+$/)?.[0]??``;if(t.match(/^\n\n/)){n.innerHTML=`${n.innerHTML}${a}`;return}wD(n),e.innerHTML=`${i}${e.innerHTML}${a}`}}withPatchedRenderer(e){let t=e=>function(){let t=e(...arguments);return t===`
181
181
  `?t:t[t.length-1]===`
182
- `?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},JD=B.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new j({key:new M(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return ot.fromSchema(this.editor.schema).parseSlice(xD(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),YD=B.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=Md.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new qD(this.editor,this.options),serializer:new KD(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[dD.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),JD.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});function XD(e,t){let n=0,r=-1;return e.descendants((e,i)=>{if(r>=0)return!1;if(e.isText){let a=e.text??``,o=n+a.length;if(t<=o)return r=i+(t-n),!1;n=o}return!0}),r<0&&(r=e.content.size),r}function ZD(e,t){let n=0;return e.descendants((e,r)=>{if(e.isText){let i=e.text??``;if(t<=r+i.length){let e=Math.max(0,t-r);return n+=e,!1}n+=i.length}return!0}),n}function QD(e){return e.storage.markdown.getMarkdown()}var $D=new M(`commentAnchorHighlights`),eO=new M(`activeHighlight`),tO=B.create({name:`commentAnchorHighlight`,addOptions(){return{anchors:[]}},addProseMirrorPlugins(){let{anchors:e}=this.options;return[new j({key:$D,state:{init(t,{doc:n}){return nO(n,e)},apply(e,t){let n=e.getMeta($D);return n?nO(e.doc,n.anchors):e.docChanged?t.map(e.mapping,e.doc):t}},props:{decorations(e){return this.getState(e)}}})]}});function nO(e,t){let n=[];for(let r of t){let t=XD(e,r.anchorStart),i=XD(e,r.anchorEnd);t<i&&n.push(Ms.inline(t,i,{class:`comment-anchor-highlight`}))}return F.create(e,n)}var rO=B.create({name:`activeHighlight`,addOptions(){return{range:null}},addProseMirrorPlugins(){let{range:e}=this.options;return[new j({key:eO,state:{init(t,{doc:n}){return iO(n,e)},apply(e,t){let n=e.getMeta(eO);return n?iO(e.doc,n.range):e.docChanged?t.map(e.mapping,e.doc):t}},props:{decorations(e){return this.getState(e)}}})]}});function iO(e,t){if(!t)return F.empty;let n=XD(e,t.start),r=XD(e,t.end);return n>=r?F.empty:F.create(e,[Ms.inline(n,r,{class:`active-highlight`})])}function aO(e={}){return[RS,iv.configure({openOnClick:!1}),wv,dv,uv,lv,YD,tO.configure({anchors:e.commentAnchors??[]}),rO.configure({range:e.highlightRange??null})]}function oO({editor:e,onCommentSubmit:t,commentSubmitting:n}){let{t:r}=i(`chat`),[a,o]=(0,S.useState)(!1),[s,c]=(0,S.useState)(``),l=(0,S.useCallback)(()=>{o(t=>{let n=!t;if(n&&e){let{from:t,to:n}=e.state.selection;if(t!==n){let r=e.state.tr.setMeta(eO,{range:{start:ZD(e.state.doc,t),end:ZD(e.state.doc,n)}});e.view.dispatch(r)}}else if(e){let t=e.state.tr.setMeta(eO,{range:null});e.view.dispatch(t)}return n})},[e]);if(!e)return null;let u=x(`h-7 w-7 rounded-md flex items-center justify-center`,`text-[var(--content-secondary)]`,`hover:bg-[var(--surface-hover)] hover:text-[var(--content-emphasised)]`,`transition-colors`),d=x(`bg-[var(--surface-active)] text-[var(--content-emphasised)]`),f=[{name:`bold`,icon:(0,C.jsx)(ee,{size:14}),action:()=>e.chain().focus().toggleBold().run()},{name:`italic`,icon:(0,C.jsx)(te,{size:14}),action:()=>e.chain().focus().toggleItalic().run()},{name:`strike`,icon:(0,C.jsx)(ne,{size:14}),action:()=>e.chain().focus().toggleStrike().run(),separator:!0},{name:`code`,icon:(0,C.jsx)(v,{size:14}),action:()=>e.chain().focus().toggleCode().run(),separator:!0},{name:`link`,icon:(0,C.jsx)(_,{size:14}),action:()=>{if(e.isActive(`link`))e.chain().focus().unsetLink().run();else{let t=window.prompt(`Enter URL:`);t&&e.chain().focus().setLink({href:t}).run()}}}],p=()=>{if(!(!s.trim()||n)&&(t?.(s.trim()),c(``),o(!1),e)){let t=e.state.tr.setMeta(eO,{range:null});e.view.dispatch(t)}};return(0,C.jsxs)(`div`,{className:x(`bg-[var(--surface-lift)] rounded-lg`,`shadow-[var(--shadow-popover)]`,`border border-[var(--border-base)]`),children:[(0,C.jsxs)(`div`,{className:`p-1 flex items-center gap-0.5`,children:[f.map((t,n)=>(0,C.jsxs)(`span`,{className:`contents`,children:[n>0&&f[n-1]?.separator&&(0,C.jsx)(`span`,{className:`mx-0.5 h-4 w-px bg-[var(--border-base)]`}),(0,C.jsx)(`button`,{type:`button`,className:x(u,e.isActive(t.name)&&d),onClick:t.action,"aria-label":t.name,"aria-pressed":e.isActive(t.name),children:t.icon})]},t.name)),t?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`mx-0.5 h-4 w-px bg-[var(--border-base)]`}),(0,C.jsx)(`button`,{type:`button`,className:x(u,a&&d),onClick:l,"aria-label":r(`tiptapDocumentEditor.comment`),"aria-pressed":a,children:(0,C.jsx)(b,{size:14})})]}):null]}),a?(0,C.jsxs)(`div`,{className:`w-64 border-t border-[var(--border-base)] p-2`,children:[(0,C.jsx)(`textarea`,{className:`w-full resize-none rounded-md border border-[var(--field-border)] bg-[var(--field-bg)] px-3 py-2 text-body-medium-lighter text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none transition-[border-color] duration-150 ease-out focus-visible:border-[var(--border-active)]`,rows:2,placeholder:r(`tiptapDocumentEditor.feedbackPlaceholder`),value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),p())},autoFocus:!0}),(0,C.jsx)(`div`,{className:`mt-1.5 flex justify-end`,children:(0,C.jsx)(`button`,{type:`button`,className:x(`rounded-md px-2.5 py-1 text-label-medium-default transition-colors`,s.trim()&&!n?`bg-[var(--primary-base)] text-[var(--content-inset)] hover:opacity-90`:`bg-[var(--surface-active)] text-[var(--content-disabled)] cursor-not-allowed`),onClick:p,disabled:n||!s.trim(),children:r(n?`tiptapDocumentEditor.adding`:`tiptapDocumentEditor.comment`)})})]}):null]})}function sO({content:e,editable:t=!0,onContentChange:n,onTextSelect:r,commentAnchors:i=[],highlightRange:a=null,onCommentSubmit:o,commentSubmitting:s,className:c}){let l=(0,S.useRef)(n);(0,S.useLayoutEffect)(()=>{l.current=n});let u=(0,S.useRef)(r);(0,S.useLayoutEffect)(()=>{u.current=r});let d=Cp({extensions:aO({commentAnchors:i,highlightRange:a}),content:e,editable:t,onUpdate({editor:e}){l.current?.(QD(e))},onSelectionUpdate({editor:e}){let{from:t,to:n}=e.state.selection;if(t===n){let t=e.state.tr.setMeta(eO,{range:null});e.view.dispatch(t),u.current?.(null);return}let r=e.state.doc.textBetween(t,n);if(!r.trim())return;let i=ZD(e.state.doc,t),a=ZD(e.state.doc,n),o=e.view.dom.ownerDocument.getSelection();if(!o||o.rangeCount===0)return;let s=o.getRangeAt(0).getBoundingClientRect();u.current?.({start:i,end:a,text:r,rect:s})}}),f=(0,S.useRef)(e);(0,S.useEffect)(()=>{d&&e!==f.current&&(f.current=e,QD(d)!==e&&d.commands.setContent(e))},[e,d]);let p=(0,S.useCallback)(e=>{if(!d)return;let t=d.state.tr.setMeta($D,{anchors:e});d.view.dispatch(t)},[d]);(0,S.useEffect)(()=>{p(i)},[i,p]);let m=(0,S.useCallback)(e=>{if(!d)return;let t=d.state.tr.setMeta(eO,{range:e});if(d.view.dispatch(t),e){let t=XD(d.state.doc,e.start),n=d.view.domAtPos(t);n.node instanceof HTMLElement?n.node.scrollIntoView({behavior:`smooth`,block:`center`}):n.node.parentElement&&n.node.parentElement.scrollIntoView({behavior:`smooth`,block:`center`})}},[d]);return(0,S.useEffect)(()=>{m(a)},[a,m]),(0,C.jsxs)(`div`,{className:x(`flex flex-col`,c),children:[(0,C.jsx)(`style`,{children:cO}),(0,C.jsx)(hp,{editor:d,className:`flex-1 overflow-y-auto`}),d?(0,C.jsx)(Gh,{editor:d,updateDelay:100,children:(0,C.jsx)(oO,{editor:d,onCommentSubmit:o,commentSubmitting:s},`${d.state.selection.from}-${d.state.selection.to}`)}):null]})}var cO=`
182
+ `?t.slice(0,-1):t};return e.renderer.rules.hardbreak=t(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=t(e.renderer.rules.softbreak),e.renderer.rules.fence=t(e.renderer.rules.fence),e.renderer.rules.code_block=t(e.renderer.rules.code_block),e.renderer.renderToken=t(e.renderer.renderToken.bind(e.renderer)),e}},JD=B.create({name:`markdownClipboard`,addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new j({key:new M(`markdownClipboard`),props:{clipboardTextParser:(e,t,n)=>{if(n||!this.options.transformPastedText)return null;let r=this.editor.storage.markdown.parser.parse(e,{inline:!0});return ot.fromSchema(this.editor.schema).parseSlice(xD(r),{preserveWhitespace:!0,context:t})},clipboardTextSerializer:e=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(e.content):null}})]}}),YD=B.create({name:`markdown`,priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:`tight`,bulletListMarker:`-`,linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){let e=Md.Commands.config.addCommands();return{setContent:(t,n)=>r=>e.setContent(r.editor.storage.markdown.parser.parse(t),n)(r),insertContentAt:(t,n,r)=>i=>e.insertContentAt(t,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new qD(this.editor,this.options),serializer:new KD(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[dD.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),JD.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});function XD(e,t){let n=0,r=-1;return e.descendants((e,i)=>{if(r>=0)return!1;if(e.isText){let a=e.text??``,o=n+a.length;if(t<=o)return r=i+(t-n),!1;n=o}return!0}),r<0&&(r=e.content.size),r}function ZD(e,t){let n=0;return e.descendants((e,r)=>{if(e.isText){let i=e.text??``;if(t<=r+i.length){let e=Math.max(0,t-r);return n+=e,!1}n+=i.length}return!0}),n}function QD(e){return e.storage.markdown.getMarkdown()}var $D=new M(`commentAnchorHighlights`),eO=new M(`activeHighlight`),tO=B.create({name:`commentAnchorHighlight`,addOptions(){return{anchors:[]}},addProseMirrorPlugins(){let{anchors:e}=this.options;return[new j({key:$D,state:{init(t,{doc:n}){return nO(n,e)},apply(e,t){let n=e.getMeta($D);return n?nO(e.doc,n.anchors):e.docChanged?t.map(e.mapping,e.doc):t}},props:{decorations(e){return this.getState(e)}}})]}});function nO(e,t){let n=[];for(let r of t){let t=XD(e,r.anchorStart),i=XD(e,r.anchorEnd);t<i&&n.push(Ms.inline(t,i,{class:`comment-anchor-highlight`}))}return F.create(e,n)}var rO=B.create({name:`activeHighlight`,addOptions(){return{range:null}},addProseMirrorPlugins(){let{range:e}=this.options;return[new j({key:eO,state:{init(t,{doc:n}){return iO(n,e)},apply(e,t){let n=e.getMeta(eO);return n?iO(e.doc,n.range):e.docChanged?t.map(e.mapping,e.doc):t}},props:{decorations(e){return this.getState(e)}}})]}});function iO(e,t){if(!t)return F.empty;let n=XD(e,t.start),r=XD(e,t.end);return n>=r?F.empty:F.create(e,[Ms.inline(n,r,{class:`active-highlight`})])}function aO(e={}){return[RS,iv.configure({openOnClick:!1}),wv,dv,uv,lv,YD,tO.configure({anchors:e.commentAnchors??[]}),rO.configure({range:e.highlightRange??null})]}function oO({editor:e,onCommentSubmit:t,commentSubmitting:n}){let{t:r}=c(`chat`),[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(``),l=(0,S.useCallback)(()=>{a(t=>{let n=!t;if(n&&e){let{from:t,to:n}=e.state.selection;if(t!==n){let r=e.state.tr.setMeta(eO,{range:{start:ZD(e.state.doc,t),end:ZD(e.state.doc,n)}});e.view.dispatch(r)}}else if(e){let t=e.state.tr.setMeta(eO,{range:null});e.view.dispatch(t)}return n})},[e]);if(!e)return null;let u=x(`h-7 w-7 rounded-md flex items-center justify-center`,`text-[var(--content-secondary)]`,`hover:bg-[var(--surface-hover)] hover:text-[var(--content-emphasised)]`,`transition-colors`),d=x(`bg-[var(--surface-active)] text-[var(--content-emphasised)]`),f=[{name:`bold`,icon:(0,C.jsx)(ee,{size:14}),action:()=>e.chain().focus().toggleBold().run()},{name:`italic`,icon:(0,C.jsx)(te,{size:14}),action:()=>e.chain().focus().toggleItalic().run()},{name:`strike`,icon:(0,C.jsx)(ne,{size:14}),action:()=>e.chain().focus().toggleStrike().run(),separator:!0},{name:`code`,icon:(0,C.jsx)(v,{size:14}),action:()=>e.chain().focus().toggleCode().run(),separator:!0},{name:`link`,icon:(0,C.jsx)(_,{size:14}),action:()=>{if(e.isActive(`link`))e.chain().focus().unsetLink().run();else{let t=window.prompt(`Enter URL:`);t&&e.chain().focus().setLink({href:t}).run()}}}],p=()=>{if(!(!o.trim()||n)&&(t?.(o.trim()),s(``),a(!1),e)){let t=e.state.tr.setMeta(eO,{range:null});e.view.dispatch(t)}};return(0,C.jsxs)(`div`,{className:x(`bg-[var(--surface-lift)] rounded-lg`,`shadow-[var(--shadow-popover)]`,`border border-[var(--border-base)]`),children:[(0,C.jsxs)(`div`,{className:`p-1 flex items-center gap-0.5`,children:[f.map((t,n)=>(0,C.jsxs)(`span`,{className:`contents`,children:[n>0&&f[n-1]?.separator&&(0,C.jsx)(`span`,{className:`mx-0.5 h-4 w-px bg-[var(--border-base)]`}),(0,C.jsx)(`button`,{type:`button`,className:x(u,e.isActive(t.name)&&d),onClick:t.action,"aria-label":t.name,"aria-pressed":e.isActive(t.name),children:t.icon})]},t.name)),t?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`mx-0.5 h-4 w-px bg-[var(--border-base)]`}),(0,C.jsx)(`button`,{type:`button`,className:x(u,i&&d),onClick:l,"aria-label":r(`tiptapDocumentEditor.comment`),"aria-pressed":i,children:(0,C.jsx)(b,{size:14})})]}):null]}),i?(0,C.jsxs)(`div`,{className:`w-64 border-t border-[var(--border-base)] p-2`,children:[(0,C.jsx)(`textarea`,{className:`w-full resize-none rounded-md border border-[var(--field-border)] bg-[var(--field-bg)] px-3 py-2 text-body-medium-lighter text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none transition-[border-color] duration-150 ease-out focus-visible:border-[var(--border-active)]`,rows:2,placeholder:r(`tiptapDocumentEditor.feedbackPlaceholder`),value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),p())},autoFocus:!0}),(0,C.jsx)(`div`,{className:`mt-1.5 flex justify-end`,children:(0,C.jsx)(`button`,{type:`button`,className:x(`rounded-md px-2.5 py-1 text-label-medium-default transition-colors`,o.trim()&&!n?`bg-[var(--primary-base)] text-[var(--content-inset)] hover:opacity-90`:`bg-[var(--surface-active)] text-[var(--content-disabled)] cursor-not-allowed`),onClick:p,disabled:n||!o.trim(),children:r(n?`tiptapDocumentEditor.adding`:`tiptapDocumentEditor.comment`)})})]}):null]})}function sO({content:e,editable:t=!0,onContentChange:n,onTextSelect:r,commentAnchors:i=[],highlightRange:a=null,onCommentSubmit:o,commentSubmitting:s,className:c}){let l=(0,S.useRef)(n);(0,S.useLayoutEffect)(()=>{l.current=n});let u=(0,S.useRef)(r);(0,S.useLayoutEffect)(()=>{u.current=r});let d=Cp({extensions:aO({commentAnchors:i,highlightRange:a}),content:e,editable:t,onUpdate({editor:e}){l.current?.(QD(e))},onSelectionUpdate({editor:e}){let{from:t,to:n}=e.state.selection;if(t===n){let t=e.state.tr.setMeta(eO,{range:null});e.view.dispatch(t),u.current?.(null);return}let r=e.state.doc.textBetween(t,n);if(!r.trim())return;let i=ZD(e.state.doc,t),a=ZD(e.state.doc,n),o=e.view.dom.ownerDocument.getSelection();if(!o||o.rangeCount===0)return;let s=o.getRangeAt(0).getBoundingClientRect();u.current?.({start:i,end:a,text:r,rect:s})}}),f=(0,S.useRef)(e);(0,S.useEffect)(()=>{d&&e!==f.current&&(f.current=e,QD(d)!==e&&d.commands.setContent(e))},[e,d]);let p=(0,S.useCallback)(e=>{if(!d)return;let t=d.state.tr.setMeta($D,{anchors:e});d.view.dispatch(t)},[d]);(0,S.useEffect)(()=>{p(i)},[i,p]);let m=(0,S.useCallback)(e=>{if(!d)return;let t=d.state.tr.setMeta(eO,{range:e});if(d.view.dispatch(t),e){let t=XD(d.state.doc,e.start),n=d.view.domAtPos(t);n.node instanceof HTMLElement?n.node.scrollIntoView({behavior:`smooth`,block:`center`}):n.node.parentElement&&n.node.parentElement.scrollIntoView({behavior:`smooth`,block:`center`})}},[d]);return(0,S.useEffect)(()=>{m(a)},[a,m]),(0,C.jsxs)(`div`,{className:x(`flex flex-col`,c),children:[(0,C.jsx)(`style`,{children:cO}),(0,C.jsx)(hp,{editor:d,className:`flex-1 overflow-y-auto`}),d?(0,C.jsx)(Gh,{editor:d,updateDelay:100,children:(0,C.jsx)(oO,{editor:d,onCommentSubmit:o,commentSubmitting:s},`${d.state.selection.from}-${d.state.selection.to}`)}):null]})}var cO=`
183
183
  .tiptap {
184
184
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
185
185
  font-size: 15px;