@madie/madie-design-system 1.2.97 → 1.2.98

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 (213) hide show
  1. package/components/RichTextEditor/test.html +1 -0
  2. package/dist/browser.js +1 -1
  3. package/dist/index.js +1 -1
  4. package/madie-madie-design-system-1.2.96.tgz +0 -0
  5. package/madie-madie-design-system-1.2.98.tgz +0 -0
  6. package/package.json +1 -1
  7. package/storybook-static/1005.b918c97b.iframe.bundle.js +3 -0
  8. package/storybook-static/1005.b918c97b.iframe.bundle.js.LICENSE.txt +1 -0
  9. package/storybook-static/1005.b918c97b.iframe.bundle.js.map +1 -0
  10. package/storybook-static/1236.098e1cb2.iframe.bundle.js +2 -0
  11. package/storybook-static/1236.098e1cb2.iframe.bundle.js.map +1 -0
  12. package/storybook-static/139.ac2799e4.iframe.bundle.js +3 -0
  13. package/storybook-static/139.ac2799e4.iframe.bundle.js.LICENSE.txt +26 -0
  14. package/storybook-static/139.ac2799e4.iframe.bundle.js.map +1 -0
  15. package/storybook-static/1984.6b4e50ae.iframe.bundle.js +2 -0
  16. package/storybook-static/1984.6b4e50ae.iframe.bundle.js.map +1 -0
  17. package/storybook-static/2543.31cbf114.iframe.bundle.js +3 -0
  18. package/storybook-static/2543.31cbf114.iframe.bundle.js.LICENSE.txt +8 -0
  19. package/storybook-static/2543.31cbf114.iframe.bundle.js.map +1 -0
  20. package/storybook-static/2862.571661b6.iframe.bundle.js +2 -0
  21. package/storybook-static/2862.571661b6.iframe.bundle.js.map +1 -0
  22. package/storybook-static/2902.1a427f9a.iframe.bundle.js +2 -0
  23. package/storybook-static/2902.1a427f9a.iframe.bundle.js.map +1 -0
  24. package/storybook-static/2984.7fe13753.iframe.bundle.js +2 -0
  25. package/storybook-static/2984.7fe13753.iframe.bundle.js.map +1 -0
  26. package/storybook-static/312.c4693e73.iframe.bundle.js +3 -0
  27. package/storybook-static/312.c4693e73.iframe.bundle.js.LICENSE.txt +17 -0
  28. package/storybook-static/312.c4693e73.iframe.bundle.js.map +1 -0
  29. package/storybook-static/3666.a04121c4.iframe.bundle.js +2 -0
  30. package/storybook-static/3666.a04121c4.iframe.bundle.js.map +1 -0
  31. package/storybook-static/4197.408fcd63.iframe.bundle.js +2 -0
  32. package/storybook-static/4197.408fcd63.iframe.bundle.js.map +1 -0
  33. package/storybook-static/442.81ce93b1.iframe.bundle.js +2 -0
  34. package/storybook-static/442.81ce93b1.iframe.bundle.js.map +1 -0
  35. package/storybook-static/5161.8a31ff0b.iframe.bundle.js +3 -0
  36. package/storybook-static/5161.8a31ff0b.iframe.bundle.js.LICENSE.txt +8 -0
  37. package/storybook-static/5161.8a31ff0b.iframe.bundle.js.map +1 -0
  38. package/storybook-static/5238.c4a8e283.iframe.bundle.js +2 -0
  39. package/storybook-static/5238.c4a8e283.iframe.bundle.js.map +1 -0
  40. package/storybook-static/6294.8381ed88.iframe.bundle.js +2 -0
  41. package/storybook-static/6294.8381ed88.iframe.bundle.js.map +1 -0
  42. package/storybook-static/6728.48097498.iframe.bundle.js +185 -0
  43. package/storybook-static/6728.48097498.iframe.bundle.js.LICENSE.txt +8 -0
  44. package/storybook-static/6728.48097498.iframe.bundle.js.map +1 -0
  45. package/storybook-static/7148.1912a15a.iframe.bundle.js +3 -0
  46. package/storybook-static/7148.1912a15a.iframe.bundle.js.LICENSE.txt +27 -0
  47. package/storybook-static/7148.1912a15a.iframe.bundle.js.map +1 -0
  48. package/storybook-static/7364.0bbb17e6.iframe.bundle.js +1 -0
  49. package/storybook-static/7368.edc8102e.iframe.bundle.js +3 -0
  50. package/storybook-static/7368.edc8102e.iframe.bundle.js.LICENSE.txt +7 -0
  51. package/storybook-static/7368.edc8102e.iframe.bundle.js.map +1 -0
  52. package/storybook-static/7608.5925882a.iframe.bundle.js +2 -0
  53. package/storybook-static/7608.5925882a.iframe.bundle.js.map +1 -0
  54. package/storybook-static/7648.5ac43950.iframe.bundle.js +2 -0
  55. package/storybook-static/7648.5ac43950.iframe.bundle.js.map +1 -0
  56. package/storybook-static/7674.58735d56.iframe.bundle.js +3 -0
  57. package/storybook-static/7674.58735d56.iframe.bundle.js.LICENSE.txt +21 -0
  58. package/storybook-static/7674.58735d56.iframe.bundle.js.map +1 -0
  59. package/storybook-static/8552.33b568fb.iframe.bundle.js +10 -0
  60. package/storybook-static/8552.33b568fb.iframe.bundle.js.LICENSE.txt +14 -0
  61. package/storybook-static/8552.33b568fb.iframe.bundle.js.map +1 -0
  62. package/storybook-static/8609.28d04d51.iframe.bundle.js +3 -0
  63. package/storybook-static/8609.28d04d51.iframe.bundle.js.LICENSE.txt +11 -0
  64. package/storybook-static/8609.28d04d51.iframe.bundle.js.map +1 -0
  65. package/storybook-static/8936.ecc13c90.iframe.bundle.js +2 -0
  66. package/storybook-static/8936.ecc13c90.iframe.bundle.js.map +1 -0
  67. package/storybook-static/8980.64c0d3f1.iframe.bundle.js +2 -0
  68. package/storybook-static/8980.64c0d3f1.iframe.bundle.js.map +1 -0
  69. package/storybook-static/9269.8bb04a59.iframe.bundle.js +2 -0
  70. package/storybook-static/9269.8bb04a59.iframe.bundle.js.map +1 -0
  71. package/storybook-static/9425.89de0c76.iframe.bundle.js +2 -0
  72. package/storybook-static/9425.89de0c76.iframe.bundle.js.map +1 -0
  73. package/storybook-static/961.3d25a584.iframe.bundle.js +3 -0
  74. package/storybook-static/961.3d25a584.iframe.bundle.js.LICENSE.txt +17 -0
  75. package/storybook-static/961.3d25a584.iframe.bundle.js.map +1 -0
  76. package/storybook-static/9646.75583d09.iframe.bundle.js +2 -0
  77. package/storybook-static/9646.75583d09.iframe.bundle.js.map +1 -0
  78. package/storybook-static/9822.ff44564b.iframe.bundle.js +2 -0
  79. package/storybook-static/9822.ff44564b.iframe.bundle.js.map +1 -0
  80. package/storybook-static/9878.85fd7dab.iframe.bundle.js +95 -0
  81. package/storybook-static/9878.85fd7dab.iframe.bundle.js.LICENSE.txt +8 -0
  82. package/storybook-static/9878.85fd7dab.iframe.bundle.js.map +1 -0
  83. package/storybook-static/Accordion-Accordion-stories.0c0bc5e9.iframe.bundle.js +2 -0
  84. package/storybook-static/Accordion-Accordion-stories.0c0bc5e9.iframe.bundle.js.map +1 -0
  85. package/storybook-static/Alert-Alert-stories.b50ecf37.iframe.bundle.js +2 -0
  86. package/storybook-static/Alert-Alert-stories.b50ecf37.iframe.bundle.js.map +1 -0
  87. package/storybook-static/AutoComplete-AutoComplete-stories.c19f10c7.iframe.bundle.js +2 -0
  88. package/storybook-static/AutoComplete-AutoComplete-stories.c19f10c7.iframe.bundle.js.map +1 -0
  89. package/storybook-static/Breadcrumb-Breadcrumb-stories.dc6d7542.iframe.bundle.js +2 -0
  90. package/storybook-static/Breadcrumb-Breadcrumb-stories.dc6d7542.iframe.bundle.js.map +1 -0
  91. package/storybook-static/Button-Button-stories.d72e6d80.iframe.bundle.js +2 -0
  92. package/storybook-static/Button-Button-stories.d72e6d80.iframe.bundle.js.map +1 -0
  93. package/storybook-static/CalloutBox-CalloutBox-stories.ba542174.iframe.bundle.js +2 -0
  94. package/storybook-static/CalloutBox-CalloutBox-stories.ba542174.iframe.bundle.js.map +1 -0
  95. package/storybook-static/Card-Card-stories.91f76acb.iframe.bundle.js +2 -0
  96. package/storybook-static/Card-Card-stories.91f76acb.iframe.bundle.js.map +1 -0
  97. package/storybook-static/DateField-DateField-stories.bbe464e1.iframe.bundle.js +2 -0
  98. package/storybook-static/DateField-DateField-stories.bbe464e1.iframe.bundle.js.map +1 -0
  99. package/storybook-static/DateTimeField-DateTimeField-stories.d00a350a.iframe.bundle.js +2 -0
  100. package/storybook-static/DateTimeField-DateTimeField-stories.d00a350a.iframe.bundle.js.map +1 -0
  101. package/storybook-static/Dropdown-Dropdown-stories.2c72dbc5.iframe.bundle.js +2 -0
  102. package/storybook-static/Dropdown-Dropdown-stories.2c72dbc5.iframe.bundle.js.map +1 -0
  103. package/storybook-static/Footer-Footer-stories.ec274928.iframe.bundle.js +2 -0
  104. package/storybook-static/Footer-Footer-stories.ec274928.iframe.bundle.js.map +1 -0
  105. package/storybook-static/Infotip-Infotip-stories.3a2e9151.iframe.bundle.js +2 -0
  106. package/storybook-static/Infotip-Infotip-stories.3a2e9151.iframe.bundle.js.map +1 -0
  107. package/storybook-static/Instant-Instant-stories.d4d3b917.iframe.bundle.js +2 -0
  108. package/storybook-static/Instant-Instant-stories.d4d3b917.iframe.bundle.js.map +1 -0
  109. package/storybook-static/Link-Link-stories.e4a40f96.iframe.bundle.js +2 -0
  110. package/storybook-static/Link-Link-stories.e4a40f96.iframe.bundle.js.map +1 -0
  111. package/storybook-static/MadieAlert-MadieAlert-stories.ff732f0b.iframe.bundle.js +3 -0
  112. package/storybook-static/MadieAlert-MadieAlert-stories.ff732f0b.iframe.bundle.js.LICENSE.txt +5 -0
  113. package/storybook-static/MadieAlert-MadieAlert-stories.ff732f0b.iframe.bundle.js.map +1 -0
  114. package/storybook-static/MadieConfirmDialog-MadieConfirmDialog-stories.1bec5e61.iframe.bundle.js +2 -0
  115. package/storybook-static/MadieConfirmDialog-MadieConfirmDialog-stories.1bec5e61.iframe.bundle.js.map +1 -0
  116. package/storybook-static/MadieDeleteDialog-MadieDeleteDialog-stories.c55f9367.iframe.bundle.js +2 -0
  117. package/storybook-static/MadieDeleteDialog-MadieDeleteDialog-stories.c55f9367.iframe.bundle.js.map +1 -0
  118. package/storybook-static/MadieDialog-MadieDialog-stories.d2bdc88c.iframe.bundle.js +2 -0
  119. package/storybook-static/MadieDialog-MadieDialog-stories.d2bdc88c.iframe.bundle.js.map +1 -0
  120. package/storybook-static/MadieDiscardDialog-MadieDiscardDialog-stories.050cc027.iframe.bundle.js +2 -0
  121. package/storybook-static/MadieDiscardDialog-MadieDiscardDialog-stories.050cc027.iframe.bundle.js.map +1 -0
  122. package/storybook-static/MadieSpinner-MadieSpinner-stories.82085813.iframe.bundle.js +2 -0
  123. package/storybook-static/MadieSpinner-MadieSpinner-stories.82085813.iframe.bundle.js.map +1 -0
  124. package/storybook-static/MadieTooltip-MadieTooltip-stories.c7413617.iframe.bundle.js +2 -0
  125. package/storybook-static/MadieTooltip-MadieTooltip-stories.c7413617.iframe.bundle.js.map +1 -0
  126. package/storybook-static/MadieTooltipIcon-MadieTooltipIcon-stories.b42bb7f1.iframe.bundle.js +2 -0
  127. package/storybook-static/MadieTooltipIcon-MadieTooltipIcon-stories.b42bb7f1.iframe.bundle.js.map +1 -0
  128. package/storybook-static/Modal-Modal-stories.d5279c12.iframe.bundle.js +2 -0
  129. package/storybook-static/Modal-Modal-stories.d5279c12.iframe.bundle.js.map +1 -0
  130. package/storybook-static/NotificationBanner-NotificationBanner-stories.c9cd7214.iframe.bundle.js +2 -0
  131. package/storybook-static/NotificationBanner-NotificationBanner-stories.c9cd7214.iframe.bundle.js.map +1 -0
  132. package/storybook-static/NumberInput-NumberInput-stories.ed54df5a.iframe.bundle.js +2 -0
  133. package/storybook-static/NumberInput-NumberInput-stories.ed54df5a.iframe.bundle.js.map +1 -0
  134. package/storybook-static/Pagination-Pagination-stories.c699faa0.iframe.bundle.js +2 -0
  135. package/storybook-static/Pagination-Pagination-stories.c699faa0.iframe.bundle.js.map +1 -0
  136. package/storybook-static/Popover-Popover-stories.61ae1fb7.iframe.bundle.js +2 -0
  137. package/storybook-static/Popover-Popover-stories.61ae1fb7.iframe.bundle.js.map +1 -0
  138. package/storybook-static/RadioButton-RadioButton-stories.86bf3fd2.iframe.bundle.js +2 -0
  139. package/storybook-static/RadioButton-RadioButton-stories.86bf3fd2.iframe.bundle.js.map +1 -0
  140. package/storybook-static/ReadOnlyTextField-ReadOnlyTextField-stories.a599e67a.iframe.bundle.js +2 -0
  141. package/storybook-static/ReadOnlyTextField-ReadOnlyTextField-stories.a599e67a.iframe.bundle.js.map +1 -0
  142. package/storybook-static/RichTextEditor-RichTextEditor-stories.81d66b4b.iframe.bundle.js +2 -0
  143. package/storybook-static/RichTextEditor-RichTextEditor-stories.81d66b4b.iframe.bundle.js.map +1 -0
  144. package/storybook-static/Select-Select-stories.a3b5faa6.iframe.bundle.js +2 -0
  145. package/storybook-static/Select-Select-stories.a3b5faa6.iframe.bundle.js.map +1 -0
  146. package/storybook-static/Tabs-Tabs-stories.0689a934.iframe.bundle.js +2 -0
  147. package/storybook-static/Tabs-Tabs-stories.0689a934.iframe.bundle.js.map +1 -0
  148. package/storybook-static/TextArea-TextArea-stories.f862921e.iframe.bundle.js +2 -0
  149. package/storybook-static/TextArea-TextArea-stories.f862921e.iframe.bundle.js.map +1 -0
  150. package/storybook-static/TextField-TextField-stories.ed07af6e.iframe.bundle.js +2 -0
  151. package/storybook-static/TextField-TextField-stories.ed07af6e.iframe.bundle.js.map +1 -0
  152. package/storybook-static/TextInput-TextInput-stories.7043f852.iframe.bundle.js +2 -0
  153. package/storybook-static/TextInput-TextInput-stories.7043f852.iframe.bundle.js.map +1 -0
  154. package/storybook-static/TimeField-TimeField-stories.e69c0bc6.iframe.bundle.js +2 -0
  155. package/storybook-static/TimeField-TimeField-stories.e69c0bc6.iframe.bundle.js.map +1 -0
  156. package/storybook-static/Toast-Toast-stories.9226d3b7.iframe.bundle.js +3 -0
  157. package/storybook-static/Toast-Toast-stories.9226d3b7.iframe.bundle.js.LICENSE.txt +5 -0
  158. package/storybook-static/Toast-Toast-stories.9226d3b7.iframe.bundle.js.map +1 -0
  159. package/storybook-static/Toggle-Toggle-stories.dabdd09d.iframe.bundle.js +2 -0
  160. package/storybook-static/Toggle-Toggle-stories.dabdd09d.iframe.bundle.js.map +1 -0
  161. package/storybook-static/Tooltip-Tooltip-stories.78bdceea.iframe.bundle.js +2 -0
  162. package/storybook-static/Tooltip-Tooltip-stories.78bdceea.iframe.bundle.js.map +1 -0
  163. package/storybook-static/TruncateText-TruncateText-stories.a5188e85.iframe.bundle.js +2 -0
  164. package/storybook-static/TruncateText-TruncateText-stories.a5188e85.iframe.bundle.js.map +1 -0
  165. package/storybook-static/iframe.html +513 -0
  166. package/storybook-static/index.json +1 -1
  167. package/storybook-static/main.f46f596f.iframe.bundle.js +2 -0
  168. package/storybook-static/main.f46f596f.iframe.bundle.js.map +1 -0
  169. package/storybook-static/project.json +1 -1
  170. package/storybook-static/runtime~main.acd6c2b7.iframe.bundle.js +2 -0
  171. package/storybook-static/runtime~main.acd6c2b7.iframe.bundle.js.map +1 -0
  172. package/storybook-static/sb-addons/backgrounds-7/manager-bundle.js +7 -7
  173. package/storybook-static/sb-addons/docs-6/manager-bundle.js +1 -1
  174. package/storybook-static/sb-addons/knobs-4/register-bundle.js +11 -11
  175. package/storybook-static/static/media/Bitter-Bold.091bd4b7.woff +0 -0
  176. package/storybook-static/static/media/Bitter-Bold.24bf01e4.woff2 +0 -0
  177. package/storybook-static/static/media/Bitter-Bold.46bc29e4.ttf +0 -0
  178. package/storybook-static/static/media/Bitter-Bold.790f4f2f.eot +0 -0
  179. package/storybook-static/static/media/Bitter-Italic.1fa5390c.eot +0 -0
  180. package/storybook-static/static/media/Bitter-Italic.25e5675f.woff +0 -0
  181. package/storybook-static/static/media/Bitter-Italic.2eb18f5a.ttf +0 -0
  182. package/storybook-static/static/media/Bitter-Italic.34644574.woff2 +0 -0
  183. package/storybook-static/static/media/Bitter-Regular.4b22b6e8.woff +0 -0
  184. package/storybook-static/static/media/Bitter-Regular.559e7075.eot +0 -0
  185. package/storybook-static/static/media/Bitter-Regular.8db0301b.ttf +0 -0
  186. package/storybook-static/static/media/Bitter-Regular.f4e2f1f1.woff2 +0 -0
  187. package/storybook-static/static/media/FontAwesome.91f80bba.otf +0 -0
  188. package/storybook-static/static/media/OpenSans-Bold-webfont.202d819d.eot +0 -0
  189. package/storybook-static/static/media/OpenSans-Bold-webfont.92e570c6.woff2 +0 -0
  190. package/storybook-static/static/media/OpenSans-Bold-webfont.da71e99a.ttf +0 -0
  191. package/storybook-static/static/media/OpenSans-Bold-webfont.e75949bb.woff +0 -0
  192. package/storybook-static/static/media/OpenSans-Italic-webfont.72daa33a.woff2 +0 -0
  193. package/storybook-static/static/media/OpenSans-Italic-webfont.74ead3a8.woff +0 -0
  194. package/storybook-static/static/media/OpenSans-Italic-webfont.ae19388f.eot +0 -0
  195. package/storybook-static/static/media/OpenSans-Italic-webfont.ec7a2746.ttf +0 -0
  196. package/storybook-static/static/media/OpenSans-Regular-webfont.63a5fa7d.woff +0 -0
  197. package/storybook-static/static/media/OpenSans-Regular-webfont.66451be4.ttf +0 -0
  198. package/storybook-static/static/media/OpenSans-Regular-webfont.7882d20f.eot +0 -0
  199. package/storybook-static/static/media/OpenSans-Regular-webfont.ca4dd835.woff2 +0 -0
  200. package/storybook-static/static/media/OpenSans-Semibold-webfont.17ded75f.woff2 +0 -0
  201. package/storybook-static/static/media/OpenSans-Semibold-webfont.2a5adf6c.woff +0 -0
  202. package/storybook-static/static/media/OpenSans-Semibold-webfont.6059fecb.ttf +0 -0
  203. package/storybook-static/static/media/OpenSans-Semibold-webfont.c9808185.eot +0 -0
  204. package/storybook-static/static/media/Rubik-Bold.31bbd4d2.ttf +0 -0
  205. package/storybook-static/static/media/Rubik-Light.c90e2014.ttf +0 -0
  206. package/storybook-static/static/media/Rubik-Medium.5daa89aa.ttf +0 -0
  207. package/storybook-static/static/media/Rubik-Regular.cdf97d58.ttf +0 -0
  208. package/storybook-static/static/media/arrow-both.a0959e13.svg +3 -0
  209. package/storybook-static/static/media/fontawesome-webfont.1e59d233.ttf +0 -0
  210. package/storybook-static/static/media/fontawesome-webfont.20fd1704.woff2 +0 -0
  211. package/storybook-static/static/media/fontawesome-webfont.8b43027f.eot +0 -0
  212. package/storybook-static/static/media/fontawesome-webfont.c1e38fd9.svg +2671 -0
  213. package/storybook-static/static/media/fontawesome-webfont.f691f37e.woff +0 -0
@@ -0,0 +1,3 @@
1
+ /*! For license information please see 7674.58735d56.iframe.bundle.js.LICENSE.txt */
2
+ (self.webpackChunk_madie_madie_design_system=self.webpackChunk_madie_madie_design_system||[]).push([[7674],{"./node_modules/@mui/icons-material/FormatBold.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5"}),"FormatBold")},"./node_modules/@mui/icons-material/FormatItalic.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic")},"./node_modules/@mui/icons-material/FormatListBulleted.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z"}),"FormatListBulleted")},"./node_modules/@mui/icons-material/FormatListNumbered.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered")},"./node_modules/@mui/icons-material/FormatUnderlined.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z"}),"FormatUnderlined")},"./node_modules/@mui/icons-material/Redo.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7z"}),"Redo")},"./node_modules/@mui/icons-material/StrikethroughS.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85-.29-.86-1.2-1.28-2.25-1.28-1.86 0-2.34 1.02-2.34 1.7 0 .48.25.88.74 1.21.38.25.77.48 1.41.7H7.39c-.21-.34-.54-.89-.54-1.92M21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97 0 1-.81 1.67-2.28 1.67-1.54 0-2.93-.54-2.93-2.51H6.4c0 .55.08 1.13.24 1.58.81 2.29 3.29 3.3 5.67 3.3 2.27 0 5.3-.89 5.3-4.05 0-.3-.01-1.16-.48-1.94H21z"}),"StrikethroughS")},"./node_modules/@mui/icons-material/TableChart.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2M3 19c0 1.1.9 2 2 2h3V10H3z"}),"TableChart")},"./node_modules/@mui/icons-material/Undo.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__("./node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _createSvgIcon=_interopRequireDefault(__webpack_require__("./node_modules/@mui/icons-material/utils/createSvgIcon.js")),_jsxRuntime=__webpack_require__("./node_modules/react/jsx-runtime.js");exports.default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8"}),"Undo")},"./node_modules/dompurify/dist/purify.cjs.js"(module){"use strict";function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n}function _slicedToArray(r,e){return function _arrayWithHoles(r){if(Array.isArray(r))return r}(r)||function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l);else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}(r,e)||function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0}}(r,e)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const entries=Object.entries,setPrototypeOf=Object.setPrototypeOf,isFrozen=Object.isFrozen,getPrototypeOf=Object.getPrototypeOf,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor;let freeze=Object.freeze,seal=Object.seal,create=Object.create,_ref="undefined"!=typeof Reflect&&Reflect,apply=_ref.apply,construct=_ref.construct;freeze||(freeze=function freeze(x){return x}),seal||(seal=function seal(x){return x}),apply||(apply=function apply(func,thisArg){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++)args[_key-2]=arguments[_key];return func.apply(thisArg,args)}),construct||(construct=function construct(Func){for(var _len2=arguments.length,args=new Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return new Func(...args)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),arrayIsArray=Array.isArray,stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),numberToString=unapply(Number.prototype.toString),booleanToString=unapply(Boolean.prototype.toString),bigintToString="undefined"==typeof BigInt?null:unapply(BigInt.prototype.toString),symbolToString="undefined"==typeof Symbol?null:unapply(Symbol.prototype.toString),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),objectToString=unapply(Object.prototype.toString),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=function unconstruct(Func){return function(){for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++)args[_key4]=arguments[_key4];return construct(Func,args)}}(TypeError);function unapply(func){return function(thisArg){thisArg instanceof RegExp&&(thisArg.lastIndex=0);for(var _len3=arguments.length,args=new Array(_len3>1?_len3-1:0),_key3=1;_key3<_len3;_key3++)args[_key3-1]=arguments[_key3];return apply(func,thisArg,args)}}function addToSet(set,array){let transformCaseFunc=arguments.length>2&&void 0!==arguments[2]?arguments[2]:stringToLowerCase;if(setPrototypeOf&&setPrototypeOf(set,null),!arrayIsArray(array))return set;let l=array.length;for(;l--;){let element=array[l];if("string"==typeof element){const lcElement=transformCaseFunc(element);lcElement!==element&&(isFrozen(array)||(array[l]=lcElement),element=lcElement)}set[element]=!0}return set}function cleanArray(array){for(let index=0;index<array.length;index++){objectHasOwnProperty(array,index)||(array[index]=null)}return array}function clone(object){const newObject=create(null);for(const _ref2 of entries(object)){var _ref3=_slicedToArray(_ref2,2);const property=_ref3[0],value=_ref3[1];objectHasOwnProperty(object,property)&&(arrayIsArray(value)?newObject[property]=cleanArray(value):value&&"object"==typeof value&&value.constructor===Object?newObject[property]=clone(value):newObject[property]=value)}return newObject}function lookupGetter(object,prop){for(;null!==object;){const desc=getOwnPropertyDescriptor(object,prop);if(desc){if(desc.get)return unapply(desc.get);if("function"==typeof desc.value)return unapply(desc.value)}object=getPrototypeOf(object)}return function fallbackValue(){return null}}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/{{[\w\W]*|^[\w\W]*}}/g),ERB_EXPR=seal(/<%[\w\W]*|^[\w\W]*%>/g),TMPLIT_EXPR=seal(/\${[\w\W]*/g),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i),ELEMENT_MARKUP_PROBE=seal(/<[/\w!]/g),COMMENT_MARKUP_PROBE=seal(/<[/\w]/g),FALLBACK_TAG_CLOSE=seal(/<\/no(script|embed|frames)/i),SELF_CLOSING_TAG=seal(/\/>/i),NODE_TYPE_element=1,NODE_TYPE_text=3,NODE_TYPE_processingInstruction=7,NODE_TYPE_comment=8,NODE_TYPE_document=9,NODE_TYPE_documentFragment=11,LITERAL_TEXT_ELEMENT_NAMES=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],LITERAL_TEXT_ELEMENTS=freeze(addToSet({},LITERAL_TEXT_ELEMENT_NAMES)),LITERAL_TEXT_CLOSE=function(){const map={};return arrayForEach(LITERAL_TEXT_ELEMENT_NAMES,name=>{map[name]=seal(new RegExp("</"+name+"(?=[\\t\\n\\f\\r />])","i"))}),freeze(map)}(),getGlobal=function getGlobal(){return"undefined"==typeof window?null:window},_resolveSetOption=function _resolveSetOption(cfg,key,fallback,options){return objectHasOwnProperty(cfg,key)&&arrayIsArray(cfg[key])?addToSet(options.base?clone(options.base):{},cfg[key],options.transform):fallback},_resolveObjectOption=function _resolveObjectOption(cfg,key,makeFallback){const value=objectHasOwnProperty(cfg,key)?cfg[key]:void 0;return value&&"object"==typeof value?clone(value):makeFallback()};var purify=function createDOMPurify(){let window=arguments.length>0&&void 0!==arguments[0]?arguments[0]:getGlobal();const DOMPurify=root=>createDOMPurify(root);if(DOMPurify.version="3.4.15",DOMPurify.removed=[],!window||!window.document||window.document.nodeType!==NODE_TYPE_document||!window.Element)return DOMPurify.isSupported=!1,DOMPurify;let document=window.document;const originalDocument=document,currentScript=originalDocument.currentScript;window.DocumentFragment;const HTMLTemplateElement=window.HTMLTemplateElement,Node=window.Node,Element=window.Element,NodeFilter=window.NodeFilter,_window$NamedNodeMap=window.NamedNodeMap;void 0===_window$NamedNodeMap&&(window.NamedNodeMap||window.MozNamedAttrMap),window.HTMLFormElement;const DOMParser=window.DOMParser,trustedTypes=window.trustedTypes,ElementPrototype=Element.prototype,cloneNode=lookupGetter(ElementPrototype,"cloneNode"),remove=lookupGetter(ElementPrototype,"remove"),removeAttributeNode=lookupGetter(ElementPrototype,"removeAttributeNode"),getNextSibling=lookupGetter(ElementPrototype,"nextSibling"),getChildNodes=lookupGetter(ElementPrototype,"childNodes"),getParentNode=lookupGetter(ElementPrototype,"parentNode"),getShadowRoot=lookupGetter(ElementPrototype,"shadowRoot"),getAttributes=lookupGetter(ElementPrototype,"attributes"),getNodeType=Node&&Node.prototype?lookupGetter(Node.prototype,"nodeType"):null,getNodeName=Node&&Node.prototype?lookupGetter(Node.prototype,"nodeName"):null,getOwnerDocument=Node&&Node.prototype?lookupGetter(Node.prototype,"ownerDocument"):null,_readNodeType=function _readNodeType(node){return getNodeType?getNodeType(node):node.nodeType},_readNodeName=function _readNodeName(node){return getNodeName?getNodeName(node):node.nodeName};if("function"==typeof HTMLTemplateElement){const template=document.createElement("template");template.content&&template.content.ownerDocument&&(document=template.content.ownerDocument)}let trustedTypesPolicy,defaultTrustedTypesPolicy,emptyHTML="",defaultTrustedTypesPolicyResolved=!1,IN_TRUSTED_TYPES_POLICY=0;const _assertNotInTrustedTypesPolicy=function _assertNotInTrustedTypesPolicy(){if(IN_TRUSTED_TYPES_POLICY>0)throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},_createTrustedHTML=function _createTrustedHTML(html){_assertNotInTrustedTypesPolicy(),IN_TRUSTED_TYPES_POLICY++;try{return trustedTypesPolicy.createHTML(html)}finally{IN_TRUSTED_TYPES_POLICY--}},_getDefaultTrustedTypesPolicy=function _getDefaultTrustedTypesPolicy(){return defaultTrustedTypesPolicyResolved||(defaultTrustedTypesPolicy=function _createTrustedTypesPolicy(trustedTypes,purifyHostElement){if("object"!=typeof trustedTypes||"function"!=typeof trustedTypes.createPolicy)return null;let suffix=null;purifyHostElement&&purifyHostElement.hasAttribute("data-tt-policy-suffix")&&(suffix=purifyHostElement.getAttribute("data-tt-policy-suffix"));const policyName="dompurify"+(suffix?"#"+suffix:"");try{return trustedTypes.createPolicy(policyName,{createHTML:html=>html,createScriptURL:scriptUrl=>scriptUrl})}catch(_){return console.warn("TrustedTypes policy "+policyName+" could not be created."),null}}(trustedTypes,currentScript),defaultTrustedTypesPolicyResolved=!0),defaultTrustedTypesPolicy},_document=document,implementation=_document.implementation,createNodeIterator=_document.createNodeIterator,createDocumentFragment=_document.createDocumentFragment,getElementsByTagName=_document.getElementsByTagName,importNode=originalDocument.importNode;let hooks={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};DOMPurify.isSupported="function"==typeof entries&&"function"==typeof getParentNode&&implementation&&void 0!==implementation.createHTMLDocument;const MUSTACHE_EXPR$1=MUSTACHE_EXPR,ERB_EXPR$1=ERB_EXPR,TMPLIT_EXPR$1=TMPLIT_EXPR,DATA_ATTR$1=DATA_ATTR,ARIA_ATTR$1=ARIA_ATTR,IS_SCRIPT_OR_DATA$1=IS_SCRIPT_OR_DATA,ATTR_WHITESPACE$1=ATTR_WHITESPACE,CUSTOM_ELEMENT$1=CUSTOM_ELEMENT;let IS_ALLOWED_URI$1=IS_ALLOWED_URI,ALLOWED_TAGS=null;const DEFAULT_ALLOWED_TAGS=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text]);let ALLOWED_ATTR=null;const DEFAULT_ALLOWED_ATTR=addToSet({},[...html,...svg,...mathMl,...xml]);let CUSTOM_ELEMENT_HANDLING=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),FORBID_TAGS=null,FORBID_ATTR=null;const EXTRA_ELEMENT_HANDLING=Object.seal(create(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ALLOW_ARIA_ATTR=!0,ALLOW_DATA_ATTR=!0,ALLOW_UNKNOWN_PROTOCOLS=!1,ALLOW_SELF_CLOSE_IN_ATTR=!0,SAFE_FOR_TEMPLATES=!1,SAFE_FOR_XML=!0,WHOLE_DOCUMENT=!1,SET_CONFIG=!1,SET_CONFIG_ALLOWED_TAGS=null,SET_CONFIG_ALLOWED_ATTR=null,FORCE_BODY=!1,RETURN_DOM=!1,RETURN_DOM_FRAGMENT=!1,RETURN_TRUSTED_TYPE=!1,SANITIZE_DOM=!0,SANITIZE_NAMED_PROPS=!1,KEEP_CONTENT=!0,IN_PLACE=!1,USE_PROFILES={},FORBID_CONTENTS=null;const DEFAULT_FORBID_CONTENTS=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let DATA_URI_TAGS=null;const DEFAULT_DATA_URI_TAGS=addToSet({},["audio","video","img","source","image","track"]);let URI_SAFE_ATTRIBUTES=null;const DEFAULT_URI_SAFE_ATTRIBUTES=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),MATHML_NAMESPACE="http://www.w3.org/1998/Math/MathML",SVG_NAMESPACE="http://www.w3.org/2000/svg",HTML_NAMESPACE="http://www.w3.org/1999/xhtml";let NAMESPACE=HTML_NAMESPACE,IS_EMPTY_INPUT=!1,ALLOWED_NAMESPACES=null;const DEFAULT_ALLOWED_NAMESPACES=addToSet({},[MATHML_NAMESPACE,SVG_NAMESPACE,HTML_NAMESPACE],stringToString),DEFAULT_MATHML_TEXT_INTEGRATION_POINTS=freeze(["mi","mo","mn","ms","mtext"]);let MATHML_TEXT_INTEGRATION_POINTS=addToSet({},DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);const DEFAULT_HTML_INTEGRATION_POINTS=freeze(["annotation-xml"]);let HTML_INTEGRATION_POINTS=addToSet({},DEFAULT_HTML_INTEGRATION_POINTS);const COMMON_SVG_AND_HTML_ELEMENTS=addToSet({},["title","style","font","a","script"]);let PARSER_MEDIA_TYPE=null;const SUPPORTED_PARSER_MEDIA_TYPES=["application/xhtml+xml","text/html"];let transformCaseFunc=null,CONFIG=null;const formElement=document.createElement("form"),isRegexOrFunction=function isRegexOrFunction(testValue){return testValue instanceof RegExp||testValue instanceof Function},_parseConfig=function _parseConfig(){let cfg=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(CONFIG&&CONFIG===cfg)return;cfg&&"object"==typeof cfg||(cfg={}),cfg=clone(cfg),PARSER_MEDIA_TYPE=-1===SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE)?"text/html":cfg.PARSER_MEDIA_TYPE,transformCaseFunc="application/xhtml+xml"===PARSER_MEDIA_TYPE?stringToString:stringToLowerCase,ALLOWED_TAGS=_resolveSetOption(cfg,"ALLOWED_TAGS",DEFAULT_ALLOWED_TAGS,{transform:transformCaseFunc}),ALLOWED_ATTR=_resolveSetOption(cfg,"ALLOWED_ATTR",DEFAULT_ALLOWED_ATTR,{transform:transformCaseFunc}),ALLOWED_NAMESPACES=_resolveSetOption(cfg,"ALLOWED_NAMESPACES",DEFAULT_ALLOWED_NAMESPACES,{transform:stringToString}),URI_SAFE_ATTRIBUTES=_resolveSetOption(cfg,"ADD_URI_SAFE_ATTR",DEFAULT_URI_SAFE_ATTRIBUTES,{transform:transformCaseFunc,base:DEFAULT_URI_SAFE_ATTRIBUTES}),DATA_URI_TAGS=_resolveSetOption(cfg,"ADD_DATA_URI_TAGS",DEFAULT_DATA_URI_TAGS,{transform:transformCaseFunc,base:DEFAULT_DATA_URI_TAGS}),FORBID_CONTENTS=_resolveSetOption(cfg,"FORBID_CONTENTS",DEFAULT_FORBID_CONTENTS,{transform:transformCaseFunc}),FORBID_TAGS=_resolveSetOption(cfg,"FORBID_TAGS",clone({}),{transform:transformCaseFunc}),FORBID_ATTR=_resolveSetOption(cfg,"FORBID_ATTR",clone({}),{transform:transformCaseFunc}),USE_PROFILES=!!objectHasOwnProperty(cfg,"USE_PROFILES")&&(cfg.USE_PROFILES&&"object"==typeof cfg.USE_PROFILES?clone(cfg.USE_PROFILES):cfg.USE_PROFILES),ALLOW_ARIA_ATTR=!1!==cfg.ALLOW_ARIA_ATTR,ALLOW_DATA_ATTR=!1!==cfg.ALLOW_DATA_ATTR,ALLOW_UNKNOWN_PROTOCOLS=cfg.ALLOW_UNKNOWN_PROTOCOLS||!1,ALLOW_SELF_CLOSE_IN_ATTR=!1!==cfg.ALLOW_SELF_CLOSE_IN_ATTR,SAFE_FOR_TEMPLATES=cfg.SAFE_FOR_TEMPLATES||!1,SAFE_FOR_XML=!1!==cfg.SAFE_FOR_XML,WHOLE_DOCUMENT=cfg.WHOLE_DOCUMENT||!1,RETURN_DOM=cfg.RETURN_DOM||!1,RETURN_DOM_FRAGMENT=cfg.RETURN_DOM_FRAGMENT||!1,RETURN_TRUSTED_TYPE=cfg.RETURN_TRUSTED_TYPE||!1,FORCE_BODY=cfg.FORCE_BODY||!1,SANITIZE_DOM=!1!==cfg.SANITIZE_DOM,SANITIZE_NAMED_PROPS=cfg.SANITIZE_NAMED_PROPS||!1,KEEP_CONTENT=!1!==cfg.KEEP_CONTENT,IN_PLACE=cfg.IN_PLACE||!1,IS_ALLOWED_URI$1=function isRegex(value){try{return regExpTest(value,""),!0}catch(_unused){return!1}}(cfg.ALLOWED_URI_REGEXP)?cfg.ALLOWED_URI_REGEXP:IS_ALLOWED_URI,NAMESPACE="string"==typeof cfg.NAMESPACE?cfg.NAMESPACE:HTML_NAMESPACE,MATHML_TEXT_INTEGRATION_POINTS=_resolveObjectOption(cfg,"MATHML_TEXT_INTEGRATION_POINTS",()=>addToSet({},DEFAULT_MATHML_TEXT_INTEGRATION_POINTS)),HTML_INTEGRATION_POINTS=_resolveObjectOption(cfg,"HTML_INTEGRATION_POINTS",()=>addToSet({},DEFAULT_HTML_INTEGRATION_POINTS));const customElementHandling=_resolveObjectOption(cfg,"CUSTOM_ELEMENT_HANDLING",()=>create(null));if(CUSTOM_ELEMENT_HANDLING=create(null),objectHasOwnProperty(customElementHandling,"tagNameCheck")&&isRegexOrFunction(customElementHandling.tagNameCheck)&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck=customElementHandling.tagNameCheck),objectHasOwnProperty(customElementHandling,"attributeNameCheck")&&isRegexOrFunction(customElementHandling.attributeNameCheck)&&(CUSTOM_ELEMENT_HANDLING.attributeNameCheck=customElementHandling.attributeNameCheck),objectHasOwnProperty(customElementHandling,"allowCustomizedBuiltInElements")&&"boolean"==typeof customElementHandling.allowCustomizedBuiltInElements&&(CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=customElementHandling.allowCustomizedBuiltInElements),seal(CUSTOM_ELEMENT_HANDLING),SAFE_FOR_TEMPLATES&&(ALLOW_DATA_ATTR=!1),RETURN_DOM_FRAGMENT&&(RETURN_DOM=!0),USE_PROFILES&&(ALLOWED_TAGS=addToSet({},text),ALLOWED_ATTR=create(null),!0===USE_PROFILES.html&&(addToSet(ALLOWED_TAGS,html$1),addToSet(ALLOWED_ATTR,html)),!0===USE_PROFILES.svg&&(addToSet(ALLOWED_TAGS,svg$1),addToSet(ALLOWED_ATTR,svg),addToSet(ALLOWED_ATTR,xml)),!0===USE_PROFILES.svgFilters&&(addToSet(ALLOWED_TAGS,svgFilters),addToSet(ALLOWED_ATTR,svg),addToSet(ALLOWED_ATTR,xml)),!0===USE_PROFILES.mathMl&&(addToSet(ALLOWED_TAGS,mathMl$1),addToSet(ALLOWED_ATTR,mathMl),addToSet(ALLOWED_ATTR,xml))),EXTRA_ELEMENT_HANDLING.tagCheck=null,EXTRA_ELEMENT_HANDLING.attributeCheck=null,objectHasOwnProperty(cfg,"ADD_TAGS")&&("function"==typeof cfg.ADD_TAGS?EXTRA_ELEMENT_HANDLING.tagCheck=cfg.ADD_TAGS:arrayIsArray(cfg.ADD_TAGS)&&(ALLOWED_TAGS===DEFAULT_ALLOWED_TAGS&&(ALLOWED_TAGS=clone(ALLOWED_TAGS)),addToSet(ALLOWED_TAGS,cfg.ADD_TAGS,transformCaseFunc))),objectHasOwnProperty(cfg,"ADD_ATTR")&&("function"==typeof cfg.ADD_ATTR?EXTRA_ELEMENT_HANDLING.attributeCheck=cfg.ADD_ATTR:arrayIsArray(cfg.ADD_ATTR)&&(ALLOWED_ATTR===DEFAULT_ALLOWED_ATTR&&(ALLOWED_ATTR=clone(ALLOWED_ATTR)),addToSet(ALLOWED_ATTR,cfg.ADD_ATTR,transformCaseFunc))),objectHasOwnProperty(cfg,"ADD_FORBID_CONTENTS")&&arrayIsArray(cfg.ADD_FORBID_CONTENTS)&&(FORBID_CONTENTS===DEFAULT_FORBID_CONTENTS&&(FORBID_CONTENTS=clone(FORBID_CONTENTS)),addToSet(FORBID_CONTENTS,cfg.ADD_FORBID_CONTENTS,transformCaseFunc)),KEEP_CONTENT&&(ALLOWED_TAGS["#text"]=!0),WHOLE_DOCUMENT&&addToSet(ALLOWED_TAGS,["html","head","body"]),ALLOWED_TAGS.table&&(addToSet(ALLOWED_TAGS,["tbody"]),delete FORBID_TAGS.tbody),cfg.TRUSTED_TYPES_POLICY){if("function"!=typeof cfg.TRUSTED_TYPES_POLICY.createHTML)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const previousTrustedTypesPolicy=trustedTypesPolicy;trustedTypesPolicy=cfg.TRUSTED_TYPES_POLICY;try{emptyHTML=_createTrustedHTML("")}catch(error){throw trustedTypesPolicy=previousTrustedTypesPolicy,error}}else null===cfg.TRUSTED_TYPES_POLICY?(trustedTypesPolicy=void 0,emptyHTML=""):(void 0===trustedTypesPolicy&&(trustedTypesPolicy=_getDefaultTrustedTypesPolicy()),trustedTypesPolicy&&"string"==typeof emptyHTML&&(emptyHTML=_createTrustedHTML("")));freeze&&freeze(cfg),CONFIG=cfg},ALL_SVG_TAGS=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),ALL_MATHML_TAGS=addToSet({},[...mathMl$1,...mathMlDisallowed]),_checkValidNamespace=function _checkValidNamespace(element){let parent=getParentNode(element);parent&&parent.tagName||(parent={namespaceURI:NAMESPACE,tagName:"template"});const tagName=stringToLowerCase(element.tagName),parentTagName=stringToLowerCase(parent.tagName);return!!ALLOWED_NAMESPACES[element.namespaceURI]&&(element.namespaceURI===SVG_NAMESPACE?function _checkSvgNamespace(tagName,parent,parentTagName){return parent.namespaceURI===HTML_NAMESPACE?"svg"===tagName:parent.namespaceURI===MATHML_NAMESPACE?"svg"===tagName&&("annotation-xml"===parentTagName||MATHML_TEXT_INTEGRATION_POINTS[parentTagName]):Boolean(ALL_SVG_TAGS[tagName])}(tagName,parent,parentTagName):element.namespaceURI===MATHML_NAMESPACE?function _checkMathMlNamespace(tagName,parent,parentTagName){return parent.namespaceURI===HTML_NAMESPACE?"math"===tagName:parent.namespaceURI===SVG_NAMESPACE?"math"===tagName&&HTML_INTEGRATION_POINTS[parentTagName]:Boolean(ALL_MATHML_TAGS[tagName])}(tagName,parent,parentTagName):element.namespaceURI===HTML_NAMESPACE?function _checkHtmlNamespace(tagName,parent,parentTagName){return!(parent.namespaceURI===SVG_NAMESPACE&&!HTML_INTEGRATION_POINTS[parentTagName])&&!(parent.namespaceURI===MATHML_NAMESPACE&&!MATHML_TEXT_INTEGRATION_POINTS[parentTagName])&&!ALL_MATHML_TAGS[tagName]&&(COMMON_SVG_AND_HTML_ELEMENTS[tagName]||!ALL_SVG_TAGS[tagName])}(tagName,parent,parentTagName):!("application/xhtml+xml"!==PARSER_MEDIA_TYPE||!ALLOWED_NAMESPACES[element.namespaceURI]))},_forceRemove=function _forceRemove(node){arrayPush(DOMPurify.removed,{element:node});try{getParentNode(node).removeChild(node)}catch(_){if(remove(node),!getParentNode(node))throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},_stripAttributeNode=function _stripAttributeNode(element,attribute,name){try{removeAttributeNode(element,attribute)}catch(_){try{element.removeAttribute(name)}catch(_){}}},_neutralizeRoot=function _neutralizeRoot(root){_neutralizeSubtree(root);const childNodes=getChildNodes(root);if(childNodes){const snapshot=[];arrayForEach(childNodes,child=>{arrayPush(snapshot,child)}),arrayForEach(snapshot,child=>{try{remove(child)}catch(_){}})}const attributes=getAttributes(root);if(attributes)for(let i=attributes.length-1;i>=0;--i){const attribute=attributes[i],name=attribute&&attribute.name;"string"==typeof name&&_stripAttributeNode(root,attribute,name)}},_removeAttribute=function _removeAttribute(name,element,attr){if(!attr)try{attr=element.getAttributeNode(name)}catch(_){attr=null}arrayPush(DOMPurify.removed,{attribute:attr||null,from:element});try{attr?removeAttributeNode(element,attr):element.removeAttribute(name)}catch(_){try{element.removeAttribute(name)}catch(_){}}if("is"===name)if(RETURN_DOM||RETURN_DOM_FRAGMENT)try{_forceRemove(element)}catch(_){}else try{element.setAttribute(name,"")}catch(_){}},_stripDisallowedAttributes=function _stripDisallowedAttributes(element){const attributes=getAttributes(element);if(attributes)for(let i=attributes.length-1;i>=0;--i){const attribute=attributes[i],name=attribute&&attribute.name;"string"!=typeof name||ALLOWED_ATTR[transformCaseFunc(name)]||_stripAttributeNode(element,attribute,name)}},_neutralizeSubtree=function _neutralizeSubtree(root){const stack=[root];for(;stack.length>0;){const node=stack.pop();_readNodeType(node)===NODE_TYPE_element&&_stripDisallowedAttributes(node);const childNodes=getChildNodes(node);if(childNodes)for(let i=childNodes.length-1;i>=0;--i)stack.push(childNodes[i])}},_isPatchLinkageAttribute=function _isPatchLinkageAttribute(lcName,lcTag){return!!SAFE_FOR_XML&&("patchsrc"===lcName||"for"===lcName&&"label"!==lcTag&&"output"!==lcTag)},_initDocument=function _initDocument(dirty){let doc=null,leadingWhitespace=null;if(FORCE_BODY)dirty="<remove></remove>"+dirty;else{const matches=stringMatch(dirty,/^[\r\n\t ]+/);leadingWhitespace=matches&&matches[0]}"application/xhtml+xml"===PARSER_MEDIA_TYPE&&NAMESPACE===HTML_NAMESPACE&&(dirty='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+dirty+"</body></html>");const dirtyPayload=trustedTypesPolicy?_createTrustedHTML(dirty):dirty;if(NAMESPACE===HTML_NAMESPACE)try{doc=(new DOMParser).parseFromString(dirtyPayload,PARSER_MEDIA_TYPE)}catch(_){}if(!doc||!doc.documentElement){doc=implementation.createDocument(NAMESPACE,"template",null);try{doc.documentElement.innerHTML=IS_EMPTY_INPUT?emptyHTML:dirtyPayload}catch(_){}}const body=doc.body||doc.documentElement;return dirty&&leadingWhitespace&&body.insertBefore(document.createTextNode(leadingWhitespace),body.childNodes[0]||null),NAMESPACE===HTML_NAMESPACE?getElementsByTagName.call(doc,WHOLE_DOCUMENT?"html":"body")[0]:WHOLE_DOCUMENT?doc.documentElement:body},_createNodeIterator=function _createNodeIterator(root){const doc=getOwnerDocument?getOwnerDocument(root):root.ownerDocument;return createNodeIterator.call(doc||root,root,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_PROCESSING_INSTRUCTION|NodeFilter.SHOW_CDATA_SECTION,null)},_stripTemplateExpressions=function _stripTemplateExpressions(value){return value=stringReplace(value,MUSTACHE_EXPR$1," "),value=stringReplace(value,ERB_EXPR$1," "),value=stringReplace(value,TMPLIT_EXPR$1," ")},_scrubTemplateExpressions2=function _scrubTemplateExpressions(node){var _node$querySelectorAl;node.normalize();const doc=getOwnerDocument?getOwnerDocument(node):node.ownerDocument,walker=createNodeIterator.call(doc||node,node,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_CDATA_SECTION|NodeFilter.SHOW_PROCESSING_INSTRUCTION,null);let currentNode=walker.nextNode();for(;currentNode;)currentNode.data=_stripTemplateExpressions(currentNode.data),currentNode=walker.nextNode();const templates=null===(_node$querySelectorAl=node.querySelectorAll)||void 0===_node$querySelectorAl?void 0:_node$querySelectorAl.call(node,"template");templates&&arrayForEach(templates,tmpl=>{_isDocumentFragment(tmpl.content)&&_scrubTemplateExpressions2(tmpl.content)})},_isClobbered=function _isClobbered(element){const realTagName=getNodeName?getNodeName(element):null;return"string"==typeof realTagName&&("form"===transformCaseFunc(realTagName)&&("string"!=typeof element.nodeName||"string"!=typeof element.textContent||"function"!=typeof element.removeChild||element.attributes!==getAttributes(element)||"function"!=typeof element.removeAttribute||"function"!=typeof element.removeAttributeNode||"function"!=typeof element.getAttributeNode||"function"!=typeof element.setAttribute||"string"!=typeof element.namespaceURI||"function"!=typeof element.insertBefore||"function"!=typeof element.hasChildNodes||element.nodeType!==getNodeType(element)||element.childNodes!==getChildNodes(element)))},_isDocumentFragment=function _isDocumentFragment(value){if(!getNodeType||"object"!=typeof value||null===value)return!1;try{return getNodeType(value)===NODE_TYPE_documentFragment}catch(_){return!1}},_isNode=function _isNode(value){if(!getNodeType||"object"!=typeof value||null===value)return!1;try{return"number"==typeof getNodeType(value)}catch(_){return!1}};function _executeHooks(hooks,currentNode,data){0!==hooks.length&&arrayForEach(hooks,hook=>{hook.call(DOMPurify,currentNode,data,CONFIG)})}const _matchesNameCheck=function _matchesNameCheck(check,name){if(check instanceof RegExp)return regExpTest(check,name);if(check instanceof Function){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++)args[_key-2]=arguments[_key];return Boolean(check(name,...args))}return!1},_forkSharedAllowlist=function _forkSharedAllowlist(hookList,set,defaultSet,setConfigSet){return 0===hookList.length?set:set===defaultSet||set===setConfigSet?clone(set):set},_handleHookDetachedNode=function _handleHookDetachedNode(currentNode,root){return currentNode!==root&&null===getParentNode(currentNode)&&(IN_PLACE&&_neutralizeSubtree(currentNode),!0)},_sanitizeElements=function _sanitizeElements(currentNode,root){if(_executeHooks(hooks.beforeSanitizeElements,currentNode,null),_handleHookDetachedNode(currentNode,root))return!0;if(_isClobbered(currentNode))return _forceRemove(currentNode),!0;const tagName=transformCaseFunc(_readNodeName(currentNode));if(ALLOWED_TAGS=_forkSharedAllowlist(hooks.uponSanitizeElement,ALLOWED_TAGS,DEFAULT_ALLOWED_TAGS,SET_CONFIG_ALLOWED_TAGS),_executeHooks(hooks.uponSanitizeElement,currentNode,{tagName,allowedTags:ALLOWED_TAGS}),_handleHookDetachedNode(currentNode,root))return!0;if(function _isUnsafeNode(currentNode,tagName){return!!(SAFE_FOR_XML&&currentNode.hasChildNodes()&&!_isNode(currentNode.firstElementChild)&&regExpTest(ELEMENT_MARKUP_PROBE,currentNode.textContent)&&regExpTest(ELEMENT_MARKUP_PROBE,currentNode.innerHTML))||!!(SAFE_FOR_XML&&currentNode.namespaceURI===HTML_NAMESPACE&&LITERAL_TEXT_ELEMENTS[tagName]&&(_isNode(currentNode.firstElementChild)||"string"==typeof currentNode.textContent&&regExpTest(LITERAL_TEXT_CLOSE[tagName],currentNode.textContent)))||currentNode.nodeType===NODE_TYPE_processingInstruction||!(!SAFE_FOR_XML||currentNode.nodeType!==NODE_TYPE_comment||!regExpTest(COMMENT_MARKUP_PROBE,currentNode.data))}(currentNode,tagName))return _forceRemove(currentNode),!0;if(FORBID_TAGS[tagName]||!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function&&EXTRA_ELEMENT_HANDLING.tagCheck(tagName))&&!ALLOWED_TAGS[tagName]){const removed=function _sanitizeDisallowedNode(currentNode,tagName,root){if(!FORBID_TAGS[tagName]&&_isBasicCustomElement(tagName)&&_matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck,tagName))return!1;if(KEEP_CONTENT&&!FORBID_CONTENTS[tagName]){const parentNode=getParentNode(currentNode),childNodes=getChildNodes(currentNode);if(childNodes&&parentNode)for(let i=childNodes.length-1;i>=0;--i){const hoisted=currentNode===root?cloneNode(childNodes[i],!0):childNodes[i];parentNode.insertBefore(hoisted,getNextSibling(currentNode))}}return _forceRemove(currentNode),!0}(currentNode,tagName,root);return!1===removed&&_executeHooks(hooks.afterSanitizeElements,currentNode,null),removed}if(_readNodeType(currentNode)===NODE_TYPE_element&&!_checkValidNamespace(currentNode))return _forceRemove(currentNode),!0;if(("noscript"===tagName||"noembed"===tagName||"noframes"===tagName)&&regExpTest(FALLBACK_TAG_CLOSE,currentNode.innerHTML))return _forceRemove(currentNode),!0;if(SAFE_FOR_TEMPLATES&&currentNode.nodeType===NODE_TYPE_text){const content=_stripTemplateExpressions(currentNode.textContent);currentNode.textContent!==content&&(arrayPush(DOMPurify.removed,{element:currentNode.cloneNode()}),currentNode.textContent=content)}return _executeHooks(hooks.afterSanitizeElements,currentNode,null),!1},_isValidAttribute=function _isValidAttribute(lcTag,lcName,value){if(FORBID_ATTR[lcName])return!1;if(_isPatchLinkageAttribute(lcName,lcTag))return!1;if(SANITIZE_DOM&&("id"===lcName||"name"===lcName)&&(value in document||value in formElement))return!1;const nameIsPermitted=ALLOWED_ATTR[lcName]||EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function&&EXTRA_ELEMENT_HANDLING.attributeCheck(lcName,lcTag);return!(!ALLOW_DATA_ATTR||!regExpTest(DATA_ATTR$1,lcName))||(!(!ALLOW_ARIA_ATTR||!regExpTest(ARIA_ATTR$1,lcName))||(nameIsPermitted?!!URI_SAFE_ATTRIBUTES[lcName]||(!!regExpTest(IS_ALLOWED_URI$1,stringReplace(value,ATTR_WHITESPACE$1,""))||(!("src"!==lcName&&"xlink:href"!==lcName&&"href"!==lcName||"script"===lcTag||0!==stringIndexOf(value,"data:")||!DATA_URI_TAGS[lcTag])||(!(!ALLOW_UNKNOWN_PROTOCOLS||regExpTest(IS_SCRIPT_OR_DATA$1,stringReplace(value,ATTR_WHITESPACE$1,"")))||!value))):_isBasicCustomElement(lcTag)&&_matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck,lcTag)&&_matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck,lcName,lcTag)||"is"===lcName&&CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&_matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck,value)))},RESERVED_CUSTOM_ELEMENT_NAMES=addToSet({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),_isBasicCustomElement=function _isBasicCustomElement(tagName){return!RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)]&&regExpTest(CUSTOM_ELEMENT$1,tagName)},_applyTrustedTypesToAttribute=function _applyTrustedTypesToAttribute(lcTag,lcName,namespaceURI,value){if(trustedTypesPolicy&&"object"==typeof trustedTypes&&"function"==typeof trustedTypes.getAttributeType&&!namespaceURI)switch(trustedTypes.getAttributeType(lcTag,lcName)){case"TrustedHTML":return _createTrustedHTML(value);case"TrustedScriptURL":return function _createTrustedScriptURL(scriptUrl){_assertNotInTrustedTypesPolicy(),IN_TRUSTED_TYPES_POLICY++;try{return trustedTypesPolicy.createScriptURL(scriptUrl)}finally{IN_TRUSTED_TYPES_POLICY--}}(value)}return value},_setAttributeValue=function _setAttributeValue(currentNode,name,namespaceURI,value){try{return namespaceURI?currentNode.setAttributeNS(namespaceURI,name,value):currentNode.setAttribute(name,value),!_isClobbered(currentNode)||(_forceRemove(currentNode),!1)}catch(_){return _removeAttribute(name,currentNode),!1}},_sanitizeAttributes=function _sanitizeAttributes(currentNode){_executeHooks(hooks.beforeSanitizeAttributes,currentNode,null);const attributes=currentNode.attributes;if(!attributes||_isClobbered(currentNode))return;ALLOWED_ATTR=_forkSharedAllowlist(hooks.uponSanitizeAttribute,ALLOWED_ATTR,DEFAULT_ALLOWED_ATTR,SET_CONFIG_ALLOWED_ATTR);const hookEvent={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ALLOWED_ATTR,forceKeepAttr:void 0};let l=attributes.length;const lcTag=transformCaseFunc(currentNode.nodeName);for(;l--;){const attr=attributes[l],name=attr.name,namespaceURI=attr.namespaceURI,attrValue=attr.value,lcName=transformCaseFunc(name),initValue=attrValue;let value="value"===name?initValue:stringTrim(initValue),recreatedNamedProp=!1;if(hookEvent.attrName=lcName,hookEvent.attrValue=value,hookEvent.keepAttr=!0,hookEvent.forceKeepAttr=void 0,_executeHooks(hooks.uponSanitizeAttribute,currentNode,hookEvent),value=hookEvent.attrValue,!SANITIZE_NAMED_PROPS||"id"!==lcName&&"name"!==lcName||0===stringIndexOf(value,"user-content-")||(_removeAttribute(name,currentNode,attr),value="user-content-"+value,recreatedNamedProp=!0),SAFE_FOR_XML&&regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,value))_removeAttribute(name,currentNode,attr);else if("attributename"===lcName&&stringMatch(value,"href"))_removeAttribute(name,currentNode,attr);else if(!hookEvent.forceKeepAttr)if(hookEvent.keepAttr)if(ALLOW_SELF_CLOSE_IN_ATTR||!regExpTest(SELF_CLOSING_TAG,value))if(SAFE_FOR_TEMPLATES&&(value=_stripTemplateExpressions(value)),_isValidAttribute(lcTag,lcName,value)){if(value=_applyTrustedTypesToAttribute(lcTag,lcName,namespaceURI,value),value!==initValue){_setAttributeValue(currentNode,name,namespaceURI,value)&&recreatedNamedProp&&arrayPop(DOMPurify.removed)}}else _removeAttribute(name,currentNode,attr);else _removeAttribute(name,currentNode,attr);else _removeAttribute(name,currentNode,attr)}_executeHooks(hooks.afterSanitizeAttributes,currentNode,null)},_sanitizeShadowDOM2=function _sanitizeShadowDOM(fragment){let shadowNode=null;const shadowIterator=_createNodeIterator(fragment);for(_executeHooks(hooks.beforeSanitizeShadowDOM,fragment,null);shadowNode=shadowIterator.nextNode();)if(_executeHooks(hooks.uponSanitizeShadowNode,shadowNode,null),_sanitizeElements(shadowNode,fragment),_sanitizeAttributes(shadowNode),_isDocumentFragment(shadowNode.content)&&_sanitizeShadowDOM2(shadowNode.content),_readNodeType(shadowNode)===NODE_TYPE_element){const innerSr=getShadowRoot(shadowNode);_isDocumentFragment(innerSr)&&(_sanitizeAttachedShadowRoots(innerSr),_sanitizeShadowDOM2(innerSr))}_executeHooks(hooks.afterSanitizeShadowDOM,fragment,null)},_sanitizeAttachedShadowRoots=function _sanitizeAttachedShadowRoots(root){const stack=[{node:root,shadow:null}];for(;stack.length>0;){const item=stack.pop();if(item.shadow){_sanitizeShadowDOM2(item.shadow);continue}const node=item.node,isElement=_readNodeType(node)===NODE_TYPE_element,childNodes=getChildNodes(node);if(childNodes)for(let i=childNodes.length-1;i>=0;--i)stack.push({node:childNodes[i],shadow:null});if(isElement){const rootName=getNodeName?getNodeName(node):null;if("string"==typeof rootName&&"template"===transformCaseFunc(rootName)){const content=node.content;_isDocumentFragment(content)&&stack.push({node:content,shadow:null})}}if(isElement){const sr=getShadowRoot(node);_isDocumentFragment(sr)&&stack.push({node:null,shadow:sr},{node:sr,shadow:null})}}};return DOMPurify.sanitize=function(dirty){let cfg=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},body=null,importedNode=null,currentNode=null,returnNode=null;if(IS_EMPTY_INPUT=!dirty,IS_EMPTY_INPUT&&(dirty="\x3c!--\x3e"),"string"!=typeof dirty&&!_isNode(dirty)&&"string"!=typeof(dirty=function stringifyValue(value){switch(typeof value){case"string":return value;case"number":return numberToString(value);case"boolean":return booleanToString(value);case"bigint":return bigintToString?bigintToString(value):"0";case"symbol":return symbolToString?symbolToString(value):"Symbol()";case"undefined":default:return objectToString(value);case"function":case"object":{if(null===value)return objectToString(value);const valueAsRecord=value,valueToString=lookupGetter(valueAsRecord,"toString");if("function"==typeof valueToString){const stringified=valueToString(valueAsRecord);return"string"==typeof stringified?stringified:objectToString(stringified)}return objectToString(value)}}}(dirty)))throw typeErrorCreate("dirty is not a string, aborting");if(!DOMPurify.isSupported)return dirty;SET_CONFIG?(ALLOWED_TAGS=SET_CONFIG_ALLOWED_TAGS,ALLOWED_ATTR=SET_CONFIG_ALLOWED_ATTR):_parseConfig(cfg),(hooks.uponSanitizeElement.length>0||hooks.uponSanitizeAttribute.length>0)&&(ALLOWED_TAGS=clone(ALLOWED_TAGS)),hooks.uponSanitizeAttribute.length>0&&(ALLOWED_ATTR=clone(ALLOWED_ATTR)),DOMPurify.removed=[];const inPlace=IN_PLACE&&"string"!=typeof dirty&&_isNode(dirty);if(inPlace){!function _neutralizePatchLinkage(root){if(!SAFE_FOR_XML)return;const stack=[root];for(;stack.length>0;){const node=stack.pop(),nodeType=_readNodeType(node);if(nodeType===NODE_TYPE_processingInstruction||nodeType===NODE_TYPE_comment&&regExpTest(COMMENT_MARKUP_PROBE,node.data)){try{remove(node)}catch(_){}continue}if(nodeType===NODE_TYPE_element){const element=node,lcTag=transformCaseFunc(_readNodeName(node));try{element.hasAttribute&&element.hasAttribute("patchsrc")&&element.removeAttribute("patchsrc"),element.hasAttribute&&element.hasAttribute("for")&&_isPatchLinkageAttribute("for",lcTag)&&element.removeAttribute("for")}catch(_){}}const childNodes=getChildNodes(node);if(childNodes)for(let i=childNodes.length-1;i>=0;--i)stack.push(childNodes[i])}}(dirty);const nn=_readNodeName(dirty);if("string"==typeof nn){const tagName=transformCaseFunc(nn);if(!ALLOWED_TAGS[tagName]||FORBID_TAGS[tagName])throw _neutralizeRoot(dirty),typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}if(_isClobbered(dirty))throw _neutralizeRoot(dirty),typeErrorCreate("root node is clobbered and cannot be sanitized in-place");try{_sanitizeAttachedShadowRoots(dirty)}catch(error){throw _neutralizeRoot(dirty),error}}else if(_isNode(dirty))body=_initDocument("\x3c!----\x3e"),importedNode=body.ownerDocument.importNode(dirty,!0),importedNode.nodeType===NODE_TYPE_element&&"BODY"===importedNode.nodeName||"HTML"===importedNode.nodeName?body=importedNode:body.appendChild(importedNode),_sanitizeAttachedShadowRoots(body);else{if(!RETURN_DOM&&!SAFE_FOR_TEMPLATES&&!WHOLE_DOCUMENT&&-1===dirty.indexOf("<"))return trustedTypesPolicy&&RETURN_TRUSTED_TYPE?_createTrustedHTML(dirty):dirty;if(body=_initDocument(dirty),!body)return RETURN_DOM?null:RETURN_TRUSTED_TYPE?emptyHTML:""}body&&FORCE_BODY&&_forceRemove(body.firstChild);const walkRoot=inPlace?dirty:body;try{const nodeIterator=_createNodeIterator(walkRoot);for(;currentNode=nodeIterator.nextNode();)_sanitizeElements(currentNode,walkRoot),_sanitizeAttributes(currentNode),_isDocumentFragment(currentNode.content)&&_sanitizeShadowDOM2(currentNode.content)}catch(error){throw inPlace&&(_neutralizeRoot(dirty),arrayForEach(DOMPurify.removed,entry=>{entry.element&&_neutralizeSubtree(entry.element)})),error}if(inPlace)return arrayForEach(DOMPurify.removed,entry=>{entry.element&&_neutralizeSubtree(entry.element)}),SAFE_FOR_TEMPLATES&&_scrubTemplateExpressions2(dirty),dirty;if(RETURN_DOM){if(SAFE_FOR_TEMPLATES&&_scrubTemplateExpressions2(body),RETURN_DOM_FRAGMENT)for(returnNode=createDocumentFragment.call(body.ownerDocument);body.firstChild;)returnNode.appendChild(body.firstChild);else returnNode=body;return(ALLOWED_ATTR.shadowroot||ALLOWED_ATTR.shadowrootmode)&&(returnNode=importNode.call(originalDocument,returnNode,!0)),returnNode}let serializedHTML=WHOLE_DOCUMENT?body.outerHTML:body.innerHTML;return WHOLE_DOCUMENT&&ALLOWED_TAGS["!doctype"]&&body.ownerDocument&&body.ownerDocument.doctype&&body.ownerDocument.doctype.name&&regExpTest(DOCTYPE_NAME,body.ownerDocument.doctype.name)&&(serializedHTML="<!DOCTYPE "+body.ownerDocument.doctype.name+">\n"+serializedHTML),SAFE_FOR_TEMPLATES&&(serializedHTML=_stripTemplateExpressions(serializedHTML)),trustedTypesPolicy&&RETURN_TRUSTED_TYPE?_createTrustedHTML(serializedHTML):serializedHTML},DOMPurify.setConfig=function(){_parseConfig(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),SET_CONFIG=!0,SET_CONFIG_ALLOWED_TAGS=ALLOWED_TAGS,SET_CONFIG_ALLOWED_ATTR=ALLOWED_ATTR},DOMPurify.clearConfig=function(){CONFIG=null,SET_CONFIG=!1,SET_CONFIG_ALLOWED_TAGS=null,SET_CONFIG_ALLOWED_ATTR=null,trustedTypesPolicy=defaultTrustedTypesPolicy,emptyHTML=""},DOMPurify.isValidAttribute=function(tag,attr,value){CONFIG||_parseConfig({});const lcTag=transformCaseFunc(tag),lcName=transformCaseFunc(attr);return _isValidAttribute(lcTag,lcName,value)},DOMPurify.addHook=function(entryPoint,hookFunction){"function"==typeof hookFunction&&objectHasOwnProperty(hooks,entryPoint)&&arrayPush(hooks[entryPoint],hookFunction)},DOMPurify.removeHook=function(entryPoint,hookFunction){if(objectHasOwnProperty(hooks,entryPoint)){if(void 0!==hookFunction){const index=arrayLastIndexOf(hooks[entryPoint],hookFunction);return-1===index?void 0:arraySplice(hooks[entryPoint],index,1)[0]}return arrayPop(hooks[entryPoint])}},DOMPurify.removeHooks=function(entryPoint){objectHasOwnProperty(hooks,entryPoint)&&(hooks[entryPoint]=[])},DOMPurify.removeAllHooks=function(){hooks={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},DOMPurify}();module.exports=purify},"./node_modules/linkifyjs/dist/linkify.mjs"(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{MultiToken:()=>MultiToken,Options:()=>Options,State:()=>State,createTokenClass:()=>createTokenClass,find:()=>find,init:()=>init,multi:()=>multi,options:()=>options,regexp:()=>regexp,registerCustomProtocol:()=>registerCustomProtocol,registerPlugin:()=>registerPlugin,registerTokenPlugin:()=>registerTokenPlugin,reset:()=>reset,stringToArray:()=>stringToArray,test:()=>test,text:()=>multi,tokenize:()=>tokenize});const numeric="numeric",ascii="ascii",alpha="alpha",asciinumeric="asciinumeric",alphanumeric="alphanumeric",emoji="emoji",scheme="scheme",slashscheme="slashscheme",whitespace="whitespace";function registerGroup(name,groups){return name in groups||(groups[name]=[]),groups[name]}function addToGroups(t,flags,groups){flags.numeric&&(flags.asciinumeric=!0,flags.alphanumeric=!0),flags.ascii&&(flags.asciinumeric=!0,flags.alpha=!0),flags.asciinumeric&&(flags.alphanumeric=!0),flags.alpha&&(flags.alphanumeric=!0),flags.alphanumeric&&(flags.domain=!0),flags.emoji&&(flags.domain=!0);for(const k in flags){const group=registerGroup(k,groups);group.indexOf(t)<0&&group.push(t)}}function State(token=null){this.j={},this.jr=[],this.jd=null,this.t=token}State.groups={},State.prototype={accepts(){return!!this.t},go(input){const state=this,nextState=state.j[input];if(nextState)return nextState;for(let i=0;i<state.jr.length;i++){const regex=state.jr[i][0],nextState=state.jr[i][1];if(nextState&&regex.test(input))return nextState}return state.jd},has(input,exactOnly=!1){return exactOnly?input in this.j:!!this.go(input)},ta(inputs,next,flags,groups){for(let i=0;i<inputs.length;i++)this.tt(inputs[i],next,flags,groups)},tr(regexp,next,flags,groups){let nextState;return groups=groups||State.groups,next&&next.j?nextState=next:(nextState=new State(next),flags&&groups&&addToGroups(next,flags,groups)),this.jr.push([regexp,nextState]),nextState},ts(input,next,flags,groups){let state=this;const len=input.length;if(!len)return state;for(let i=0;i<len-1;i++)state=state.tt(input[i]);return state.tt(input[len-1],next,flags,groups)},tt(input,next,flags,groups){groups=groups||State.groups;const state=this;if(next&&next.j)return state.j[input]=next,next;const t=next;let nextState,templateState=state.go(input);if(templateState?(nextState=new State,Object.assign(nextState.j,templateState.j),nextState.jr.push.apply(nextState.jr,templateState.jr),nextState.jd=templateState.jd,nextState.t=templateState.t):nextState=new State,t){if(groups)if(nextState.t&&"string"==typeof nextState.t){const allFlags=Object.assign(function flagsForToken(t,groups){const result={};for(const c in groups)groups[c].indexOf(t)>=0&&(result[c]=!0);return result}(nextState.t,groups),flags);addToGroups(t,allFlags,groups)}else flags&&addToGroups(t,flags,groups);nextState.t=t}return state.j[input]=nextState,nextState}};const ta=(state,input,next,flags,groups)=>state.ta(input,next,flags,groups),tr=(state,regexp,next,flags,groups)=>state.tr(regexp,next,flags,groups),ts=(state,input,next,flags,groups)=>state.ts(input,next,flags,groups),tt=(state,input,next,flags,groups)=>state.tt(input,next,flags,groups),WORD="WORD",AT="AT",DOT="DOT",HYPHEN="HYPHEN",SLASH="SLASH";var tk=Object.freeze({__proto__:null,ALPHANUMERICAL:"ALPHANUMERICAL",AMPERSAND:"AMPERSAND",APOSTROPHE:"APOSTROPHE",ASCIINUMERICAL:"ASCIINUMERICAL",ASTERISK:"ASTERISK",AT,BACKSLASH:"BACKSLASH",BACKTICK:"BACKTICK",CARET:"CARET",CLOSEANGLEBRACKET:"CLOSEANGLEBRACKET",CLOSEBRACE:"CLOSEBRACE",CLOSEBRACKET:"CLOSEBRACKET",CLOSEPAREN:"CLOSEPAREN",COLON:"COLON",COMMA:"COMMA",DOLLAR:"DOLLAR",DOT,EMOJI:"EMOJI",EQUALS:"EQUALS",EXCLAMATION:"EXCLAMATION",FULLWIDTHGREATERTHAN:"FULLWIDTHGREATERTHAN",FULLWIDTHLEFTPAREN:"FULLWIDTHLEFTPAREN",FULLWIDTHLESSTHAN:"FULLWIDTHLESSTHAN",FULLWIDTHMIDDLEDOT:"FULLWIDTHMIDDLEDOT",FULLWIDTHRIGHTPAREN:"FULLWIDTHRIGHTPAREN",HYPHEN,LEFTCORNERBRACKET:"LEFTCORNERBRACKET",LEFTWHITECORNERBRACKET:"LEFTWHITECORNERBRACKET",LOCALHOST:"LOCALHOST",NL:"NL",NUM:"NUM",OPENANGLEBRACKET:"OPENANGLEBRACKET",OPENBRACE:"OPENBRACE",OPENBRACKET:"OPENBRACKET",OPENPAREN:"OPENPAREN",PERCENT:"PERCENT",PIPE:"PIPE",PLUS:"PLUS",POUND:"POUND",QUERY:"QUERY",QUOTE:"QUOTE",RIGHTCORNERBRACKET:"RIGHTCORNERBRACKET",RIGHTWHITECORNERBRACKET:"RIGHTWHITECORNERBRACKET",SCHEME:"SCHEME",SEMI:"SEMI",SLASH,SLASH_SCHEME:"SLASH_SCHEME",SYM:"SYM",TILDE:"TILDE",TLD:"TLD",UNDERSCORE:"UNDERSCORE",UTLD:"UTLD",UWORD:"UWORD",WORD,WS:"WS"});const ASCII_LETTER=/[a-z]/,LETTER=/\p{L}/u,EMOJI=/\p{Emoji}/u,DIGIT=/\d/,SPACE=/\s/;var regexp=Object.freeze({__proto__:null,ASCII_LETTER,DIGIT,EMOJI,EMOJI_VARIATION:/\ufe0f/,LETTER,SPACE});let tlds=null,utlds=null;function run$1(start,str){const iterable=stringToArray(str.replace(/[A-Z]/g,c=>c.toLowerCase())),charCount=iterable.length,tokens=[];let cursor=0,charCursor=0;for(;charCursor<charCount;){let state=start,nextState=null,tokenLength=0,latestAccepting=null,sinceAccepts=-1,charsSinceAccepts=-1;for(;charCursor<charCount&&(nextState=state.go(iterable[charCursor]));)state=nextState,state.accepts()?(sinceAccepts=0,charsSinceAccepts=0,latestAccepting=state):sinceAccepts>=0&&(sinceAccepts+=iterable[charCursor].length,charsSinceAccepts++),tokenLength+=iterable[charCursor].length,cursor+=iterable[charCursor].length,charCursor++;cursor-=sinceAccepts,charCursor-=charsSinceAccepts,tokenLength-=sinceAccepts,tokens.push({t:latestAccepting.t,v:str.slice(cursor-tokenLength,cursor),s:cursor-tokenLength,e:cursor})}return tokens}function stringToArray(str){const result=[],len=str.length;let index=0;for(;index<len;){let second,first=str.charCodeAt(index),char=first<55296||first>56319||index+1===len||(second=str.charCodeAt(index+1))<56320||second>57343?str[index]:str.slice(index,index+2);result.push(char),index+=char.length}return result}function fastts(state,input,t,defaultt,jr){let next;const len=input.length;for(let i=0;i<len-1;i++){const char=input[i];state.j[char]?next=state.j[char]:(next=new State(defaultt),next.jr=jr.slice(),state.j[char]=next),state=next}return next=new State(t),next.jr=jr.slice(),state.j[input[len-1]]=next,next}function decodeTlds(encoded){const words=[],stack=[];let i=0;for(;i<encoded.length;){let popDigitCount=0;for(;"0123456789".indexOf(encoded[i+popDigitCount])>=0;)popDigitCount++;if(popDigitCount>0){words.push(stack.join(""));for(let popCount=parseInt(encoded.substring(i,i+popDigitCount),10);popCount>0;popCount--)stack.pop();i+=popDigitCount}else stack.push(encoded[i]),i++}return words}const defaults={defaultProtocol:"http",events:null,format:noop,formatHref:noop,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Options(opts,defaultRender=null){let o=Object.assign({},defaults);opts&&(o=Object.assign(o,opts instanceof Options?opts.o:opts));const ignoredTags=o.ignoreTags,uppercaseIgnoredTags=[];for(let i=0;i<ignoredTags.length;i++)uppercaseIgnoredTags.push(ignoredTags[i].toUpperCase());this.o=o,defaultRender&&(this.defaultRender=defaultRender),this.ignoreTags=uppercaseIgnoredTags}function noop(val){return val}Options.prototype={o:defaults,ignoreTags:[],defaultRender:ir=>ir,check(token){return this.get("validate",token.toString(),token)},get(key,operator,token){const isCallable=null!=operator;let option=this.o[key];return option?("object"==typeof option?(option=token.t in option?option[token.t]:defaults[key],"function"==typeof option&&isCallable&&(option=option(operator,token))):"function"==typeof option&&isCallable&&(option=option(operator,token.t,token)),option):option},getObj(key,operator,token){let obj=this.o[key];return"function"==typeof obj&&null!=operator&&(obj=obj(operator,token.t,token)),obj},render(token){const ir=token.render(this);return(this.get("render",null,token)||this.defaultRender)(ir,token.t,token)}};var options=Object.freeze({__proto__:null,Options,defaults});function MultiToken(value,tokens){this.t="token",this.v=value,this.tk=tokens}function createTokenClass(type,props){class Token extends MultiToken{constructor(value,tokens){super(value,tokens),this.t=type}}for(const p in props)Token.prototype[p]=props[p];return Token.t=type,Token}MultiToken.prototype={isLink:!1,toString(){return this.v},toHref(scheme){return this.toString()},toFormattedString(options){const val=this.toString(),truncate=options.get("truncate",val,this),formatted=options.get("format",val,this);return truncate&&formatted.length>truncate?formatted.substring(0,truncate)+"…":formatted},toFormattedHref(options){return options.get("formatHref",this.toHref(options.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(protocol=defaults.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(protocol),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(options){return{type:this.t,value:this.toFormattedString(options),isLink:this.isLink,href:this.toFormattedHref(options),start:this.startIndex(),end:this.endIndex()}},validate(options){return options.get("validate",this.toString(),this)},render(options){const href=this.toHref(options.get("defaultProtocol")),formattedHref=options.get("formatHref",href,this),tagName=options.get("tagName",href,this),content=this.toFormattedString(options),attributes={},className=options.get("className",href,this),target=options.get("target",href,this),rel=options.get("rel",href,this),attrs=options.getObj("attributes",href,this),eventListeners=options.getObj("events",href,this);return attributes.href=formattedHref,className&&(attributes.class=className),target&&(attributes.target=target),rel&&(attributes.rel=rel),attrs&&Object.assign(attributes,attrs),{tagName,attributes,content,eventListeners}}};const Email=createTokenClass("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Text=createTokenClass("text"),Nl=createTokenClass("nl"),Url=createTokenClass("url",{isLink:!0,toHref(scheme=defaults.defaultProtocol){return this.hasProtocol()?this.v:`${scheme}://${this.v}`},hasProtocol(){const tokens=this.tk;return tokens.length>=2&&"LOCALHOST"!==tokens[0].t&&"COLON"===tokens[1].t}});var multi=Object.freeze({__proto__:null,Base:MultiToken,Email,MultiToken,Nl,Text,Url,createTokenClass});const makeState=arg=>new State(arg);function initMultiToken(Multi,input,tokens){const startIdx=tokens[0].s,endIdx=tokens[tokens.length-1].e;return new Multi(input.slice(startIdx,endIdx),tokens)}const warn="undefined"!=typeof console&&console&&console.warn||(()=>{}),warnAdvice="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",INIT={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function reset(){return State.groups={},INIT.scanner=null,INIT.parser=null,INIT.tokenQueue=[],INIT.pluginQueue=[],INIT.customSchemes=[],INIT.initialized=!1,INIT}function registerTokenPlugin(name,plugin){if("function"!=typeof plugin)throw new Error(`linkifyjs: Invalid token plugin ${plugin} (expects function)`);for(let i=0;i<INIT.tokenQueue.length;i++)if(name===INIT.tokenQueue[i][0])return warn(`linkifyjs: token plugin "${name}" already registered - will be overwritten`),void(INIT.tokenQueue[i]=[name,plugin]);INIT.tokenQueue.push([name,plugin]),INIT.initialized&&warn(`linkifyjs: already initialized - will not register token plugin "${name}" ${warnAdvice}`)}function registerPlugin(name,plugin){if("function"!=typeof plugin)throw new Error(`linkifyjs: Invalid plugin ${plugin} (expects function)`);for(let i=0;i<INIT.pluginQueue.length;i++)if(name===INIT.pluginQueue[i][0])return warn(`linkifyjs: plugin "${name}" already registered - will be overwritten`),void(INIT.pluginQueue[i]=[name,plugin]);INIT.pluginQueue.push([name,plugin]),INIT.initialized&&warn(`linkifyjs: already initialized - will not register plugin "${name}" ${warnAdvice}`)}function registerCustomProtocol(scheme,optionalSlashSlash=!1){if(INIT.initialized&&warn(`linkifyjs: already initialized - will not register custom scheme "${scheme}" ${warnAdvice}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(scheme))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');INIT.customSchemes.push([scheme,optionalSlashSlash])}function init(){INIT.scanner=function init$2(customSchemes=[]){const groups={};State.groups=groups;const Start=new State;null==tlds&&(tlds=decodeTlds("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==utlds&&(utlds=decodeTlds("ελ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")),tt(Start,"'","APOSTROPHE"),tt(Start,"{","OPENBRACE"),tt(Start,"}","CLOSEBRACE"),tt(Start,"[","OPENBRACKET"),tt(Start,"]","CLOSEBRACKET"),tt(Start,"(","OPENPAREN"),tt(Start,")","CLOSEPAREN"),tt(Start,"<","OPENANGLEBRACKET"),tt(Start,">","CLOSEANGLEBRACKET"),tt(Start,"(","FULLWIDTHLEFTPAREN"),tt(Start,")","FULLWIDTHRIGHTPAREN"),tt(Start,"「","LEFTCORNERBRACKET"),tt(Start,"」","RIGHTCORNERBRACKET"),tt(Start,"『","LEFTWHITECORNERBRACKET"),tt(Start,"』","RIGHTWHITECORNERBRACKET"),tt(Start,"<","FULLWIDTHLESSTHAN"),tt(Start,">","FULLWIDTHGREATERTHAN"),tt(Start,"&","AMPERSAND"),tt(Start,"*","ASTERISK"),tt(Start,"@",AT),tt(Start,"`","BACKTICK"),tt(Start,"^","CARET"),tt(Start,":","COLON"),tt(Start,",","COMMA"),tt(Start,"$","DOLLAR"),tt(Start,".",DOT),tt(Start,"=","EQUALS"),tt(Start,"!","EXCLAMATION"),tt(Start,"-",HYPHEN),tt(Start,"%","PERCENT"),tt(Start,"|","PIPE"),tt(Start,"+","PLUS"),tt(Start,"#","POUND"),tt(Start,"?","QUERY"),tt(Start,'"',"QUOTE"),tt(Start,"/",SLASH),tt(Start,";","SEMI"),tt(Start,"~","TILDE"),tt(Start,"_","UNDERSCORE"),tt(Start,"\\","BACKSLASH"),tt(Start,"・","FULLWIDTHMIDDLEDOT");const Num=tr(Start,DIGIT,"NUM",{[numeric]:!0});tr(Num,DIGIT,Num);const Asciinumeric=tr(Num,ASCII_LETTER,"ASCIINUMERICAL",{[asciinumeric]:!0}),Alphanumeric=tr(Num,LETTER,"ALPHANUMERICAL",{[alphanumeric]:!0}),Word=tr(Start,ASCII_LETTER,WORD,{[ascii]:!0});tr(Word,DIGIT,Asciinumeric),tr(Word,ASCII_LETTER,Word),tr(Asciinumeric,DIGIT,Asciinumeric),tr(Asciinumeric,ASCII_LETTER,Asciinumeric);const UWord=tr(Start,LETTER,"UWORD",{[alpha]:!0});tr(UWord,ASCII_LETTER),tr(UWord,DIGIT,Alphanumeric),tr(UWord,LETTER,UWord),tr(Alphanumeric,DIGIT,Alphanumeric),tr(Alphanumeric,ASCII_LETTER),tr(Alphanumeric,LETTER,Alphanumeric);const Nl=tt(Start,"\n","NL",{[whitespace]:!0}),Cr=tt(Start,"\r","WS",{[whitespace]:!0}),Ws=tr(Start,SPACE,"WS",{[whitespace]:!0});tt(Start,"",Ws),tt(Cr,"\n",Nl),tt(Cr,"",Ws),tr(Cr,SPACE,Ws),tt(Ws,"\r"),tt(Ws,"\n"),tr(Ws,SPACE,Ws),tt(Ws,"",Ws);const Emoji=tr(Start,EMOJI,"EMOJI",{[emoji]:!0});tt(Emoji,"#"),tr(Emoji,EMOJI,Emoji),tt(Emoji,"️",Emoji);const EmojiJoiner=tt(Emoji,"‍");tt(EmojiJoiner,"#"),tr(EmojiJoiner,EMOJI,Emoji);const wordjr=[[ASCII_LETTER,Word],[DIGIT,Asciinumeric]],uwordjr=[[ASCII_LETTER,null],[LETTER,UWord],[DIGIT,Alphanumeric]];for(let i=0;i<tlds.length;i++)fastts(Start,tlds[i],"TLD",WORD,wordjr);for(let i=0;i<utlds.length;i++)fastts(Start,utlds[i],"UTLD","UWORD",uwordjr);addToGroups("TLD",{tld:!0,ascii:!0},groups),addToGroups("UTLD",{utld:!0,alpha:!0},groups),fastts(Start,"file","SCHEME",WORD,wordjr),fastts(Start,"mailto","SCHEME",WORD,wordjr),fastts(Start,"http","SLASH_SCHEME",WORD,wordjr),fastts(Start,"https","SLASH_SCHEME",WORD,wordjr),fastts(Start,"ftp","SLASH_SCHEME",WORD,wordjr),fastts(Start,"ftps","SLASH_SCHEME",WORD,wordjr),addToGroups("SCHEME",{scheme:!0,ascii:!0},groups),addToGroups("SLASH_SCHEME",{slashscheme:!0,ascii:!0},groups),customSchemes=customSchemes.sort((a,b)=>a[0]>b[0]?1:-1);for(let i=0;i<customSchemes.length;i++){const sch=customSchemes[i][0],flags=customSchemes[i][1]?{[scheme]:!0}:{[slashscheme]:!0};sch.indexOf("-")>=0?flags.domain=!0:ASCII_LETTER.test(sch)?DIGIT.test(sch)?flags.asciinumeric=!0:flags.ascii=!0:flags.numeric=!0,ts(Start,sch,sch,flags)}return ts(Start,"localhost","LOCALHOST",{ascii:!0}),Start.jd=new State("SYM"),{start:Start,tokens:Object.assign({groups},tk)}}(INIT.customSchemes);for(let i=0;i<INIT.tokenQueue.length;i++)INIT.tokenQueue[i][1]({scanner:INIT.scanner});INIT.parser=function init$1({groups}){const qsAccepting=groups.domain.concat(["AMPERSAND","ASTERISK",AT,"BACKSLASH","BACKTICK","CARET","DOLLAR","EQUALS",HYPHEN,"NUM","PERCENT","PIPE","PLUS","POUND",SLASH,"SYM","TILDE","UNDERSCORE"]),qsNonAccepting=["APOSTROPHE","COLON","COMMA",DOT,"EXCLAMATION","PERCENT","QUERY","QUOTE","SEMI","OPENANGLEBRACKET","CLOSEANGLEBRACKET","OPENBRACE","CLOSEBRACE","CLOSEBRACKET","OPENBRACKET","OPENPAREN","CLOSEPAREN","FULLWIDTHLEFTPAREN","FULLWIDTHRIGHTPAREN","LEFTCORNERBRACKET","RIGHTCORNERBRACKET","LEFTWHITECORNERBRACKET","RIGHTWHITECORNERBRACKET","FULLWIDTHLESSTHAN","FULLWIDTHGREATERTHAN"],localpartAccepting=["AMPERSAND","APOSTROPHE","ASTERISK","BACKSLASH","BACKTICK","CARET","DOLLAR","EQUALS",HYPHEN,"OPENBRACE","CLOSEBRACE","PERCENT","PIPE","PLUS","POUND","QUERY",SLASH,"SYM","TILDE","UNDERSCORE"],Start=makeState(),Localpart=tt(Start,"TILDE");ta(Localpart,localpartAccepting,Localpart),ta(Localpart,groups.domain,Localpart);const Domain=makeState(),Scheme=makeState(),SlashScheme=makeState();ta(Start,groups.domain,Domain),ta(Start,groups.scheme,Scheme),ta(Start,groups.slashscheme,SlashScheme),ta(Domain,localpartAccepting,Localpart),ta(Domain,groups.domain,Domain);const LocalpartAt=tt(Domain,AT);tt(Localpart,AT,LocalpartAt),tt(Scheme,AT,LocalpartAt),tt(SlashScheme,AT,LocalpartAt);const LocalpartDot=tt(Localpart,DOT);ta(LocalpartDot,localpartAccepting,Localpart),ta(LocalpartDot,groups.domain,Localpart);const EmailDomain=makeState();ta(LocalpartAt,groups.domain,EmailDomain),ta(EmailDomain,groups.domain,EmailDomain);const EmailDomainDot=tt(EmailDomain,DOT);ta(EmailDomainDot,groups.domain,EmailDomain);const Email$1=makeState(Email);ta(EmailDomainDot,groups.tld,Email$1),ta(EmailDomainDot,groups.utld,Email$1),tt(LocalpartAt,"LOCALHOST",Email$1);const EmailDomainHyphen=tt(EmailDomain,HYPHEN);tt(EmailDomainHyphen,HYPHEN,EmailDomainHyphen),ta(EmailDomainHyphen,groups.domain,EmailDomain),ta(Email$1,groups.domain,EmailDomain),tt(Email$1,DOT,EmailDomainDot),tt(Email$1,HYPHEN,EmailDomainHyphen);const DomainHyphen=tt(Domain,HYPHEN),DomainDot=tt(Domain,DOT);tt(DomainHyphen,HYPHEN,DomainHyphen),ta(DomainHyphen,groups.domain,Domain),ta(DomainDot,localpartAccepting,Localpart),ta(DomainDot,groups.domain,Domain);const DomainDotTld=makeState(Url);ta(DomainDot,groups.tld,DomainDotTld),ta(DomainDot,groups.utld,DomainDotTld),ta(DomainDotTld,groups.domain,Domain),ta(DomainDotTld,localpartAccepting,Localpart),tt(DomainDotTld,DOT,DomainDot),tt(DomainDotTld,HYPHEN,DomainHyphen),tt(DomainDotTld,AT,LocalpartAt);const DomainDotTldColon=tt(DomainDotTld,"COLON"),DomainDotTldColonPort=makeState(Url);ta(DomainDotTldColon,groups.numeric,DomainDotTldColonPort);const Url$1=makeState(Url),UrlNonaccept=makeState();ta(Url$1,qsAccepting,Url$1),ta(Url$1,qsNonAccepting,UrlNonaccept),ta(UrlNonaccept,qsAccepting,Url$1),ta(UrlNonaccept,qsNonAccepting,UrlNonaccept),tt(DomainDotTld,SLASH,Url$1),tt(DomainDotTldColonPort,SLASH,Url$1);const SchemeColon=tt(Scheme,"COLON"),SlashSchemeColon=tt(SlashScheme,"COLON"),SlashSchemeColonSlash=tt(SlashSchemeColon,SLASH),UriPrefix=tt(SlashSchemeColonSlash,SLASH);ta(Scheme,groups.domain,Domain),tt(Scheme,DOT,DomainDot),tt(Scheme,HYPHEN,DomainHyphen),ta(SlashScheme,groups.domain,Domain),tt(SlashScheme,DOT,DomainDot),tt(SlashScheme,HYPHEN,DomainHyphen),ta(SchemeColon,groups.domain,Url$1),tt(SchemeColon,SLASH,Url$1),tt(SchemeColon,"QUERY",Url$1),ta(UriPrefix,groups.domain,Url$1),ta(UriPrefix,qsAccepting,Url$1),tt(UriPrefix,SLASH,Url$1);const bracketPairs=[["OPENBRACE","CLOSEBRACE"],["OPENBRACKET","CLOSEBRACKET"],["OPENPAREN","CLOSEPAREN"],["OPENANGLEBRACKET","CLOSEANGLEBRACKET"],["FULLWIDTHLEFTPAREN","FULLWIDTHRIGHTPAREN"],["LEFTCORNERBRACKET","RIGHTCORNERBRACKET"],["LEFTWHITECORNERBRACKET","RIGHTWHITECORNERBRACKET"],["FULLWIDTHLESSTHAN","FULLWIDTHGREATERTHAN"]];for(let i=0;i<bracketPairs.length;i++){const[OPEN,CLOSE]=bracketPairs[i],UrlOpen=tt(Url$1,OPEN);tt(UrlNonaccept,OPEN,UrlOpen);const UrlOpenQ=makeState(Url);ta(UrlOpen,qsAccepting,UrlOpenQ);const UrlOpenSyms=makeState();ta(UrlOpen,qsNonAccepting,UrlOpenSyms),tt(UrlOpen,CLOSE,Url$1),ta(UrlOpenQ,qsAccepting,UrlOpenQ),ta(UrlOpenQ,qsNonAccepting,UrlOpenSyms),ta(UrlOpenSyms,qsAccepting,UrlOpenQ),ta(UrlOpenSyms,qsNonAccepting,UrlOpenSyms),tt(UrlOpenQ,CLOSE,Url$1),tt(UrlOpenSyms,CLOSE,Url$1)}return tt(Start,"LOCALHOST",DomainDotTld),tt(Start,"NL",Nl),{start:Start,tokens:tk}}(INIT.scanner.tokens);for(let i=0;i<INIT.pluginQueue.length;i++)INIT.pluginQueue[i][1]({scanner:INIT.scanner,parser:INIT.parser});return INIT.initialized=!0,INIT}function tokenize(str){return INIT.initialized||init(),function run(start,input,tokens){let len=tokens.length,cursor=0,multis=[],textTokens=[];for(;cursor<len;){let state=start,secondState=null,nextState=null,multiLength=0,latestAccepting=null,sinceAccepts=-1;for(;cursor<len&&!(secondState=state.go(tokens[cursor].t));)textTokens.push(tokens[cursor++]);for(;cursor<len&&(nextState=secondState||state.go(tokens[cursor].t));)secondState=null,state=nextState,state.accepts()?(sinceAccepts=0,latestAccepting=state):sinceAccepts>=0&&sinceAccepts++,cursor++,multiLength++;if(sinceAccepts<0)cursor-=multiLength,cursor<len&&(textTokens.push(tokens[cursor]),cursor++);else{textTokens.length>0&&(multis.push(initMultiToken(Text,input,textTokens)),textTokens=[]),cursor-=sinceAccepts,multiLength-=sinceAccepts;const Multi=latestAccepting.t,subtokens=tokens.slice(cursor-multiLength,cursor);multis.push(initMultiToken(Multi,input,subtokens))}}return textTokens.length>0&&multis.push(initMultiToken(Text,input,textTokens)),multis}(INIT.parser.start,str,run$1(INIT.scanner.start,str))}function find(str,type=null,opts=null){if(type&&"object"==typeof type){if(opts)throw Error(`linkifyjs: Invalid link type ${type}; must be a string`);opts=type,type=null}const options=new Options(opts),tokens=tokenize(str),filtered=[];for(let i=0;i<tokens.length;i++){const token=tokens[i];!token.isLink||type&&token.t!==type||!options.check(token)||filtered.push(token.toFormattedObject(options))}return filtered}function test(str,type=null){const tokens=tokenize(str);return 1===tokens.length&&tokens[0].isLink&&(!type||tokens[0].t===type)}tokenize.scan=run$1},"./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var React=__webpack_require__("./node_modules/react/index.js");var objectIs="function"==typeof Object.is?Object.is:function is(x,y){return x===y&&(0!==x||1/x==1/y)||x!=x&&y!=y},useState=React.useState,useEffect=React.useEffect,useLayoutEffect=React.useLayoutEffect,useDebugValue=React.useDebugValue;function checkIfSnapshotChanged(inst){var latestGetSnapshot=inst.getSnapshot;inst=inst.value;try{var nextValue=latestGetSnapshot();return!objectIs(inst,nextValue)}catch(error){return!0}}var shim="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function useSyncExternalStore$1(subscribe,getSnapshot){return getSnapshot()}:function useSyncExternalStore$2(subscribe,getSnapshot){var value=getSnapshot(),_useState=useState({inst:{value,getSnapshot}}),inst=_useState[0].inst,forceUpdate=_useState[1];return useLayoutEffect(function(){inst.value=value,inst.getSnapshot=getSnapshot,checkIfSnapshotChanged(inst)&&forceUpdate({inst})},[subscribe,value,getSnapshot]),useEffect(function(){return checkIfSnapshotChanged(inst)&&forceUpdate({inst}),subscribe(function(){checkIfSnapshotChanged(inst)&&forceUpdate({inst})})},[subscribe]),useDebugValue(value),value};exports.useSyncExternalStore=void 0!==React.useSyncExternalStore?React.useSyncExternalStore:shim},"./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js"(__unused_webpack_module,exports,__webpack_require__){"use strict";var React=__webpack_require__("./node_modules/react/index.js"),shim=__webpack_require__("./node_modules/use-sync-external-store/shim/index.js");var objectIs="function"==typeof Object.is?Object.is:function is(x,y){return x===y&&(0!==x||1/x==1/y)||x!=x&&y!=y},useSyncExternalStore=shim.useSyncExternalStore,useRef=React.useRef,useEffect=React.useEffect,useMemo=React.useMemo,useDebugValue=React.useDebugValue;exports.useSyncExternalStoreWithSelector=function(subscribe,getSnapshot,getServerSnapshot,selector,isEqual){var instRef=useRef(null);if(null===instRef.current){var inst={hasValue:!1,value:null};instRef.current=inst}else inst=instRef.current;instRef=useMemo(function(){function memoizedSelector(nextSnapshot){if(!hasMemo){if(hasMemo=!0,memoizedSnapshot=nextSnapshot,nextSnapshot=selector(nextSnapshot),void 0!==isEqual&&inst.hasValue){var currentSelection=inst.value;if(isEqual(currentSelection,nextSnapshot))return memoizedSelection=currentSelection}return memoizedSelection=nextSnapshot}if(currentSelection=memoizedSelection,objectIs(memoizedSnapshot,nextSnapshot))return currentSelection;var nextSelection=selector(nextSnapshot);return void 0!==isEqual&&isEqual(currentSelection,nextSelection)?(memoizedSnapshot=nextSnapshot,currentSelection):(memoizedSnapshot=nextSnapshot,memoizedSelection=nextSelection)}var memoizedSnapshot,memoizedSelection,hasMemo=!1,maybeGetServerSnapshot=void 0===getServerSnapshot?null:getServerSnapshot;return[function(){return memoizedSelector(getSnapshot())},null===maybeGetServerSnapshot?void 0:function(){return memoizedSelector(maybeGetServerSnapshot())}]},[getSnapshot,getServerSnapshot,selector,isEqual]);var value=useSyncExternalStore(subscribe,instRef[0],instRef[1]);return useEffect(function(){inst.hasValue=!0,inst.value=value},[value]),useDebugValue(value),value}},"./node_modules/use-sync-external-store/shim/index.js"(module,__unused_webpack_exports,__webpack_require__){"use strict";module.exports=__webpack_require__("./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js")},"./node_modules/use-sync-external-store/shim/with-selector.js"(module,__unused_webpack_exports,__webpack_require__){"use strict";module.exports=__webpack_require__("./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js")},"./node_modules/@tiptap/core/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var process=__webpack_require__("./node_modules/process/browser.js");Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var __defProp=Object.defineProperty,__exportAll=(all,no_symbols)=>{let target={};for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0});return no_symbols||__defProp(target,Symbol.toStringTag,{value:"Module"}),target};let _tiptap_pm_transform=__webpack_require__("./node_modules/@tiptap/pm/dist/transform/index.cjs"),_tiptap_pm_commands=__webpack_require__("./node_modules/@tiptap/pm/dist/commands/index.cjs"),_tiptap_pm_state=__webpack_require__("./node_modules/@tiptap/pm/dist/state/index.cjs"),_tiptap_pm_model=__webpack_require__("./node_modules/@tiptap/pm/dist/model/index.cjs"),_tiptap_pm_schema_list=__webpack_require__("./node_modules/@tiptap/pm/dist/schema-list/index.cjs"),_tiptap_pm_view=__webpack_require__("./node_modules/@tiptap/pm/dist/view/index.cjs"),_tiptap_pm_keymap=__webpack_require__("./node_modules/@tiptap/pm/dist/keymap/index.cjs");function createChainableState(config){const{state,transaction}=config;let{selection}=transaction,{doc}=transaction,{storedMarks}=transaction;return{...state,apply:state.apply.bind(state),applyTransaction:state.applyTransaction.bind(state),plugins:state.plugins,schema:state.schema,reconfigure:state.reconfigure.bind(state),toJSON:state.toJSON.bind(state),get storedMarks(){return storedMarks},get selection(){return selection},get doc(){return doc},get tr(){return selection=transaction.selection,doc=transaction.doc,storedMarks=transaction.storedMarks,transaction}}}var CommandManager=class CommandManager{constructor(props){this.editor=props.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=props.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands,editor,state}=this,{view}=editor,{tr}=state,props=this.buildProps(tr);return Object.fromEntries(Object.entries(rawCommands).map(([name,command])=>[name,(...args)=>{const callback=command(...args)(props);return tr.getMeta("preventDispatch")||this.hasCustomState||view.dispatch(tr),callback}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(startTr,shouldDispatch=!0){const{rawCommands,editor,state}=this,{view}=editor,callbacks=[],hasStartTransaction=!!startTr,tr=startTr||state.tr,chain={...Object.fromEntries(Object.entries(rawCommands).map(([name,command])=>[name,(...args)=>{const props=this.buildProps(tr,shouldDispatch),callback=command(...args)(props);return callbacks.push(callback),chain}])),run:()=>(hasStartTransaction||!shouldDispatch||tr.getMeta("preventDispatch")||this.hasCustomState||view.dispatch(tr),callbacks.every(callback=>!0===callback))};return chain}static createFakeChain(){const chain=new Proxy({},{get:(_target,property)=>{if("then"!==property)return"run"===property?()=>!1:()=>chain}});return chain}createCan(startTr){const{rawCommands,state}=this,tr=startTr||state.tr,props=this.buildProps(tr,false);return{...Object.fromEntries(Object.entries(rawCommands).map(([name,command])=>[name,(...args)=>command(...args)({...props,dispatch:void 0})])),chain:()=>this.createChain(tr,false)}}static createFallbackCan(){const chain=CommandManager.createFakeChain();return new Proxy({chain:()=>chain},{get:(target,property)=>{if("then"!==property)return"chain"===property?target.chain:()=>!1}})}buildProps(tr,shouldDispatch=!0){const{rawCommands,editor,state}=this,{view}=editor,props={tr,editor,view,state:createChainableState({state,transaction:tr}),dispatch:shouldDispatch?()=>{}:void 0,chain:()=>this.createChain(tr,shouldDispatch),can:()=>this.createCan(tr),get commands(){return Object.fromEntries(Object.entries(rawCommands).map(([name,command])=>[name,(...args)=>command(...args)(props)]))}};return props}};const blur=()=>({editor,view})=>(requestAnimationFrame(()=>{var _window;editor.isDestroyed||(view.dom.blur(),null===(_window=window)||void 0===_window||null===(_window=_window.getSelection())||void 0===_window||_window.removeAllRanges())}),!0),clearContent=(emitUpdate=!0)=>({commands})=>commands.setContent("",{emitUpdate}),clearNodes=()=>({state,tr,dispatch})=>{const{selection}=tr,{ranges}=selection;return!dispatch||(ranges.forEach(({$from,$to})=>{state.doc.nodesBetween($from.pos,$to.pos,(node,pos)=>{if(node.type.isText)return;const{doc,mapping}=tr,$mappedFrom=doc.resolve(mapping.map(pos)),$mappedTo=doc.resolve(mapping.map(pos+node.nodeSize)),nodeRange=$mappedFrom.blockRange($mappedTo);if(!nodeRange)return;const targetLiftDepth=(0,_tiptap_pm_transform.liftTarget)(nodeRange);if(node.type.isTextblock){const{defaultType}=$mappedFrom.parent.contentMatchAt($mappedFrom.index());tr.setNodeMarkup(nodeRange.start,defaultType)}(targetLiftDepth||0===targetLiftDepth)&&tr.lift(nodeRange,targetLiftDepth)})}),!0)},command=fn=>props=>fn(props),createParagraphNear=()=>({state,dispatch})=>(0,_tiptap_pm_commands.createParagraphNear)(state,dispatch),cut=(originRange,targetPos)=>({editor,tr})=>{const{state}=editor,contentSlice=state.doc.slice(originRange.from,originRange.to);tr.deleteRange(originRange.from,originRange.to);const newPos=tr.mapping.map(targetPos);return tr.insert(newPos,contentSlice.content),tr.setSelection(new _tiptap_pm_state.TextSelection(tr.doc.resolve(Math.max(newPos-1,0)))),!0},deleteCurrentNode=()=>({tr,dispatch})=>{const{selection}=tr,currentNode=selection.$anchor.node();if(currentNode.content.size>0)return!1;const $pos=tr.selection.$anchor;for(let depth=$pos.depth;depth>0;depth-=1)if($pos.node(depth).type===currentNode.type){if(dispatch){const from=$pos.before(depth),to=$pos.after(depth);tr.delete(from,to).scrollIntoView()}return!0}return!1};function getNodeType(nameOrType,schema){if("string"==typeof nameOrType){if(!schema.nodes[nameOrType])throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);return schema.nodes[nameOrType]}return nameOrType}const deleteNode=typeOrName=>({tr,state,dispatch})=>{const type=getNodeType(typeOrName,state.schema),$pos=tr.selection.$anchor;for(let depth=$pos.depth;depth>0;depth-=1)if($pos.node(depth).type===type){if(dispatch){const from=$pos.before(depth),to=$pos.after(depth);tr.delete(from,to).scrollIntoView()}return!0}return!1},deleteRange=range=>({tr,dispatch})=>{const{from,to}=range;return dispatch&&tr.delete(from,to),!0},expandSelectionForSide=($pos,schema,side)=>{if(!$pos.parent.isInline)return $pos.pos;if("left"===side&&$pos.pos>$pos.start()||"right"===side&&$pos.pos<$pos.end())return $pos.pos;const parentContent=schema.nodes[$pos.parent.type.name].spec;return(nodeSpec=parentContent).content&&/^text(\*|\+)/.test(nodeSpec.content)?"left"===side?$pos.start()-1:$pos.end()+1:$pos.pos;var nodeSpec},deleteSelection=()=>({state,dispatch})=>{if(state.selection.empty)return!1;if(dispatch){const tr=state.tr,{ranges}=state.selection,mapFrom=tr.steps.length;ranges.forEach(range=>{const mapping=tr.mapping.slice(mapFrom),$from=tr.doc.resolve(mapping.map(range.$from.pos)),$to=tr.doc.resolve(mapping.map(range.$to.pos)),{from,to}=(($from,$to,schema)=>({from:expandSelectionForSide($from,schema,"left"),to:expandSelectionForSide($to,schema,"right")}))($from,$to,state.schema);tr.deleteRange(from,to)}),tr.selection.empty||tr.setSelection(_tiptap_pm_state.TextSelection.near(tr.doc.resolve(tr.selection.from))),tr.scrollIntoView(),dispatch(tr)}return!0},enter=()=>({commands})=>commands.keyboardShortcut("Enter"),exitCode=()=>({state,dispatch})=>(0,_tiptap_pm_commands.exitCode)(state,dispatch);function isRegExp(value){return"[object RegExp]"===Object.prototype.toString.call(value)}function objectIncludes(object1,object2,options={strict:!0}){const keys=Object.keys(object2);return!keys.length||keys.every(key=>options.strict?object2[key]===object1[key]:isRegExp(object2[key])?object2[key].test(object1[key]):object2[key]===object1[key])}function findMarkInSet(marks,type,attributes={}){return marks.find(item=>item.type===type&&objectIncludes(Object.fromEntries(Object.keys(attributes).map(k=>[k,item.attrs[k]])),attributes))}function isMarkInSet(marks,type,attributes={}){return!!findMarkInSet(marks,type,attributes)}function getMarkRange($pos,type,attributes){if(!$pos||!type)return;let start=$pos.parent.childAfter($pos.parentOffset);if(start.node&&start.node.marks.some(mark=>mark.type===type)||(start=$pos.parent.childBefore($pos.parentOffset)),!start.node||!start.node.marks.some(mark=>mark.type===type))return;if(!attributes){const firstMark=start.node.marks.find(mark=>mark.type===type);firstMark&&(attributes=firstMark.attrs)}if(!findMarkInSet([...start.node.marks],type,attributes))return;let startIndex=start.index,startPos=$pos.start()+start.offset,endIndex=startIndex+1,endPos=startPos+start.node.nodeSize;for(;startIndex>0&&isMarkInSet([...$pos.parent.child(startIndex-1).marks],type,attributes);)startIndex-=1,startPos-=$pos.parent.child(startIndex).nodeSize;for(;endIndex<$pos.parent.childCount&&isMarkInSet([...$pos.parent.child(endIndex).marks],type,attributes);)endPos+=$pos.parent.child(endIndex).nodeSize,endIndex+=1;return{from:startPos,to:endPos}}function getMarkType(nameOrType,schema){if("string"==typeof nameOrType){if(!schema.marks[nameOrType])throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);return schema.marks[nameOrType]}return nameOrType}const extendMarkRange=(typeOrName,attributes)=>({tr,state,dispatch})=>{const type=getMarkType(typeOrName,state.schema),{doc,selection}=tr,{$from,from,to}=selection;if(dispatch){const range=getMarkRange($from,type,attributes);if(range&&range.from<=from&&range.to>=to){const newSelection=_tiptap_pm_state.TextSelection.create(doc,range.from,range.to);tr.setSelection(newSelection)}}return!0},first=commands=>props=>{const items="function"==typeof commands?commands(props):commands;for(let i=0;i<items.length;i+=1)if(items[i](props))return!0;return!1};function isTextSelection(value){return value instanceof _tiptap_pm_state.TextSelection}function minMax(value=0,min=0,max=0){return Math.min(Math.max(value,min),max)}function resolveFocusPosition(doc,position=null){if(!position)return null;const selectionAtStart=_tiptap_pm_state.Selection.atStart(doc),selectionAtEnd=_tiptap_pm_state.Selection.atEnd(doc);if("start"===position||!0===position)return selectionAtStart;if("end"===position)return selectionAtEnd;const minPos=selectionAtStart.from,maxPos=selectionAtEnd.to;return"all"===position?_tiptap_pm_state.TextSelection.create(doc,minMax(0,minPos,maxPos),minMax(doc.content.size,minPos,maxPos)):_tiptap_pm_state.TextSelection.create(doc,minMax(position,minPos,maxPos),minMax(position,minPos,maxPos))}function isAndroid(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function isiOS(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function isSafari(){return"undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}const focus=(position=null,options={})=>({editor,view,tr,dispatch})=>{options={scrollIntoView:!0,...options};const delayedFocus=()=>{(isiOS()||isAndroid())&&view.dom.focus(),!isSafari()||isiOS()||isAndroid()||view.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{editor.isDestroyed||(view.focus(),(null==options?void 0:options.scrollIntoView)&&editor.commands.scrollIntoView())})};try{if(view.hasFocus()&&null===position||!1===position)return!0}catch{return!1}if(dispatch&&null===position&&!isTextSelection(editor.state.selection))return delayedFocus(),!0;const selection=resolveFocusPosition(tr.doc,position)||editor.state.selection,isSameSelection=editor.state.selection.eq(selection);return dispatch&&(isSameSelection||tr.setSelection(selection),isSameSelection&&tr.storedMarks&&tr.setStoredMarks(tr.storedMarks),delayedFocus()),!0},forEach=(items,fn)=>props=>items.every((item,index)=>fn(item,{...props,index})),insertContent=(value,options)=>({tr,commands})=>commands.insertContentAt({from:tr.selection.from,to:tr.selection.to},value,options),removeWhitespaces=node=>{const children=node.childNodes;for(let i=children.length-1;i>=0;i-=1){const child=children[i];3===child.nodeType&&child.nodeValue&&/^(\n\s\s|\n)$/.test(child.nodeValue)?node.removeChild(child):1===child.nodeType&&removeWhitespaces(child)}return node};function elementFromString(value){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const wrappedValue=`<body>${value}</body>`,html=(new window.DOMParser).parseFromString(wrappedValue,"text/html").body;return removeWhitespaces(html)}function isProseMirrorContent(value){return"function"==typeof(null==value?void 0:value.nodesBetween)}function createNodeFromContent(content,schema,options){if(isProseMirrorContent(content))return content;const isJSONContent="object"==typeof content&&null!==content;options={slice:!0,parseOptions:{},...options};const isTextContent="string"==typeof content;if(isJSONContent)try{if(Array.isArray(content)&&content.length>0)return _tiptap_pm_model.Fragment.fromArray(content.map(item=>schema.nodeFromJSON(item)));const node=schema.nodeFromJSON(content);return options.errorOnInvalidContent&&node.check(),node}catch(error){if(options.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:error});return console.warn("[tiptap warn]: Invalid content.","Passed value:",content,"Error:",error),createNodeFromContent("",schema,options)}if(isTextContent){if(options.errorOnInvalidContent){let hasInvalidContent=!1,invalidContent="";const contentCheckSchema=new _tiptap_pm_model.Schema({topNode:schema.spec.topNode,marks:schema.spec.marks,nodes:schema.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(hasInvalidContent=!0,invalidContent="string"==typeof e?e:e.outerHTML,null)}]}})});if(options.slice?_tiptap_pm_model.DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content),options.parseOptions):_tiptap_pm_model.DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content),options.parseOptions),options.errorOnInvalidContent&&hasInvalidContent)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${invalidContent}`)})}const parser=_tiptap_pm_model.DOMParser.fromSchema(schema);return options.slice?parser.parseSlice(elementFromString(content),options.parseOptions).content:parser.parse(elementFromString(content),options.parseOptions)}return createNodeFromContent("",schema,options)}function isFragment(nodeOrFragment){return!("type"in nodeOrFragment)}function selectionToInsertionEnd(tr,startLen,bias){const last=tr.steps.length-1;if(last<startLen)return;const step=tr.steps[last];if(!(step instanceof _tiptap_pm_transform.ReplaceStep||step instanceof _tiptap_pm_transform.ReplaceAroundStep))return;const map=tr.mapping.maps[last];let end=0;map.forEach((_from,_to,_newFrom,newTo)=>{0===end&&(end=newTo)}),tr.setSelection(_tiptap_pm_state.Selection.near(tr.doc.resolve(end),bias))}const insertContentAt=(position,value,options)=>({tr,dispatch,editor})=>{if(dispatch){let content;const emitContentError=error=>{editor.emit("contentError",{editor,error,disableCollaboration:()=>{"collaboration"in editor.storage&&"object"==typeof editor.storage.collaboration&&editor.storage.collaboration&&(editor.storage.collaboration.isDisabled=!0)}})},parseOptions={preserveWhitespace:"full",...(options={parseOptions:editor.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...options}).parseOptions};if(!options.errorOnInvalidContent&&!editor.options.enableContentCheck&&editor.options.emitContentError)try{createNodeFromContent(value,editor.schema,{parseOptions,errorOnInvalidContent:!0})}catch(e){emitContentError(e)}try{var _options$errorOnInval;content=createNodeFromContent(value,editor.schema,{parseOptions,errorOnInvalidContent:null!==(_options$errorOnInval=options.errorOnInvalidContent)&&void 0!==_options$errorOnInval?_options$errorOnInval:editor.options.enableContentCheck})}catch(e){return emitContentError(e),!1}let{from,to}="number"==typeof position?{from:position,to:position}:{from:position.from,to:position.to},isOnlyTextContent=!0,isOnlyBlockContent=!0;const nodes=isFragment(content)?content.content:[content];if(nodes.forEach(node=>{node.check(),isOnlyTextContent=!!isOnlyTextContent&&(node.isText&&0===node.marks.length),isOnlyBlockContent=!!isOnlyBlockContent&&node.isBlock}),from===to&&isOnlyBlockContent){const{parent}=tr.doc.resolve(from);!parent.isTextblock||parent.type.spec.code||parent.childCount||(from-=1,to+=1)}let newContent;if(isOnlyTextContent)newContent=Array.isArray(value)?value.map(item=>item.text||"").join(""):isProseMirrorContent(value)?nodes.map(node=>{var _node$text;return null!==(_node$text=node.text)&&void 0!==_node$text?_node$text:""}).join(""):"object"==typeof value&&value&&value.text?value.text:value,tr.insertText(newContent,from,to);else{newContent=_tiptap_pm_model.Fragment.from(nodes);const $from=tr.doc.resolve(from),$fromNode=$from.node(),fromSelectionAtStart=0===$from.parentOffset,isTextSelection=$fromNode.isText||$fromNode.isTextblock,hasContent=$fromNode.content.size>0;fromSelectionAtStart&&isTextSelection&&hasContent&&isOnlyBlockContent&&(from=Math.max(0,from-1)),tr.replaceWith(from,to,nodes)}options.updateSelection&&selectionToInsertionEnd(tr,tr.steps.length-1,-1),options.applyInputRules&&tr.setMeta("applyInputRules",{from,text:newContent}),options.applyPasteRules&&tr.setMeta("applyPasteRules",{from,text:newContent})}return!0};function defaultBlockAt(match){for(let i=0;i<match.edgeCount;i+=1){const{type}=match.edge(i);if(type.isTextblock&&!type.hasRequiredAttrs())return type}return null}const insertDefaultBlock=(options={})=>({tr,dispatch,editor})=>{const{pos,attrs,content,updateSelection=!0}=options;let $pos;$pos="number"==typeof pos?tr.doc.resolve(pos):pos||tr.selection.$from;const defaultType=defaultBlockAt($pos.parent.contentMatchAt($pos.index()));if(!defaultType)return!1;const validAttrKeys=Object.keys(defaultType.spec.attrs||{}),filteredAttrs=attrs?Object.fromEntries(Object.entries(attrs).filter(([key])=>validAttrKeys.includes(key))):{};let node;if(content){const parsed=createNodeFromContent(content,editor.schema);node=defaultType.createAndFill(filteredAttrs,parsed)}else node=defaultType.createAndFill(filteredAttrs);return!!node&&(dispatch&&(tr.insert($pos.pos,node),updateSelection&&selectionToInsertionEnd(tr,tr.steps.length-1,-1)),!0)},joinUp=()=>({state,dispatch})=>(0,_tiptap_pm_commands.joinUp)(state,dispatch),joinDown=()=>({state,dispatch})=>(0,_tiptap_pm_commands.joinDown)(state,dispatch),joinBackward=()=>({state,dispatch})=>(0,_tiptap_pm_commands.joinBackward)(state,dispatch),joinForward=()=>({state,dispatch})=>(0,_tiptap_pm_commands.joinForward)(state,dispatch),joinItemBackward=()=>({state,dispatch,tr})=>{try{const point=(0,_tiptap_pm_transform.joinPoint)(state.doc,state.selection.$from.pos,-1);return null!=point&&(tr.join(point,2),dispatch&&dispatch(tr),!0)}catch{return!1}},joinItemForward=()=>({state,dispatch,tr})=>{try{const point=(0,_tiptap_pm_transform.joinPoint)(state.doc,state.selection.$from.pos,1);return null!=point&&(tr.join(point,2),dispatch&&dispatch(tr),!0)}catch{return!1}},joinTextblockBackward=()=>({state,dispatch})=>(0,_tiptap_pm_commands.joinTextblockBackward)(state,dispatch),joinTextblockForward=()=>({state,dispatch})=>(0,_tiptap_pm_commands.joinTextblockForward)(state,dispatch);function isMacOS(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}const keyboardShortcut=name=>({editor,view,tr,dispatch})=>{const keys=function normalizeKeyName(name){const parts=name.split(/-(?!$)/);let alt,ctrl,shift,meta,result=parts[parts.length-1];"Space"===result&&(result=" ");for(let i=0;i<parts.length-1;i+=1){const mod=parts[i];if(/^(cmd|meta|m)$/i.test(mod))meta=!0;else if(/^a(lt)?$/i.test(mod))alt=!0;else if(/^(c|ctrl|control)$/i.test(mod))ctrl=!0;else if(/^s(hift)?$/i.test(mod))shift=!0;else{if(!/^mod$/i.test(mod))throw new Error(`Unrecognized modifier name: ${mod}`);isiOS()||isMacOS()?meta=!0:ctrl=!0}}return alt&&(result=`Alt-${result}`),ctrl&&(result=`Ctrl-${result}`),meta&&(result=`Meta-${result}`),shift&&(result=`Shift-${result}`),result}(name).split(/-(?!$)/),key=keys.find(item=>!["Alt","Ctrl","Meta","Shift"].includes(item)),event=new KeyboardEvent("keydown",{key:"Space"===key?" ":key,altKey:keys.includes("Alt"),ctrlKey:keys.includes("Ctrl"),metaKey:keys.includes("Meta"),shiftKey:keys.includes("Shift"),bubbles:!0,cancelable:!0}),capturedTransaction=editor.captureTransaction(()=>{view.someProp("handleKeyDown",f=>f(view,event))});return null==capturedTransaction||capturedTransaction.steps.forEach(step=>{const newStep=step.map(tr.mapping);newStep&&dispatch&&tr.maybeStep(newStep)}),!0};function isNodeActive(state,typeOrName,attributes={}){const{from,to,empty}=state.selection,type=typeOrName?getNodeType(typeOrName,state.schema):null,nodeRanges=[];state.doc.nodesBetween(from,to,(node,pos)=>{if(node.isText)return;const relativeFrom=Math.max(from,pos),relativeTo=Math.min(to,pos+node.nodeSize);nodeRanges.push({node,from:relativeFrom,to:relativeTo})});const selectionRange=to-from,matchedNodeRanges=nodeRanges.filter(nodeRange=>!type||type.name===nodeRange.node.type.name).filter(nodeRange=>objectIncludes(nodeRange.node.attrs,attributes,{strict:!1}));return empty?!!matchedNodeRanges.length:matchedNodeRanges.reduce((sum,nodeRange)=>sum+nodeRange.to-nodeRange.from,0)>=selectionRange}const lift=(typeOrName,attributes={})=>({state,dispatch})=>!!isNodeActive(state,getNodeType(typeOrName,state.schema),attributes)&&(0,_tiptap_pm_commands.lift)(state,dispatch),liftEmptyBlock=()=>({state,dispatch})=>(0,_tiptap_pm_commands.liftEmptyBlock)(state,dispatch),liftListItem=typeOrName=>({state,dispatch})=>{const type=getNodeType(typeOrName,state.schema);return(0,_tiptap_pm_schema_list.liftListItem)(type)(state,dispatch)},newlineInCode=()=>({state,dispatch})=>(0,_tiptap_pm_commands.newlineInCode)(state,dispatch);function getSchemaTypeNameByName(name,schema){return schema.nodes[name]?"node":schema.marks[name]?"mark":null}function deleteProps(obj,propOrProps){const props="string"==typeof propOrProps?[propOrProps]:propOrProps;return Object.keys(obj).reduce((newObj,prop)=>(props.includes(prop)||(newObj[prop]=obj[prop]),newObj),{})}const resetAttributes=(typeOrName,attributes)=>({tr,state,dispatch})=>{let nodeType=null,markType=null;const schemaType=getSchemaTypeNameByName("string"==typeof typeOrName?typeOrName:typeOrName.name,state.schema);if(!schemaType)return!1;"node"===schemaType&&(nodeType=getNodeType(typeOrName,state.schema)),"mark"===schemaType&&(markType=getMarkType(typeOrName,state.schema));let canReset=!1;return tr.selection.ranges.forEach(range=>{state.doc.nodesBetween(range.$from.pos,range.$to.pos,(node,pos)=>{nodeType&&nodeType===node.type&&(canReset=!0,dispatch&&tr.setNodeMarkup(pos,void 0,deleteProps(node.attrs,attributes))),markType&&node.marks.length&&node.marks.forEach(mark=>{markType===mark.type&&(canReset=!0,dispatch&&tr.addMark(pos,pos+node.nodeSize,markType.create(deleteProps(mark.attrs,attributes))))})})}),canReset},scrollIntoView=()=>({tr,dispatch})=>(dispatch&&tr.scrollIntoView(),!0),selectAll=()=>({tr,dispatch})=>{if(dispatch){const selection=new _tiptap_pm_state.AllSelection(tr.doc);tr.setSelection(selection)}return!0},selectNodeBackward=()=>({state,dispatch})=>(0,_tiptap_pm_commands.selectNodeBackward)(state,dispatch),selectNodeForward=()=>({state,dispatch})=>(0,_tiptap_pm_commands.selectNodeForward)(state,dispatch),selectParentNode=()=>({state,dispatch})=>(0,_tiptap_pm_commands.selectParentNode)(state,dispatch),selectTextblockEnd=()=>({state,dispatch})=>(0,_tiptap_pm_commands.selectTextblockEnd)(state,dispatch),selectTextblockStart=()=>({state,dispatch})=>(0,_tiptap_pm_commands.selectTextblockStart)(state,dispatch);function createDocument(content,schema,parseOptions={},options={}){return createNodeFromContent(content,schema,{slice:!1,parseOptions,errorOnInvalidContent:options.errorOnInvalidContent})}const setContent=(content,{errorOnInvalidContent,emitUpdate=!0,parseOptions={}}={})=>({editor,tr,dispatch,commands})=>{const{doc}=tr;if("full"!==parseOptions.preserveWhitespace){const document=createDocument(content,editor.schema,parseOptions,{errorOnInvalidContent:null!=errorOnInvalidContent?errorOnInvalidContent:editor.options.enableContentCheck});if(dispatch){const nodes=isFragment(document)?document.content:[document];tr.replaceWith(0,doc.content.size,nodes).setMeta("preventUpdate",!emitUpdate)}return!0}return dispatch&&tr.setMeta("preventUpdate",!emitUpdate),commands.insertContentAt({from:0,to:doc.content.size},content,{parseOptions,errorOnInvalidContent:null!=errorOnInvalidContent?errorOnInvalidContent:editor.options.enableContentCheck})};function getMarkAttributes(state,typeOrName){const type=getMarkType(typeOrName,state.schema),{from,to,empty}=state.selection,marks=[];empty?(state.storedMarks&&marks.push(...state.storedMarks),marks.push(...state.selection.$head.marks())):state.doc.nodesBetween(from,to,node=>{marks.push(...node.marks)});const mark=marks.find(markItem=>markItem.type.name===type.name);return mark?{...mark.attrs}:{}}function combineTransactionSteps(oldDoc,transactions){const transform=new _tiptap_pm_transform.Transform(oldDoc);return transactions.forEach(transaction=>{transaction.steps.forEach(step=>{transform.step(step)})}),transform}function findParentNodeClosestToPos($pos,predicate){for(let i=$pos.depth;i>0;i-=1){const node=$pos.node(i);if(predicate(node))return{pos:i>0?$pos.before(i):0,start:$pos.start(i),depth:i,node}}}function findParentNode(predicate){return selection=>findParentNodeClosestToPos(selection.$from,predicate)}function getExtensionField(extension,field,context){return void 0===extension.config[field]&&extension.parent?getExtensionField(extension.parent,field,context):"function"==typeof extension.config[field]?extension.config[field].bind({...context,parent:extension.parent?getExtensionField(extension.parent,field,context):null}):extension.config[field]}function flattenExtensions(extensions){return extensions.map(extension=>{const addExtensions=getExtensionField(extension,"addExtensions",{name:extension.name,options:extension.options,storage:extension.storage});return addExtensions?[extension,...flattenExtensions(addExtensions())]:extension}).flat(10)}function getHTMLFromFragment(fragment,schema){const documentFragment=_tiptap_pm_model.DOMSerializer.fromSchema(schema).serializeFragment(fragment),container=document.implementation.createHTMLDocument().createElement("div");return container.appendChild(documentFragment),container.innerHTML}function isFunction(value){return"function"==typeof value}function callOrReturn(value,context=void 0,...props){return isFunction(value)?context?value.bind(context)(...props):value(...props):value}function isEmptyObject(value={}){return 0===Object.keys(value).length&&value.constructor===Object}function splitExtensions(extensions){return{baseExtensions:extensions.filter(extension=>"extension"===extension.type),nodeExtensions:extensions.filter(extension=>"node"===extension.type),markExtensions:extensions.filter(extension=>"mark"===extension.type)}}function getAttributesFromExtensions(extensions){const extensionAttributes=[],{nodeExtensions,markExtensions}=splitExtensions(extensions),nodeAndMarkExtensions=[...nodeExtensions,...markExtensions],defaultAttribute={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},nodeExtensionTypes=nodeExtensions.filter(ext=>"text"!==ext.name).map(ext=>ext.name),markExtensionTypes=markExtensions.map(ext=>ext.name),allExtensionTypes=[...nodeExtensionTypes,...markExtensionTypes];return extensions.forEach(extension=>{const addGlobalAttributes=getExtensionField(extension,"addGlobalAttributes",{name:extension.name,options:extension.options,storage:extension.storage,extensions:nodeAndMarkExtensions});addGlobalAttributes&&addGlobalAttributes().forEach(globalAttribute=>{let resolvedTypes;resolvedTypes=Array.isArray(globalAttribute.types)?globalAttribute.types:"*"===globalAttribute.types?allExtensionTypes:"nodes"===globalAttribute.types?nodeExtensionTypes:"marks"===globalAttribute.types?markExtensionTypes:[],resolvedTypes.forEach(type=>{Object.entries(globalAttribute.attributes).forEach(([name,attribute])=>{extensionAttributes.push({type,name,attribute:{...defaultAttribute,...attribute}})})})})}),nodeAndMarkExtensions.forEach(extension=>{const addAttributes=getExtensionField(extension,"addAttributes",{name:extension.name,options:extension.options,storage:extension.storage});if(!addAttributes)return;const attributes=addAttributes();Object.entries(attributes).forEach(([name,attribute])=>{const mergedAttr={...defaultAttribute,...attribute};"function"==typeof(null==mergedAttr?void 0:mergedAttr.default)&&(mergedAttr.default=mergedAttr.default()),(null==mergedAttr?void 0:mergedAttr.isRequired)&&void 0===(null==mergedAttr?void 0:mergedAttr.default)&&delete mergedAttr.default,extensionAttributes.push({type:extension.name,name,attribute:mergedAttr})})}),extensionAttributes}function parseStyleEntries(styles){const pairs=[],declarations=function splitStyleDeclarations(styles){const result=[];let current="",inSingleQuote=!1,inDoubleQuote=!1,parenDepth=0;const length=styles.length;for(let i=0;i<length;i+=1){const char=styles[i];if("'"!==char||inDoubleQuote)if('"'!==char||inSingleQuote){if(!inSingleQuote&&!inDoubleQuote){if("("===char){parenDepth+=1,current+=char;continue}if(")"===char&&parenDepth>0){parenDepth-=1,current+=char;continue}if(";"===char&&0===parenDepth){result.push(current),current="";continue}}current+=char}else inDoubleQuote=!inDoubleQuote,current+=char;else inSingleQuote=!inSingleQuote,current+=char}return current&&result.push(current),result}(styles||""),numDeclarations=declarations.length;for(let i=0;i<numDeclarations;i+=1){const declaration=declarations[i],firstColonIndex=declaration.indexOf(":");if(-1===firstColonIndex)continue;const property=declaration.slice(0,firstColonIndex).trim(),value=declaration.slice(firstColonIndex+1).trim();property&&value&&pairs.push([property,value])}return pairs}function mergeAttributes(...objects){return objects.filter(item=>!!item).reduce((items,item)=>{const mergedAttributes={...items};return Object.entries(item).forEach(([key,value])=>{if("__proto__"!==key)if(mergedAttributes[key])if("class"===key){const valueClasses=value?String(value).split(" "):[],existingClasses=mergedAttributes[key]?mergedAttributes[key].split(" "):[],insertClasses=valueClasses.filter(valueClass=>!existingClasses.includes(valueClass));mergedAttributes[key]=[...existingClasses,...insertClasses].join(" ")}else if("style"===key){const styleMap=new Map([...parseStyleEntries(mergedAttributes[key]),...parseStyleEntries(value)]);mergedAttributes[key]=Array.from(styleMap.entries()).map(([property,val])=>`${property}: ${val}`).join("; ")}else mergedAttributes[key]=value;else mergedAttributes[key]=value;else Object.defineProperty(mergedAttributes,key,{configurable:!0,enumerable:!0,value,writable:!0})}),mergedAttributes},{})}function getRenderedAttributes(nodeOrMark,extensionAttributes){return extensionAttributes.filter(attribute=>attribute.type===nodeOrMark.type.name).filter(item=>item.attribute.rendered).map(item=>item.attribute.renderHTML?item.attribute.renderHTML(nodeOrMark.attrs)||{}:{[item.name]:nodeOrMark.attrs[item.name]}).reduce((attributes,attribute)=>mergeAttributes(attributes,attribute),{})}function fromString(value){return"string"!=typeof value?value:value.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(value):"true"===value||"false"!==value&&value}function injectExtensionAttributesToParseRule(parseRule,extensionAttributes){return"style"in parseRule?parseRule:{...parseRule,getAttrs:node=>{const oldAttributes=parseRule.getAttrs?parseRule.getAttrs(node):parseRule.attrs;if(!1===oldAttributes)return!1;const newAttributes=extensionAttributes.reduce((items,item)=>{const value=item.attribute.parseHTML?item.attribute.parseHTML(node):fromString(node.getAttribute(item.name));return null==value?items:{...items,[item.name]:value}},{});return{...oldAttributes,...newAttributes}}}}function cleanUpSchemaItem(data){return Object.fromEntries(Object.entries(data).filter(([key,value])=>("attrs"!==key||!isEmptyObject(value))&&null!=value))}function buildAttributeSpec(extensionAttribute){var _extensionAttribute$a,_extensionAttribute$a2;const spec={};return!(null==extensionAttribute||null===(_extensionAttribute$a=extensionAttribute.attribute)||void 0===_extensionAttribute$a?void 0:_extensionAttribute$a.isRequired)&&"default"in((null==extensionAttribute?void 0:extensionAttribute.attribute)||{})&&(spec.default=extensionAttribute.attribute.default),void 0!==(null==extensionAttribute||null===(_extensionAttribute$a2=extensionAttribute.attribute)||void 0===_extensionAttribute$a2?void 0:_extensionAttribute$a2.validate)&&(spec.validate=extensionAttribute.attribute.validate),[extensionAttribute.name,spec]}function getSchemaByResolvedExtensions(extensions,editor){var _nodeExtensions$find;const allAttributes=getAttributesFromExtensions(extensions),{nodeExtensions,markExtensions}=splitExtensions(extensions),topNode=null===(_nodeExtensions$find=nodeExtensions.find(extension=>getExtensionField(extension,"topNode")))||void 0===_nodeExtensions$find?void 0:_nodeExtensions$find.name,nodes=Object.fromEntries(nodeExtensions.map(extension=>{const extensionAttributes=allAttributes.filter(attribute=>attribute.type===extension.name),context={name:extension.name,options:extension.options,storage:extension.storage,editor},schema=cleanUpSchemaItem({...extensions.reduce((fields,e)=>{const extendNodeSchema=getExtensionField(e,"extendNodeSchema",context);return{...fields,...extendNodeSchema?extendNodeSchema(extension):{}}},{}),content:callOrReturn(getExtensionField(extension,"content",context)),marks:callOrReturn(getExtensionField(extension,"marks",context)),group:callOrReturn(getExtensionField(extension,"group",context)),inline:callOrReturn(getExtensionField(extension,"inline",context)),atom:callOrReturn(getExtensionField(extension,"atom",context)),selectable:callOrReturn(getExtensionField(extension,"selectable",context)),draggable:callOrReturn(getExtensionField(extension,"draggable",context)),code:callOrReturn(getExtensionField(extension,"code",context)),whitespace:callOrReturn(getExtensionField(extension,"whitespace",context)),linebreakReplacement:callOrReturn(getExtensionField(extension,"linebreakReplacement",context)),defining:callOrReturn(getExtensionField(extension,"defining",context)),isolating:callOrReturn(getExtensionField(extension,"isolating",context)),attrs:Object.fromEntries(extensionAttributes.map(buildAttributeSpec))}),parseHTML=callOrReturn(getExtensionField(extension,"parseHTML",context));parseHTML&&(schema.parseDOM=parseHTML.map(parseRule=>injectExtensionAttributesToParseRule(parseRule,extensionAttributes)));const renderHTML=getExtensionField(extension,"renderHTML",context);renderHTML&&(schema.toDOM=node=>renderHTML({node,HTMLAttributes:getRenderedAttributes(node,extensionAttributes)}));const renderText=getExtensionField(extension,"renderText",context);return renderText&&(schema.toText=renderText),[extension.name,schema]})),marks=Object.fromEntries(markExtensions.map(extension=>{const extensionAttributes=allAttributes.filter(attribute=>attribute.type===extension.name),context={name:extension.name,options:extension.options,storage:extension.storage,editor},schema=cleanUpSchemaItem({...extensions.reduce((fields,e)=>{const extendMarkSchema=getExtensionField(e,"extendMarkSchema",context);return{...fields,...extendMarkSchema?extendMarkSchema(extension):{}}},{}),inclusive:callOrReturn(getExtensionField(extension,"inclusive",context)),excludes:callOrReturn(getExtensionField(extension,"excludes",context)),group:callOrReturn(getExtensionField(extension,"group",context)),spanning:callOrReturn(getExtensionField(extension,"spanning",context)),code:callOrReturn(getExtensionField(extension,"code",context)),attrs:Object.fromEntries(extensionAttributes.map(buildAttributeSpec))}),parseHTML=callOrReturn(getExtensionField(extension,"parseHTML",context));parseHTML&&(schema.parseDOM=parseHTML.map(parseRule=>injectExtensionAttributesToParseRule(parseRule,extensionAttributes)));const renderHTML=getExtensionField(extension,"renderHTML",context);return renderHTML&&(schema.toDOM=mark=>renderHTML({mark,HTMLAttributes:getRenderedAttributes(mark,extensionAttributes)})),[extension.name,schema]}));return new _tiptap_pm_model.Schema({topNode,nodes,marks})}function findDuplicates(items){const filtered=items.filter((el,index)=>items.indexOf(el)!==index);return Array.from(new Set(filtered))}function sortExtensions(extensions){return extensions.sort((a,b)=>{const priorityA=getExtensionField(a,"priority")||100,priorityB=getExtensionField(b,"priority")||100;return priorityA>priorityB?-1:priorityA<priorityB?1:0})}function resolveExtensions(extensions){const resolvedExtensions=sortExtensions(flattenExtensions(extensions)),duplicatedNames=findDuplicates(resolvedExtensions.map(extension=>extension.name));return duplicatedNames.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map(item=>`'${item}'`).join(", ")}]. This can lead to issues.`),resolvedExtensions}function getSchema(extensions,editor){return getSchemaByResolvedExtensions(resolveExtensions(extensions),editor)}function getTextBetween(startNode,range,options){const{from,to}=range,{blockSeparator="\n\n",textSerializers={}}=options||{};let text="";return startNode.nodesBetween(from,to,(node,pos,parent,index)=>{node.isBlock&&pos>from&&(text+=blockSeparator);const textSerializer=null==textSerializers?void 0:textSerializers[node.type.name];if(textSerializer)return parent&&(text+=textSerializer({node,pos,parent,index,range})),!1;var _node$text;node.isText&&(text+=null==node||null===(_node$text=node.text)||void 0===_node$text?void 0:_node$text.slice(Math.max(from,pos)-pos,to-pos))}),text}function getText(node,options){return getTextBetween(node,{from:0,to:node.content.size},options)}function getTextSerializersFromSchema(schema){return Object.fromEntries(Object.entries(schema.nodes).filter(([,node])=>node.spec.toText).map(([name,node])=>[name,node.spec.toText]))}function getNodeAttributes(state,typeOrName){const type=getNodeType(typeOrName,state.schema),{from,to}=state.selection,nodes=[];state.doc.nodesBetween(from,to,node=>{nodes.push(node)});const node=nodes.reverse().find(nodeItem=>nodeItem.type.name===type.name);return node?{...node.attrs}:{}}function getAttributes(state,typeOrName){const schemaType=getSchemaTypeNameByName("string"==typeof typeOrName?typeOrName:typeOrName.name,state.schema);return"node"===schemaType?getNodeAttributes(state,typeOrName):"mark"===schemaType?getMarkAttributes(state,typeOrName):{}}function removeDuplicates(array,by=JSON.stringify){const seen={};return array.filter(item=>{const key=by(item);return!Object.prototype.hasOwnProperty.call(seen,key)&&(seen[key]=!0)})}function getChangedRanges(transform){const{mapping,steps}=transform,changes=[];return mapping.maps.forEach((stepMap,index)=>{const ranges=[];if(stepMap.ranges.length)stepMap.forEach((from,to)=>{ranges.push({from,to})});else{const{from,to}=steps[index];if(void 0===from||void 0===to)return;ranges.push({from,to})}ranges.forEach(({from,to})=>{const newStart=mapping.slice(index).map(from,-1),newEnd=mapping.slice(index).map(to),oldStart=mapping.invert().map(newStart,-1),oldEnd=mapping.invert().map(newEnd);changes.push({oldRange:{from:oldStart,to:oldEnd},newRange:{from:newStart,to:newEnd}})})}),function simplifyChangedRanges(changes){const uniqueChanges=removeDuplicates(changes);return 1===uniqueChanges.length?uniqueChanges:uniqueChanges.filter((change,index)=>!uniqueChanges.filter((_,i)=>i!==index).some(otherChange=>change.oldRange.from>=otherChange.oldRange.from&&change.oldRange.to<=otherChange.oldRange.to&&change.newRange.from>=otherChange.newRange.from&&change.newRange.to<=otherChange.newRange.to))}(changes)}function getMarksBetween(from,to,doc){const marks=[];return from===to?doc.resolve(from).marks().forEach(mark=>{const range=getMarkRange(doc.resolve(from),mark.type);range&&marks.push({mark,...range})}):doc.nodesBetween(from,to,(node,pos)=>{node&&void 0!==(null==node?void 0:node.nodeSize)&&marks.push(...node.marks.map(mark=>({from:pos,to:pos+node.nodeSize,mark})))}),marks}function getSchemaTypeByName(name,schema){return schema.nodes[name]||schema.marks[name]||null}function getSplittedAttributes(extensionAttributes,typeName,attributes){return Object.fromEntries(Object.entries(attributes).filter(([name])=>{const extensionAttribute=extensionAttributes.find(item=>item.type===typeName&&item.name===name);return!!extensionAttribute&&extensionAttribute.attribute.keepOnSplit}))}const getTextContentFromNodes=($from,maxMatch=500)=>{let textBefore="";const sliceEndPos=$from.parentOffset;return $from.parent.nodesBetween(Math.max(0,sliceEndPos-maxMatch),sliceEndPos,(node,pos,parent,index)=>{var _node$type$spec$toTex,_node$type$spec;const chunk=(null===(_node$type$spec$toTex=(_node$type$spec=node.type.spec).toText)||void 0===_node$type$spec$toTex?void 0:_node$type$spec$toTex.call(_node$type$spec,{node,pos,parent,index}))||node.textContent||"%leaf%";textBefore+=node.isAtom&&!node.isText?chunk:chunk.slice(0,Math.max(0,sliceEndPos-pos))}),textBefore};function isMarkActive(state,typeOrName,attributes={}){const{empty,ranges}=state.selection,type=typeOrName?getMarkType(typeOrName,state.schema):null;if(empty)return!!(state.storedMarks||state.selection.$from.marks()).filter(mark=>!type||type.name===mark.type.name).find(mark=>objectIncludes(mark.attrs,attributes,{strict:!1}));let selectionRange=0;const markRanges=[];if(ranges.forEach(({$from,$to})=>{const from=$from.pos,to=$to.pos;state.doc.nodesBetween(from,to,(node,pos)=>{if(type&&node.inlineContent&&!node.type.allowsMarkType(type))return!1;if(!node.isText&&!node.marks.length)return;const relativeFrom=Math.max(from,pos),relativeTo=Math.min(to,pos+node.nodeSize);selectionRange+=relativeTo-relativeFrom,markRanges.push(...node.marks.map(mark=>({mark,from:relativeFrom,to:relativeTo})))})}),0===selectionRange)return!1;const matchedRange=markRanges.filter(markRange=>!type||type.name===markRange.mark.type.name).filter(markRange=>objectIncludes(markRange.mark.attrs,attributes,{strict:!1})).reduce((sum,markRange)=>sum+markRange.to-markRange.from,0),excludedRange=markRanges.filter(markRange=>!type||markRange.mark.type!==type&&markRange.mark.type.excludes(type)).reduce((sum,markRange)=>sum+markRange.to-markRange.from,0);return(matchedRange>0?matchedRange+excludedRange:matchedRange)>=selectionRange}function isActive(state,name,attributes={}){if(!name)return isNodeActive(state,null,attributes)||isMarkActive(state,null,attributes);const schemaType=getSchemaTypeNameByName(name,state.schema);return"node"===schemaType?isNodeActive(state,name,attributes):"mark"===schemaType&&isMarkActive(state,name,attributes)}function isExtensionRulesEnabled(extension,enabled){return Array.isArray(enabled)?enabled.some(enabledExtension=>("string"==typeof enabledExtension?enabledExtension:enabledExtension.name)===extension.name):enabled}function isList(name,extensions){const{nodeExtensions}=splitExtensions(extensions),extension=nodeExtensions.find(item=>item.name===name);if(!extension)return!1;const group=callOrReturn(getExtensionField(extension,"group",{name:extension.name,options:extension.options,storage:extension.storage}));return"string"==typeof group&&group.split(" ").includes("list")}function isNodeEmpty(node,{checkChildren=!0,ignoreWhitespace=!1}={}){if(ignoreWhitespace){if("hardBreak"===node.type.name)return!0;var _node$text;if(node.isText)return!/\S/.test(null!==(_node$text=node.text)&&void 0!==_node$text?_node$text:"")}if(node.isText)return!node.text;if(node.isAtom||node.isLeaf)return!1;if(0===node.content.childCount)return!0;if(checkChildren){let isContentEmpty=!0;return node.content.forEach(childNode=>{!1!==isContentEmpty&&(isNodeEmpty(childNode,{ignoreWhitespace,checkChildren})||(isContentEmpty=!1))}),isContentEmpty}return!1}function isProseMirrorStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;return"function"==typeof step.apply&&"function"==typeof step.getMap&&"function"==typeof step.invert&&"function"==typeof step.map&&"function"==typeof step.merge&&"function"==typeof step.toJSON}function isProseMirrorFragment(value){if(null===value||"object"!=typeof value)return!1;const fragment=value;return!(!Array.isArray(fragment.content)||"number"!=typeof fragment.size||"function"!=typeof fragment.nodesBetween||"function"!=typeof fragment.descendants||"function"!=typeof fragment.textBetween||"function"!=typeof fragment.append||"function"!=typeof fragment.cut||"function"!=typeof fragment.eq||"function"!=typeof fragment.child||"function"!=typeof fragment.forEach)}var MappablePosition=class MappablePosition{constructor(position){this.position=position}static fromJSON(json){return new MappablePosition(json.position)}toJSON(){return{position:this.position}}};function getUpdatedPosition(position,transaction){const mapResult=transaction.mapping.mapResult(position.position);return{position:new MappablePosition(mapResult.pos),mapResult}}function createMappablePosition(position){return new MappablePosition(position)}function rewriteUnknownContentInner({json,validMarks,validNodes,options,rewrittenContent=[]}){return json.marks&&Array.isArray(json.marks)&&(json.marks=json.marks.filter(mark=>{if(null==mark)return!1;const name="string"==typeof mark?mark:mark.type;return!!validMarks.has(name)||(rewrittenContent.push({original:JSON.parse(JSON.stringify(mark)),unsupported:name}),!1)})),json.content&&Array.isArray(json.content)&&(json.content=json.content.map(value=>null==value?null:rewriteUnknownContentInner({json:value,validMarks,validNodes,options,rewrittenContent}).json).filter(a=>null!=a)),json.type&&!validNodes.has(json.type)?(rewrittenContent.push({original:JSON.parse(JSON.stringify(json)),unsupported:json.type}),json.content&&Array.isArray(json.content)&&!1!==(null==options?void 0:options.fallbackToParagraph)?(json.type="paragraph",{json,rewrittenContent}):{json:null,rewrittenContent}):{json,rewrittenContent}}const setMark=(typeOrName,attributes={})=>({tr,state,dispatch})=>{const{selection}=tr,{empty,ranges}=selection,type=getMarkType(typeOrName,state.schema);if(dispatch)if(empty){const oldAttributes=getMarkAttributes(state,type);tr.addStoredMark(type.create({...oldAttributes,...attributes}))}else ranges.forEach(range=>{const from=range.$from.pos,to=range.$to.pos;state.doc.nodesBetween(from,to,(node,pos)=>{const trimmedFrom=Math.max(pos,from),trimmedTo=Math.min(pos+node.nodeSize,to);node.marks.find(mark=>mark.type===type)?node.marks.forEach(mark=>{type===mark.type&&tr.addMark(trimmedFrom,trimmedTo,type.create({...mark.attrs,...attributes}))}):tr.addMark(trimmedFrom,trimmedTo,type.create(attributes))})});return function canSetMark(state,tr,newMarkType){const{selection}=tr;let cursor=null;if(isTextSelection(selection)&&(cursor=selection.$cursor),cursor){var _state$storedMarks;const currentMarks=null!==(_state$storedMarks=state.storedMarks)&&void 0!==_state$storedMarks?_state$storedMarks:cursor.marks();return cursor.parent.type.allowsMarkType(newMarkType)&&(!!newMarkType.isInSet(currentMarks)||!currentMarks.some(mark=>mark.type.excludes(newMarkType)))}const{ranges}=selection;return ranges.some(({$from,$to})=>{let someNodeSupportsMark=0===$from.depth&&state.doc.inlineContent&&state.doc.type.allowsMarkType(newMarkType);return state.doc.nodesBetween($from.pos,$to.pos,(node,_pos,parent)=>{if(someNodeSupportsMark)return!1;if(node.isInline){const parentAllowsMarkType=!parent||parent.type.allowsMarkType(newMarkType),currentMarksAllowMarkType=!!newMarkType.isInSet(node.marks)||!node.marks.some(otherMark=>otherMark.type.excludes(newMarkType));someNodeSupportsMark=parentAllowsMarkType&&currentMarksAllowMarkType}return!someNodeSupportsMark}),someNodeSupportsMark})}(state,tr,type)},setMeta=(key,value)=>({tr})=>(tr.setMeta(key,value),!0),setNode=(typeOrName,attributes={})=>({state,dispatch,chain})=>{const type=getNodeType(typeOrName,state.schema);let attributesToCopy;return state.selection.$anchor.sameParent(state.selection.$head)&&(attributesToCopy=state.selection.$anchor.parent.attrs),type.isTextblock?chain().command(({commands})=>!!(0,_tiptap_pm_commands.setBlockType)(type,{...attributesToCopy,...attributes})(state)||commands.clearNodes()).command(({state:updatedState})=>(0,_tiptap_pm_commands.setBlockType)(type,{...attributesToCopy,...attributes})(updatedState,dispatch)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection=position=>({tr,dispatch})=>{if(dispatch){const{doc}=tr,from=minMax(position,0,doc.content.size),selection=_tiptap_pm_state.NodeSelection.create(doc,from);tr.setSelection(selection)}return!0},setTextDirection=(direction,position)=>({tr,state,dispatch})=>{const{selection}=state;let from,to;return"number"==typeof position?(from=position,to=position):position&&"from"in position&&"to"in position?(from=position.from,to=position.to):(from=selection.from,to=selection.to),dispatch&&tr.doc.nodesBetween(from,to,(node,pos)=>{node.isText||tr.setNodeMarkup(pos,void 0,{...node.attrs,dir:direction})}),!0},setTextSelection=position=>({tr,dispatch})=>{if(dispatch){const{doc}=tr,{from,to}="number"==typeof position?{from:position,to:position}:position,minPos=_tiptap_pm_state.TextSelection.atStart(doc).from,maxPos=_tiptap_pm_state.TextSelection.atEnd(doc).to,resolvedFrom=minMax(from,minPos,maxPos),resolvedEnd=minMax(to,minPos,maxPos),selection=_tiptap_pm_state.TextSelection.create(doc,resolvedFrom,resolvedEnd);tr.setSelection(selection)}return!0},sinkListItem=typeOrName=>({state,dispatch})=>{const type=getNodeType(typeOrName,state.schema);return(0,_tiptap_pm_schema_list.sinkListItem)(type)(state,dispatch)};function ensureMarks(state,splittableMarks){const marks=state.storedMarks||state.selection.$to.parentOffset&&state.selection.$from.marks();if(marks){const filteredMarks=marks.filter(mark=>null==splittableMarks?void 0:splittableMarks.includes(mark.type.name));state.tr.ensureMarks(filteredMarks)}}const splitBlock=({keepMarks=!0}={})=>({tr,state,dispatch,editor})=>{const{selection,doc}=tr,{$from,$to}=selection,newAttributes=getSplittedAttributes(editor.extensionManager.attributes,$from.node().type.name,$from.node().attrs);if(selection instanceof _tiptap_pm_state.NodeSelection&&selection.node.isBlock)return!(!$from.parentOffset||!(0,_tiptap_pm_transform.canSplit)(doc,$from.pos))&&(dispatch&&(keepMarks&&ensureMarks(state,editor.extensionManager.splittableMarks),tr.split($from.pos).scrollIntoView()),!0);if(!$from.parent.isBlock)return!1;const atEnd=$to.parentOffset===$to.parent.content.size,deflt=0===$from.depth?void 0:defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));let types=atEnd&&deflt?[{type:deflt,attrs:newAttributes}]:void 0,can=(0,_tiptap_pm_transform.canSplit)(tr.doc,tr.mapping.map($from.pos),1,types);if(types||can||!(0,_tiptap_pm_transform.canSplit)(tr.doc,tr.mapping.map($from.pos),1,deflt?[{type:deflt}]:void 0)||(can=!0,types=deflt?[{type:deflt,attrs:newAttributes}]:void 0),dispatch){if(can&&(selection instanceof _tiptap_pm_state.TextSelection&&tr.deleteSelection(),tr.split(tr.mapping.map($from.pos),1,types),deflt&&!atEnd&&!$from.parentOffset&&$from.parent.type!==deflt)){const first=tr.mapping.map($from.before()),$first=tr.doc.resolve(first);$from.node(-1).canReplaceWith($first.index(),$first.index()+1,deflt)&&tr.setNodeMarkup(tr.mapping.map($from.before()),deflt)}keepMarks&&ensureMarks(state,editor.extensionManager.splittableMarks),tr.scrollIntoView()}return can},splitListItem=(typeOrName,overrideAttrs={})=>({tr,state,dispatch,editor})=>{const type=getNodeType(typeOrName,state.schema),{$from,$to}=state.selection,node=state.selection.node;if(node&&node.isBlock||$from.depth<2||!$from.sameParent($to))return!1;const grandParent=$from.node(-1);if(grandParent.type!==type)return!1;const extensionAttributes=editor.extensionManager.attributes;if(0===$from.parent.content.size&&$from.node(-1).childCount===$from.indexAfter(-1)){if(2===$from.depth||$from.node(-3).type!==type||$from.index(-2)!==$from.node(-2).childCount-1)return!1;if(dispatch){var _type$contentMatch$de;let wrap=_tiptap_pm_model.Fragment.empty;const depthBefore=$from.index(-1)?1:$from.index(-2)?2:3;for(let d=$from.depth-depthBefore;d>=$from.depth-3;d-=1)wrap=_tiptap_pm_model.Fragment.from($from.node(d).copy(wrap));const depthAfter=$from.indexAfter(-1)<$from.node(-2).childCount?1:$from.indexAfter(-2)<$from.node(-3).childCount?2:3,newNextTypeAttributes={...getSplittedAttributes(extensionAttributes,$from.node().type.name,$from.node().attrs),...overrideAttrs},nextType=(null===(_type$contentMatch$de=type.contentMatch.defaultType)||void 0===_type$contentMatch$de?void 0:_type$contentMatch$de.createAndFill(newNextTypeAttributes))||void 0;wrap=wrap.append(_tiptap_pm_model.Fragment.from(type.createAndFill(null,nextType)||void 0));const start=$from.before($from.depth-(depthBefore-1));tr.replace(start,$from.after(-depthAfter),new _tiptap_pm_model.Slice(wrap,4-depthBefore,0));let sel=-1;tr.doc.nodesBetween(start,tr.doc.content.size,(n,pos)=>{if(sel>-1)return!1;n.isTextblock&&0===n.content.size&&(sel=pos+1)}),sel>-1&&tr.setSelection(_tiptap_pm_state.TextSelection.near(tr.doc.resolve(sel))),tr.scrollIntoView()}return!0}const nextType=$to.pos===$from.end()?grandParent.contentMatchAt(0).defaultType:null,newTypeAttributes={...getSplittedAttributes(extensionAttributes,grandParent.type.name,grandParent.attrs),...overrideAttrs},newNextTypeAttributes={...getSplittedAttributes(extensionAttributes,$from.node().type.name,$from.node().attrs),...overrideAttrs};tr.delete($from.pos,$to.pos);const types=nextType?[{type,attrs:newTypeAttributes},{type:nextType,attrs:newNextTypeAttributes}]:[{type,attrs:newTypeAttributes}];if(!(0,_tiptap_pm_transform.canSplit)(tr.doc,$from.pos,2))return!1;if(dispatch){const{selection,storedMarks}=state,{splittableMarks}=editor.extensionManager,marks=storedMarks||selection.$to.parentOffset&&selection.$from.marks();if(tr.split($from.pos,2,types).scrollIntoView(),!marks||!dispatch)return!0;const filteredMarks=marks.filter(mark=>splittableMarks.includes(mark.type.name));tr.ensureMarks(filteredMarks)}return!0};function normalizeListType(type){return type&&"1"!==type?type:null}function areListTypesCompatible(typeA,typeB){return normalizeListType(typeA)===normalizeListType(typeB)}const joinListBackwards=(tr,listType)=>{const list=findParentNode(node=>node.type===listType)(tr.selection);if(!list)return!0;const before=tr.doc.resolve(Math.max(0,list.pos-1)).before(list.depth);if(void 0===before)return!0;const nodeBefore=tr.doc.nodeAt(before);return list.node.type!==(null==nodeBefore?void 0:nodeBefore.type)||!(0,_tiptap_pm_transform.canJoin)(tr.doc,list.pos)||(!areListTypesCompatible(list.node.attrs.type,null==nodeBefore?void 0:nodeBefore.attrs.type)||(tr.join(list.pos),!0))},joinListForwards=(tr,listType)=>{const list=findParentNode(node=>node.type===listType)(tr.selection);if(!list)return!0;const after=tr.doc.resolve(list.start).after(list.depth);if(void 0===after)return!0;const nodeAfter=tr.doc.nodeAt(after);return list.node.type!==(null==nodeAfter?void 0:nodeAfter.type)||!(0,_tiptap_pm_transform.canJoin)(tr.doc,after)||(!areListTypesCompatible(list.node.attrs.type,null==nodeAfter?void 0:nodeAfter.attrs.type)||(tr.join(after),!0))};const toggleList=(listTypeOrName,itemTypeOrName,keepMarks,attributes={})=>({editor,tr,state,dispatch,chain,commands,can})=>{const{extensions,splittableMarks}=editor.extensionManager,listType=getNodeType(listTypeOrName,state.schema),itemType=getNodeType(itemTypeOrName,state.schema),{selection,storedMarks}=state,{$from,$to}=selection,range=$from.blockRange($to),marks=storedMarks||selection.$to.parentOffset&&selection.$from.marks();if(!range)return!1;const parentList=findParentNode(node=>isList(node.type.name,extensions))(selection),isAllSelection=0===selection.from&&selection.to===state.doc.content.size,topLevelNodes=state.doc.content.content,soleTopLevelNode=1===topLevelNodes.length?topLevelNodes[0]:null,allSelectionList=isAllSelection&&soleTopLevelNode&&isList(soleTopLevelNode.type.name,extensions)?{node:soleTopLevelNode,pos:0,depth:0}:null,currentList=null!=parentList?parentList:allSelectionList,hasWholeDocSelectedList=!!allSelectionList;if((!!parentList&&range.depth>=1&&range.depth-parentList.depth<=1||hasWholeDocSelectedList)&&currentList){if(currentList.node.type===listType)return isAllSelection&&hasWholeDocSelectedList?chain().command(({tr:trx,dispatch:disp})=>{const nextSelection=function createInnerSelectionForWholeDocList(tr){const doc=tr.doc,list=doc.firstChild;if(!list)return null;const $start=doc.resolve(1),$end=doc.resolve(list.nodeSize-1);return _tiptap_pm_state.TextSelection.between($start,$end)}(trx);return!!nextSelection&&(trx.setSelection(nextSelection),disp&&disp(trx),!0)}).liftListItem(itemType).run():commands.liftListItem(itemType);if(isList(currentList.node.type.name,extensions)&&listType.validContent(currentList.node.content))return chain().command(()=>(tr.setNodeMarkup(currentList.pos,listType),!0)).command(()=>joinListBackwards(tr,listType)).command(()=>joinListForwards(tr,listType)).run()}return keepMarks&&marks&&dispatch?chain().command(()=>{const canWrapInList=can().wrapInList(listType,attributes),filteredMarks=marks.filter(mark=>splittableMarks.includes(mark.type.name));return tr.ensureMarks(filteredMarks),!!canWrapInList||commands.clearNodes()}).wrapInList(listType,attributes).command(()=>joinListBackwards(tr,listType)).command(()=>joinListForwards(tr,listType)).run():chain().command(()=>!!can().wrapInList(listType,attributes)||commands.clearNodes()).wrapInList(listType,attributes).command(()=>joinListBackwards(tr,listType)).command(()=>joinListForwards(tr,listType)).run()},toggleMark=(typeOrName,attributes={},options={})=>({state,commands})=>{const{extendEmptyMarkRange=!1}=options,type=getMarkType(typeOrName,state.schema);return isMarkActive(state,type,attributes)?commands.unsetMark(type,{extendEmptyMarkRange}):commands.setMark(type,attributes)},toggleNode=(typeOrName,toggleTypeOrName,attributes={})=>({state,commands})=>{const type=getNodeType(typeOrName,state.schema),toggleType=getNodeType(toggleTypeOrName,state.schema),isActive=isNodeActive(state,type,attributes);let attributesToCopy;return state.selection.$anchor.sameParent(state.selection.$head)&&(attributesToCopy=state.selection.$anchor.parent.attrs),isActive?commands.setNode(toggleType,attributesToCopy):commands.setNode(type,{...attributesToCopy,...attributes})},toggleWrap=(typeOrName,attributes={})=>({state,commands})=>{const type=getNodeType(typeOrName,state.schema);return isNodeActive(state,type,attributes)?commands.lift(type):commands.wrapIn(type,attributes)},undoInputRule=()=>({state,dispatch})=>{const plugins=state.plugins;for(let i=0;i<plugins.length;i+=1){const plugin=plugins[i];let undoable;if(plugin.spec.isInputRules&&(undoable=plugin.getState(state))){if(dispatch){const tr=state.tr,toUndo=undoable.transform;for(let j=toUndo.steps.length-1;j>=0;j-=1)tr.step(toUndo.steps[j].invert(toUndo.docs[j]));if(undoable.text){const marks=tr.doc.resolve(undoable.from).marks();tr.replaceWith(undoable.from,undoable.to,state.schema.text(undoable.text,marks))}else tr.delete(undoable.from,undoable.to)}return!0}}return!1},unsetAllMarks=(options={})=>({tr,dispatch,editor})=>{const{ignoreClearable=!1}=options,{selection}=tr,{empty,ranges}=selection;if(empty)return!0;const{nonClearableMarks}=editor.extensionManager;if(dispatch){const clearableMarkTypes=Object.values(editor.schema.marks).filter(markType=>ignoreClearable||!nonClearableMarks.includes(markType.name));ranges.forEach(range=>{for(const markType of clearableMarkTypes)tr.removeMark(range.$from.pos,range.$to.pos,markType)})}return!0},unsetMark=(typeOrName,options={})=>({tr,state,dispatch})=>{const{extendEmptyMarkRange=!1}=options,{selection}=tr,type=getMarkType(typeOrName,state.schema),{$from,empty,ranges}=selection;if(!dispatch)return!0;if(empty&&extendEmptyMarkRange){var _$from$marks$find;let{from,to}=selection;const range=getMarkRange($from,type,null===(_$from$marks$find=$from.marks().find(mark=>mark.type===type))||void 0===_$from$marks$find?void 0:_$from$marks$find.attrs);range&&(from=range.from,to=range.to),tr.removeMark(from,to,type)}else ranges.forEach(range=>{tr.removeMark(range.$from.pos,range.$to.pos,type)});return tr.removeStoredMark(type),!0},unsetTextDirection=position=>({tr,state,dispatch})=>{const{selection}=state;let from,to;return"number"==typeof position?(from=position,to=position):position&&"from"in position&&"to"in position?(from=position.from,to=position.to):(from=selection.from,to=selection.to),dispatch&&tr.doc.nodesBetween(from,to,(node,pos)=>{if(node.isText)return;const newAttrs={...node.attrs};delete newAttrs.dir,tr.setNodeMarkup(pos,void 0,newAttrs)}),!0},updateAttributes=(typeOrName,attributes={})=>({tr,state,dispatch})=>{let nodeType=null,markType=null;const schemaType=getSchemaTypeNameByName("string"==typeof typeOrName?typeOrName:typeOrName.name,state.schema);if(!schemaType)return!1;"node"===schemaType&&(nodeType=getNodeType(typeOrName,state.schema)),"mark"===schemaType&&(markType=getMarkType(typeOrName,state.schema));let canUpdate=!1;return tr.selection.ranges.forEach(range=>{const from=range.$from.pos,to=range.$to.pos;let lastPos,lastNode,trimmedFrom,trimmedTo;tr.selection.empty?state.doc.nodesBetween(from,to,(node,pos)=>{nodeType&&nodeType===node.type&&(canUpdate=!0,trimmedFrom=Math.max(pos,from),trimmedTo=Math.min(pos+node.nodeSize,to),lastPos=pos,lastNode=node)}):state.doc.nodesBetween(from,to,(node,pos)=>{pos<from&&nodeType&&nodeType===node.type&&(canUpdate=!0,trimmedFrom=Math.max(pos,from),trimmedTo=Math.min(pos+node.nodeSize,to),lastPos=pos,lastNode=node),pos>=from&&pos<=to&&(nodeType&&nodeType===node.type&&(canUpdate=!0,dispatch&&tr.setNodeMarkup(pos,void 0,{...node.attrs,...attributes})),markType&&node.marks.length&&node.marks.forEach(mark=>{if(markType===mark.type&&(canUpdate=!0,dispatch)){const trimmedFrom2=Math.max(pos,from),trimmedTo2=Math.min(pos+node.nodeSize,to);tr.addMark(trimmedFrom2,trimmedTo2,markType.create({...mark.attrs,...attributes}))}}))}),lastNode&&(void 0!==lastPos&&dispatch&&tr.setNodeMarkup(lastPos,void 0,{...lastNode.attrs,...attributes}),markType&&lastNode.marks.length&&lastNode.marks.forEach(mark=>{markType===mark.type&&dispatch&&tr.addMark(trimmedFrom,trimmedTo,markType.create({...mark.attrs,...attributes}))}))}),canUpdate},DECORATION_MANAGER_PLUGIN_KEY=new _tiptap_pm_state.PluginKey("__tiptap_decorations__"),updateDecorations=extensionName=>({tr,dispatch})=>(dispatch&&tr.setMeta(DECORATION_MANAGER_PLUGIN_KEY,{type:"force",name:extensionName}),!0),wrapIn=(typeOrName,attributes={})=>({state,dispatch})=>{const type=getNodeType(typeOrName,state.schema);return(0,_tiptap_pm_commands.wrapIn)(type,attributes)(state,dispatch)},wrapInList=(typeOrName,attributes={})=>({state,dispatch})=>{const type=getNodeType(typeOrName,state.schema);return(0,_tiptap_pm_schema_list.wrapInList)(type,attributes)(state,dispatch)};var commands_exports=__exportAll({blur:()=>blur,clearContent:()=>clearContent,clearNodes:()=>clearNodes,command:()=>command,createParagraphNear:()=>createParagraphNear,cut:()=>cut,deleteCurrentNode:()=>deleteCurrentNode,deleteNode:()=>deleteNode,deleteRange:()=>deleteRange,deleteSelection:()=>deleteSelection,enter:()=>enter,exitCode:()=>exitCode,extendMarkRange:()=>extendMarkRange,first:()=>first,focus:()=>focus,forEach:()=>forEach,insertContent:()=>insertContent,insertContentAt:()=>insertContentAt,insertDefaultBlock:()=>insertDefaultBlock,joinBackward:()=>joinBackward,joinDown:()=>joinDown,joinForward:()=>joinForward,joinItemBackward:()=>joinItemBackward,joinItemForward:()=>joinItemForward,joinTextblockBackward:()=>joinTextblockBackward,joinTextblockForward:()=>joinTextblockForward,joinUp:()=>joinUp,keyboardShortcut:()=>keyboardShortcut,lift:()=>lift,liftEmptyBlock:()=>liftEmptyBlock,liftListItem:()=>liftListItem,newlineInCode:()=>newlineInCode,resetAttributes:()=>resetAttributes,scrollIntoView:()=>scrollIntoView,selectAll:()=>selectAll,selectNodeBackward:()=>selectNodeBackward,selectNodeForward:()=>selectNodeForward,selectParentNode:()=>selectParentNode,selectTextblockEnd:()=>selectTextblockEnd,selectTextblockStart:()=>selectTextblockStart,setContent:()=>setContent,setMark:()=>setMark,setMeta:()=>setMeta,setNode:()=>setNode,setNodeSelection:()=>setNodeSelection,setTextDirection:()=>setTextDirection,setTextSelection:()=>setTextSelection,sinkListItem:()=>sinkListItem,splitBlock:()=>splitBlock,splitListItem:()=>splitListItem,toggleList:()=>toggleList,toggleMark:()=>toggleMark,toggleNode:()=>toggleNode,toggleWrap:()=>toggleWrap,undoInputRule:()=>undoInputRule,unsetAllMarks:()=>unsetAllMarks,unsetMark:()=>unsetMark,unsetTextDirection:()=>unsetTextDirection,updateAttributes:()=>updateAttributes,updateDecorations:()=>updateDecorations,wrapIn:()=>wrapIn,wrapInList:()=>wrapInList});const depthByEditor=new WeakMap;var EventEmitter=class{constructor(){this.callbacks={}}on(event,fn){return this.callbacks[event]||(this.callbacks[event]=[]),this.callbacks[event].push(fn),this}emit(event,...args){const callbacks=this.callbacks[event];return callbacks&&callbacks.forEach(callback=>callback.apply(this,args)),this}off(event,fn){const callbacks=this.callbacks[event];return callbacks&&(fn?this.callbacks[event]=callbacks.filter(callback=>callback!==fn):delete this.callbacks[event]),this}once(event,fn){const onceFn=(...args)=>{this.off(event,onceFn),fn.apply(this,args)};return this.on(event,onceFn)}removeAllListeners(){this.callbacks={}}};const isDev=void 0!==process&&!1;function isWidgetDecoration(decoration){return"widget"===decoration.kind}function decorationsToPMDecorations(decorations,extensionName){const pmDecorations=[],widgetKeys=new Set;for(const decoration of decorations)"widget"===decoration.kind&&isWidgetDecoration(decoration)&&widgetKeys.add(decoration.key),pmDecorations.push(decoration.toPMDecoration(extensionName));return{decorations:pmDecorations,widgetKeys}}function rangeOwnsPosition({position,from,to,docSize}){return!(position<from)&&(position<to||position===to&&to===docSize)}function filterOutOfRangeDecorations({decorations,from,to,docSize,extensionName,warnedExtensions}){return decorations.filter(decoration=>!!rangeOwnsPosition({position:decoration.anchor,from,to,docSize})||(decoration.anchor===to||warnedExtensions.has(extensionName)||(warnedExtensions.add(extensionName),console.warn(`[tiptap warn]: Extension "${extensionName}" returned a decoration outside the requested range [${from}, ${to}). It was ignored.`)),!1))}function widgetKeyOf(decoration){var _decoration$spec;const key=null===(_decoration$spec=decoration.spec)||void 0===_decoration$spec?void 0:_decoration$spec.key;return"string"==typeof key?key:void 0}function isAttrStep(step){return"attr"===step.jsonID}function blockRangeFor(doc,changed){let from=null,to=0,nodeStart=0;for(let index=0;index<doc.childCount&&!(nodeStart>changed.to);index+=1){const nodeEnd=nodeStart+doc.child(index).nodeSize;nodeEnd>=changed.from&&(null===from&&(from=nodeStart),to=nodeEnd),nodeStart=nodeEnd}return null===from?null:{from,to}}function getRebuildRanges(tr,doc){if(tr.steps.some(step=>!function hasResolvableChangedRange(step){let hasMappedRange=!1;if(step.getMap().forEach(()=>{hasMappedRange=!0}),hasMappedRange||isAttrStep(step))return!0;const positionalStep=step;return"number"==typeof positionalStep.from&&"number"==typeof positionalStep.to}(step)))return{type:"full"};const newRanges=getChangedRanges(tr).map(({newRange})=>newRange);tr.steps.forEach((step,index)=>{if(!isAttrStep(step))return;const mapping=tr.mapping.slice(index);newRanges.push({from:mapping.map(step.pos,-1),to:mapping.map(step.pos+1)})});const ranges=[];for(const newRange of newRanges){const blockRange=blockRangeFor(doc,newRange);blockRange&&ranges.push(blockRange)}ranges.sort((a,b)=>a.from-b.from);const merged=[];for(const range of ranges){const last=merged[merged.length-1];last&&range.from<=last.to?last.to=Math.max(last.to,range.to):merged.push({...range})}return{type:"ranges",ranges:merged}}function mapDecorationSet(set,mapping,doc,widgetKeys){return set.map(mapping,doc,{onRemove:removedSpec=>{const key=null==removedSpec?void 0:removedSpec.key;"string"==typeof key&&widgetKeys.delete(key)}})}function mapDecorations(name,previous,tr){var _previous$decorationS,_previous$widgetKeysB;const previousSet=null!==(_previous$decorationS=previous.decorationSetsByExtension[name])&&void 0!==_previous$decorationS?_previous$decorationS:_tiptap_pm_view.DecorationSet.empty,widgetKeys=new Set(null!==(_previous$widgetKeysB=previous.widgetKeysByExtension[name])&&void 0!==_previous$widgetKeysB?_previous$widgetKeysB:[]);return{set:mapDecorationSet(previousSet,tr.mapping,tr.doc,widgetKeys),widgetKeys}}function mergeDecorationSets(doc,decorationSetsByExtension){const allDecorations=Object.values(decorationSetsByExtension).flatMap(set=>set.find());return _tiptap_pm_view.DecorationSet.create(doc,allDecorations)}function unionWidgetKeys(widgetKeysByExtension){const merged=new Set;for(const keys of Object.values(widgetKeysByExtension))for(const key of keys)merged.add(key);return merged}function shouldRecomputeDecoration(spec,props,forced){return!!forced||"manual"!==spec.update&&(spec.shouldUpdate?spec.shouldUpdate(props):props.tr.docChanged)}const EMPTY_KEYS=new Set;function liveWidgetKeys(editor){var _editor$extensionMana,_editor$extensionMana2;return null!==(_editor$extensionMana=null===(_editor$extensionMana2=editor.extensionManager)||void 0===_editor$extensionMana2||null===(_editor$extensionMana2=_editor$extensionMana2.decorationManager)||void 0===_editor$extensionMana2?void 0:_editor$extensionMana2.liveWidgetKeys())&&void 0!==_editor$extensionMana?_editor$extensionMana:EMPTY_KEYS}var DecorationManager=class{constructor(options){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState})=>{const state=DECORATION_MANAGER_PLUGIN_KEY.getState(nextState);state&&this.warnDuplicateWidgetKeys(state)},this.editor=options.editor,this.entries=this.resolveEntries(options.entries),this.entries.forEach(({name,spec})=>function validateDecorationSpec(name,spec){var _update;switch(null!==(_update=spec.update)&&void 0!==_update?_update:"document"){case"document":if(spec.createInRange)throw new Error(`[tiptap error]: Extension "${name}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!spec.createInRange)throw new Error(`[tiptap error]: Extension "${name}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(spec.createInRange)throw new Error(`[tiptap error]: Extension "${name}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(spec.shouldUpdate)throw new Error(`[tiptap error]: Extension "${name}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${name}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}(name,spec)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var _DECORATION_MANAGER_P,_DECORATION_MANAGER_P2;return null!==(_DECORATION_MANAGER_P=null===(_DECORATION_MANAGER_P2=DECORATION_MANAGER_PLUGIN_KEY.getState(this.editor.state))||void 0===_DECORATION_MANAGER_P2?void 0:_DECORATION_MANAGER_P2.widgetKeys)&&void 0!==_DECORATION_MANAGER_P?_DECORATION_MANAGER_P:EMPTY_KEYS}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(entries){const resolved=[];for(const{name,addDecorations}of entries){const spec=addDecorations();spec&&resolved.push({name,spec})}return resolved}createPlugin(){const{editor,entries}=this;return new _tiptap_pm_state.Plugin({key:DECORATION_MANAGER_PLUGIN_KEY,state:{init:(_config,state)=>{const decorationSetsByExtension={},widgetKeysByExtension={};for(const{name,spec}of entries){const{set,widgetKeys}=this.buildFullSet(name,spec,state);decorationSetsByExtension[name]=set,widgetKeysByExtension[name]=widgetKeys}const managerState={decorationSetsByExtension,widgetKeysByExtension,mergedDecorationSet:this.buildMergedSet(state.doc,decorationSetsByExtension),widgetKeys:unionWidgetKeys(widgetKeysByExtension)};return this.warnDuplicateWidgetKeys(managerState),managerState},apply:(tr,previous,oldState,newState)=>{const meta=tr.getMeta(DECORATION_MANAGER_PLUGIN_KEY),forceAll="force"===(null==meta?void 0:meta.type)&&!meta.name,forceName="force"===(null==meta?void 0:meta.type)?meta.name:void 0,decorationSetsByExtension={},widgetKeysByExtension={},recomputedNames=new Set;return function runInDecorationApplyScope(editor,callback){var _depthByEditor$get;depthByEditor.set(editor,(null!==(_depthByEditor$get=depthByEditor.get(editor))&&void 0!==_depthByEditor$get?_depthByEditor$get:0)+1);try{return callback()}finally{var _depthByEditor$get2;const remaining=(null!==(_depthByEditor$get2=depthByEditor.get(editor))&&void 0!==_depthByEditor$get2?_depthByEditor$get2:1)-1;remaining>0?depthByEditor.set(editor,remaining):depthByEditor.delete(editor)}}(editor,()=>{for(const{name,spec}of entries){const forced=forceAll||forceName===name;if(shouldRecomputeDecoration(spec,{editor,tr,oldState,newState},forced))if("changedRanges"===spec.update&&tr.docChanged&&!forced){const result=this.applyChangedRangesRecompute(name,spec,previous,tr,newState);decorationSetsByExtension[name]=result.set,widgetKeysByExtension[name]=result.widgetKeys,recomputedNames.add(name)}else{const{set,widgetKeys}=this.buildFullSet(name,spec,newState);decorationSetsByExtension[name]=set,widgetKeysByExtension[name]=widgetKeys,recomputedNames.add(name)}else{const result=mapDecorations(name,previous,tr);decorationSetsByExtension[name]=result.set,widgetKeysByExtension[name]=result.widgetKeys}}}),0!==recomputedNames.size||tr.docChanged?{decorationSetsByExtension,widgetKeysByExtension,mergedDecorationSet:this.mergeAfterApply({entries,previous,tr,decorationSetsByExtension,recomputedNames}),widgetKeys:unionWidgetKeys(widgetKeysByExtension)}:previous}},props:{decorations(state){var _DECORATION_MANAGER_P3,_DECORATION_MANAGER_P4;return null!==(_DECORATION_MANAGER_P3=null===(_DECORATION_MANAGER_P4=DECORATION_MANAGER_PLUGIN_KEY.getState(state))||void 0===_DECORATION_MANAGER_P4?void 0:_DECORATION_MANAGER_P4.mergedDecorationSet)&&void 0!==_DECORATION_MANAGER_P3?_DECORATION_MANAGER_P3:_tiptap_pm_view.DecorationSet.empty}}})}applyChangedRangesRecompute(name,spec,previous,tr,newState){const resolution=getRebuildRanges(tr,newState.doc);return"full"===resolution.type?this.buildFullSet(name,spec,newState):this.rebuildRanges(name,spec,previous,tr,newState,resolution.ranges)}rebuildRanges(name,spec,previous,tr,newState,ranges){var _previous$decorationS,_previous$widgetKeysB;const previousSet=null!==(_previous$decorationS=previous.decorationSetsByExtension[name])&&void 0!==_previous$decorationS?_previous$decorationS:_tiptap_pm_view.DecorationSet.empty,widgetKeys=new Set(null!==(_previous$widgetKeysB=previous.widgetKeysByExtension[name])&&void 0!==_previous$widgetKeysB?_previous$widgetKeysB:[]);let set=mapDecorationSet(previousSet,tr.mapping,tr.doc,widgetKeys);const docSize=newState.doc.content.size;for(const{from,to}of ranges){const stale=set.find(from,to).filter(decoration=>rangeOwnsPosition({position:decoration.from,from,to,docSize}));for(const decoration of stale){const key=widgetKeyOf(decoration);key&&widgetKeys.delete(key)}set=set.remove(stale);const{decorations:pmDecorations,widgetKeys:addedKeys}=decorationsToPMDecorations(filterOutOfRangeDecorations({decorations:this.runCreate(name,"createInRange",()=>spec.createInRange({editor:this.editor,state:newState,view:this.mountedView,from,to})),from,to,docSize,extensionName:name,warnedExtensions:this.warnedOutOfRangeExtensions}),name);set=set.add(newState.doc,pmDecorations);for(const key of addedKeys)widgetKeys.add(key)}return{set,widgetKeys}}buildFullSet(name,spec,state){const decorations=this.runCreate(name,"create",()=>spec.create({editor:this.editor,state,view:this.mountedView}));return function buildDecorationSet(doc,decorations,extensionName){const{decorations:pmDecorations,widgetKeys}=decorationsToPMDecorations(decorations,extensionName);return{set:_tiptap_pm_view.DecorationSet.create(doc,pmDecorations),widgetKeys}}(state.doc,decorations,name)}runCreate(name,method,create){try{return create()}catch(error){return console.error(`[tiptap error]: Extension "${name}" threw in \`addDecorations().${method}()\`. Its decorations were dropped for this update.`,error),[]}}warnDuplicateWidgetKeys(state){if(!isDev)return;if(0===state.widgetKeys.size)return void this.warnedWidgetKeys.clear();const duplicateKeys=function findDuplicateWidgetKeys(decorationSet){const extensionsByKey=new Map,counts=new Map;for(const decoration of decorationSet.find()){var _extensionName,_extensionsByKey$get,_counts$get;const key=widgetKeyOf(decoration);if(!key)continue;const extension=null!==(_extensionName=decoration.spec.extensionName)&&void 0!==_extensionName?_extensionName:"unknown",extensions=null!==(_extensionsByKey$get=extensionsByKey.get(key))&&void 0!==_extensionsByKey$get?_extensionsByKey$get:new Set;extensions.add(extension),extensionsByKey.set(key,extensions),counts.set(key,(null!==(_counts$get=counts.get(key))&&void 0!==_counts$get?_counts$get:0)+1)}return Array.from(extensionsByKey,([key,extensions])=>({key,extensions})).filter(({key})=>{var _counts$get2;return(null!==(_counts$get2=counts.get(key))&&void 0!==_counts$get2?_counts$get2:0)>1})}(state.mergedDecorationSet),nextWarningKeys=new Set(duplicateKeys.map(({key})=>key));for(const{key,extensions}of duplicateKeys){if(this.warnedWidgetKeys.has(key))continue;const names=Array.from(extensions).map(name=>`"${name}"`).join(", ");console.warn(`[tiptap warn]: Duplicate widget decoration key "${key}" in extension${1===extensions.size?"":"s"} ${names}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=nextWarningKeys}buildMergedSet(doc,decorationSetsByExtension){const names=Object.keys(decorationSetsByExtension);return 1===names.length?decorationSetsByExtension[names[0]]:mergeDecorationSets(doc,decorationSetsByExtension)}mergeAfterApply({entries,previous,tr,decorationSetsByExtension,recomputedNames}){return 1===entries.length?decorationSetsByExtension[entries[0].name]:0===recomputedNames.size?previous.mergedDecorationSet.map(tr.mapping,tr.doc):mergeDecorationSets(tr.doc,decorationSetsByExtension)}};function attrsEqual(a,b){if(a===b)return!0;if(!a||!b)return!1;const keysA=Object.keys(a),keysB=Object.keys(b);return keysA.length===keysB.length&&keysA.every(key=>Object.prototype.hasOwnProperty.call(b,key)&&Object.is(a[key],b[key]))}function createStyleTag(style,nonce,suffix){const tiptapStyleTag=document.querySelector(`style[data-tiptap-style${suffix?`-${suffix}`:""}]`);if(null!==tiptapStyleTag)return tiptapStyleTag;const styleNode=document.createElement("style");return nonce&&styleNode.setAttribute("nonce",nonce),styleNode.setAttribute("data-tiptap-style"+(suffix?`-${suffix}`:""),""),styleNode.innerHTML=style,document.getElementsByTagName("head")[0].appendChild(styleNode),styleNode}function isNumber(value){return"number"==typeof value}function isPlainObject(value){return"Object"===function getType(value){return Object.prototype.toString.call(value).slice(8,-1)}(value)&&(value.constructor===Object&&Object.getPrototypeOf(value)===Object.prototype)}function isWhitespace(character){return/\s/.test(character)}function isWordCharacter(character){return/^\w$/.test(character)}function skipWhitespace(input,index){for(;index<input.length&&isWhitespace(input[index]);)index+=1;return index}function skipToWhitespace(input,index){for(;index<input.length&&!isWhitespace(input[index]);)index+=1;return index}function readName(input,index,allowHyphen){for(;index<input.length&&(isWordCharacter(input[index])||allowHyphen&&"-"===input[index]);)index+=1;return index}function readNamedAttribute(input,index,syntax){const isPandoc="pandoc"===syntax,nameEnd=readName(input,index+1,isPandoc),name=input.slice(index,nameEnd),keyValue=function readKeyValue(input,name,index,allowWhitespace){let valueStart=allowWhitespace?skipWhitespace(input,index):index;if("="!==input[valueStart])return;valueStart=allowWhitespace?skipWhitespace(input,valueStart+1):valueStart+1;const quote=input[valueStart];if('"'!==quote&&"'"!==quote)return;const valueEnd=input.indexOf(quote,valueStart+1);return-1!==valueEnd?{token:{type:"keyValue",name,value:input.slice(valueStart+1,valueEnd)},nextIndex:skipToWhitespace(input,valueEnd+1)}:void 0}(input,name,nameEnd,isPandoc);if(keyValue)return keyValue;const isStandalone=nameEnd===input.length||isWhitespace(input[nameEnd]);return{token:isPandoc&&isStandalone?{type:"boolean",name}:void 0,nextIndex:"shortcode"===syntax?skipToWhitespace(input,nameEnd):nameEnd}}function readAttribute(input,index,syntax){const prefix=input[index];return"pandoc"!==syntax||"."!==prefix&&"#"!==prefix?'"'===prefix||"'"===prefix?function readQuotedSegment(input,index){const closingQuote=input.indexOf(input[index],index+1);return{nextIndex:skipToWhitespace(input,-1===closingQuote?index:closingQuote+1)}}(input,index):("pandoc"===syntax?function isAsciiLetter(character){return/^[a-zA-Z]$/.test(character)}(prefix):isWordCharacter(prefix))?readNamedAttribute(input,index,syntax):{nextIndex:skipToWhitespace(input,index)}:function readShorthand(input,index){const prefix=input[index],nameStart=index+1,nameEnd=readName(input,nameStart,!0);return nameEnd===nameStart?{nextIndex:skipToWhitespace(input,nameEnd)}:{token:{type:"."===prefix?"class":"id",name:input.slice(nameStart,nameEnd)},nextIndex:skipToWhitespace(input,nameEnd)}}(input,index)}function tokenizeAttributes(input,syntax){const tokens=[];let index=0;for(;index<input.length&&(index=skipWhitespace(input,index),!(index>=input.length));){const result=readAttribute(input,index,syntax);result.token&&tokens.push(result.token),index=result.nextIndex}return tokens}function parseAttributes(attrString){return(null==attrString?void 0:attrString.trim())?function applyTokens(tokens){const attributes={},classes=tokens.filter(token=>"class"===token.type).map(token=>token.name),id=tokens.find(token=>"id"===token.type);return classes.length>0&&(attributes.class=classes.join(" ")),id&&(attributes.id=id.name),tokens.forEach(token=>{"keyValue"===token.type&&(attributes[token.name]=token.value)}),tokens.forEach(token=>{"boolean"===token.type&&(attributes[token.name]=!0)}),attributes}(tokenizeAttributes(attrString,"pandoc")):{}}function serializeAttributes(attributes){if(!attributes||0===Object.keys(attributes).length)return"";const parts=[];return attributes.class&&String(attributes.class).split(/\s+/).filter(Boolean).forEach(className=>parts.push(`.${className}`)),attributes.id&&parts.push(`#${attributes.id}`),Object.entries(attributes).forEach(([key,value])=>{"class"!==key&&"id"!==key&&(!0===value?parts.push(key):!1!==value&&null!=value&&parts.push(`${key}="${String(value)}"`))}),parts.join(" ")}function createAtomBlockMarkdownSpec(options){const{nodeName,name:markdownName,parseAttributes:parseAttributes$2=parseAttributes,serializeAttributes:serializeAttributes$2=serializeAttributes,defaultAttributes={},requiredAttributes=[],allowedAttributes}=options,blockName=markdownName||nodeName;return{parseMarkdown:(token,h)=>{const attrs={...defaultAttributes,...token.attributes};return h.createNode(nodeName,attrs,[])},markdownTokenizer:{name:nodeName,level:"block",start(src){var _src$match;const regex=new RegExp(`^:::${blockName}(?:\\s|$)`,"m"),index=null===(_src$match=src.match(regex))||void 0===_src$match?void 0:_src$match.index;return void 0!==index?index:-1},tokenize(src,_tokens,_lexer){const regex=new RegExp(`^:::${blockName}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),match=src.match(regex);if(!match)return;const attrString=match[1]||"",attributes=parseAttributes$2(attrString);return requiredAttributes.find(required=>!(required in attributes))?void 0:{type:nodeName,raw:match[0],attributes}}},renderMarkdown:node=>{const filteredAttrs=(attrs=>{if(!allowedAttributes)return attrs;const filtered={};return allowedAttributes.forEach(key=>{key in attrs&&(filtered[key]=attrs[key])}),filtered})(node.attrs||{}),attrs=serializeAttributes$2(filteredAttrs);return`:::${blockName}${attrs?` {${attrs}}`:""} :::`}}}function createBlockMarkdownSpec(options){const{nodeName,name:markdownName,getContent,parseAttributes:parseAttributes$1=parseAttributes,serializeAttributes:serializeAttributes$1=serializeAttributes,defaultAttributes={},content="block",allowedAttributes}=options,blockName=markdownName||nodeName;return{parseMarkdown:(token,h)=>{let nodeContent;if(getContent){const contentResult=getContent(token);nodeContent="string"==typeof contentResult?[{type:"text",text:contentResult}]:contentResult}else nodeContent="block"===content?h.parseChildren(token.tokens||[]):h.parseInline(token.tokens||[]);const attrs={...defaultAttributes,...token.attributes};return h.createNode(nodeName,attrs,nodeContent)},markdownTokenizer:{name:nodeName,level:"block",start(src){var _src$match;const regex=new RegExp(`^:::${blockName}`,"m"),index=null===(_src$match=src.match(regex))||void 0===_src$match?void 0:_src$match.index;return void 0!==index?index:-1},tokenize(src,_tokens,lexer){const openingRegex=new RegExp(`^:::${blockName}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),openingMatch=src.match(openingRegex);if(!openingMatch)return;const[openingTag,attrString=""]=openingMatch,attributes=parseAttributes$1(attrString);let level=1;const position=openingTag.length;let matchedContent="";const blockPattern=/^:::([\w-]*)(\s.*)?/gm,remaining=src.slice(position);for(blockPattern.lastIndex=0;;){var _match$;const match=blockPattern.exec(remaining);if(null===match)break;const matchPos=match.index,blockType=match[1];if(!(null===(_match$=match[2])||void 0===_match$?void 0:_match$.endsWith(":::")))if(blockType)level+=1;else if(level-=1,0===level){const rawContent=remaining.slice(0,matchPos);matchedContent=rawContent.trim();const fullMatch=src.slice(0,position+matchPos+match[0].length);let contentTokens=[];if(matchedContent)if("block"===content)for(contentTokens=lexer.blockTokens(rawContent),contentTokens.forEach(token=>{!token.text||token.tokens&&0!==token.tokens.length||(token.tokens=lexer.inlineTokens(token.text))});contentTokens.length>0;){const lastToken=contentTokens[contentTokens.length-1];if("paragraph"!==lastToken.type||lastToken.text&&""!==lastToken.text.trim())break;contentTokens.pop()}else contentTokens=lexer.inlineTokens(matchedContent);return{type:nodeName,raw:fullMatch,attributes,content:matchedContent,tokens:contentTokens}}}}},renderMarkdown:(node,h)=>{const filteredAttrs=(attrs=>{if(!allowedAttributes)return attrs;const filtered={};return allowedAttributes.forEach(key=>{key in attrs&&(filtered[key]=attrs[key])}),filtered})(node.attrs||{}),attrs=serializeAttributes$1(filteredAttrs),attrString=attrs?` {${attrs}}`:"",renderedContent=h.renderChildren(node.content||[],"\n\n");return`:::${blockName}${attrString}\n\n${renderedContent}\n\n:::`}}}function parseShortcodeAttributes(attrString){const attributes={};return tokenizeAttributes(attrString,"shortcode").forEach(token=>{"keyValue"===token.type&&(attributes[token.name]=token.value)}),attributes}function serializeShortcodeAttributes(attrs){return Object.entries(attrs).filter(([,value])=>null!=value).map(([key,value])=>`${key}="${value}"`).join(" ")}function createInlineMarkdownSpec(options){const{nodeName,name:shortcodeName,getContent,parseAttributes=parseShortcodeAttributes,serializeAttributes=serializeShortcodeAttributes,defaultAttributes={},selfClosing=!1,allowedAttributes}=options,shortcode=shortcodeName||nodeName,escapedShortcode=shortcode.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(token,h)=>{const attrs={...defaultAttributes,...token.attributes};if(selfClosing)return h.createNode(nodeName,attrs);const content=getContent?getContent(token):token.content||"";return content?h.createNode(nodeName,attrs,[h.createTextNode(content)]):h.createNode(nodeName,attrs,[])},markdownTokenizer:{name:nodeName,level:"inline",start(src){const startPattern=selfClosing?new RegExp(`\\[${escapedShortcode}\\s*[^\\]]*\\]`):new RegExp(`\\[${escapedShortcode}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${escapedShortcode}\\]`),match=src.match(startPattern),index=null==match?void 0:match.index;return void 0!==index?index:-1},tokenize(src,_tokens,_lexer){const tokenPattern=selfClosing?new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${escapedShortcode}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${escapedShortcode}\\]`),match=src.match(tokenPattern);if(!match)return;let content="",attrString="";if(selfClosing){const[,attrs]=match;attrString=attrs}else{const[,attrs,contentMatch]=match;attrString=attrs,content=contentMatch||""}const attributes=parseAttributes(attrString.trim());return{type:nodeName,raw:match[0],content:content.trim(),attributes}}},renderMarkdown:node=>{let content="";getContent?content=getContent(node):node.content&&node.content.length>0&&(content=node.content.filter(child=>"text"===child.type).map(child=>child.text).join(""));const filteredAttrs=(attrs=>{if(!allowedAttributes)return attrs;const filtered={};return allowedAttributes.forEach(attr=>{const attrName="string"==typeof attr?attr:attr.name,skipIfDefault="string"==typeof attr?void 0:attr.skipIfDefault;if(attrName in attrs){const value=attrs[attrName];if(void 0!==skipIfDefault&&value===skipIfDefault)return;filtered[attrName]=value}}),filtered})(node.attrs||{}),attrs=serializeAttributes(filteredAttrs),attrString=attrs?` ${attrs}`:"";return selfClosing?`[${shortcode}${attrString}]`:`[${shortcode}${attrString}]${content}[/${shortcode}]`}}}function parseIndentedBlocks(src,config,lexer){const lines=src.split("\n"),items=[];let totalRaw="",i=0;const baseIndentSize=config.baseIndentSize||2;for(;i<lines.length;){const currentLine=lines[i],itemMatch=currentLine.match(config.itemPattern);if(!itemMatch){if(items.length>0)break;if(""===currentLine.trim()){i+=1,totalRaw=`${totalRaw}${currentLine}\n`;continue}return}const itemData=config.extractItemData(itemMatch),{indentLevel,mainContent}=itemData;totalRaw=`${totalRaw}${currentLine}\n`;const itemContent=[mainContent];for(i+=1;i<lines.length;){var _nextLine$match;const nextLine=lines[i];if(""===nextLine.trim()){var _nextNonEmpty$match;const nextNonEmptyIndex=lines.slice(i+1).findIndex(l=>""!==l.trim());if(-1===nextNonEmptyIndex)break;if(((null===(_nextNonEmpty$match=lines[i+1+nextNonEmptyIndex].match(/^(\s*)/))||void 0===_nextNonEmpty$match||null===(_nextNonEmpty$match=_nextNonEmpty$match[1])||void 0===_nextNonEmpty$match?void 0:_nextNonEmpty$match.length)||0)>indentLevel){itemContent.push(nextLine),totalRaw=`${totalRaw}${nextLine}\n`,i+=1;continue}break}if(!(((null===(_nextLine$match=nextLine.match(/^(\s*)/))||void 0===_nextLine$match||null===(_nextLine$match=_nextLine$match[1])||void 0===_nextLine$match?void 0:_nextLine$match.length)||0)>indentLevel))break;itemContent.push(nextLine),totalRaw=`${totalRaw}${nextLine}\n`,i+=1}let nestedTokens;const nestedContent=itemContent.slice(1);if(nestedContent.length>0){const dedentedNested=nestedContent.map(nestedLine=>nestedLine.slice(indentLevel+baseIndentSize)).join("\n");dedentedNested.trim()&&(nestedTokens=config.customNestedParser?config.customNestedParser(dedentedNested):lexer.blockTokens(dedentedNested))}const token=config.createToken(itemData,nestedTokens);items.push(token)}if(0!==items.length)return{items,raw:totalRaw}}function columnWidth(text){let width=0;for(const character of text)width="\t"===character?width+4-width%4:width+1;return width}function renderNestedMarkdownContent(node,h,prefixOrGenerator,ctx,options){if(!node||!Array.isArray(node.content))return"";const prefix="function"==typeof prefixOrGenerator?prefixOrGenerator(ctx):prefixOrGenerator,[content,...children]=node.content;let output=`${prefix}${h.renderChildren([content])}`;return children&&children.length>0&&children.forEach((child,index)=>{var _h$renderChild,_h$renderChild2;const childContent=null!==(_h$renderChild=null===(_h$renderChild2=h.renderChild)||void 0===_h$renderChild2?void 0:_h$renderChild2.call(h,child,index+1))&&void 0!==_h$renderChild?_h$renderChild:h.renderChildren([child]);if(null!=childContent){const indentLine=line=>{if(!(null==options?void 0:options.alignNestedToPrefix))return h.indent(line);const configured=h.indent(""),prefixWidth=columnWidth(prefix);return(columnWidth(configured)>=prefixWidth?configured:" ".repeat(prefixWidth))+line},indentedChild=childContent.split("\n").map(line=>indentLine(line||"")).join("\n");output+="paragraph"===child.type?`\n\n${indentedChild}`:`\n${indentedChild}`}}),output}var markdown_exports=__exportAll({createAtomBlockMarkdownSpec:()=>createAtomBlockMarkdownSpec,createBlockMarkdownSpec:()=>createBlockMarkdownSpec,createInlineMarkdownSpec:()=>createInlineMarkdownSpec,parseAttributes:()=>parseAttributes,parseIndentedBlocks:()=>parseIndentedBlocks,renderNestedMarkdownContent:()=>renderNestedMarkdownContent,serializeAttributes:()=>serializeAttributes});function markTypeName(mark){return"string"==typeof mark.type?mark.type:mark.type.name}function mergeDeep(target,source){const output={...target};return isPlainObject(target)&&isPlainObject(source)&&Object.keys(source).forEach(key=>{isPlainObject(source[key])&&isPlainObject(target[key])?output[key]=mergeDeep(target[key],source[key]):output[key]=source[key]}),output}function updateMarkViewAttributes(checkMark,editor,attrs={}){const{state}=editor,{doc,tr}=state,thisMark=checkMark;doc.descendants((node,pos)=>{const from=tr.mapping.map(pos),to=tr.mapping.map(pos)+node.nodeSize;let foundMark=null;if(node.marks.forEach(mark=>{if(mark!==thisMark)return!1;foundMark=mark}),!foundMark)return;let needsUpdate=!1;if(Object.keys(attrs).forEach(k=>{attrs[k]!==foundMark.attrs[k]&&(needsUpdate=!0)}),needsUpdate){const updatedMark=checkMark.type.create({...checkMark.attrs,...attrs});tr.removeMark(from,to,checkMark.type),tr.addMark(from,to,updatedMark)}}),tr.docChanged&&editor.view.dispatch(tr)}var InputRule=class{constructor(config){var _config$undoable;this.find=config.find,this.handler=config.handler,this.undoable=null===(_config$undoable=config.undoable)||void 0===_config$undoable||_config$undoable}};function run$1(config){var _ref;const{editor,from,to,text,rules,plugin}=config,{view}=editor;if(view.composing)return!1;const $from=view.state.doc.resolve(from);if($from.parent.type.spec.code||(null===(_ref=$from.nodeBefore||$from.nodeAfter)||void 0===_ref?void 0:_ref.marks.find(mark=>mark.type.spec.code)))return!1;let matched=!1;const textBefore=getTextContentFromNodes($from)+text;return rules.forEach(rule=>{if(matched)return;const match=((text,find)=>{if(isRegExp(find))return find.exec(text);const inputRuleMatch=find(text);if(!inputRuleMatch)return null;const result=[inputRuleMatch.text];return result.index=inputRuleMatch.index,result.input=text,result.data=inputRuleMatch.data,inputRuleMatch.replaceWith&&(inputRuleMatch.text.includes(inputRuleMatch.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),result.push(inputRuleMatch.replaceWith)),result})(textBefore,rule.find);if(!match)return;const matchedDocLength=match[0].length-text.length;if(matchedDocLength>0){const matchStartOffset=$from.parentOffset-matchedDocLength;if(matchStartOffset<0||$from.parent.textBetween(matchStartOffset,$from.parentOffset)!==match[0].slice(0,matchedDocLength))return}const tr=view.state.tr,state=createChainableState({state:view.state,transaction:tr}),range={from:from-(match[0].length-text.length),to},{commands,chain,can}=new CommandManager({editor,state});null!==rule.handler({state,range,match,commands,chain,can})&&tr.steps.length&&(rule.undoable&&tr.setMeta(plugin,{transform:tr,from,to,text}),view.dispatch(tr),matched=!0)}),matched}function inputRulesPlugin(props){const{editor,rules}=props,plugin=new _tiptap_pm_state.Plugin({state:{init:()=>null,apply(tr,prev,state){const stored=tr.getMeta(plugin);if(stored)return stored;const simulatedInputMeta=tr.getMeta("applyInputRules");return simulatedInputMeta&&setTimeout(()=>{let{text}=simulatedInputMeta;"string"==typeof text||(text=getHTMLFromFragment(_tiptap_pm_model.Fragment.from(text),state.schema));const{from}=simulatedInputMeta,to=from+text.length;run$1({editor,from,to,text,rules,plugin})}),tr.selectionSet||tr.docChanged?null:prev}},props:{handleTextInput:(view,from,to,text)=>run$1({editor,from,to,text,rules,plugin}),handleDOMEvents:{compositionend:view=>(setTimeout(()=>{const{$cursor}=view.state.selection;$cursor&&run$1({editor,from:$cursor.pos,to:$cursor.pos,text:"",rules,plugin})}),!1)},handleKeyDown(view,event){if("Enter"!==event.key)return!1;const{$cursor}=view.state.selection;return!!$cursor&&run$1({editor,from:$cursor.pos,to:$cursor.pos,text:"\n",rules,plugin})}},isInputRules:!0});return plugin}var Extendable=class{constructor(config={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...config},this.name=this.config.name}get options(){return{...callOrReturn(getExtensionField(this,"addOptions",{name:this.name}))}}get storage(){return{...callOrReturn(getExtensionField(this,"addStorage",{name:this.name,options:this.options}))}}configure(options={}){const extension=this.extend({...this.config,addOptions:()=>mergeDeep(this.options,options)});return extension.name=this.name,extension.parent=this.parent,this.child=null,extension}extend(extendedConfig={}){const extension=new this.constructor({...this.config,...extendedConfig});return extension.parent=this,this.child=extension,extension.name="name"in extendedConfig?extendedConfig.name:extension.parent.name,extension}},Mark=class Mark extends Extendable{constructor(..._args){super(..._args),this.type="mark"}static create(config={}){const resolvedConfig="function"==typeof config?config():config;return new Mark(resolvedConfig)}static handleExit({editor,mark}){const{tr}=editor.state,currentPos=editor.state.selection.$from;if(currentPos.pos===currentPos.end()){const currentMarks=currentPos.marks();if(!currentMarks.find(m=>(null==m?void 0:m.type.name)===mark.name))return!1;const removeMark=currentMarks.find(m=>(null==m?void 0:m.type.name)===mark.name);return removeMark&&tr.removeStoredMark(removeMark),tr.insertText(" ",currentPos.pos),editor.view.dispatch(tr),!0}return!1}configure(options){return super.configure(options)}extend(extendedConfig){const resolvedConfig="function"==typeof extendedConfig?extendedConfig():extendedConfig;return super.extend(resolvedConfig)}},PasteRule=class{constructor(config){this.find=config.find,this.handler=config.handler}};function run(config){const{editor,state,from,to,rule,pasteEvent,dropEvent}=config,{commands,chain,can}=new CommandManager({editor,state}),handlers=[];return state.doc.nodesBetween(from,to,(node,pos)=>{var _node$type,_ref,_node$content$size,_node$content;if((null===(_node$type=node.type)||void 0===_node$type||null===(_node$type=_node$type.spec)||void 0===_node$type?void 0:_node$type.code)||!(node.isText||node.isTextblock||node.isInline))return;const contentSize=null!==(_ref=null!==(_node$content$size=null===(_node$content=node.content)||void 0===_node$content?void 0:_node$content.size)&&void 0!==_node$content$size?_node$content$size:node.nodeSize)&&void 0!==_ref?_ref:0,resolvedFrom=Math.max(from,pos),resolvedTo=Math.min(to,pos+contentSize);if(resolvedFrom>=resolvedTo)return;((text,find,event)=>{if(isRegExp(find))return[...text.matchAll(find)];const matches=find(text,event);return matches?matches.map(pasteRuleMatch=>{const result=[pasteRuleMatch.text];return result.index=pasteRuleMatch.index,result.input=text,result.data=pasteRuleMatch.data,pasteRuleMatch.replaceWith&&(pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),result.push(pasteRuleMatch.replaceWith)),result}):[]})(node.isText?node.text||"":node.textBetween(resolvedFrom-pos,resolvedTo-pos,void 0,""),rule.find,pasteEvent).forEach(match=>{if(void 0===match.index)return;const start=resolvedFrom+match.index+1,end=start+match[0].length,range={from:state.tr.mapping.map(start),to:state.tr.mapping.map(end)},handler=rule.handler({state,range,match,commands,chain,can,pasteEvent,dropEvent});handlers.push(handler)})}),handlers.every(handler=>null!==handler)}let tiptapDragFromOtherEditor=null;function pasteRulesPlugin(props){const{editor,rules}=props;let dropEvent,dragSourceElement=null,isPastedFromProseMirror=!1,isDroppedFromProseMirror=!1,pasteEvent="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{dropEvent="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{dropEvent=null}const processEvent=({state,from,to,rule,pasteEvt})=>{const tr=state.tr,chainableState=createChainableState({state,transaction:tr});if(run({editor,state:chainableState,from:Math.max(from-1,0),to:to.b-1,rule,pasteEvent:pasteEvt,dropEvent})&&tr.steps.length){try{dropEvent="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{dropEvent=null}return pasteEvent="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,tr}};return rules.map(rule=>new _tiptap_pm_state.Plugin({view(view){const handleDragstart=event=>{var _view$dom$parentEleme;dragSourceElement=(null===(_view$dom$parentEleme=view.dom.parentElement)||void 0===_view$dom$parentEleme?void 0:_view$dom$parentEleme.contains(event.target))?view.dom.parentElement:null,dragSourceElement&&(tiptapDragFromOtherEditor=editor)},handleDragend=()=>{tiptapDragFromOtherEditor&&(tiptapDragFromOtherEditor=null)};return window.addEventListener("dragstart",handleDragstart),window.addEventListener("dragend",handleDragend),{destroy(){window.removeEventListener("dragstart",handleDragstart),window.removeEventListener("dragend",handleDragend)}}},props:{handleDOMEvents:{drop:(view,event)=>{if(isDroppedFromProseMirror=dragSourceElement===view.dom.parentElement,dropEvent=event,!isDroppedFromProseMirror){const dragFromOtherEditor=tiptapDragFromOtherEditor;(null==dragFromOtherEditor?void 0:dragFromOtherEditor.isEditable)&&setTimeout(()=>{const selection=dragFromOtherEditor.state.selection;selection&&dragFromOtherEditor.commands.deleteRange({from:selection.from,to:selection.to})},10)}return!1},paste:(_view,event)=>{var _clipboardData;const html=null===(_clipboardData=event.clipboardData)||void 0===_clipboardData?void 0:_clipboardData.getData("text/html");return pasteEvent=event,isPastedFromProseMirror=!!(null==html?void 0:html.includes("data-pm-slice")),!1}}},appendTransaction:(transactions,oldState,state)=>{const transaction=transactions[0],isPaste="paste"===transaction.getMeta("uiEvent")&&!isPastedFromProseMirror,isDrop="drop"===transaction.getMeta("uiEvent")&&!isDroppedFromProseMirror,simulatedPasteMeta=transaction.getMeta("applyPasteRules"),isSimulatedPaste=!!simulatedPasteMeta;if(!isPaste&&!isDrop&&!isSimulatedPaste)return;if(isSimulatedPaste){let{text}=simulatedPasteMeta;"string"==typeof text||(text=getHTMLFromFragment(_tiptap_pm_model.Fragment.from(text),state.schema));const{from}=simulatedPasteMeta,to=from+text.length,pasteEvt=(text=>{var _event$clipboardData;const event=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(_event$clipboardData=event.clipboardData)||void 0===_event$clipboardData||_event$clipboardData.setData("text/html",text),event})(text);return processEvent({rule,state,from,to:{b:to},pasteEvt})}const from=oldState.doc.content.findDiffStart(state.doc.content),to=oldState.doc.content.findDiffEnd(state.doc.content);return isNumber(from)&&to&&from!==to.b?processEvent({rule,state,from,to,pasteEvt:pasteEvent}):void 0}}))}var ExtensionManager=class{constructor(extensions,editor){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=editor,this.baseExtensions=extensions,this.extensions=resolveExtensions(extensions),this.schema=getSchemaByResolvedExtensions(this.extensions,editor),this.setupExtensions()}get commands(){return this.extensions.reduce((commands,extension)=>{const addCommands=getExtensionField(extension,"addCommands",{name:extension.name,options:extension.options,storage:this.editor.extensionStorage[extension.name],editor:this.editor,type:getSchemaTypeByName(extension.name,this.schema)});return addCommands?{...commands,...addCommands()}:commands},{})}get plugins(){const{editor}=this,allPlugins=sortExtensions([...this.extensions].reverse()).flatMap(extension=>{const context={name:extension.name,options:extension.options,storage:this.editor.extensionStorage[extension.name],editor,type:getSchemaTypeByName(extension.name,this.schema)},plugins=[],addKeyboardShortcuts=getExtensionField(extension,"addKeyboardShortcuts",context);let defaultBindings={};if("mark"===extension.type&&getExtensionField(extension,"exitable",context)&&(defaultBindings.ArrowRight=()=>Mark.handleExit({editor,mark:extension})),addKeyboardShortcuts){const bindings=Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut,method])=>[shortcut,()=>method({editor})]));defaultBindings={...defaultBindings,...bindings}}const keyMapPlugin=(0,_tiptap_pm_keymap.keymap)(defaultBindings);plugins.push(keyMapPlugin);const addInputRules=getExtensionField(extension,"addInputRules",context);if(isExtensionRulesEnabled(extension,editor.options.enableInputRules)&&addInputRules){const rules=addInputRules();if(rules&&rules.length){const inputResult=inputRulesPlugin({editor,rules}),inputPlugins=Array.isArray(inputResult)?inputResult:[inputResult];plugins.push(...inputPlugins)}}const addPasteRules=getExtensionField(extension,"addPasteRules",context);if(isExtensionRulesEnabled(extension,editor.options.enablePasteRules)&&addPasteRules){const rules=addPasteRules();if(rules&&rules.length){const pasteRules=pasteRulesPlugin({editor,rules});plugins.push(...pasteRules)}}const addProseMirrorPlugins=getExtensionField(extension,"addProseMirrorPlugins",context);if(addProseMirrorPlugins){const proseMirrorPlugins=addProseMirrorPlugins();plugins.push(...proseMirrorPlugins)}return plugins}),decorationPlugin=this.createDecorationPlugin();return decorationPlugin&&allPlugins.push(decorationPlugin),allPlugins}createDecorationPlugin(){var _this$decorationManag;const{editor}=this;null===(_this$decorationManag=this.decorationManager)||void 0===_this$decorationManag||_this$decorationManag.destroy();const entries=[];return this.extensions.forEach(extension=>{const addDecorations=getExtensionField(extension,"addDecorations",{name:extension.name,options:extension.options,storage:this.editor.extensionStorage[extension.name],editor,type:getSchemaTypeByName(extension.name,this.schema)});addDecorations&&entries.push({name:extension.name,addDecorations})}),this.decorationManager=new DecorationManager({editor,entries}),this.decorationManager.plugin}get attributes(){return getAttributesFromExtensions(this.extensions)}get nodeViews(){const{editor}=this,{nodeExtensions}=splitExtensions(this.extensions);return Object.fromEntries(nodeExtensions.filter(extension=>!!getExtensionField(extension,"addNodeView")).map(extension=>{const extensionAttributes=this.attributes.filter(attribute=>attribute.type===extension.name),addNodeView=getExtensionField(extension,"addNodeView",{name:extension.name,options:extension.options,storage:this.editor.extensionStorage[extension.name],editor,type:getNodeType(extension.name,this.schema)});if(!addNodeView)return[];const nodeViewResult=addNodeView();if(!nodeViewResult)return[];return[extension.name,(node,view,getPos,decorations,innerDecorations)=>{const HTMLAttributes=getRenderedAttributes(node,extensionAttributes);return nodeViewResult({node,view,getPos,decorations,innerDecorations,editor,extension,HTMLAttributes})}]}))}dispatchTransaction(baseDispatch){const{editor}=this;return sortExtensions([...this.extensions].reverse()).reduceRight((next,extension)=>{const context={name:extension.name,options:extension.options,storage:this.editor.extensionStorage[extension.name],editor,type:getSchemaTypeByName(extension.name,this.schema)},dispatchTransaction=getExtensionField(extension,"dispatchTransaction",context);return dispatchTransaction?transaction=>{dispatchTransaction.call(context,{transaction,next})}:next},baseDispatch)}transformPastedHTML(baseTransform){const{editor}=this;return sortExtensions([...this.extensions]).reduce((transform,extension)=>{const context={name:extension.name,options:extension.options,storage:this.editor.extensionStorage[extension.name],editor,type:getSchemaTypeByName(extension.name,this.schema)},extensionTransform=getExtensionField(extension,"transformPastedHTML",context);return extensionTransform?(html,view)=>{const transformedHtml=transform(html,view);return extensionTransform.call(context,transformedHtml)}:transform},baseTransform||(html=>html))}get markViews(){const{editor}=this,{markExtensions}=splitExtensions(this.extensions);return Object.fromEntries(markExtensions.filter(extension=>!!getExtensionField(extension,"addMarkView")).map(extension=>{const extensionAttributes=this.attributes.filter(attribute=>attribute.type===extension.name),addMarkView=getExtensionField(extension,"addMarkView",{name:extension.name,options:extension.options,storage:this.editor.extensionStorage[extension.name],editor,type:getMarkType(extension.name,this.schema)});if(!addMarkView)return[];return[extension.name,(mark,view,inline)=>{const HTMLAttributes=getRenderedAttributes(mark,extensionAttributes);return addMarkView()({mark,view,inline,editor,extension,HTMLAttributes,updateAttributes:attrs=>{updateMarkViewAttributes(mark,editor,attrs)}})}]}))}destroy(){var _this$decorationManag2;null===(_this$decorationManag2=this.decorationManager)||void 0===_this$decorationManag2||_this$decorationManag2.destroy(),this.extensions.forEach(extension=>{let current=extension;for(;current.parent;){const parent=current.parent;parent.child===current&&(parent.child=null),current=parent}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const extensions=this.extensions;this.editor.extensionStorage=Object.fromEntries(extensions.map(extension=>[extension.name,extension.storage])),extensions.forEach(extension=>{const context={name:extension.name,options:extension.options,storage:this.editor.extensionStorage[extension.name],editor:this.editor,type:getSchemaTypeByName(extension.name,this.schema)};var _callOrReturn,_callOrReturn2;"mark"===extension.type&&((null===(_callOrReturn=callOrReturn(getExtensionField(extension,"keepOnSplit",context)))||void 0===_callOrReturn||_callOrReturn)&&this.splittableMarks.push(extension.name),null===(_callOrReturn2=callOrReturn(getExtensionField(extension,"clearable",context)))||void 0===_callOrReturn2||_callOrReturn2||this.nonClearableMarks.push(extension.name));const onBeforeCreate=getExtensionField(extension,"onBeforeCreate",context),onCreate=getExtensionField(extension,"onCreate",context),onUpdate=getExtensionField(extension,"onUpdate",context),onSelectionUpdate=getExtensionField(extension,"onSelectionUpdate",context),onTransaction=getExtensionField(extension,"onTransaction",context),onFocus=getExtensionField(extension,"onFocus",context),onBlur=getExtensionField(extension,"onBlur",context),onDestroy=getExtensionField(extension,"onDestroy",context);onBeforeCreate&&this.editor.on("beforeCreate",onBeforeCreate),onCreate&&this.editor.on("create",onCreate),onUpdate&&this.editor.on("update",onUpdate),onSelectionUpdate&&this.editor.on("selectionUpdate",onSelectionUpdate),onTransaction&&this.editor.on("transaction",onTransaction),onFocus&&this.editor.on("focus",onFocus),onBlur&&this.editor.on("blur",onBlur),onDestroy&&this.editor.on("destroy",onDestroy)})}};ExtensionManager.resolve=resolveExtensions,ExtensionManager.sort=sortExtensions,ExtensionManager.flatten=flattenExtensions;var Extension=class Extension extends Extendable{constructor(..._args){super(..._args),this.type="extension"}static create(config={}){const resolvedConfig="function"==typeof config?config():config;return new Extension(resolvedConfig)}configure(options){return super.configure(options)}extend(extendedConfig){const resolvedConfig="function"==typeof extendedConfig?extendedConfig():extendedConfig;return super.extend(resolvedConfig)}};const ClipboardTextSerializer=Extension.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor}=this,{state,schema}=editor,{doc,selection}=state,textSerializers=getTextSerializersFromSchema(schema),{blockSeparator}=this.options,options={...void 0!==blockSeparator?{blockSeparator}:{},textSerializers};return[...selection.ranges].sort((a,b)=>a.$from.pos-b.$from.pos).map(({$from,$to})=>getTextBetween(doc,{from:$from.pos,to:$to.pos},options)).join(null!=blockSeparator?blockSeparator:"\n\n")}}})]}}),Commands=Extension.create({name:"commands",addCommands:()=>({...commands_exports})}),Delete=Extension.create({name:"delete",onUpdate({transaction,appendedTransactions}){var _this$editor$options$4,_this$editor$options$5;const callback=()=>{var _this$editor$options$,_this$editor$options$2,_this$editor$options$3;if(null!==(_this$editor$options$=null===(_this$editor$options$2=this.editor.options.coreExtensionOptions)||void 0===_this$editor$options$2||null===(_this$editor$options$2=_this$editor$options$2.delete)||void 0===_this$editor$options$2||null===(_this$editor$options$3=_this$editor$options$2.filterTransaction)||void 0===_this$editor$options$3?void 0:_this$editor$options$3.call(_this$editor$options$2,transaction))&&void 0!==_this$editor$options$?_this$editor$options$:transaction.getMeta("y-sync$"))return;const nextTransaction=combineTransactionSteps(transaction.before,[transaction,...appendedTransactions]);getChangedRanges(nextTransaction).forEach(change=>{nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter&&nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore&&nextTransaction.before.nodesBetween(change.oldRange.from,change.oldRange.to,(node,from)=>{const to=from+node.nodeSize-2,isFullyWithinRange=change.oldRange.from<=from&&to<=change.oldRange.to;this.editor.emit("delete",{type:"node",node,from,to,newFrom:nextTransaction.mapping.map(from),newTo:nextTransaction.mapping.map(to),deletedRange:change.oldRange,newRange:change.newRange,partial:!isFullyWithinRange,editor:this.editor,transaction,combinedTransform:nextTransaction})})});const mapping=nextTransaction.mapping;nextTransaction.steps.forEach((step,index)=>{if(step instanceof _tiptap_pm_transform.RemoveMarkStep){var _nextTransaction$doc$,_nextTransaction$doc$2;const newStart=mapping.slice(index).map(step.from,-1),newEnd=mapping.slice(index).map(step.to),oldStart=mapping.invert().map(newStart,-1),oldEnd=mapping.invert().map(newEnd),foundBeforeMark=newStart>0&&(null===(_nextTransaction$doc$=nextTransaction.doc.nodeAt(newStart-1))||void 0===_nextTransaction$doc$?void 0:_nextTransaction$doc$.marks.some(mark=>mark.eq(step.mark))),foundAfterMark=null===(_nextTransaction$doc$2=nextTransaction.doc.nodeAt(newEnd))||void 0===_nextTransaction$doc$2?void 0:_nextTransaction$doc$2.marks.some(mark=>mark.eq(step.mark));this.editor.emit("delete",{type:"mark",mark:step.mark,from:step.from,to:step.to,deletedRange:{from:oldStart,to:oldEnd},newRange:{from:newStart,to:newEnd},partial:Boolean(foundAfterMark||foundBeforeMark),editor:this.editor,transaction,combinedTransform:nextTransaction})}})};null===(_this$editor$options$4=null===(_this$editor$options$5=this.editor.options.coreExtensionOptions)||void 0===_this$editor$options$5||null===(_this$editor$options$5=_this$editor$options$5.delete)||void 0===_this$editor$options$5?void 0:_this$editor$options$5.async)||void 0===_this$editor$options$4||_this$editor$options$4?setTimeout(callback,0):callback()}}),Drop=Extension.create({name:"drop",addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("tiptapDrop"),props:{handleDrop:(_,e,slice,moved)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice,moved})}}})]}}),Editable=Extension.create({name:"editable",addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),focusEventsPluginKey=new _tiptap_pm_state.PluginKey("focusEvents"),FocusEvents=Extension.create({name:"focusEvents",addProseMirrorPlugins(){const{editor}=this;return[new _tiptap_pm_state.Plugin({key:focusEventsPluginKey,props:{handleDOMEvents:{focus:(view,event)=>{editor.isFocused=!0;const transaction=editor.state.tr.setMeta("focus",{event}).setMeta("addToHistory",!1);return view.dispatch(transaction),!1},blur:(view,event)=>{editor.isFocused=!1;const transaction=editor.state.tr.setMeta("blur",{event}).setMeta("addToHistory",!1);return view.dispatch(transaction),!1}}}})]}}),Keymap=Extension.create({name:"keymap",addKeyboardShortcuts(){const handleBackspace=()=>this.editor.commands.first(({commands})=>[()=>commands.undoInputRule(),()=>commands.command(({tr})=>{const{selection,doc}=tr,{empty,$anchor}=selection,{pos,parent}=$anchor,$parentPos=$anchor.parent.isTextblock&&pos>0?tr.doc.resolve(pos-1):$anchor,parentIsIsolating=$parentPos.parent.type.spec.isolating,parentPos=$anchor.pos-$anchor.parentOffset,isAtStart=parentIsIsolating&&1===$parentPos.parent.childCount?parentPos===$anchor.pos:_tiptap_pm_state.Selection.atStart(doc).from===pos;return!(!empty||!parent.type.isTextblock||parent.textContent.length||!isAtStart||isAtStart&&"paragraph"===$anchor.parent.type.name)&&commands.clearNodes()}),()=>commands.deleteSelection(),()=>commands.joinBackward(),()=>commands.selectNodeBackward()]),handleDelete=()=>this.editor.commands.first(({commands})=>[()=>commands.deleteSelection(),()=>commands.deleteCurrentNode(),()=>commands.joinForward(),()=>commands.selectNodeForward()]),baseKeymap={Enter:()=>this.editor.commands.first(({commands})=>[()=>commands.newlineInCode(),()=>commands.createParagraphNear(),()=>commands.liftEmptyBlock(),()=>commands.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:handleBackspace,"Mod-Backspace":handleBackspace,"Shift-Backspace":handleBackspace,Delete:handleDelete,"Mod-Delete":handleDelete,"Mod-a":()=>this.editor.commands.selectAll()},pcKeymap={...baseKeymap},macKeymap={...baseKeymap,"Ctrl-h":handleBackspace,"Alt-Backspace":handleBackspace,"Ctrl-d":handleDelete,"Ctrl-Alt-Backspace":handleDelete,"Alt-Delete":handleDelete,"Alt-d":handleDelete,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return isiOS()||isMacOS()?macKeymap:pcKeymap},addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("clearDocument"),appendTransaction:(transactions,oldState,newState)=>{if(transactions.some(tr=>tr.getMeta("composition")))return;const docChanges=transactions.some(transaction=>transaction.docChanged)&&!oldState.doc.eq(newState.doc),ignoreTr=transactions.some(transaction=>transaction.getMeta("preventClearDocument"));if(!docChanges||ignoreTr)return;const{empty,from,to}=oldState.selection,allFrom=_tiptap_pm_state.Selection.atStart(oldState.doc).from,allEnd=_tiptap_pm_state.Selection.atEnd(oldState.doc).to;if(empty||from!==allFrom||to!==allEnd)return;if(!isNodeEmpty(newState.doc))return;const tr=newState.tr,state=createChainableState({state:newState,transaction:tr}),{commands}=new CommandManager({editor:this.editor,state});return commands.clearNodes(),tr.steps.length?tr:void 0}})]}}),Paste=Extension.create({name:"paste",addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("tiptapPaste"),props:{handlePaste:(_view,e,slice)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice})}}})]}}),Tabindex=Extension.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("tabindex"),props:{attributes:()=>{var _this$options$value;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!==(_this$options$value=this.options.value)&&void 0!==_this$options$value?_this$options$value:"0"}:{}}}})]}}),TextDirection=Extension.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions}=splitExtensions(this.extensions);return[{types:nodeExtensions.filter(extension=>"text"!==extension.name).map(extension=>extension.name),attributes:{dir:{default:this.options.direction,parseHTML:element=>{const dir=element.getAttribute("dir");return!dir||"ltr"!==dir&&"rtl"!==dir&&"auto"!==dir?this.options.direction:dir},renderHTML:attributes=>attributes.dir?{dir:attributes.dir}:{}}}}]},addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("textDirection"),props:{attributes:()=>{const direction=this.options.direction;return direction?{dir:direction}:{}}}})]}});var extensions_exports=__exportAll({ClipboardTextSerializer:()=>ClipboardTextSerializer,Commands:()=>Commands,Delete:()=>Delete,Drop:()=>Drop,Editable:()=>Editable,FocusEvents:()=>FocusEvents,Keymap:()=>Keymap,Paste:()=>Paste,Tabindex:()=>Tabindex,TextDirection:()=>TextDirection,focusEventsPluginKey:()=>focusEventsPluginKey});let hasChecked=!1;var NodePos=class NodePos{get name(){return this.node.type.name}constructor(pos,editor,isBlock=!1,node=null){this.currentNode=null,this.actualDepth=null,this.isBlock=isBlock,this.resolvedPos=pos,this.editor=editor,this.currentNode=node}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var _this$actualDepth;return null!==(_this$actualDepth=this.actualDepth)&&void 0!==_this$actualDepth?_this$actualDepth:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(content){let from=this.from,to=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);from=this.from+1,to=this.to-1}this.editor.commands.insertContentAt({from,to},content)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const parentPos=this.resolvedPos.start(this.resolvedPos.depth-1),$pos=this.resolvedPos.doc.resolve(parentPos);return new NodePos($pos,this.editor)}get before(){let $pos=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return $pos.depth!==this.depth&&($pos=this.resolvedPos.doc.resolve(this.from-3)),new NodePos($pos,this.editor)}get after(){let $pos=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return $pos.depth!==this.depth&&($pos=this.resolvedPos.doc.resolve(this.to+3)),new NodePos($pos,this.editor)}get children(){const children=[];return this.node.content.forEach((node,offset)=>{const isBlock=node.isBlock&&!node.isTextblock,isNonTextAtom=node.isAtom&&!node.isText,isInline=node.isInline,targetPos=this.pos+offset+(isNonTextAtom?0:1);if(targetPos<0||targetPos>this.resolvedPos.doc.nodeSize-2)return;const $pos=this.resolvedPos.doc.resolve(targetPos);if(!isBlock&&!isInline&&$pos.depth<=this.depth)return;const childNodePos=new NodePos($pos,this.editor,isBlock,isBlock||isInline?node:null);isBlock&&(childNodePos.actualDepth=this.depth+1),children.push(childNodePos)}),children}get firstChild(){return this.children[0]||null}get lastChild(){const children=this.children;return children[children.length-1]||null}closest(selector,attributes={}){let node=null,currentNode=this.parent;for(;currentNode&&!node;){if(currentNode.node.type.name===selector)if(Object.keys(attributes).length>0){const nodeAttributes=currentNode.node.attrs,attrKeys=Object.keys(attributes);for(let index=0;index<attrKeys.length;index+=1){const key=attrKeys[index];if(nodeAttributes[key]!==attributes[key])break}}else node=currentNode;currentNode=currentNode.parent}return node}querySelector(selector,attributes={}){return this.querySelectorAll(selector,attributes,!0)[0]||null}querySelectorAll(selector,attributes={},firstItemOnly=!1){let nodes=[];if(!this.children||0===this.children.length)return nodes;const attrKeys=Object.keys(attributes);return this.children.forEach(childPos=>{firstItemOnly&&nodes.length>0||(childPos.node.type.name===selector&&attrKeys.every(key=>attributes[key]===childPos.node.attrs[key])&&nodes.push(childPos),firstItemOnly&&nodes.length>0||(nodes=nodes.concat(childPos.querySelectorAll(selector,attributes,firstItemOnly))))}),nodes}setAttribute(attributes){const{tr}=this.editor.state;tr.setNodeMarkup(this.from,void 0,{...this.node.attrs,...attributes}),this.editor.view.dispatch(tr)}};var Decoration=class{static Inline(from,to,attrs={},spec){return new InlineDecoration(from,to,attrs,spec)}static Node(pos,to,attrs={},spec){return new NodeDecoration(pos,to,attrs,spec)}static Widget(pos,render,options){const{key,...spec}=options;return new WidgetDecoration(pos,render,key,spec)}},InlineDecoration=class extends Decoration{constructor(from,to,attrs={},spec){super(),this.kind="inline",this.from=from,this.to=to,this.attrs=attrs,this.spec=spec}get anchor(){return this.from}toPMDecoration(extensionName){const spec=extensionName?{...this.spec,extensionName}:this.spec;return _tiptap_pm_view.Decoration.inline(this.from,this.to,this.attrs,spec)}},NodeDecoration=class extends Decoration{constructor(pos,to,attrs={},spec){super(),this.kind="node",this.from=pos,this.to=to,this.attrs=attrs,this.spec=spec}get anchor(){return this.from}toPMDecoration(extensionName){const spec=extensionName?{...this.spec,extensionName}:this.spec;return _tiptap_pm_view.Decoration.node(this.from,this.to,this.attrs,spec)}},WidgetDecoration=class extends Decoration{constructor(pos,render,key,spec){super(),this.kind="widget",this.pos=pos,this.render=render,this.key=key,this.spec=spec}get anchor(){return this.pos}toPMDecoration(extensionName){const spec=extensionName?{...this.spec,key:this.key,extensionName}:{...this.spec,key:this.key};return _tiptap_pm_view.Decoration.widget(this.pos,this.render,spec)}};const jsxElements=new WeakSet,jsxFragments=new WeakSet;function createJSXElement(spec){const element=spec;return jsxElements.add(element),element}function isJSXElement(value){return Array.isArray(value)&&jsxElements.has(value)}function flattenFragmentChildren(children){return children.flatMap(child=>null==child?[]:Array.isArray(child)&&jsxFragments.has(child)&&!isJSXElement(child)?flattenFragmentChildren(child):[child])}function render(tag,attributes){if("slot"===tag)return 0;if(tag instanceof Function){const result=tag(attributes);return!Array.isArray(result)||isJSXElement(result)||jsxFragments.has(result)?result:createJSXElement(result)}const{children,...rest}=null!=attributes?attributes:{};if("svg"===tag)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(children)){if(isJSXElement(children))return createJSXElement([tag,rest,children]);if(0===children.length)return createJSXElement([tag,rest]);const flattenedChildren=flattenFragmentChildren(children);return 0===flattenedChildren.length?createJSXElement([tag,rest]):createJSXElement([tag,rest,...flattenedChildren])}return createJSXElement(null!=children?[tag,rest,children]:[tag,rest])}const h=(tag,attributes)=>render(tag,attributes);var ResizableNodeView=class{constructor(options){var _options$options,_options$options2,_options$options3,_options$options4,_options$options5,_options$options6;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=event=>{if(!this.isResizing||!this.activeHandle)return;const deltaX=event.clientX-this.startX,deltaY=event.clientY-this.startY;this.handleResize(deltaX,deltaY)},this.handleTouchMove=event=>{if(!this.isResizing||!this.activeHandle)return;const touch=event.touches[0];if(!touch)return;const deltaX=touch.clientX-this.startX,deltaY=touch.clientY-this.startY;this.handleResize(deltaX,deltaY)},this.handleMouseUp=()=>{if(!this.isResizing)return;const finalWidth=this.element.offsetWidth,finalHeight=this.element.offsetHeight;this.onCommit(finalWidth,finalHeight),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=event=>{"Shift"===event.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=event=>{"Shift"===event.key&&(this.isShiftKeyPressed=!1)},this.node=options.node,this.editor=options.editor,this.element=options.element,this.element.draggable=!1,this.contentElement=options.contentElement,this.getPos=options.getPos,this.onResize=options.onResize,this.onCommit=options.onCommit,this.onUpdate=options.onUpdate,(null===(_options$options=options.options)||void 0===_options$options?void 0:_options$options.min)&&(this.minSize={...this.minSize,...options.options.min}),(null===(_options$options2=options.options)||void 0===_options$options2?void 0:_options$options2.max)&&(this.maxSize=options.options.max),(null==options||null===(_options$options3=options.options)||void 0===_options$options3?void 0:_options$options3.directions)&&(this.directions=options.options.directions),(null===(_options$options4=options.options)||void 0===_options$options4?void 0:_options$options4.preserveAspectRatio)&&(this.preserveAspectRatio=options.options.preserveAspectRatio),(null===(_options$options5=options.options)||void 0===_options$options5?void 0:_options$options5.className)&&(this.classNames={container:options.options.className.container||"",wrapper:options.options.className.wrapper||"",handle:options.options.className.handle||"",resizing:options.options.className.resizing||""}),(null===(_options$options6=options.options)||void 0===_options$options6?void 0:_options$options6.createCustomHandle)&&(this.createCustomHandle=options.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var _this$contentElement;return null!==(_this$contentElement=this.contentElement)&&void 0!==_this$contentElement?_this$contentElement:null}handleEditorUpdate(){const isEditable=this.editor.isEditable;isEditable!==this.lastEditableState&&(this.lastEditableState=isEditable,isEditable?isEditable&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(node,decorations,innerDecorations){return node.type===this.node.type&&(this.node=node,!this.onUpdate||this.onUpdate(node,decorations,innerDecorations))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const element=document.createElement("div");return element.dataset.resizeContainer="",element.dataset.node=this.node.type.name,element.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(element.className=this.classNames.container),element.appendChild(this.wrapper),element}createWrapper(){const element=document.createElement("div");return element.style.position="relative",element.style.display="block",element.dataset.resizeWrapper="",this.classNames.wrapper&&(element.className=this.classNames.wrapper),element.appendChild(this.element),element}createHandle(direction){const handle=document.createElement("div");return handle.dataset.resizeHandle=direction,handle.style.position="absolute",this.classNames.handle&&(handle.className=this.classNames.handle),handle}positionHandle(handle,direction){const isTop=direction.includes("top"),isBottom=direction.includes("bottom"),isLeft=direction.includes("left"),isRight=direction.includes("right");isTop&&(handle.style.top="0"),isBottom&&(handle.style.bottom="0"),isLeft&&(handle.style.left="0"),isRight&&(handle.style.right="0"),"top"!==direction&&"bottom"!==direction||(handle.style.left="0",handle.style.right="0"),"left"!==direction&&"right"!==direction||(handle.style.top="0",handle.style.bottom="0")}attachHandles(){this.directions.forEach(direction=>{let handle;handle=this.createCustomHandle?this.createCustomHandle(direction):this.createHandle(direction),handle instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${direction}") did not return an HTMLElement. Falling back to default handle.`),handle=this.createHandle(direction)),this.createCustomHandle||this.positionHandle(handle,direction),handle.addEventListener("mousedown",event=>this.handleResizeStart(event,direction)),handle.addEventListener("touchstart",event=>this.handleResizeStart(event,direction)),this.handleMap.set(direction,handle),this.wrapper.appendChild(handle)})}removeHandles(){this.handleMap.forEach(el=>el.remove()),this.handleMap.clear()}applyInitialSize(){const width=this.node.attrs.width,height=this.node.attrs.height;width?(this.element.style.width=`${width}px`,this.initialWidth=width):this.initialWidth=this.element.offsetWidth,height?(this.element.style.height=`${height}px`,this.initialHeight=height):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(event,direction){event.preventDefault(),event.stopPropagation(),this.isResizing=!0,this.activeHandle=direction,"touches"in event?(this.startX=event.touches[0].clientX,this.startY=event.touches[0].clientY):(this.startX=event.clientX,this.startY=event.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(deltaX,deltaY){if(!this.activeHandle)return;const shouldPreserveAspectRatio=this.preserveAspectRatio||this.isShiftKeyPressed,{width,height}=this.calculateNewDimensions(this.activeHandle,deltaX,deltaY),constrained=this.applyConstraints(width,height,shouldPreserveAspectRatio);this.element.style.width=`${constrained.width}px`,this.element.style.height=`${constrained.height}px`,this.onResize&&this.onResize(constrained.width,constrained.height)}calculateNewDimensions(direction,deltaX,deltaY){let newWidth=this.startWidth,newHeight=this.startHeight;const isRight=direction.includes("right"),isLeft=direction.includes("left"),isBottom=direction.includes("bottom"),isTop=direction.includes("top");return isRight?newWidth=this.startWidth+deltaX:isLeft&&(newWidth=this.startWidth-deltaX),isBottom?newHeight=this.startHeight+deltaY:isTop&&(newHeight=this.startHeight-deltaY),"right"!==direction&&"left"!==direction||(newWidth=this.startWidth+(isRight?deltaX:-deltaX)),"top"!==direction&&"bottom"!==direction||(newHeight=this.startHeight+(isBottom?deltaY:-deltaY)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(newWidth,newHeight,direction):{width:newWidth,height:newHeight}}applyConstraints(width,height,preserveAspectRatio){var _this$maxSize3,_this$maxSize4;if(!preserveAspectRatio){var _this$maxSize,_this$maxSize2;let constrainedWidth=Math.max(this.minSize.width,width),constrainedHeight=Math.max(this.minSize.height,height);return(null===(_this$maxSize=this.maxSize)||void 0===_this$maxSize?void 0:_this$maxSize.width)&&(constrainedWidth=Math.min(this.maxSize.width,constrainedWidth)),(null===(_this$maxSize2=this.maxSize)||void 0===_this$maxSize2?void 0:_this$maxSize2.height)&&(constrainedHeight=Math.min(this.maxSize.height,constrainedHeight)),{width:constrainedWidth,height:constrainedHeight}}let constrainedWidth=width,constrainedHeight=height;return constrainedWidth<this.minSize.width&&(constrainedWidth=this.minSize.width,constrainedHeight=constrainedWidth/this.aspectRatio),constrainedHeight<this.minSize.height&&(constrainedHeight=this.minSize.height,constrainedWidth=constrainedHeight*this.aspectRatio),(null===(_this$maxSize3=this.maxSize)||void 0===_this$maxSize3?void 0:_this$maxSize3.width)&&constrainedWidth>this.maxSize.width&&(constrainedWidth=this.maxSize.width,constrainedHeight=constrainedWidth/this.aspectRatio),(null===(_this$maxSize4=this.maxSize)||void 0===_this$maxSize4?void 0:_this$maxSize4.height)&&constrainedHeight>this.maxSize.height&&(constrainedHeight=this.maxSize.height,constrainedWidth=constrainedHeight*this.aspectRatio),{width:constrainedWidth,height:constrainedHeight}}applyAspectRatio(width,height,direction){const isVertical="top"===direction||"bottom"===direction;return"left"===direction||"right"===direction?{width,height:width/this.aspectRatio}:isVertical?{width:height*this.aspectRatio,height}:{width,height:width/this.aspectRatio}}};const ResizableNodeview=ResizableNodeView;exports.CommandManager=CommandManager,exports.DECORATION_MANAGER_PLUGIN_KEY=DECORATION_MANAGER_PLUGIN_KEY,exports.Decoration=Decoration,exports.DecorationManager=DecorationManager,exports.Editor=class extends EventEmitter{constructor(options={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error})=>{throw error},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition,createMappablePosition},this.setOptions(options),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event,slice,moved})=>this.options.onDrop(event,slice,moved)),this.on("paste",({event,slice})=>this.options.onPaste(event,slice)),this.on("delete",this.options.onDelete);const initialDoc=this.createDoc();if(!this.editorState){const selection=resolveFocusPosition(initialDoc,this.options.autofocus);this.editorState=_tiptap_pm_state.EditorState.create({doc:initialDoc,schema:this.schema,selection:selection||void 0})}!function warnOnDuplicatedProseMirrorModel(schema){if(hasChecked)return;let content;hasChecked=!0;try{content=_tiptap_pm_transform.ReplaceStep.fromJSON(schema,{from:0,to:0}).slice.content}catch{return}content instanceof _tiptap_pm_model.Fragment||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}(this.schema),this.options.element&&this.mount(this.options.element)}mount(el){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(el),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const dom=this.editorView.dom;(null==dom?void 0:dom.editor)&&delete dom.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(error){console.warn("Failed to remove CSS element:",error)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():CommandManager.createFakeChain()}can(){return this.commandManager?this.commandManager.can():CommandManager.createFallbackCan()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=createStyleTag('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}',this.options.injectNonce))}setOptions(options={}){this.options={...this.options,...options},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(editable,emitUpdate=!0){this.setOptions({editable}),emitUpdate&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:state=>{this.editorState=state},dispatch:tr=>{this.dispatchTransaction(tr)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(obj,key)=>{if(this.editorView)return this.editorView[key];if("state"===key)return this.editorState;if(key in obj)return Reflect.get(obj,key);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${key}']. The editor may not be mounted yet.`)}})}get state(){return isDev&&!this.hasWarnedStaleDecorationRead&&function isInDecorationApplyScope(editor){return depthByEditor.has(editor)}(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(plugin,handlePlugins){const plugins=isFunction(handlePlugins)?handlePlugins(plugin,[...this.state.plugins]):[...this.state.plugins,plugin],state=this.state.reconfigure({plugins});return this.view.updateState(state),state}unregisterPlugin(nameOrPluginKeyToRemove){if(this.isDestroyed)return;const prevPlugins=this.state.plugins;let plugins=prevPlugins;if([].concat(nameOrPluginKeyToRemove).forEach(nameOrPluginKey=>{const name="string"==typeof nameOrPluginKey?`${nameOrPluginKey}$`:nameOrPluginKey.key;plugins=plugins.filter(plugin=>!plugin.key.startsWith(name))}),prevPlugins.length===plugins.length)return;const state=this.state.reconfigure({plugins});return this.view.updateState(state),state}createExtensionManager(){var _this$options$coreExt,_this$options$coreExt2;const allExtensions=[...this.options.enableCoreExtensions?[Editable,ClipboardTextSerializer.configure({blockSeparator:null===(_this$options$coreExt=this.options.coreExtensionOptions)||void 0===_this$options$coreExt||null===(_this$options$coreExt=_this$options$coreExt.clipboardTextSerializer)||void 0===_this$options$coreExt?void 0:_this$options$coreExt.blockSeparator}),Commands,FocusEvents,Keymap,Tabindex.configure({value:null===(_this$options$coreExt2=this.options.coreExtensionOptions)||void 0===_this$options$coreExt2||null===(_this$options$coreExt2=_this$options$coreExt2.tabindex)||void 0===_this$options$coreExt2?void 0:_this$options$coreExt2.value}),Drop,Paste,Delete,TextDirection.configure({direction:this.options.textDirection})].filter(ext=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[ext.name]):[],...this.options.extensions].filter(extension=>["extension","node","mark"].includes(null==extension?void 0:extension.type));this.extensionManager=new ExtensionManager(allExtensions,this)}createCommandManager(){this.commandManager=new CommandManager({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let doc;try{doc=createDocument(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;const fallbackDoc=createDocument(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=_tiptap_pm_state.EditorState.create({doc:fallbackDoc,schema:this.schema,selection:resolveFocusPosition(fallbackDoc,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(extension=>"collaboration"!==extension.name),this.createExtensionManager()}}),this.editorState.doc}return doc}createView(element){const{editorProps,enableExtensionDispatchTransaction}=this.options,baseDispatch=editorProps.dispatchTransaction||this.dispatchTransaction.bind(this),dispatch=enableExtensionDispatchTransaction?this.extensionManager.dispatchTransaction(baseDispatch):baseDispatch,baseTransformPastedHTML=editorProps.transformPastedHTML,transformPastedHTML=this.extensionManager.transformPastedHTML(baseTransformPastedHTML);this.editorView=new _tiptap_pm_view.EditorView(element,{...editorProps,attributes:{role:"textbox",...null==editorProps?void 0:editorProps.attributes},dispatchTransaction:dispatch,transformPastedHTML,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const newState=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(newState),this.prependClass(),this.injectCSS();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(fn){this.isCapturingTransaction=!0,fn(),this.isCapturingTransaction=!1;const tr=this.capturedTransaction;return this.capturedTransaction=null,tr}dispatchTransaction(transaction){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void transaction.steps.forEach(step=>{var _this$capturedTransac;return null===(_this$capturedTransac=this.capturedTransaction)||void 0===_this$capturedTransac?void 0:_this$capturedTransac.step(step)}):void(this.capturedTransaction=transaction);const{state,transactions}=this.state.applyTransaction(transaction),selectionHasChanged=!this.state.selection.eq(state.selection),rootTrWasApplied=transactions.includes(transaction),prevState=this.state;if(this.emit("beforeTransaction",{editor:this,transaction,nextState:state}),!rootTrWasApplied)return;this.view.updateState(state),this.emit("transaction",{editor:this,transaction,appendedTransactions:transactions.slice(1)}),selectionHasChanged&&this.emit("selectionUpdate",{editor:this,transaction});const mostRecentFocusTr=transactions.findLast(tr=>tr.getMeta("focus")||tr.getMeta("blur")),focus=null==mostRecentFocusTr?void 0:mostRecentFocusTr.getMeta("focus"),blur=null==mostRecentFocusTr?void 0:mostRecentFocusTr.getMeta("blur");focus&&this.emit("focus",{editor:this,event:focus.event,transaction:mostRecentFocusTr}),blur&&this.emit("blur",{editor:this,event:blur.event,transaction:mostRecentFocusTr}),transaction.getMeta("preventUpdate")||!transactions.some(tr=>tr.docChanged)||prevState.doc.eq(state.doc)||this.emit("update",{editor:this,transaction,appendedTransactions:transactions.slice(1)})}getAttributes(nameOrType){return getAttributes(this.state,nameOrType)}isActive(nameOrAttributes,attributesOrUndefined){const name="string"==typeof nameOrAttributes?nameOrAttributes:null,attributes="string"==typeof nameOrAttributes?attributesOrUndefined:nameOrAttributes;return isActive(this.state,name,attributes)}getJSON(){return this.state.doc.toJSON()}getHTML(){return getHTMLFromFragment(this.state.doc.content,this.schema)}getText(options){const{blockSeparator="\n\n",textSerializers={}}=options||{};return getText(this.state.doc,{blockSeparator,textSerializers:{...getTextSerializersFromSchema(this.schema),...textSerializers}})}get isEmpty(){return isNodeEmpty(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var _this$editorView$isDe,_this$editorView;return null===(_this$editorView$isDe=null===(_this$editorView=this.editorView)||void 0===_this$editorView?void 0:_this$editorView.isDestroyed)||void 0===_this$editorView$isDe||_this$editorView$isDe}$node(selector,attributes){var _this$$doc;return(null===(_this$$doc=this.$doc)||void 0===_this$$doc?void 0:_this$$doc.querySelector(selector,attributes))||null}$nodes(selector,attributes){var _this$$doc2;return(null===(_this$$doc2=this.$doc)||void 0===_this$$doc2?void 0:_this$$doc2.querySelectorAll(selector,attributes))||null}$pos(pos){const $pos=this.state.doc.resolve(pos),node=pos>0&&$pos.nodeAfter&&!$pos.nodeAfter.isText&&$pos.nodeAfter.isAtom?$pos.nodeAfter:null;return new NodePos($pos,this,!1,node)}get $doc(){return this.$pos(0)}},exports.Extendable=Extendable,exports.Extension=Extension,exports.Fragment=function Fragment(props){return jsxFragments.add(props.children),props.children},exports.InlineDecoration=InlineDecoration,exports.InputRule=InputRule,exports.MappablePosition=MappablePosition,exports.Mark=Mark,exports.MarkView=class{constructor(component,props,options){this.component=component,this.editor=props.editor,this.options={...options},this.mark=props.mark,this.HTMLAttributes=props.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(attrs,checkMark){updateMarkViewAttributes(checkMark||this.mark,this.editor,attrs)}ignoreMutation(mutation){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation}):"selection"!==mutation.type&&(!(this.contentDOM.contains(mutation.target)&&"childList"===mutation.type&&(isiOS()||isAndroid())&&this.editor.isFocused&&[...Array.from(mutation.addedNodes),...Array.from(mutation.removedNodes)].every(node=>node.isContentEditable))&&(this.contentDOM===mutation.target&&"attributes"===mutation.type||!this.contentDOM.contains(mutation.target))))}},exports.Node=class Node extends Extendable{constructor(..._args){super(..._args),this.type="node"}static create(config={}){const resolvedConfig="function"==typeof config?config():config;return new Node(resolvedConfig)}configure(options){return super.configure(options)}extend(extendedConfig){const resolvedConfig="function"==typeof extendedConfig?extendedConfig():extendedConfig;return super.extend(resolvedConfig)}},exports.NodeDecoration=NodeDecoration,exports.NodePos=NodePos,exports.NodeView=class{constructor(component,props,options){this.isDragging=!1,this.component=component,this.editor=props.editor,this.options={stopEvent:null,ignoreMutation:null,...options},this.extension=props.extension,this.node=props.node,this.decorations=props.decorations,this.innerDecorations=props.innerDecorations,this.view=props.view,this.HTMLAttributes=props.HTMLAttributes,this.getPos=()=>{try{return props.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(event){var _target$parentElement,_this$contentDOM;const{view}=this.editor,target=event.target,dragHandle=3===target.nodeType?null===(_target$parentElement=target.parentElement)||void 0===_target$parentElement?void 0:_target$parentElement.closest("[data-drag-handle]"):target.closest("[data-drag-handle]");if(!this.dom||(null===(_this$contentDOM=this.contentDOM)||void 0===_this$contentDOM?void 0:_this$contentDOM.contains(target))||!dragHandle)return;let x=0,y=0;if(this.dom!==dragHandle){var _event$offsetX,_nativeEvent,_event$offsetY,_nativeEvent2;const domBox=this.dom.getBoundingClientRect(),handleBox=dragHandle.getBoundingClientRect(),offsetX=null!==(_event$offsetX=event.offsetX)&&void 0!==_event$offsetX?_event$offsetX:null===(_nativeEvent=event.nativeEvent)||void 0===_nativeEvent?void 0:_nativeEvent.offsetX,offsetY=null!==(_event$offsetY=event.offsetY)&&void 0!==_event$offsetY?_event$offsetY:null===(_nativeEvent2=event.nativeEvent)||void 0===_nativeEvent2?void 0:_nativeEvent2.offsetY;x=handleBox.x-domBox.x+offsetX,y=handleBox.y-domBox.y+offsetY}const clonedNode=this.dom.cloneNode(!0);try{const domBox=this.dom.getBoundingClientRect();clonedNode.style.width=`${Math.round(domBox.width)}px`,clonedNode.style.height=`${Math.round(domBox.height)}px`,clonedNode.style.boxSizing="border-box",clonedNode.style.pointerEvents="none"}catch{}let dragImageWrapper=null;try{var _event$dataTransfer;dragImageWrapper=document.createElement("div"),dragImageWrapper.style.position="absolute",dragImageWrapper.style.top="-9999px",dragImageWrapper.style.left="-9999px",dragImageWrapper.style.pointerEvents="none",dragImageWrapper.appendChild(clonedNode),document.body.appendChild(dragImageWrapper),null===(_event$dataTransfer=event.dataTransfer)||void 0===_event$dataTransfer||_event$dataTransfer.setDragImage(clonedNode,x,y)}finally{dragImageWrapper&&setTimeout(()=>{try{null==dragImageWrapper||dragImageWrapper.remove()}catch{}},0)}const pos=this.getPos();if("number"!=typeof pos)return;const selection=_tiptap_pm_state.NodeSelection.create(view.state.doc,pos),transaction=view.state.tr.setSelection(selection);view.dispatch(transaction)}stopEvent(event){var _this$contentDOM2;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event});const target=event.target;if(!this.dom.contains(target)||(null===(_this$contentDOM2=this.contentDOM)||void 0===_this$contentDOM2?void 0:_this$contentDOM2.contains(target)))return!1;const isDragEvent=event.type.startsWith("drag"),isDragOverEnterEvent="dragover"===event.type||"dragenter"===event.type,isDropEvent="drop"===event.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(target.tagName)||target.isContentEditable)&&!isDropEvent&&!isDragEvent)return!0;const{isEditable}=this.editor,{isDragging}=this,isDraggable=!!this.node.type.spec.draggable,isSelectable=_tiptap_pm_state.NodeSelection.isSelectable(this.node),isCopyEvent="copy"===event.type,isPasteEvent="paste"===event.type,isCutEvent="cut"===event.type,isClickEvent="mousedown"===event.type;if(!isDraggable&&isSelectable&&isDragEvent&&event.target===this.dom&&event.preventDefault(),isDraggable&&isDragEvent&&!isDragging&&event.target===this.dom)return event.preventDefault(),!1;if(isDraggable&&isEditable&&!isDragging&&isClickEvent){const dragHandle=target.closest("[data-drag-handle]");dragHandle&&(this.dom===dragHandle||this.dom.contains(dragHandle))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(isDragging||isDragOverEnterEvent||isDropEvent||isCopyEvent||isPasteEvent||isCutEvent||isClickEvent&&isSelectable)}ignoreMutation(mutation){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation}):!(!this.node.isLeaf&&!this.node.isAtom)||"selection"!==mutation.type&&(!(this.contentDOM.contains(mutation.target)&&"childList"===mutation.type&&(isiOS()||isAndroid())&&this.editor.isFocused&&[...Array.from(mutation.addedNodes),...Array.from(mutation.removedNodes)].every(node=>node.isContentEditable))&&(this.contentDOM===mutation.target&&"attributes"===mutation.type||!this.contentDOM.contains(mutation.target))))}updateAttributes(attributes){this.editor.commands.command(({tr})=>{const pos=this.getPos();return"number"==typeof pos&&(tr.setNodeMarkup(pos,void 0,{...this.node.attrs,...attributes}),!0)})}deleteNode(){const from=this.getPos();if("number"!=typeof from)return;const to=from+this.node.nodeSize;this.editor.commands.deleteRange({from,to})}},exports.PasteRule=PasteRule,exports.ResizableNodeView=ResizableNodeView,exports.ResizableNodeview=ResizableNodeview,exports.Tracker=class{constructor(transaction){this.transaction=transaction,this.currentStep=this.transaction.steps.length}map(position){let deleted=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((newPosition,step)=>{const mapResult=step.getMap().mapResult(newPosition);return mapResult.deleted&&(deleted=!0),mapResult.pos},position),deleted}}},exports.WidgetDecoration=WidgetDecoration,exports.attrsEqual=attrsEqual,exports.callOrReturn=callOrReturn,exports.canInsertNode=function canInsertNode(state,nodeType){const{selection}=state,{$from}=selection;if(selection instanceof _tiptap_pm_state.NodeSelection){const index=$from.index();return $from.parent.canReplaceWith(index,index+1,nodeType)}let depth=$from.depth;for(;depth>=0;){const index=$from.index(depth);if($from.node(depth).contentMatchAt(index).matchType(nodeType))return!0;depth-=1}return!1},exports.combineTransactionSteps=combineTransactionSteps,Object.defineProperty(exports,"commands",{enumerable:!0,get:function(){return commands_exports}}),exports.createAtomBlockMarkdownSpec=createAtomBlockMarkdownSpec,exports.createBlockMarkdownSpec=createBlockMarkdownSpec,exports.createChainableState=createChainableState,exports.createDocument=createDocument,exports.createElement=h,exports.createInlineMarkdownSpec=createInlineMarkdownSpec,exports.createMappablePosition=createMappablePosition,exports.createNodeFromContent=createNodeFromContent,exports.createStyleTag=createStyleTag,exports.createWidgetDecoration=function createWidgetDecoration(options){const{editor,pos,key,props,cacheKey,context,create,materialize,side,relaxedSide,marks,stopEvent,ignoreSelection,destroy}=options,cache=function getCache(editor,cacheKey){const host=editor;let cache=host[cacheKey];if(!cache){cache={renderers:new Map,props:new Map,pendingProps:new Map,flushScheduled:!1},host[cacheKey]=cache;const sweep=cache;editor.on("destroy",()=>{sweep.pendingProps.clear(),sweep.renderers.forEach(renderer=>renderer.destroy()),sweep.renderers.clear(),sweep.props.clear()})}return cache}(editor,cacheKey);if(cache.renderers.has(key)){var _cache$pendingProps$g;const previous=null!==(_cache$pendingProps$g=cache.pendingProps.get(key))&&void 0!==_cache$pendingProps$g?_cache$pendingProps$g:cache.props.get(key);previous&&attrsEqual(previous,props)||(cache.pendingProps.set(key,props),cache.flushScheduled||(cache.flushScheduled=!0,queueMicrotask(()=>function flushPendingProps(cache){cache.flushScheduled=!1;for(const[key,props]of cache.pendingProps){const renderer=cache.renderers.get(key);renderer&&(renderer.updateProps(props),cache.props.set(key,{...props}))}cache.pendingProps.clear()}(cache))))}return Decoration.Widget(pos,(_view,getPos)=>{const renderProps={...props,...context(getPos)};let renderer=cache.renderers.get(key);return renderer?renderer.updateProps(renderProps):(renderer=create(renderProps),cache.renderers.set(key,renderer),cache.props.set(key,{...props})),materialize(renderer)},{key,side,relaxedSide,marks,stopEvent,ignoreSelection,destroy:rendererElement=>{if(!liveWidgetKeys(editor).has(key))try{var _cache$renderers$get;null===(_cache$renderers$get=cache.renderers.get(key))||void 0===_cache$renderers$get||_cache$renderers$get.destroy(),cache.renderers.delete(key),cache.props.delete(key),cache.pendingProps.delete(key)}finally{null==destroy||destroy(rendererElement)}}})},exports.decodeHtmlEntities=function decodeHtmlEntities(text){return text.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")},exports.defaultBlockAt=defaultBlockAt,exports.deleteProps=deleteProps,exports.elementFromString=elementFromString,exports.encodeHtmlEntities=function encodeHtmlEntities(text){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},exports.escapeForRegEx=function escapeForRegEx(string){return string.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},Object.defineProperty(exports,"extensions",{enumerable:!0,get:function(){return extensions_exports}}),exports.findChildren=function findChildren(node,predicate){const nodesWithPos=[];return node.descendants((child,pos)=>{predicate(child)&&nodesWithPos.push({node:child,pos})}),nodesWithPos},exports.findChildrenInRange=function findChildrenInRange(node,range,predicate){const nodesWithPos=[];return node.nodesBetween(range.from,range.to,(child,pos)=>{predicate(child)&&nodesWithPos.push({node:child,pos})}),nodesWithPos},exports.findDuplicates=findDuplicates,exports.findParentNode=findParentNode,exports.findParentNodeClosestToPos=findParentNodeClosestToPos,exports.flattenExtensions=flattenExtensions,exports.fromString=fromString,exports.generateHTML=function generateHTML(doc,extensions){const schema=getSchema(extensions);return getHTMLFromFragment(_tiptap_pm_model.Node.fromJSON(schema,doc).content,schema)},exports.generateJSON=function generateJSON(html,extensions){const schema=getSchema(extensions),dom=elementFromString(html);return _tiptap_pm_model.DOMParser.fromSchema(schema).parse(dom).toJSON()},exports.generateText=function generateText(doc,extensions,options){const{blockSeparator="\n\n",textSerializers={}}=options||{},schema=getSchema(extensions);return getText(_tiptap_pm_model.Node.fromJSON(schema,doc),{blockSeparator,textSerializers:{...getTextSerializersFromSchema(schema),...textSerializers}})},exports.getAttributes=getAttributes,exports.getAttributesFromExtensions=getAttributesFromExtensions,exports.getChangedRanges=getChangedRanges,exports.getDebugJSON=function getDebugJSON(node,startOffset=0){const increment=node.type===node.type.schema.topNodeType?0:1,from=startOffset,to=from+node.nodeSize,marks=node.marks.map(mark=>{const output={type:mark.type.name};return Object.keys(mark.attrs).length&&(output.attrs={...mark.attrs}),output}),attrs={...node.attrs},output={type:node.type.name,from,to};return Object.keys(attrs).length&&(output.attrs=attrs),marks.length&&(output.marks=marks),node.content.childCount&&(output.content=[],node.forEach((child,offset)=>{var _output$content;null===(_output$content=output.content)||void 0===_output$content||_output$content.push(getDebugJSON(child,startOffset+offset+increment))})),node.text&&(output.text=node.text),output},exports.getExtensionField=getExtensionField,exports.getHTMLFromFragment=getHTMLFromFragment,exports.getMarkAttributes=getMarkAttributes,exports.getMarkRange=getMarkRange,exports.getMarkType=getMarkType,exports.getMarksBetween=getMarksBetween,exports.getNodeAtPosition=(state,typeOrName,pos,maxDepth=20)=>{const $pos=state.doc.resolve(pos);let currentDepth=maxDepth,node=null;for(;currentDepth>0&&null===node;){const currentNode=$pos.node(currentDepth);(null==currentNode?void 0:currentNode.type.name)===typeOrName?node=currentNode:currentDepth-=1}return[node,currentDepth]},exports.getNodeAttributes=getNodeAttributes,exports.getNodeType=getNodeType,exports.getPreviousBlockSibling=$pos=>{const parentDepth=$pos.depth-1;if(parentDepth<0)return null;const index=$pos.index(parentDepth);return 0===index?null:$pos.node(parentDepth).child(index-1)},exports.getRenderedAttributes=getRenderedAttributes,exports.getSchema=getSchema,exports.getSchemaByResolvedExtensions=getSchemaByResolvedExtensions,exports.getSchemaTypeByName=getSchemaTypeByName,exports.getSchemaTypeNameByName=getSchemaTypeNameByName,exports.getSplittedAttributes=getSplittedAttributes,exports.getStyleProperty=function getStyleProperty(element,propertyName){const styleAttr=element.getAttribute("style");if(!styleAttr)return null;const decls=styleAttr.split(";").map(decl=>decl.trim()).filter(Boolean),target=propertyName.toLowerCase();for(let i=decls.length-1;i>=0;i-=1){const decl=decls[i],colonIndex=decl.indexOf(":");if(-1!==colonIndex&&decl.slice(0,colonIndex).trim().toLowerCase()===target)return decl.slice(colonIndex+1).trim()}return null},exports.getText=getText,exports.getTextBetween=getTextBetween,exports.getTextContentFromNodes=getTextContentFromNodes,exports.getTextSerializersFromSchema=getTextSerializersFromSchema,exports.getUpdatedPosition=getUpdatedPosition,exports.h=h,exports.injectExtensionAttributesToParseRule=injectExtensionAttributesToParseRule,exports.inputRulesPlugin=inputRulesPlugin,exports.isActive=isActive,exports.isAndroid=isAndroid,exports.isAtEndOfNode=(state,nodeType)=>{const{$from,$to,$anchor}=state.selection;if(nodeType){const parentNode=findParentNode(node=>node.type.name===nodeType)(state.selection);if(!parentNode)return!1;const $parentPos=state.doc.resolve(parentNode.pos+1);return $anchor.pos+1===$parentPos.end()}return!($to.parentOffset<$to.parent.nodeSize-2||$from.pos!==$to.pos)},exports.isAtStartOfNode=state=>{const{$from,$to}=state.selection;return!($from.parentOffset>0||$from.pos!==$to.pos)},exports.isEmptyObject=isEmptyObject,exports.isExtensionRulesEnabled=isExtensionRulesEnabled,exports.isFirefox=function isFirefox(){return"undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent)},exports.isFunction=isFunction,exports.isList=isList,exports.isMacOS=isMacOS,exports.isMarkActive=isMarkActive,exports.isNodeActive=isNodeActive,exports.isNodeEmpty=isNodeEmpty,exports.isNodeSelection=function isNodeSelection(value){return value instanceof _tiptap_pm_state.NodeSelection},exports.isNodeViewSelected=function isNodeViewSelected({selection,pos,nodeSize,selectedOnTextSelection=!1}){const{from,to}=selection;return from<=pos&&to>=pos+nodeSize||!!(selectedOnTextSelection&&isTextSelection(selection)&&from>pos&&to<pos+nodeSize)},exports.isNumber=isNumber,exports.isPlainObject=isPlainObject,exports.isProseMirrorAddMarkStep=function isProseMirrorAddMarkStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;if(!isProseMirrorStep(step))return!1;const json=step.toJSON();return null!==json&&"object"==typeof json&&"addMark"===json.stepType},exports.isProseMirrorAddNodeMarkStep=function isProseMirrorAddNodeMarkStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;if(!isProseMirrorStep(step))return!1;const json=step.toJSON();return null!==json&&"object"==typeof json&&"addNodeMark"===json.stepType},exports.isProseMirrorAttrStep=function isProseMirrorAttrStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;if(!isProseMirrorStep(step))return!1;const json=step.toJSON();return null!==json&&"object"==typeof json&&"attr"===json.stepType},exports.isProseMirrorCellSelection=function isProseMirrorCellSelection(selection){return null!==selection&&"object"==typeof selection&&("forEachCell"in selection&&"function"==typeof selection.forEachCell)},exports.isProseMirrorDocAttrStep=function isProseMirrorDocAttrStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;if(!isProseMirrorStep(step))return!1;const json=step.toJSON();return null!==json&&"object"==typeof json&&"docAttr"===json.stepType},exports.isProseMirrorFragment=isProseMirrorFragment,exports.isProseMirrorNodeSelection=function isProseMirrorNodeSelection(selection){return null!==selection&&"object"==typeof selection&&("node"in selection&&null!=selection.node)},exports.isProseMirrorRemoveMarkStep=function isProseMirrorRemoveMarkStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;if(!isProseMirrorStep(step))return!1;const json=step.toJSON();return null!==json&&"object"==typeof json&&"removeMark"===json.stepType},exports.isProseMirrorRemoveNodeMarkStep=function isProseMirrorRemoveNodeMarkStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;if(!isProseMirrorStep(step))return!1;const json=step.toJSON();return null!==json&&"object"==typeof json&&"removeNodeMark"===json.stepType},exports.isProseMirrorReplaceAroundStep=function isProseMirrorReplaceAroundStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;if(!isProseMirrorStep(step))return!1;const json=step.toJSON();return null!==json&&"object"==typeof json&&"replaceAround"===json.stepType},exports.isProseMirrorReplaceStep=function isProseMirrorReplaceStep(value){if(null===value||"object"!=typeof value)return!1;const step=value;if(!isProseMirrorStep(step))return!1;const json=step.toJSON();return null!==json&&"object"==typeof json&&"replace"===json.stepType},exports.isProseMirrorSlice=function isProseMirrorSlice(value){if(null===value||"object"!=typeof value)return!1;const slice=value,openStartIsNumber=Number.isInteger(slice.openStart)&&slice.openStart>=0,openEndIsNumber=Number.isInteger(slice.openEnd)&&slice.openEnd>=0,sliceHasRequiredProperties="number"==typeof slice.size&&"function"==typeof slice.eq&&"function"==typeof slice.toJSON;if(!openStartIsNumber||!openEndIsNumber||!sliceHasRequiredProperties)return!1;const content=slice.content;return null!==content&&"object"==typeof content&&!!isProseMirrorFragment(content)},exports.isProseMirrorStep=isProseMirrorStep,exports.isProseMirrorStepResult=function isProseMirrorStepResult(value){if(null===value||"object"!=typeof value)return!1;const result=value,isValidDoc=null!==result.doc&&"object"==typeof result.doc&&null===result.failed,isValidFailed="string"==typeof result.failed&&null===result.doc;return!(!isValidDoc&&!isValidFailed)},exports.isRegExp=isRegExp,exports.isSafari=isSafari,exports.isString=function isString(value){return"string"==typeof value},exports.isTextSelection=isTextSelection,exports.isiOS=isiOS,exports.liveWidgetKeys=liveWidgetKeys,exports.markInputRule=function markInputRule(config){return new InputRule({find:config.find,handler:({state,range,match})=>{const attributes=callOrReturn(config.getAttributes,void 0,match);if(!1===attributes||null===attributes)return null;const{tr}=state,captureGroup=match[match.length-1],fullMatch=match[0];if(captureGroup){const startSpaces=fullMatch.search(/\S/),textStart=range.from+fullMatch.indexOf(captureGroup),textEnd=textStart+captureGroup.length;if(getMarksBetween(range.from,range.to,state.doc).filter(item=>item.mark.type.excluded.find(type=>type===config.type&&type!==item.mark.type)).filter(item=>item.to>textStart).length)return null;textEnd<range.to&&tr.delete(textEnd,range.to),textStart>range.from&&tr.delete(range.from+startSpaces,textStart);const markEnd=range.from+startSpaces+captureGroup.length;tr.addMark(range.from+startSpaces,markEnd,config.type.create(attributes||{})),tr.removeStoredMark(config.type)}},undoable:config.undoable})},exports.markPasteRule=function markPasteRule(config){return new PasteRule({find:config.find,handler:({state,range,match,pasteEvent})=>{const attributes=callOrReturn(config.getAttributes,void 0,match,pasteEvent);if(!1===attributes||null===attributes)return null;const{tr}=state,captureGroup=match[match.length-1],fullMatch=match[0];let markEnd=range.to;if(captureGroup){const startSpaces=fullMatch.search(/\S/),textStart=range.from+fullMatch.indexOf(captureGroup),textEnd=textStart+captureGroup.length;if(getMarksBetween(range.from,range.to,state.doc).filter(item=>item.mark.type.excluded.find(type=>type===config.type&&type!==item.mark.type)).filter(item=>item.to>textStart).length)return null;textEnd<range.to&&tr.delete(textEnd,range.to),textStart>range.from&&tr.delete(range.from+startSpaces,textStart),markEnd=range.from+startSpaces+captureGroup.length,tr.addMark(range.from+startSpaces,markEnd,config.type.create(attributes||{})),void 0!==match.index&&void 0!==match.input&&match.index+match[0].length>=match.input.length||tr.removeStoredMark(config.type)}}})},Object.defineProperty(exports,"markdown",{enumerable:!0,get:function(){return markdown_exports}}),exports.marksEqual=function marksEqual(a,b){if(a.length!==b.length)return!1;const consumed=Array.from({length:b.length},()=>!1);return a.every(markA=>{const nameA=markTypeName(markA),idx=b.findIndex((markB,i)=>!consumed[i]&&nameA===markTypeName(markB)&&attrsEqual(markA.attrs,markB.attrs));return-1!==idx&&(consumed[idx]=!0,!0)})},exports.mergeAttributes=mergeAttributes,exports.mergeDeep=mergeDeep,exports.minMax=minMax,exports.nodeInputRule=function nodeInputRule(config){return new InputRule({find:config.find,handler:({state,range,match})=>{const attributes=callOrReturn(config.getAttributes,void 0,match)||{},{tr}=state,start=range.from;let end=range.to;const newNode=config.type.create(attributes);if(match[1]){let matchStart=start+match[0].lastIndexOf(match[1]);matchStart>end?matchStart=end:end=matchStart+match[1].length;const lastChar=match[0][match[0].length-1];tr.insertText(lastChar,start+match[0].length-1),tr.replaceWith(matchStart,end,newNode)}else if(match[0]){const insertionStart=config.type.isInline?start:start-1;tr.insert(insertionStart,config.type.create(attributes)).delete(tr.mapping.map(start),tr.mapping.map(end))}tr.scrollIntoView()},undoable:config.undoable})},exports.nodePasteRule=function nodePasteRule(config){return new PasteRule({find:config.find,handler({match,chain,range,pasteEvent}){const attributes=callOrReturn(config.getAttributes,void 0,match,pasteEvent),content=callOrReturn(config.getContent,void 0,attributes);if(!1===attributes||null===attributes)return null;const node={type:config.type.name,attrs:attributes};content&&(node.content=content),match.input&&chain().deleteRange(range).insertContentAt(range.from,node)}})},exports.objectIncludes=objectIncludes,exports.parseAttributes=parseAttributes,exports.parseIndentedBlocks=parseIndentedBlocks,exports.pasteRulesPlugin=pasteRulesPlugin,exports.posToDOMRect=function posToDOMRect(view,from,to){const maxPos=view.state.doc.content.size,resolvedFrom=minMax(from,0,maxPos),resolvedEnd=minMax(to,0,maxPos),start=view.coordsAtPos(resolvedFrom),end=view.coordsAtPos(resolvedEnd,-1),top=Math.min(start.top,end.top),bottom=Math.max(start.bottom,end.bottom),left=Math.min(start.left,end.left),right=Math.max(start.right,end.right),data={top,bottom,left,right,width:right-left,height:bottom-top,x:left,y:top};return{...data,toJSON:()=>data}},exports.removeDuplicates=removeDuplicates,exports.renderNestedMarkdownContent=renderNestedMarkdownContent,exports.resolveExtensions=resolveExtensions,exports.resolveFocusPosition=resolveFocusPosition,exports.rewriteUnknownContent=function rewriteUnknownContent(json,schema,options){return rewriteUnknownContentInner({json,validNodes:new Set(Object.keys(schema.nodes)),validMarks:new Set(Object.keys(schema.marks)),options})},exports.selectionToInsertionEnd=selectionToInsertionEnd,exports.serializeAttributes=serializeAttributes,exports.sortExtensions=sortExtensions,exports.splitExtensions=splitExtensions,exports.textInputRule=function textInputRule(config){return new InputRule({find:config.find,handler:({state,range,match})=>{let insert=config.replace,start=range.from;const end=range.to;if(match[1]){const offset=match[0].lastIndexOf(match[1]);insert+=match[0].slice(offset+match[1].length),start+=offset;const cutOff=start-end;cutOff>0&&(insert=match[0].slice(offset-cutOff,offset)+insert,start=end)}state.tr.insertText(insert,start,end)},undoable:config.undoable})},exports.textPasteRule=function textPasteRule(config){return new PasteRule({find:config.find,handler:({state,range,match})=>{let insert=config.replace,start=range.from;const end=range.to;if(match[1]){const offset=match[0].lastIndexOf(match[1]);insert+=match[0].slice(offset+match[1].length),start+=offset;const cutOff=start-end;cutOff>0&&(insert=match[0].slice(offset-cutOff,offset)+insert,start=end)}state.tr.insertText(insert,start,end)}})},exports.textblockTypeInputRule=function textblockTypeInputRule(config){return new InputRule({find:config.find,handler:({state,range,match})=>{const $start=state.doc.resolve(range.from),attributes=callOrReturn(config.getAttributes,void 0,match)||{};if(!$start.node(-1).canReplaceWith($start.index(-1),$start.indexAfter(-1),config.type))return null;state.tr.delete(range.from,range.to).setBlockType(range.from,range.from,config.type,attributes)},undoable:config.undoable})},exports.updateMarkViewAttributes=updateMarkViewAttributes,exports.wrappingInputRule=function wrappingInputRule(config){return new InputRule({find:config.find,handler:({state,range,match,chain})=>{const attributes=callOrReturn(config.getAttributes,void 0,match)||{},tr=state.tr.delete(range.from,range.to),blockRange=tr.doc.resolve(range.from).blockRange(),wrapping=blockRange&&(0,_tiptap_pm_transform.findWrapping)(blockRange,config.type,attributes);if(!wrapping)return null;if(tr.wrap(blockRange,wrapping),config.keepMarks&&config.editor){const{selection,storedMarks}=state,{splittableMarks}=config.editor.extensionManager,marks=storedMarks||selection.$to.parentOffset&&selection.$from.marks();if(marks){const filteredMarks=marks.filter(mark=>splittableMarks.includes(mark.type.name));tr.ensureMarks(filteredMarks)}}if(config.keepAttributes){const nodeType="bulletList"===config.type.name||"orderedList"===config.type.name?"listItem":"taskList";chain().updateAttributes(nodeType,attributes).run()}const before=tr.doc.resolve(range.from-1).nodeBefore;before&&before.type===config.type&&(0,_tiptap_pm_transform.canJoin)(tr.doc,range.from-1)&&(!config.joinPredicate||config.joinPredicate(match,before))&&tr.join(range.from-1)},undoable:config.undoable})}},"./node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs"(__unused_webpack_module,exports){Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsxElements=new WeakSet,jsxFragments=new WeakSet;function createJSXElement(spec){const element=spec;return jsxElements.add(element),element}function isJSXElement(value){return Array.isArray(value)&&jsxElements.has(value)}function flattenFragmentChildren(children){return children.flatMap(child=>null==child?[]:Array.isArray(child)&&jsxFragments.has(child)&&!isJSXElement(child)?flattenFragmentChildren(child):[child])}function render(tag,attributes){if("slot"===tag)return 0;if(tag instanceof Function){const result=tag(attributes);return!Array.isArray(result)||isJSXElement(result)||jsxFragments.has(result)?result:createJSXElement(result)}const{children,...rest}=null!=attributes?attributes:{};if("svg"===tag)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(children)){if(isJSXElement(children))return createJSXElement([tag,rest,children]);if(0===children.length)return createJSXElement([tag,rest]);const flattenedChildren=flattenFragmentChildren(children);return 0===flattenedChildren.length?createJSXElement([tag,rest]):createJSXElement([tag,rest,...flattenedChildren])}return createJSXElement(null!=children?[tag,rest,children]:[tag,rest])}const h=(tag,attributes)=>render(tag,attributes);exports.Fragment=function Fragment(props){return jsxFragments.add(props.children),props.children},exports.createElement=h,exports.h=h,exports.jsx=h,exports.jsxDEV=(tag,attributes,_key,_isStaticChildren)=>render(tag,attributes),exports.jsxs=(tag,attributes)=>render(tag,attributes)},"./node_modules/@tiptap/core/jsx-runtime/index.cjs"(module,__unused_webpack_exports,__webpack_require__){module.exports=__webpack_require__("./node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs")},"./node_modules/@tiptap/extension-blockquote/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),_tiptap_pm_model=__webpack_require__("./node_modules/@tiptap/pm/dist/model/index.cjs"),_tiptap_pm_state=__webpack_require__("./node_modules/@tiptap/pm/dist/state/index.cjs"),_tiptap_core_jsx_runtime=__webpack_require__("./node_modules/@tiptap/core/jsx-runtime/index.cjs");const inputRegex=/^\s*>\s$/,Blockquote=_tiptap_core.Node.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes}){return(0,_tiptap_core_jsx_runtime.jsx)("blockquote",{...(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),children:(0,_tiptap_core_jsx_runtime.jsx)("slot",{})})},parseMarkdown:(token,helpers)=>{var _helpers$parseBlockCh;const parseBlockChildren=null!==(_helpers$parseBlockCh=helpers.parseBlockChildren)&&void 0!==_helpers$parseBlockCh?_helpers$parseBlockCh:helpers.parseChildren;return helpers.createNode("blockquote",void 0,parseBlockChildren(token.tokens||[]))},renderMarkdown:(node,h)=>{if(!node.content)return"";const result=[];return node.content.forEach((child,index)=>{var _h$renderChild,_h$renderChild2;const linesWithPrefix=(null!==(_h$renderChild=null===(_h$renderChild2=h.renderChild)||void 0===_h$renderChild2?void 0:_h$renderChild2.call(h,child,index))&&void 0!==_h$renderChild?_h$renderChild:h.renderChildren([child])).split("\n").map(line=>""===line.trim()?">":`> ${line}`);result.push(linesWithPrefix.join("\n"))}),result.join("\n>\n")},addCommands(){return{setBlockquote:()=>({commands})=>commands.wrapIn(this.name),toggleBlockquote:()=>({commands})=>commands.toggleWrap(this.name),unsetBlockquote:()=>({commands})=>commands.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>((editor,type)=>{var _previous$lastChild;const{state}=editor,{selection}=state;if(!selection.empty)return!1;const{$from}=selection;if(0!==$from.parentOffset)return!1;const parentDepth=$from.depth-1;if(parentDepth<0)return!1;const parent=$from.node(parentDepth),index=$from.index(parentDepth);if(0===index)return!1;if(parent.type===type)return editor.commands.lift(type.name);const previous=parent.child(index-1);if(previous.type!==type||!(null===(_previous$lastChild=previous.lastChild)||void 0===_previous$lastChild?void 0:_previous$lastChild.isTextblock))return!1;const targetPos=$from.before()-1-1;return editor.commands.command(({tr,dispatch})=>{if(!dispatch)return!0;const content=$from.parent.content,slice=new _tiptap_pm_model.Slice(content,0,0);return tr.replace(targetPos,$from.after(),slice),tr.setSelection(_tiptap_pm_state.TextSelection.create(tr.doc,targetPos+content.size)),tr.scrollIntoView(),dispatch(tr),!0})})(this.editor,this.type)}},addInputRules(){return[(0,_tiptap_core.wrappingInputRule)({find:inputRegex,type:this.type})]}});var src_default=Blockquote;exports.Blockquote=Blockquote,exports.default=src_default,exports.inputRegex=inputRegex},"./node_modules/@tiptap/extension-bold/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),_tiptap_core_jsx_runtime=__webpack_require__("./node_modules/@tiptap/core/jsx-runtime/index.cjs");const starInputRegex=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,starPasteRegex=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,underscoreInputRegex=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,underscorePasteRegex=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Bold=_tiptap_core.Mark.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:node=>"normal"!==node.style.fontWeight&&null},{style:"font-weight=400",clearMark:mark=>mark.type.name===this.name},{style:"font-weight",getAttrs:value=>/^(bold(er)?|[5-9]\d{2,})$/.test(value)&&null}]},renderHTML({HTMLAttributes}){return(0,_tiptap_core_jsx_runtime.jsx)("strong",{...(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),children:(0,_tiptap_core_jsx_runtime.jsx)("slot",{})})},markdownTokenName:"strong",parseMarkdown:(token,helpers)=>helpers.applyMark("bold",helpers.parseInline(token.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(node,h)=>`**${h.renderChildren(node)}**`,addCommands(){return{setBold:()=>({commands})=>commands.setMark(this.name),toggleBold:()=>({commands})=>commands.toggleMark(this.name),unsetBold:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[(0,_tiptap_core.markInputRule)({find:starInputRegex,type:this.type}),(0,_tiptap_core.markInputRule)({find:underscoreInputRegex,type:this.type})]},addPasteRules(){return[(0,_tiptap_core.markPasteRule)({find:starPasteRegex,type:this.type}),(0,_tiptap_core.markPasteRule)({find:underscorePasteRegex,type:this.type})]}});var src_default=Bold;exports.Bold=Bold,exports.default=src_default,exports.starInputRegex=starInputRegex,exports.starPasteRegex=starPasteRegex,exports.underscoreInputRegex=underscoreInputRegex,exports.underscorePasteRegex=underscorePasteRegex},"./node_modules/@tiptap/extension-code-block/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),_tiptap_pm_state=__webpack_require__("./node_modules/@tiptap/pm/dist/state/index.cjs");const backtickInputRegex=/^```([a-z]+)?[\s\n]$/,tildeInputRegex=/^~~~([a-z]+)?[\s\n]$/,CodeBlock=_tiptap_core.Node.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:element=>{var _element$firstElement;const{languageClassPrefix}=this.options;if(!languageClassPrefix)return null;const language=[...(null===(_element$firstElement=element.firstElementChild)||void 0===_element$firstElement?void 0:_element$firstElement.classList)||[]].filter(className=>className.startsWith(languageClassPrefix)).map(className=>className.replace(languageClassPrefix,""))[0];return language||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node,HTMLAttributes}){return["pre",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),["code",{class:node.attrs.language?this.options.languageClassPrefix+node.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(token,helpers)=>{var _token$raw,_token$raw2;return!1===(null===(_token$raw=token.raw)||void 0===_token$raw?void 0:_token$raw.startsWith("```"))&&!1===(null===(_token$raw2=token.raw)||void 0===_token$raw2?void 0:_token$raw2.startsWith("~~~"))&&"indented"!==token.codeBlockStyle?[]:helpers.createNode("codeBlock",{language:token.lang||null},token.text?[helpers.createTextNode(token.text)]:[])},renderMarkdown:(node,h)=>{var _node$attrs;let output="";const language=(null===(_node$attrs=node.attrs)||void 0===_node$attrs?void 0:_node$attrs.language)||"";return output=node.content?[`\`\`\`${language}`,h.renderChildren(node.content),"```"].join("\n"):`\`\`\`${language}\n\n\`\`\``,output},addCommands(){return{setCodeBlock:attributes=>({commands})=>commands.setNode(this.name,attributes),toggleCodeBlock:attributes=>({commands})=>commands.toggleNode(this.name,"paragraph",attributes)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty,$anchor}=this.editor.state.selection,isAtStart=1===$anchor.pos;return!(!empty||$anchor.parent.type.name!==this.name)&&(!(!isAtStart&&$anchor.parent.textContent.length)&&this.editor.commands.clearNodes())},Tab:({editor})=>{var _this$options$tabSize;if(!this.options.enableTabIndentation)return!1;const tabSize=null!==(_this$options$tabSize=this.options.tabSize)&&void 0!==_this$options$tabSize?_this$options$tabSize:4,{state}=editor,{selection}=state,{$from,empty}=selection;if($from.parent.type!==this.type)return!1;const indent=" ".repeat(tabSize);return empty?editor.commands.insertContent(indent):editor.commands.command(({tr})=>{const{from,to}=selection,indentedText=state.doc.textBetween(from,to,"\n","\n").split("\n").map(line=>indent+line).join("\n");return tr.replaceWith(from,to,state.schema.text(indentedText)),!0})},"Shift-Tab":({editor})=>{var _this$options$tabSize2;if(!this.options.enableTabIndentation)return!1;const tabSize=null!==(_this$options$tabSize2=this.options.tabSize)&&void 0!==_this$options$tabSize2?_this$options$tabSize2:4,{state}=editor,{selection}=state,{$from,empty}=selection;return $from.parent.type===this.type&&(empty?editor.commands.command(({tr})=>{var _currentLine$match;const{pos}=$from,codeBlockStart=$from.start(),codeBlockEnd=$from.end(),lines=state.doc.textBetween(codeBlockStart,codeBlockEnd,"\n","\n").split("\n");let currentLineIndex=0,charCount=0;const relativeCursorPos=pos-codeBlockStart;for(let i=0;i<lines.length;i+=1){if(charCount+lines[i].length>=relativeCursorPos){currentLineIndex=i;break}charCount+=lines[i].length+1}const leadingSpaces=(null===(_currentLine$match=lines[currentLineIndex].match(/^ */))||void 0===_currentLine$match?void 0:_currentLine$match[0])||"",spacesToRemove=Math.min(leadingSpaces.length,tabSize);if(0===spacesToRemove)return!0;let lineStartPos=codeBlockStart;for(let i=0;i<currentLineIndex;i+=1)lineStartPos+=lines[i].length+1;return tr.delete(lineStartPos,lineStartPos+spacesToRemove),pos-lineStartPos<=spacesToRemove&&tr.setSelection(_tiptap_pm_state.TextSelection.create(tr.doc,lineStartPos)),!0}):editor.commands.command(({tr})=>{const{from,to}=selection,reverseIndentText=state.doc.textBetween(from,to,"\n","\n").split("\n").map(line=>{var _line$match;const leadingSpaces=(null===(_line$match=line.match(/^ */))||void 0===_line$match?void 0:_line$match[0])||"",spacesToRemove=Math.min(leadingSpaces.length,tabSize);return line.slice(spacesToRemove)}).join("\n");return tr.replaceWith(from,to,state.schema.text(reverseIndentText)),!0}))},Enter:({editor})=>{if(!this.options.exitOnTripleEnter)return!1;const{state}=editor,{selection}=state,{$from,empty}=selection;if(!empty||$from.parent.type!==this.type)return!1;const isAtEnd=$from.parentOffset===$from.parent.nodeSize-2,endsWithDoubleNewline=$from.parent.textContent.endsWith("\n\n");return!(!isAtEnd||!endsWithDoubleNewline)&&editor.chain().command(({tr})=>(tr.delete($from.pos-2,$from.pos),!0)).exitCode().run()},ArrowUp:({editor})=>{if(!this.options.exitOnArrowUp)return!1;const{state}=editor,{selection}=state,{$from,empty}=selection;if(!empty||$from.parent.type!==this.type)return!1;if(0!==$from.parentOffset)return!1;const before=$from.before();return!(before>0)&&editor.commands.insertDefaultBlock({pos:before})},ArrowDown:({editor})=>{if(!this.options.exitOnArrowDown)return!1;const{state}=editor,{selection,doc}=state,{$from,empty}=selection;if(!empty||$from.parent.type!==this.type)return!1;if($from.parentOffset!==$from.parent.nodeSize-2)return!1;const after=$from.after();return void 0!==after&&(doc.nodeAt(after)?editor.commands.command(({tr})=>(tr.setSelection(_tiptap_pm_state.Selection.near(doc.resolve(after))),!0)):editor.commands.exitCode())}}},addInputRules(){return[(0,_tiptap_core.textblockTypeInputRule)({find:backtickInputRegex,type:this.type,getAttributes:match=>({language:match[1]})}),(0,_tiptap_core.textblockTypeInputRule)({find:tildeInputRegex,type:this.type,getAttributes:match=>({language:match[1]})})]},addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("codeBlockVSCodeHandler"),props:{handlePaste:(view,event)=>{if(!event.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const text=event.clipboardData.getData("text/plain"),vscode=event.clipboardData.getData("vscode-editor-data"),vscodeData=vscode?JSON.parse(vscode):void 0,language=null==vscodeData?void 0:vscodeData.mode;if(!text||!language)return!1;const{tr,schema}=view.state,textNode=schema.text(text.replace(/\r\n?/g,"\n"));return tr.replaceSelectionWith(this.type.create({language},textNode)),tr.selection.$from.parent.type!==this.type&&tr.setSelection(_tiptap_pm_state.TextSelection.near(tr.doc.resolve(Math.max(0,tr.selection.from-2)))),tr.setMeta("paste",!0),view.dispatch(tr),!0}}})]}});var src_default=CodeBlock;exports.CodeBlock=CodeBlock,exports.backtickInputRegex=backtickInputRegex,exports.default=src_default,exports.tildeInputRegex=tildeInputRegex},"./node_modules/@tiptap/extension-code/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs");const inputRegexMatch=text=>{const match=/`([^`]+)`(?!`)$/.exec(text);return match?match.index>0&&"`"===text[match.index-1]?null:{index:match.index,text:match[0],replaceWith:match[1]}:null},pasteRegexMatch=text=>{const regex=/`([^`]+)`(?!`)/g,matches=[];let match;for(;null!==(match=regex.exec(text));)match.index>0&&"`"===text[match.index-1]||matches.push({index:match.index,text:match[0],replaceWith:match[1]});return matches},Code=_tiptap_core.Mark.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes}){return["code",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},markdownTokenName:"codespan",parseMarkdown:(token,helpers)=>helpers.applyMark("code",[{type:"text",text:token.text||""}]),renderMarkdown:(node,h)=>node.content?`\`${h.renderChildren(node.content)}\``:"",addCommands(){return{setCode:()=>({commands})=>commands.setMark(this.name),toggleCode:()=>({commands})=>commands.toggleMark(this.name),unsetCode:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[(0,_tiptap_core.markInputRule)({find:inputRegexMatch,type:this.type})]},addPasteRules(){return[(0,_tiptap_core.markPasteRule)({find:pasteRegexMatch,type:this.type})]}});var src_default=Code;exports.Code=Code,exports.default=src_default,exports.inputRegex=/(^|[^`])`([^`]+)`(?!`)$/,exports.inputRegexMatch=inputRegexMatch,exports.pasteRegex=/(^|[^`])`([^`]+)`(?!`)/g,exports.pasteRegexMatch=pasteRegexMatch},"./node_modules/@tiptap/extension-document/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Document=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs").Node.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(node,h)=>node.content?h.renderChildren(node.content,"\n\n"):""});var src_default=Document;exports.Document=Document,exports.default=src_default},"./node_modules/@tiptap/extension-gapcursor/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_extensions=__webpack_require__("./node_modules/@tiptap/extensions/dist/index.cjs");var src_default=_tiptap_extensions.Gapcursor;Object.defineProperty(exports,"Gapcursor",{enumerable:!0,get:function(){return _tiptap_extensions.Gapcursor}}),exports.default=src_default},"./node_modules/@tiptap/extension-hard-break/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs");const HardBreak=_tiptap_core.Node.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes}){return["br",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes)]},renderText:()=>"\n",renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands,chain,state,editor})=>commands.first([()=>commands.exitCode(),()=>commands.command(()=>{const{selection,storedMarks}=state;if(selection.$from.parent.type.spec.isolating)return!1;const{keepMarks}=this.options,{splittableMarks}=editor.extensionManager,marks=storedMarks||selection.$to.parentOffset&&selection.$from.marks();return chain().insertContent({type:this.name}).command(({tr,dispatch})=>{if(dispatch&&marks&&keepMarks){const filteredMarks=marks.filter(mark=>splittableMarks.includes(mark.type.name));tr.ensureMarks(filteredMarks)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var src_default=HardBreak;exports.HardBreak=HardBreak,exports.default=src_default},"./node_modules/@tiptap/extension-heading/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs");const Heading=_tiptap_core.Node.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(level=>({tag:`h${level}`,attrs:{level}}))},renderHTML({node,HTMLAttributes}){return[`h${this.options.levels.includes(node.attrs.level)?node.attrs.level:this.options.levels[0]}`,(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},parseMarkdown:(token,helpers)=>helpers.createNode("heading",{level:token.depth||1},helpers.parseInline(token.tokens||[])),renderMarkdown:(node,h)=>{var _node$attrs;const level=(null===(_node$attrs=node.attrs)||void 0===_node$attrs?void 0:_node$attrs.level)?parseInt(node.attrs.level,10):1,headingChars="#".repeat(level);return node.content?`${headingChars} ${h.renderChildren(node.content)}`:""},addCommands(){return{setHeading:attributes=>({commands})=>!!this.options.levels.includes(attributes.level)&&commands.setNode(this.name,attributes),toggleHeading:attributes=>({commands})=>!!this.options.levels.includes(attributes.level)&&commands.toggleNode(this.name,"paragraph",attributes)}},addKeyboardShortcuts(){return this.options.levels.reduce((items,level)=>({...items,[`Mod-Alt-${level}`]:()=>this.editor.commands.toggleHeading({level})}),{})},addInputRules(){return this.options.levels.map(level=>(0,_tiptap_core.textblockTypeInputRule)({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),type:this.type,getAttributes:{level}}))}});var src_default=Heading;exports.Heading=Heading,exports.default=src_default},"./node_modules/@tiptap/extension-horizontal-rule/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),_tiptap_pm_state=__webpack_require__("./node_modules/@tiptap/pm/dist/state/index.cjs");const HorizontalRule=_tiptap_core.Node.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{},nextNodeType:"paragraph"}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes}){return["hr",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes)]},markdownTokenName:"hr",parseMarkdown:(token,helpers)=>helpers.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain,state})=>{if(!(0,_tiptap_core.canInsertNode)(state,state.schema.nodes[this.name]))return!1;const{selection}=state,{$to:$originTo}=selection,currentChain=chain();return(0,_tiptap_core.isNodeSelection)(selection)?currentChain.insertContentAt($originTo.pos,{type:this.name}):currentChain.insertContent({type:this.name}),currentChain.command(({state:chainState,tr,dispatch})=>{if(dispatch){const{$to}=tr.selection,posAfter=$to.end();if($to.nodeAfter)$to.nodeAfter.isTextblock?tr.setSelection(_tiptap_pm_state.TextSelection.create(tr.doc,$to.pos+1)):$to.nodeAfter.isBlock?tr.setSelection(_tiptap_pm_state.NodeSelection.create(tr.doc,$to.pos)):tr.setSelection(_tiptap_pm_state.TextSelection.create(tr.doc,$to.pos));else{const nodeType=chainState.schema.nodes[this.options.nextNodeType]||$to.parent.type.contentMatch.defaultType,node=null==nodeType?void 0:nodeType.create();node&&(tr.insert(posAfter,node),tr.setSelection(_tiptap_pm_state.TextSelection.create(tr.doc,posAfter+1)))}tr.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(0,_tiptap_core.nodeInputRule)({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var src_default=HorizontalRule;exports.HorizontalRule=HorizontalRule,exports.default=src_default},"./node_modules/@tiptap/extension-italic/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs");const starInputRegex=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,starPasteRegex=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,underscoreInputRegex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,underscorePasteRegex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Italic=_tiptap_core.Mark.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:node=>"normal"!==node.style.fontStyle&&null},{style:"font-style=normal",clearMark:mark=>mark.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes}){return["em",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setItalic:()=>({commands})=>commands.setMark(this.name),toggleItalic:()=>({commands})=>commands.toggleMark(this.name),unsetItalic:()=>({commands})=>commands.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(token,helpers)=>helpers.applyMark("italic",helpers.parseInline(token.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(node,h)=>`*${h.renderChildren(node)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[(0,_tiptap_core.markInputRule)({find:starInputRegex,type:this.type}),(0,_tiptap_core.markInputRule)({find:underscoreInputRegex,type:this.type})]},addPasteRules(){return[(0,_tiptap_core.markPasteRule)({find:starPasteRegex,type:this.type}),(0,_tiptap_core.markPasteRule)({find:underscorePasteRegex,type:this.type})]}});var src_default=Italic;exports.Italic=Italic,exports.default=src_default,exports.starInputRegex=starInputRegex,exports.starPasteRegex=starPasteRegex,exports.underscoreInputRegex=underscoreInputRegex,exports.underscorePasteRegex=underscorePasteRegex},"./node_modules/@tiptap/extension-link/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),linkifyjs=__webpack_require__("./node_modules/linkifyjs/dist/linkify.mjs"),_tiptap_pm_state=__webpack_require__("./node_modules/@tiptap/pm/dist/state/index.cjs");const UNICODE_WHITESPACE_REGEX=new RegExp("[\0-   ᠎ -\u2029  ]"),UNICODE_WHITESPACE_REGEX_END=new RegExp("[\0-   ᠎ -\u2029  ]$"),UNICODE_WHITESPACE_REGEX_GLOBAL=new RegExp("[\0-   ᠎ -\u2029  ]","g");const MARKDOWN_LINK_INPUT_REGEX=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,MARKDOWN_LINK_PASTE_REGEX=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function isEscaped(text,index){let backslashes=0;for(let position=index-1;position>=0&&"\\"===text[position];position-=1)backslashes+=1;return backslashes%2==1}function isConvertibleLink(text,match,isAllowedHref){var _match$index,_match$index2;const[,linkText,href]=match;return"!"!==(match.index?text[match.index-1]:void 0)&&!isEscaped(text,null!==(_match$index=match.index)&&void 0!==_match$index?_match$index:0)&&(!function isInsideCodeSpan(text,matchIndex){let openRunLength=0,index=0;for(;index<matchIndex;){if("`"!==text[index]){index+=1;continue}if(0===openRunLength&&isEscaped(text,index)){index+=1;continue}let runLength=0;for(;index<matchIndex&&"`"===text[index];)runLength+=1,index+=1;0===openRunLength?openRunLength=runLength:runLength===openRunLength&&(openRunLength=0)}return openRunLength>0}(text,null!==(_match$index2=match.index)&&void 0!==_match$index2?_match$index2:0)&&(!!linkText.trim()&&isAllowedHref(href)))}function toRuleMatch(match){var _ref,_match$index3;const[linkSyntax,linkText,href,,straightQuotedTitle,curlyDoubleTitle,curlySingleTitle]=match,title=null!==(_ref=null!=straightQuotedTitle?straightQuotedTitle:curlyDoubleTitle)&&void 0!==_ref?_ref:curlySingleTitle;return{index:null!==(_match$index3=match.index)&&void 0!==_match$index3?_match$index3:0,text:linkSyntax,replaceWith:linkText,data:{href,title:title||null,markdown:!0}}}function getMarkdownLinkAttributes(match){var _match$data,_match$data$title,_match$data2;return{href:null===(_match$data=match.data)||void 0===_match$data?void 0:_match$data.href,title:null!==(_match$data$title=null===(_match$data2=match.data)||void 0===_match$data2?void 0:_match$data2.title)&&void 0!==_match$data$title?_match$data$title:null}}function markdownLinkInputRule(config){const rule=(0,_tiptap_core.markInputRule)({find:text=>{const match=MARKDOWN_LINK_INPUT_REGEX.exec(text);return match&&isConvertibleLink(text,match,config.isAllowedHref)?toRuleMatch(match):null},type:config.type,getAttributes:getMarkdownLinkAttributes});return new _tiptap_core.InputRule({find:rule.find,handler:props=>{const result=rule.handler(props);return null!==result&&props.state.tr.steps.length&&props.state.tr.setMeta("preventAutolink",!0),result}})}function markdownLinkPasteRule(config){const rule=(0,_tiptap_core.markPasteRule)({find:text=>{var _config$findPlainUrls,_config$findPlainUrls2;const markdownMatches=[];for(const match of text.matchAll(MARKDOWN_LINK_PASTE_REGEX))isConvertibleLink(text,match,config.isAllowedHref)&&markdownMatches.push(toRuleMatch(match));const plainUrlMatches=(null!==(_config$findPlainUrls=null===(_config$findPlainUrls2=config.findPlainUrls)||void 0===_config$findPlainUrls2?void 0:_config$findPlainUrls2.call(config,text))&&void 0!==_config$findPlainUrls?_config$findPlainUrls:[]).filter(urlMatch=>!markdownMatches.some(markdownMatch=>function matchesOverlap(a,b){return a.index<b.index+b.text.length&&b.index<a.index+a.text.length}(markdownMatch,urlMatch)));return[...markdownMatches,...plainUrlMatches]},type:config.type,getAttributes:getMarkdownLinkAttributes});return new _tiptap_core.PasteRule({find:rule.find,handler:props=>{var _props$match$data;const result=rule.handler(props);return null!==result&&props.state.tr.steps.length&&(null===(_props$match$data=props.match.data)||void 0===_props$match$data?void 0:_props$match$data.markdown)&&props.state.tr.setMeta("preventAutolink",!0),result}})}function isAllowedUri(uri,protocols){const allowedProtocols=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return protocols&&protocols.forEach(protocol=>{const nextProtocol="string"==typeof protocol?protocol:protocol.scheme;nextProtocol&&allowedProtocols.push(nextProtocol)}),!uri||uri.replace(UNICODE_WHITESPACE_REGEX_GLOBAL,"").match(new RegExp(`^(?:(?:${allowedProtocols.map(protocol=>protocol.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}const Link=_tiptap_core.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(protocol=>{"string"!=typeof protocol?(0,linkifyjs.registerCustomProtocol)(protocol.scheme,protocol.optionalSlashes):(0,linkifyjs.registerCustomProtocol)(protocol)})},onDestroy(){(0,linkifyjs.reset)()},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(url,ctx)=>!!isAllowedUri(url,ctx.protocols),validate:url=>!!url,shouldAutoLink:url=>{const hasProtocol=/^[a-z][a-z0-9+.-]*:\/\//i.test(url),hasMaybeProtocol=/^[a-z][a-z0-9+.-]*:/i.test(url);if(hasProtocol||hasMaybeProtocol&&!url.includes("@"))return!0;const hostname=(url.includes("@")?url.split("@").pop():url).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(hostname)&&!!/\./.test(hostname)}}),addAttributes(){var _this$options$HTMLAtt,_this$options$HTMLAtt2,_this$options$HTMLAtt3;return{href:{default:null,parseHTML:element=>element.getAttribute("href")},target:{default:null!==(_this$options$HTMLAtt=this.options.HTMLAttributes.target)&&void 0!==_this$options$HTMLAtt?_this$options$HTMLAtt:null},rel:{default:null!==(_this$options$HTMLAtt2=this.options.HTMLAttributes.rel)&&void 0!==_this$options$HTMLAtt2?_this$options$HTMLAtt2:null},class:{default:null!==(_this$options$HTMLAtt3=this.options.HTMLAttributes.class)&&void 0!==_this$options$HTMLAtt3?_this$options$HTMLAtt3:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:dom=>{const href=dom.getAttribute("href");return!(!href||!this.options.isAllowedUri(href,{defaultValidate:url=>!!isAllowedUri(url,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes}){return this.options.isAllowedUri(HTMLAttributes.href,{defaultValidate:href=>!!isAllowedUri(href,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]:["a",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,{...HTMLAttributes,href:""}),0]},markdownTokenName:"link",parseMarkdown:(token,helpers)=>helpers.applyMark("link",helpers.parseInline(token.tokens||[]),{href:token.href,title:token.title||null}),renderMarkdown:(node,h)=>{var _node$attrs$href,_node$attrs,_node$attrs$title,_node$attrs2;const href=null!==(_node$attrs$href=null===(_node$attrs=node.attrs)||void 0===_node$attrs?void 0:_node$attrs.href)&&void 0!==_node$attrs$href?_node$attrs$href:"",title=null!==(_node$attrs$title=null===(_node$attrs2=node.attrs)||void 0===_node$attrs2?void 0:_node$attrs2.title)&&void 0!==_node$attrs$title?_node$attrs$title:"",text=h.renderChildren(node);return title?`[${text}](${href} "${title}")`:`[${text}](${href})`},addCommands(){return{setLink:attributes=>({chain})=>{const{href}=attributes;return!!this.options.isAllowedUri(href,{defaultValidate:url=>!!isAllowedUri(url,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&chain().setMark(this.name,attributes).setMeta("preventAutolink",!0).run()},toggleLink:attributes=>({chain})=>{const{href}=attributes||{};return!(href&&!this.options.isAllowedUri(href,{defaultValidate:url=>!!isAllowedUri(url,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&chain().toggleMark(this.name,attributes,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain})=>chain().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[markdownLinkInputRule({type:this.type,isAllowedHref:href=>this.options.isAllowedUri(href,{defaultValidate:url=>!!isAllowedUri(url,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){const findPlainUrls=text=>{const foundLinks=[];if(text){const{protocols,defaultProtocol}=this.options;(0,linkifyjs.find)(text).filter(item=>item.isLink&&this.options.isAllowedUri(item.value,{defaultValidate:href=>!!isAllowedUri(href,protocols),protocols,defaultProtocol})).forEach(link=>{this.options.shouldAutoLink(link.value)&&foundLinks.push({text:link.value,data:{href:link.href},index:link.start})})}return foundLinks};return this.options.markdownLinks?[markdownLinkPasteRule({type:this.type,isAllowedHref:href=>this.options.isAllowedUri(href,{defaultValidate:url=>!!isAllowedUri(url,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls})]:[(0,_tiptap_core.markPasteRule)({find:findPlainUrls,type:this.type,getAttributes:match=>{var _match$data;return{href:null===(_match$data=match.data)||void 0===_match$data?void 0:_match$data.href}}})]},addProseMirrorPlugins(){const plugins=[],{protocols,defaultProtocol}=this.options;return this.options.autolink&&plugins.push(function autolink(options){return new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("autolink"),appendTransaction:(transactions,oldState,newState)=>{const docChanges=transactions.some(transaction=>transaction.docChanged)&&!oldState.doc.eq(newState.doc),preventAutolink=transactions.some(transaction=>transaction.getMeta("preventAutolink"));if(!docChanges||preventAutolink)return;const{tr}=newState,transform=(0,_tiptap_core.combineTransactionSteps)(oldState.doc,[...transactions]);return(0,_tiptap_core.getChangedRanges)(transform).forEach(({newRange})=>{const nodesInChangedRanges=(0,_tiptap_core.findChildrenInRange)(newState.doc,newRange,node=>node.isTextblock);let textBlock,textBeforeWhitespace;if(nodesInChangedRanges.length>1)textBlock=nodesInChangedRanges[0],textBeforeWhitespace=newState.doc.textBetween(textBlock.pos,textBlock.pos+textBlock.node.nodeSize,void 0," ");else if(nodesInChangedRanges.length){const endText=newState.doc.textBetween(newRange.from,newRange.to," "," ");if(!UNICODE_WHITESPACE_REGEX_END.test(endText))return;textBlock=nodesInChangedRanges[0],textBeforeWhitespace=newState.doc.textBetween(textBlock.pos,newRange.to,void 0," ")}if(textBlock&&textBeforeWhitespace){const wordsBeforeWhitespace=textBeforeWhitespace.split(UNICODE_WHITESPACE_REGEX).filter(Boolean);if(wordsBeforeWhitespace.length<=0)return!1;const lastWordBeforeSpace=wordsBeforeWhitespace[wordsBeforeWhitespace.length-1],lastWordAndBlockOffset=textBlock.pos+textBeforeWhitespace.lastIndexOf(lastWordBeforeSpace);if(!lastWordBeforeSpace)return!1;const linksBeforeSpace=(0,linkifyjs.tokenize)(lastWordBeforeSpace).map(t=>t.toObject(options.defaultProtocol));if(!function isValidLinkStructure(tokens){return 1===tokens.length?tokens[0].isLink:!(3!==tokens.length||!tokens[1].isLink)&&["()","[]"].includes(tokens[0].value+tokens[2].value)}(linksBeforeSpace))return!1;linksBeforeSpace.filter(link=>link.isLink).map(link=>({...link,from:lastWordAndBlockOffset+link.start+1,to:lastWordAndBlockOffset+link.end+1})).filter(link=>!newState.schema.marks.code||!newState.doc.rangeHasMark(link.from,link.to,newState.schema.marks.code)).filter(link=>options.validate(link.value)).filter(link=>options.shouldAutoLink(link.value)).forEach(link=>{(0,_tiptap_core.getMarksBetween)(link.from,link.to,newState.doc).some(item=>item.mark.type===options.type)||tr.addMark(link.from,link.to,options.type.create({href:link.href}))})}}),tr.steps.length?tr:void 0}})}({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:url=>this.options.isAllowedUri(url,{defaultValidate:href=>!!isAllowedUri(href,protocols),protocols,defaultProtocol}),shouldAutoLink:this.options.shouldAutoLink})),plugins.push(function clickHandler(options){return new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("handleClickLink"),props:{handleClick:(view,pos,event)=>{if(0!==event.button)return!1;if(!view.editable)return!1;let link=null;if(event.target instanceof HTMLAnchorElement)link=event.target;else{const target=event.target;if(!target)return!1;const root=options.editor.view.dom;link=target.closest("a"),link&&!root.contains(link)&&(link=null)}if(!link)return!1;let handled=!1;if(options.enableClickSelection&&(handled=options.editor.commands.extendMarkRange(options.type.name)),options.openOnClick){var _link$href,_link$target;const attrs=(0,_tiptap_core.getAttributes)(view.state,options.type.name),href=null!==(_link$href=link.href)&&void 0!==_link$href?_link$href:attrs.href,target=null!==(_link$target=link.target)&&void 0!==_link$target?_link$target:attrs.target;href&&(window.open(href,target),handled=!0)}return handled}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&plugins.push(function pasteHandler(options){return new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("handlePasteLink"),props:{handlePaste:(view,_event,slice)=>{const{shouldAutoLink}=options,{state}=view,{selection}=state,{empty}=selection;if(empty)return!1;let textContent="";slice.content.forEach(node=>{textContent+=node.textContent});const link=(0,linkifyjs.find)(textContent,{defaultProtocol:options.defaultProtocol}).find(item=>item.isLink&&item.value===textContent);return!(!textContent||!link||void 0!==shouldAutoLink&&!shouldAutoLink(link.value))&&options.editor.commands.setMark(options.type,{href:link.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),plugins}});var src_default=Link;exports.Link=Link,exports.default=src_default,exports.isAllowedUri=isAllowedUri,exports.pasteRegex=/https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi},"./node_modules/@tiptap/extension-list/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var __defProp=Object.defineProperty,__exportAll=(all,no_symbols)=>{let target={};for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0});return no_symbols||__defProp(target,Symbol.toStringTag,{value:"Module"}),target};let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),_tiptap_pm_model=__webpack_require__("./node_modules/@tiptap/pm/dist/model/index.cjs"),_tiptap_pm_state=__webpack_require__("./node_modules/@tiptap/pm/dist/state/index.cjs");const bulletListInputRegex=/^\s*([-+*])\s$/,BulletList=_tiptap_core.Node.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes}){return["ul",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},markdownTokenName:"list",parseMarkdown:(token,helpers)=>"list"!==token.type||token.ordered?[]:{type:"bulletList",content:token.items?helpers.parseChildren(token.items):[]},renderMarkdown:(node,h)=>node.content?h.renderChildren(node.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands,chain})=>this.options.keepAttributes?chain().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes("textStyle")).run():commands.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let inputRule=(0,_tiptap_core.wrappingInputRule)({find:bulletListInputRegex,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(inputRule=(0,_tiptap_core.wrappingInputRule)({find:bulletListInputRegex,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[inputRule]}}),handleDeleteBranchingNestedList=(editor,itemName,wrapperNames)=>((state,dispatch,itemName,wrapperNames)=>{const context=((state,itemName,wrapperNames)=>{const{selection}=state;if(!selection.empty)return null;const{$from}=selection;if(!$from.parent.isTextblock)return null;if($from.parentOffset!==$from.parent.content.size)return null;let listItemDepth=-1;for(let depth=$from.depth;depth>0;depth-=1)if($from.node(depth).type.name===itemName){listItemDepth=depth;break}if(listItemDepth<0)return null;const listItem=$from.node(listItemDepth),indexInListItem=$from.index(listItemDepth);if(indexInListItem+1>=listItem.childCount)return null;const nextChild=listItem.child(indexInListItem+1);if(!wrapperNames.includes(nextChild.type.name))return null;const itemType=state.schema.nodes[itemName];let hasBranching=!1;if(nextChild.forEach(child=>{child.type===itemType&&child.childCount>1&&(hasBranching=!0)}),!hasBranching)return null;const nodeAfter=state.doc.resolve($from.after()).nodeAfter;if(!nodeAfter||!wrapperNames.includes(nodeAfter.type.name))return null;const items=[];return nodeAfter.forEach(child=>{items.push(child)}),0===items.length?null:{listItemDepth,nestedList:nodeAfter,nestedListPos:$from.after(),insertPos:$from.after(listItemDepth),items}})(state,itemName,wrapperNames);if(!context)return!1;const{selection}=state,{nestedList,nestedListPos,insertPos,items}=context,tr=state.tr;tr.delete(nestedListPos,nestedListPos+nestedList.nodeSize);const mappedInsertPos=tr.mapping.map(insertPos);return tr.insert(mappedInsertPos,_tiptap_pm_model.Fragment.from(items)),tr.setSelection(selection.map(tr.doc,tr.mapping)),dispatch&&dispatch(tr),!0})(editor.state,editor.view.dispatch,itemName,wrapperNames),createBranchingListDeleteKeymap=(itemName,wrapperNames)=>_tiptap_core.Extension.create({name:`${itemName}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){const handleDelete=()=>handleDeleteBranchingNestedList(this.editor,itemName,wrapperNames);return{Delete:handleDelete,"Mod-Delete":handleDelete}}}),ROMAN_NUMERALS=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],ALPHA_NUMERALS="abcdefghijklmnopqrstuvwxyz",ORDERED_LIST_MARKER_PATTERN=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function toRoman(num){let remaining=num,result="";for(const[value,numeral]of ROMAN_NUMERALS)for(;remaining>=value;)result+=numeral,remaining-=value;return result}function toRomanUpper(num){return toRoman(num).toUpperCase()}function fromRoman(roman){const lower=roman.toLowerCase();let index=0,result=0;for(;index<lower.length;){let matched=!1;for(const[value,numeral]of ROMAN_NUMERALS)if(lower.startsWith(numeral,index)){result+=value,index+=numeral.length,matched=!0;break}if(!matched)return 0}return result}function toRomanAlpha(num){if(num<=26)return ALPHA_NUMERALS[num-1];const first=Math.floor((num-1)/26)-1,second=(num-1)%26;return first<0?ALPHA_NUMERALS[second]:ALPHA_NUMERALS[first]+ALPHA_NUMERALS[second]}function detectMarkerType(marker){if(marker&&!/^\d+$/.test(marker))return function isValidRoman(marker){if(!/^[ivxlcdmIVXLCDM]+$/.test(marker))return!1;const value=fromRoman(marker);return!(value<=0)&&(marker===marker.toLowerCase()?toRoman(value):toRomanUpper(value))===marker}(marker)?marker===marker.toLowerCase()?"i":"I":/^[a-z]{1,2}$/.test(marker)?"a":/^[A-Z]{1,2}$/.test(marker)?"A":void 0}function markerToStart(marker){if(/^\d+$/.test(marker))return parseInt(marker,10);const type=detectMarkerType(marker);if("i"===type||"I"===type)return fromRoman(marker);if("a"===type||"A"===type){const start=function fromAlpha(marker){const lower=marker.toLowerCase();if(1===lower.length)return lower.charCodeAt(0)-"a".charCodeAt(0)+1;if(2===lower.length)return 26*(lower.charCodeAt(0)-"a".charCodeAt(0)+1)+(lower.charCodeAt(1)-"a".charCodeAt(0))+1;return 0}(marker);return start>0?start:1}const parsed=parseInt(marker,10);return Number.isNaN(parsed)?1:parsed}function startToMarker(type,start){if("numeric"===type)return String(start);switch(type){case"a":return toRomanAlpha(start);case"A":return toRomanAlpha(start).toUpperCase();case"i":return toRoman(start);case"I":return toRomanUpper(start);default:return String(start)}}function areOrderedListMarkersSequential(markers){var _detectMarkerType;if(0===markers.length)return!1;const firstType=null!==(_detectMarkerType=detectMarkerType(markers[0]))&&void 0!==_detectMarkerType?_detectMarkerType:"numeric",firstStart=markerToStart(markers[0]);if(firstStart<1)return!1;for(let i=0;i<markers.length;i++){const expected=startToMarker(firstType,firstStart+i);if(markers[i]!==expected)return!1}return!0}function parseListMarker(marker){return{type:detectMarkerType(marker),start:markerToStart(marker)}}function buildOrderedListAttrsFromMarker(marker){const{type,start}=parseListMarker(marker),attrs={};return type&&(attrs.type=type),1!==start&&(attrs.start=start),attrs}function getListMarker(type,index,separator=". "){const position=index+1;if(!type||"1"===type)return`${position}${separator}`;switch(type){case"a":return`${toRomanAlpha(position)}${separator}`;case"A":return`${toRomanAlpha(position).toUpperCase()}${separator}`;case"i":return`${toRoman(position)}${separator}`;case"I":return`${toRomanUpper(position)}${separator}`;default:return`${position}${separator}`}}function parseSameLineOrderedListText(text,helpers){return helpers.tokenizeInline?helpers.parseInline(helpers.tokenizeInline(text)):helpers.parseInline([{type:"text",raw:text,text}])}const ListItem=_tiptap_core.Node.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes}){return["li",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},markdownTokenName:"list_item",parseMarkdown:(token,helpers)=>{var _helpers$parseBlockCh;if("list_item"!==token.type)return[];const parseBlockChildren=null!==(_helpers$parseBlockCh=helpers.parseBlockChildren)&&void 0!==_helpers$parseBlockCh?_helpers$parseBlockCh:helpers.parseChildren;let content=[];if(token.tokens&&token.tokens.length>0){if(function isSameLineOrderedListToken(token){var _token$tokens,_token$tokens2;const nestedToken=null===(_token$tokens=token.tokens)||void 0===_token$tokens?void 0:_token$tokens[0];return Boolean(token.text&&1===(null===(_token$tokens2=token.tokens)||void 0===_token$tokens2?void 0:_token$tokens2.length)&&"list"===(null==nestedToken?void 0:nestedToken.type)&&nestedToken.ordered&&nestedToken.raw===token.text)}(token))return{type:"listItem",content:[{type:"paragraph",content:parseSameLineOrderedListText(token.text||"",helpers)}]};if(token.tokens.some(t=>"paragraph"===t.type))content=parseBlockChildren(token.tokens);else{const firstToken=token.tokens[0];if(firstToken&&"text"===firstToken.type&&firstToken.tokens&&firstToken.tokens.length>0){if(content=[{type:"paragraph",content:helpers.parseInline(firstToken.tokens)}],token.tokens.length>1){const additionalContent=parseBlockChildren(token.tokens.slice(1));content.push(...additionalContent)}}else content=parseBlockChildren(token.tokens)}}return 0===content.length&&(content=[{type:"paragraph",content:[]}]),{type:"listItem",content}},renderMarkdown:(node,h,ctx)=>(0,_tiptap_core.renderNestedMarkdownContent)(node,h,context=>{if("bulletList"===context.parentType)return"- ";if("orderedList"===context.parentType){var _context$meta,_context$meta2;const start=(null===(_context$meta=context.meta)||void 0===_context$meta||null===(_context$meta=_context$meta.parentAttrs)||void 0===_context$meta?void 0:_context$meta.start)||1;return getListMarker(null===(_context$meta2=context.meta)||void 0===_context$meta2||null===(_context$meta2=_context$meta2.parentAttrs)||void 0===_context$meta2?void 0:_context$meta2.type,start-1+(context.index||0),". ")}return"- "},ctx,{alignNestedToPrefix:"orderedList"===(null==ctx?void 0:ctx.parentType)}),addExtensions(){return[createBranchingListDeleteKeymap(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),findListItemPos=(typeOrName,state)=>{const{$from}=state.selection,nodeType=(0,_tiptap_core.getNodeType)(typeOrName,state.schema);let currentNode=null,currentDepth=$from.depth,currentPos=$from.pos,targetDepth=null;for(;currentDepth>0&&null===targetDepth;)currentNode=$from.node(currentDepth),currentNode.type===nodeType?targetDepth=currentDepth:(currentDepth-=1,currentPos-=1);return null===targetDepth?null:{$pos:state.doc.resolve(currentPos),depth:targetDepth}},getNextListDepth=(typeOrName,state)=>{const listItemPos=findListItemPos(typeOrName,state);if(!listItemPos)return!1;const[,depth]=(0,_tiptap_core.getNodeAtPosition)(state,typeOrName,listItemPos.$pos.pos+4);return depth},hasListBefore=(editorState,name,parentListTypes)=>{const{$anchor}=editorState.selection,previousNodePos=Math.max(0,$anchor.pos-2),previousNode=editorState.doc.resolve(previousNodePos).node();return!(!previousNode||!parentListTypes.includes(previousNode.type.name))},handleBackspace=(editor,name,parentListTypes)=>{if(editor.commands.undoInputRule())return!0;if(editor.state.selection.from!==editor.state.selection.to)return!1;if(!(0,_tiptap_core.isNodeActive)(editor.state,name)&&hasListBefore(editor.state,0,parentListTypes)){const{$anchor}=editor.state.selection,$listPos=editor.state.doc.resolve($anchor.before()-1),listDescendants=[];$listPos.node().descendants((node,pos)=>{node.type.name===name&&listDescendants.push({node,pos})});const lastItem=listDescendants.at(-1);if(!lastItem)return!1;const $lastItemPos=editor.state.doc.resolve($listPos.start()+lastItem.pos+1);return editor.chain().cut({from:$anchor.start()-1,to:$anchor.end()+1},$lastItemPos.end()).joinForward().run()}if(!(0,_tiptap_core.isNodeActive)(editor.state,name))return!1;if(!(0,_tiptap_core.isAtStartOfNode)(editor.state))return!1;const{$from}=editor.state.selection,itemDepth=$from.depth-1;return $from.node(itemDepth).type===editor.schema.nodes[name]&&0===$from.index(itemDepth)&&editor.chain().liftListItem(name).run()},nextListIsDeeper=(typeOrName,state)=>{const listDepth=getNextListDepth(typeOrName,state),listItemPos=findListItemPos(typeOrName,state);return!(!listItemPos||!listDepth)&&listDepth>listItemPos.depth},nextListIsHigher=(typeOrName,state)=>{const listDepth=getNextListDepth(typeOrName,state),listItemPos=findListItemPos(typeOrName,state);return!(!listItemPos||!listDepth)&&listDepth<listItemPos.depth},handleDelete=(editor,name)=>{if(!(0,_tiptap_core.isNodeActive)(editor.state,name))return!1;if(!(0,_tiptap_core.isAtEndOfNode)(editor.state,name))return!1;const{selection}=editor.state,{$from,$to}=selection;return!(!selection.empty&&$from.sameParent($to))&&(nextListIsDeeper(name,editor.state)?editor.chain().focus(editor.state.selection.from+4).lift(name).joinBackward().run():nextListIsHigher(name,editor.state)?editor.chain().joinForward().joinBackward().run():editor.commands.joinItemForward())},handleTab=(editor,name,parentListTypes)=>{const{state}=editor,{selection}=state;if(!selection.empty)return!1;const{$from}=selection;if(0!==$from.parentOffset)return!1;if(!$from.parent.isTextblock)return!1;if((0,_tiptap_core.isNodeActive)(state,name))return!1;const previous=(0,_tiptap_core.getPreviousBlockSibling)($from);if(!previous||!parentListTypes.includes(previous.type.name))return!1;const lastItem=previous.lastChild;if(!lastItem||lastItem.type.name!==name)return!1;const block=$from.parent;if(!lastItem.canReplace(lastItem.childCount,lastItem.childCount,_tiptap_pm_model.Fragment.from(block)))return!1;const blockStart=$from.before(),blockEnd=$from.after(),insideLastItemEnd=blockStart-2;return editor.commands.command(({tr,dispatch})=>(dispatch&&(tr.delete(blockStart,blockEnd).insert(insideLastItemEnd,_tiptap_pm_model.Fragment.from(block)),tr.setSelection(_tiptap_pm_state.TextSelection.create(tr.doc,insideLastItemEnd+1)),tr.scrollIntoView()),!0))},hasListItemAfter=(typeOrName,state)=>{var _$targetPos$nodeAfter;const{$anchor}=state.selection,$targetPos=state.doc.resolve($anchor.pos-$anchor.parentOffset-2);return $targetPos.index()!==$targetPos.parent.childCount-1&&(null===(_$targetPos$nodeAfter=$targetPos.nodeAfter)||void 0===_$targetPos$nodeAfter?void 0:_$targetPos$nodeAfter.type.name)===typeOrName},hasListItemBefore=(typeOrName,state)=>{var _$targetPos$nodeBefor;const{$anchor}=state.selection,$targetPos=state.doc.resolve($anchor.pos-2);return 0!==$targetPos.index()&&(null===(_$targetPos$nodeBefor=$targetPos.nodeBefore)||void 0===_$targetPos$nodeBefor?void 0:_$targetPos$nodeBefor.type.name)===typeOrName},listItemHasSubList=(typeOrName,state,node)=>{if(!node)return!1;const nodeType=(0,_tiptap_core.getNodeType)(typeOrName,state.schema);let hasSubList=!1;return node.descendants(child=>{child.type===nodeType&&(hasSubList=!0)}),hasSubList};var listHelpers_exports=__exportAll({findListItemPos:()=>findListItemPos,getNextListDepth:()=>getNextListDepth,handleBackspace:()=>handleBackspace,handleDelete:()=>handleDelete,handleTab:()=>handleTab,hasListBefore:()=>hasListBefore,hasListItemAfter:()=>hasListItemAfter,hasListItemBefore:()=>hasListItemBefore,listItemHasSubList:()=>listItemHasSubList,nextListIsDeeper:()=>nextListIsDeeper,nextListIsHigher:()=>nextListIsHigher});const ListKeymap=_tiptap_core.Extension.create({name:"listKeymap",addOptions:()=>({listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}),addKeyboardShortcuts(){return{Delete:({editor})=>{let handled=!1;return this.options.listTypes.forEach(({itemName})=>{void 0!==editor.state.schema.nodes[itemName]&&handleDelete(editor,itemName)&&(handled=!0)}),handled},"Mod-Delete":({editor})=>{let handled=!1;return this.options.listTypes.forEach(({itemName})=>{void 0!==editor.state.schema.nodes[itemName]&&handleDelete(editor,itemName)&&(handled=!0)}),handled},Backspace:({editor})=>{let handled=!1;return this.options.listTypes.forEach(({itemName,wrapperNames})=>{void 0!==editor.state.schema.nodes[itemName]&&handleBackspace(editor,itemName,wrapperNames)&&(handled=!0)}),handled},"Mod-Backspace":({editor})=>{let handled=!1;return this.options.listTypes.forEach(({itemName,wrapperNames})=>{void 0!==editor.state.schema.nodes[itemName]&&handleBackspace(editor,itemName,wrapperNames)&&(handled=!0)}),handled},Tab:({editor})=>{for(const{itemName,wrapperNames}of this.options.listTypes)if(void 0!==editor.state.schema.nodes[itemName]&&handleTab(editor,itemName,wrapperNames))return!0;return!1}}}}),ORDERED_LIST_ITEM_REGEX=new RegExp(`^(\\s*)(${ORDERED_LIST_MARKER_PATTERN})([.)])\\s+(.*)$`),INDENTED_LINE_REGEX=/^\s/,PARAGRAPH_INTERRUPTERS={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function isBlockContentLine(line){const trimmedLine=line.trimStart();return PARAGRAPH_INTERRUPTERS.bulletItem.test(trimmedLine)||function isOrderedListMarkerLine(line){return ORDERED_LIST_ITEM_REGEX.test(line.trimStart())}(trimmedLine)||PARAGRAPH_INTERRUPTERS.heading.test(trimmedLine)||PARAGRAPH_INTERRUPTERS.thematicBreak.test(trimmedLine)&&!trimmedLine.startsWith("-")||/^>\s?/.test(trimmedLine)||PARAGRAPH_INTERRUPTERS.codeFence.test(trimmedLine)||PARAGRAPH_INTERRUPTERS.blockMath.test(trimmedLine)}function interruptsLazyContinuation(line){return Object.values(PARAGRAPH_INTERRUPTERS).some(pattern=>pattern.test(line))}function splitItemContent(contentLines){const paragraphLines=[],blockLines=[];let reachedBlockBoundary=!1;return contentLines.forEach(line=>{if(!reachedBlockBoundary)return""===line.trim()||paragraphLines.length>0&&isBlockContentLine(line)?(reachedBlockBoundary=!0,void blockLines.push(line)):void paragraphLines.push(line);blockLines.push(line)}),{paragraphLines,blockLines}}const PLAIN_TEXT_ORDERED_LIST_LINE_REGEX=new RegExp(`^(${ORDERED_LIST_MARKER_PATTERN})([.)])\\s+(.+)$`);function parsePlainTextOrderedListPaste(text){const lines=text.split("\n").filter(l=>l.trim().length>0);if(0===lines.length)return null;const parsedItems=[];for(const line of lines){const match=line.trim().match(PLAIN_TEXT_ORDERED_LIST_LINE_REGEX);if(!match)return null;parsedItems.push({marker:match[1],content:match[3]})}return areOrderedListMarkersSequential(parsedItems.map(item=>item.marker))?{type:"orderedList",attrs:buildOrderedListAttrsFromMarker(parsedItems[0].marker),content:parsedItems.map(item=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:item.content}]}]}))}:null}function buildNestedStructure(items,baseIndent,lexer){const result=[];let currentIndex=0;for(;currentIndex<items.length;){const item=items[currentIndex];if(item.indent===baseIndent){const{paragraphLines,blockLines}=splitItemContent(item.contentLines),mainText=paragraphLines.join("\n").trim(),tokens=[];mainText&&tokens.push({type:"paragraph",raw:mainText,tokens:lexer.inlineTokens(mainText)});const additionalContent=blockLines.join("\n").trim();if(additionalContent){const blockTokens=lexer.blockTokens(additionalContent);tokens.push(...blockTokens)}let lookAheadIndex=currentIndex+1;const nestedItems=[];for(;lookAheadIndex<items.length&&items[lookAheadIndex].indent>baseIndent;)nestedItems.push(items[lookAheadIndex]),lookAheadIndex+=1;if(nestedItems.length>0){const nestedListItems=buildNestedStructure(nestedItems,Math.min(...nestedItems.map(nestedItem=>nestedItem.indent)),lexer);tokens.push({type:"list",ordered:!0,start:nestedItems[0].number,typeMarker:nestedItems[0].type,items:nestedListItems,raw:nestedItems.map(nestedItem=>nestedItem.raw).join("\n")})}result.push({type:"list_item",raw:item.raw,tokens}),currentIndex=lookAheadIndex}else currentIndex+=1}return result}const orderedListInputRegex=/^(\d+)\.\s$/;function cssListStyleTypeToHtmlType(style){const match=style.match(/list-style-type\s*:\s*([^;]+)/i);if(!match)return null;switch(match[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}const OrderedList=_tiptap_core.Node.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:element=>element.hasAttribute("start")?parseInt(element.getAttribute("start")||"",10):1},type:{default:null,parseHTML:element=>{const htmlType=element.getAttribute("type");if(htmlType)return htmlType;const style=element.getAttribute("style");if(style){const mappedFromOl=cssListStyleTypeToHtmlType(style);if(mappedFromOl)return mappedFromOl}const firstLi=element.querySelector("li");if(firstLi){const liStyle=firstLi.getAttribute("style");if(liStyle){const mappedFromLi=cssListStyleTypeToHtmlType(liStyle);if(mappedFromLi)return mappedFromLi}}return null}}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes}){const{start,type,...attributesWithoutType}=HTMLAttributes,attrs=(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,attributesWithoutType);return 1!==start&&(attrs.start=start),type&&"1"!==type&&(attrs.type=type),["ol",attrs,0]},markdownTokenName:"list",parseMarkdown:(token,helpers)=>{if("list"!==token.type||!token.ordered)return[];const startValue=token.start||1,typeValue=token.typeMarker,content=token.items?function parseListItems(items,helpers){return items.map(item=>{if("list_item"!==item.type)return helpers.parseChildren([item])[0];const content=[];return item.tokens&&item.tokens.length>0&&item.tokens.forEach(itemToken=>{if("paragraph"===itemToken.type||"list"===itemToken.type||"blockquote"===itemToken.type||"code"===itemToken.type)content.push(...helpers.parseChildren([itemToken]));else if("text"===itemToken.type&&itemToken.tokens){const inlineContent=helpers.parseChildren([itemToken]);content.push({type:"paragraph",content:inlineContent})}else{const parsed=helpers.parseChildren([itemToken]);parsed.length>0&&content.push(...parsed)}}),{type:"listItem",content}})}(token.items,helpers):[],attrs={};return 1!==startValue&&(attrs.start=startValue),typeValue&&(attrs.type=typeValue),Object.keys(attrs).length>0?{type:"orderedList",attrs,content}:{type:"orderedList",content}},renderMarkdown:(node,h)=>node.content?h.renderChildren(node.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(src,_tokens,lexer)=>{var _listItems$,_listItems$2;const lines=src.split("\n"),[listItems,consumed]=function collectOrderedListItems(lines){const listItems=[];let currentLineIndex=0,consumed=0;for(;currentLineIndex<lines.length;){const line=lines[currentLineIndex],match=line.match(ORDERED_LIST_ITEM_REGEX);if(!match)break;const[,indent,marker,_separator,content]=match,indentLevel=indent.length,number=parseInt(marker,10),markerType=isNaN(number)?detectMarkerType(marker):void 0,itemNumber=isNaN(number)?markerToStart(marker):number,itemContentLines=[content];let nextLineIndex=currentLineIndex+1;const itemLines=[line];let sawBlankLine=!1;for(;nextLineIndex<lines.length;){const nextLine=lines[nextLineIndex];if(nextLine.match(ORDERED_LIST_ITEM_REGEX))break;if(""===nextLine.trim())itemLines.push(nextLine),itemContentLines.push(""),sawBlankLine=!0,nextLineIndex+=1;else if(nextLine.match(INDENTED_LINE_REGEX)){const leadingWhitespace=nextLine.length-nextLine.trimStart().length,contentIndent=indentLevel+marker.length+1;itemLines.push(nextLine),itemContentLines.push(nextLine.slice(Math.min(leadingWhitespace,contentIndent))),nextLineIndex+=1}else{if(sawBlankLine||interruptsLazyContinuation(nextLine))break;itemLines.push(nextLine),itemContentLines.push(nextLine),nextLineIndex+=1}}listItems.push({indent:indentLevel,number:itemNumber,type:markerType,content:itemContentLines.join("\n").trim(),contentLines:itemContentLines,raw:itemLines.join("\n")}),consumed=nextLineIndex,currentLineIndex=nextLineIndex}return[listItems,consumed]}(lines);if(0===listItems.length)return;const items=buildNestedStructure(listItems,listItems[0].indent,lexer);return 0!==items.length?{type:"list",ordered:!0,start:(null===(_listItems$=listItems[0])||void 0===_listItems$?void 0:_listItems$.number)||1,typeMarker:null===(_listItems$2=listItems[0])||void 0===_listItems$2?void 0:_listItems$2.type,items,raw:lines.slice(0,consumed).join("\n")}:void 0}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands,chain})=>this.options.keepAttributes?chain().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes("textStyle")).run():commands.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins:()=>[new _tiptap_pm_state.Plugin({props:{handlePaste:(view,event)=>{var _event$clipboardData,_event$clipboardData2;const html=null===(_event$clipboardData=event.clipboardData)||void 0===_event$clipboardData?void 0:_event$clipboardData.getData("text/html");if(null==html?void 0:html.trim())return!1;const text=null===(_event$clipboardData2=event.clipboardData)||void 0===_event$clipboardData2?void 0:_event$clipboardData2.getData("text/plain");if(!text)return!1;const orderedListContent=parsePlainTextOrderedListPaste(text);if(!orderedListContent)return!1;try{const orderedListNode=view.state.schema.nodeFromJSON(orderedListContent),tr=view.state.tr.replaceSelectionWith(orderedListNode);return view.dispatch(tr),!0}catch{return!1}}}})],addInputRules(){const joinPredicate=(match,node)=>(!node.attrs.type||"1"===node.attrs.type)&&node.childCount+node.attrs.start===+match[1];let inputRule=(0,_tiptap_core.wrappingInputRule)({find:orderedListInputRegex,type:this.type,getAttributes:match=>({start:+match[1]}),joinPredicate});return(this.options.keepMarks||this.options.keepAttributes)&&(inputRule=(0,_tiptap_core.wrappingInputRule)({find:orderedListInputRegex,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:match=>({start:+match[1],...this.editor.getAttributes("textStyle")}),joinPredicate,editor:this.editor})),[inputRule]}}),inputRegex=/^\s*(\[([( |x])?\])\s$/,TaskItem=_tiptap_core.Node.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:element=>{const dataChecked=element.getAttribute("data-checked");return""===dataChecked||"true"===dataChecked},renderHTML:attributes=>({"data-checked":attributes.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:element=>{var _element$querySelecto;return null!==(_element$querySelecto=element.querySelector("div"))&&void 0!==_element$querySelecto?_element$querySelecto:element}}]},renderHTML({node,HTMLAttributes}){return["li",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:node.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(token,h)=>{const content=[];if(token.tokens&&token.tokens.length>0?content.push(h.createNode("paragraph",{},h.parseInline(token.tokens))):token.text?content.push(h.createNode("paragraph",{},[h.createNode("text",{text:token.text})])):content.push(h.createNode("paragraph",{},[])),token.nestedTokens&&token.nestedTokens.length>0){const nestedContent=h.parseChildren(token.nestedTokens);content.push(...nestedContent)}return h.createNode("taskItem",{checked:token.checked||!1},content)},renderMarkdown:(node,h)=>{var _node$attrs;const prefix=`- [${(null===(_node$attrs=node.attrs)||void 0===_node$attrs?void 0:_node$attrs.checked)?"x":" "}] `;return(0,_tiptap_core.renderNestedMarkdownContent)(node,h,prefix)},addExtensions(){return this.options.nested?[createBranchingListDeleteKeymap(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){const shortcuts={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...shortcuts,Tab:()=>this.editor.commands.sinkListItem(this.name)}:shortcuts},addNodeView(){return({node,HTMLAttributes,getPos,editor})=>{const listItem=document.createElement("li"),checkboxWrapper=document.createElement("label"),checkboxStyler=document.createElement("span"),checkbox=document.createElement("input"),content=document.createElement("div");checkboxStyler.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0";const updateA11Y=currentNode=>{const label=((node,checked,a11y)=>{var _a11y$checkboxLabel;return(null==a11y||null===(_a11y$checkboxLabel=a11y.checkboxLabel)||void 0===_a11y$checkboxLabel?void 0:_a11y$checkboxLabel.call(a11y,node,checked))||`Task item checkbox for ${node.textContent||"empty task item"}`})(currentNode,currentNode.attrs.checked,this.options.a11y);checkbox.setAttribute("aria-label",label),checkboxStyler.textContent=label};updateA11Y(node),checkboxWrapper.contentEditable="false",checkbox.type="checkbox",checkbox.addEventListener("mousedown",event=>event.preventDefault()),checkbox.addEventListener("change",event=>{if(!editor.isEditable&&!this.options.onReadOnlyChecked)return void(checkbox.checked=!checkbox.checked);const{checked}=event.target;editor.isEditable&&"function"==typeof getPos&&editor.chain().focus(void 0,{scrollIntoView:!1}).command(({tr})=>{const position=getPos();if("number"!=typeof position)return!1;const currentNode=tr.doc.nodeAt(position);return tr.setNodeMarkup(position,void 0,{...null==currentNode?void 0:currentNode.attrs,checked}),!0}).run(),!editor.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(node,checked)||(checkbox.checked=!checkbox.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([key,value])=>{listItem.setAttribute(key,value)}),listItem.dataset.checked=node.attrs.checked,checkbox.checked=node.attrs.checked,checkboxWrapper.append(checkbox,checkboxStyler),listItem.append(checkboxWrapper,content),Object.entries(HTMLAttributes).forEach(([key,value])=>{listItem.setAttribute(key,value)});let prevRenderedAttributeKeys=new Set(Object.keys(HTMLAttributes));return{dom:listItem,contentDOM:content,update:updatedNode=>{if(updatedNode.type!==this.type)return!1;listItem.dataset.checked=updatedNode.attrs.checked,checkbox.checked=updatedNode.attrs.checked,updateA11Y(updatedNode);const extensionAttributes=editor.extensionManager.attributes,newHTMLAttributes=(0,_tiptap_core.getRenderedAttributes)(updatedNode,extensionAttributes),newKeys=new Set(Object.keys(newHTMLAttributes)),staticAttrs=this.options.HTMLAttributes;return prevRenderedAttributeKeys.forEach(key=>{newKeys.has(key)||(key in staticAttrs?listItem.setAttribute(key,staticAttrs[key]):listItem.removeAttribute(key))}),Object.entries(newHTMLAttributes).forEach(([key,value])=>{null==value?key in staticAttrs?listItem.setAttribute(key,staticAttrs[key]):listItem.removeAttribute(key):listItem.setAttribute(key,value)}),prevRenderedAttributeKeys=newKeys,!0}}}},addInputRules(){return[(0,_tiptap_core.wrappingInputRule)({find:inputRegex,type:this.type,getAttributes:match=>({checked:"x"===match[match.length-1]})})]}}),TaskList=_tiptap_core.Node.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes}){return["ul",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes,{"data-type":this.name}),0]},parseMarkdown:(token,h)=>h.createNode("taskList",{},h.parseChildren(token.items||[])),renderMarkdown:(node,h)=>node.content?h.renderChildren(node.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(src){var _src$match;const index=null===(_src$match=src.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))||void 0===_src$match?void 0:_src$match.index;return void 0!==index?index:-1},tokenize(src,tokens,lexer){const parseTaskListContent=content=>{const nestedResult=(0,_tiptap_core.parseIndentedBlocks)(content,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:match=>({indentLevel:match[1].length,mainContent:match[4],checked:"x"===match[3].toLowerCase()}),createToken:(data,nestedTokens)=>({type:"taskItem",raw:"",mainContent:data.mainContent,indentLevel:data.indentLevel,checked:data.checked,text:data.mainContent,tokens:lexer.inlineTokens(data.mainContent),nestedTokens}),customNestedParser:parseTaskListContent},lexer);if(nestedResult){const taskListToken={type:"taskList",raw:nestedResult.raw,items:nestedResult.items},remainder=content.slice(nestedResult.raw.length);return remainder.trim()?[taskListToken,...lexer.blockTokens(remainder)]:[taskListToken]}return lexer.blockTokens(content)},result=(0,_tiptap_core.parseIndentedBlocks)(src,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:match=>({indentLevel:match[1].length,mainContent:match[4],checked:"x"===match[3].toLowerCase()}),createToken:(data,nestedTokens)=>({type:"taskItem",raw:"",mainContent:data.mainContent,indentLevel:data.indentLevel,checked:data.checked,text:data.mainContent,tokens:lexer.inlineTokens(data.mainContent),nestedTokens}),customNestedParser:parseTaskListContent},lexer);if(result)return{type:"taskList",raw:result.raw,items:result.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands})=>commands.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),ListKit=_tiptap_core.Extension.create({name:"listKit",addExtensions(){const extensions=[];return!1!==this.options.bulletList&&extensions.push(BulletList.configure(this.options.bulletList)),!1!==this.options.listItem&&extensions.push(ListItem.configure(this.options.listItem)),!1!==this.options.listKeymap&&extensions.push(ListKeymap.configure(this.options.listKeymap)),!1!==this.options.orderedList&&extensions.push(OrderedList.configure(this.options.orderedList)),!1!==this.options.taskItem&&extensions.push(TaskItem.configure(this.options.taskItem)),!1!==this.options.taskList&&extensions.push(TaskList.configure(this.options.taskList)),extensions}});exports.BulletList=BulletList,exports.ListItem=ListItem,exports.ListKeymap=ListKeymap,exports.ListKit=ListKit,exports.ORDERED_LIST_MARKER_PATTERN=ORDERED_LIST_MARKER_PATTERN,exports.OrderedList=OrderedList,exports.TaskItem=TaskItem,exports.TaskList=TaskList,exports.areOrderedListMarkersSequential=areOrderedListMarkersSequential,exports.buildOrderedListAttrsFromMarker=buildOrderedListAttrsFromMarker,exports.bulletListInputRegex=bulletListInputRegex,exports.detectMarkerType=detectMarkerType,exports.getListMarker=getListMarker,exports.inputRegex=inputRegex,Object.defineProperty(exports,"listHelpers",{enumerable:!0,get:function(){return listHelpers_exports}}),exports.markerToStart=markerToStart,exports.orderedListInputRegex=orderedListInputRegex,exports.parseListMarker=parseListMarker,exports.parsePlainTextOrderedListPaste=parsePlainTextOrderedListPaste,exports.toRoman=toRoman,exports.toRomanUpper=toRomanUpper},"./node_modules/@tiptap/extension-paragraph/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs");const Paragraph=_tiptap_core.Node.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes}){return["p",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},parseMarkdown:(token,helpers)=>{const tokens=token.tokens||[];if(1===tokens.length&&"image"===tokens[0].type)return helpers.parseChildren([tokens[0]]);const content=helpers.parseInline(tokens);return 1!==tokens.length||"text"!==tokens[0].type||"&nbsp;"!==tokens[0].raw&&"&nbsp;"!==tokens[0].text&&" "!==tokens[0].raw&&" "!==tokens[0].text||1!==content.length||"text"!==content[0].type||"&nbsp;"!==content[0].text&&" "!==content[0].text?helpers.createNode("paragraph",void 0,content):helpers.createNode("paragraph",void 0,[])},renderMarkdown:(node,h,ctx)=>{if(!node)return"";const content=Array.isArray(node.content)?node.content:[];if(0===content.length){var _ctx$previousNode,_ctx$previousNode2;const previousContent=Array.isArray(null==ctx||null===(_ctx$previousNode=ctx.previousNode)||void 0===_ctx$previousNode?void 0:_ctx$previousNode.content)?ctx.previousNode.content:[];return"paragraph"===(null==ctx||null===(_ctx$previousNode2=ctx.previousNode)||void 0===_ctx$previousNode2?void 0:_ctx$previousNode2.type)&&0===previousContent.length?"&nbsp;":""}return h.renderChildren(content)},addCommands(){return{setParagraph:()=>({commands})=>commands.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var src_default=Paragraph;exports.Paragraph=Paragraph,exports.default=src_default},"./node_modules/@tiptap/extension-strike/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs");const inputRegex=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,pasteRegex=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Strike=_tiptap_core.Mark.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:style=>!!style.includes("line-through")&&{}}],renderHTML({HTMLAttributes}){return["s",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},markdownTokenName:"del",parseMarkdown:(token,helpers)=>helpers.applyMark("strike",helpers.parseInline(token.tokens||[])),renderMarkdown:(node,h)=>`~~${h.renderChildren(node)}~~`,addCommands(){return{setStrike:()=>({commands})=>commands.setMark(this.name),toggleStrike:()=>({commands})=>commands.toggleMark(this.name),unsetStrike:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[(0,_tiptap_core.markInputRule)({find:inputRegex,type:this.type})]},addPasteRules(){return[(0,_tiptap_core.markPasteRule)({find:pasteRegex,type:this.type})]}});var src_default=Strike;exports.Strike=Strike,exports.default=src_default,exports.inputRegex=inputRegex,exports.pasteRegex=pasteRegex},"./node_modules/@tiptap/extension-table-cell/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_extension_table=__webpack_require__("./node_modules/@tiptap/extension-table/dist/index.cjs");var src_default=_tiptap_extension_table.TableCell;Object.defineProperty(exports,"TableCell",{enumerable:!0,get:function(){return _tiptap_extension_table.TableCell}}),exports.default=src_default},"./node_modules/@tiptap/extension-table-header/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_extension_table=__webpack_require__("./node_modules/@tiptap/extension-table/dist/index.cjs");var src_default=_tiptap_extension_table.TableHeader;Object.defineProperty(exports,"TableHeader",{enumerable:!0,get:function(){return _tiptap_extension_table.TableHeader}}),exports.default=src_default},"./node_modules/@tiptap/extension-table-row/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_extension_table=__webpack_require__("./node_modules/@tiptap/extension-table/dist/index.cjs");var src_default=_tiptap_extension_table.TableRow;Object.defineProperty(exports,"TableRow",{enumerable:!0,get:function(){return _tiptap_extension_table.TableRow}}),exports.default=src_default},"./node_modules/@tiptap/extension-table/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),_tiptap_pm_state=__webpack_require__("./node_modules/@tiptap/pm/dist/state/index.cjs"),_tiptap_pm_tables=__webpack_require__("./node_modules/@tiptap/pm/dist/tables/index.cjs");function normalizeTableCellAlign(value){return"left"===value||"right"===value||"center"===value?value:null}function createAlignAttribute(){return{default:null,parseHTML:element=>function parseAlign(element){const styleAlign=(element.style.textAlign||"").trim().toLowerCase(),attrAlign=(element.getAttribute("align")||"").trim().toLowerCase();return normalizeTableCellAlign(styleAlign||attrAlign)}(element),renderHTML:attributes=>attributes.align?{style:`text-align: ${attributes.align}`}:{}}}function parseColwidth(element){const colwidth=element.getAttribute("colwidth");return colwidth?colwidth.split(",").map(width=>parseInt(width,10)):function parseColgroupWidth(element){var _table$querySelectorA;const row=element.parentElement,table=element.closest("table");if(!row||!table)return null;const cellIndex=Array.from(row.children).indexOf(element),width=null===(_table$querySelectorA=table.querySelectorAll("colgroup > col")[cellIndex])||void 0===_table$querySelectorA?void 0:_table$querySelectorA.getAttribute("width");return width?[parseInt(width,10)]:null}(element)}const COLLAPSIBLE_WHITESPACE=/[ \t\r\n\f]+/g;function isEmptyCellElement(element){var _element$textContent;return!(element.children.length>0)&&""===(null!==(_element$textContent=element.textContent)&&void 0!==_element$textContent?_element$textContent:"").replace(COLLAPSIBLE_WHITESPACE,"")}function fillEmptyCellContent(cellType){const filled=cellType.createAndFill();if(!filled)throw new Error(`[tiptap error]: "${cellType.name}" has no default content to backfill.`);return filled.content}const TableCell=_tiptap_core.Node.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:parseColwidth},align:createAlignAttribute()}),tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:node=>!!isEmptyCellElement(node)&&{},getContent:(_node,schema)=>fillEmptyCellContent(schema.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes}){return["td",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]}}),TableHeader=_tiptap_core.Node.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:parseColwidth},align:createAlignAttribute()}),tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:node=>!!isEmptyCellElement(node)&&{},getContent:(_node,schema)=>fillEmptyCellContent(schema.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes}){return["th",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]}}),TableRow=_tiptap_core.Node.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes}){return["tr",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]}});function getColStyleDeclaration(minWidth,width){return width?["width",`${Math.max(width,minWidth)}px`]:["min-width",`${minWidth}px`]}function updateColumns(node,colgroup,table,cellMinWidth,overrideCol,overrideValue){let totalWidth=0,fixedWidth=!0,nextDOM=colgroup.firstChild;const row=node.firstChild;if(null!==row)for(let i=0,col=0;i<row.childCount;i+=1){const{colspan,colwidth}=row.child(i).attrs;for(let j=0;j<colspan;j+=1,col+=1){const hasWidth=overrideCol===col?overrideValue:colwidth&&colwidth[j],cssWidth=hasWidth?`${hasWidth}px`:"";if(totalWidth+=hasWidth||cellMinWidth,hasWidth||(fixedWidth=!1),nextDOM){if(nextDOM.style.width!==cssWidth){const[propertyKey,propertyValue]=getColStyleDeclaration(cellMinWidth,hasWidth);nextDOM.style.setProperty(propertyKey,propertyValue)}nextDOM=nextDOM.nextSibling}else{const colElement=document.createElement("col"),[propertyKey,propertyValue]=getColStyleDeclaration(cellMinWidth,hasWidth);colElement.style.setProperty(propertyKey,propertyValue),colgroup.appendChild(colElement)}}}for(;nextDOM;){var _nextDOM$parentNode;const after=nextDOM.nextSibling;null===(_nextDOM$parentNode=nextDOM.parentNode)||void 0===_nextDOM$parentNode||_nextDOM$parentNode.removeChild(nextDOM),nextDOM=after}const hasUserWidth=node.attrs.style&&"string"==typeof node.attrs.style&&/\bwidth\s*:/i.test(node.attrs.style);fixedWidth&&!hasUserWidth?(table.style.width=`${totalWidth}px`,table.style.minWidth=""):(table.style.width="",table.style.minWidth=`${totalWidth}px`)}var TableView=class{constructor(node,cellMinWidth,_view,HTMLAttributes={}){this.node=node,this.cellMinWidth=cellMinWidth,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(const[key,value]of Object.entries(HTMLAttributes))null!=value&&("style"===key?this.table.style.cssText=String(value):this.table.setAttribute(key,String(value)));node.attrs.style&&(this.table.style.cssText=node.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),updateColumns(node,this.colgroup,this.table,cellMinWidth),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(node){return node.type===this.node.type&&(this.node=node,updateColumns(node,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(mutation){const target=mutation.target,isInsideWrapper=this.dom.contains(target),isInsideContent=this.contentDOM.contains(target);return!(!isInsideWrapper||isInsideContent||"attributes"!==mutation.type&&"childList"!==mutation.type&&"characterData"!==mutation.type)}};function createColGroup(node,cellMinWidth,overrideCol,overrideValue){let totalWidth=0,fixedWidth=!0;const cols=[],row=node.firstChild;if(!row)return{};for(let i=0,col=0;i<row.childCount;i+=1){const{colspan,colwidth}=row.child(i).attrs;for(let j=0;j<colspan;j+=1,col+=1){const hasWidth=overrideCol===col?overrideValue:colwidth&&colwidth[j];totalWidth+=hasWidth||cellMinWidth,hasWidth||(fixedWidth=!1);const[property,value]=getColStyleDeclaration(cellMinWidth,hasWidth);cols.push(["col",{style:`${property}: ${value}`}])}}const tableWidth=fixedWidth?`${totalWidth}px`:"",tableMinWidth=fixedWidth?"":`${totalWidth}px`;return{colgroup:["colgroup",{},...cols],tableWidth,tableMinWidth}}function createCell(cellType,cellContent){return cellContent?cellType.createChecked(null,cellContent):cellType.createAndFill()}function createTable(schema,rowsCount,colsCount,withHeaderRow,cellContent){const types=function getTableNodeTypes(schema){if(schema.cached.tableNodeTypes)return schema.cached.tableNodeTypes;const roles={};return Object.keys(schema.nodes).forEach(type=>{const nodeType=schema.nodes[type];nodeType.spec.tableRole&&(roles[nodeType.spec.tableRole]=nodeType)}),schema.cached.tableNodeTypes=roles,roles}(schema),headerCells=[],cells=[];for(let index=0;index<colsCount;index+=1){const cell=createCell(types.cell,cellContent);if(cell&&cells.push(cell),withHeaderRow){const headerCell=createCell(types.header_cell,cellContent);headerCell&&headerCells.push(headerCell)}}const rows=[];for(let index=0;index<rowsCount;index+=1)rows.push(types.row.createChecked(null,withHeaderRow&&0===index?headerCells:cells));return types.table.createChecked(null,rows)}const deleteTableWhenAllCellsSelected=({editor})=>{const{selection}=editor.state;if(!function isCellSelection(value){return value instanceof _tiptap_pm_tables.CellSelection}(selection))return!1;let cellCount=0;const table=(0,_tiptap_core.findParentNodeClosestToPos)(selection.ranges[0].$from,node=>"table"===node.type.name);return null==table||table.node.descendants(node=>{if("table"===node.type.name)return!1;["tableCell","tableHeader"].includes(node.type.name)&&(cellCount+=1)}),cellCount===selection.ranges.length&&(editor.commands.deleteTable(),!0)};function keepCursorInTable(tr,tablePos){const mappedTablePos=tr.mapping.map(tablePos),stillInTable=(0,_tiptap_core.findParentNodeClosestToPos)(tr.selection.$from,node=>"table"===node.type.name);if((null==stillInTable?void 0:stillInTable.pos)===mappedTablePos)return;const tableNode=tr.doc.nodeAt(mappedTablePos);if(!tableNode)return;const endOfTable=mappedTablePos+tableNode.nodeSize-1;tr.setSelection(_tiptap_pm_state.TextSelection.near(tr.doc.resolve(endOfTable),-1))}function escapeTableCellPipes(line){let result="",i=0;for(;i<line.length;){if("\\"===line[i]&&i+1<line.length){result+=line[i]+line[i+1],i+=2;continue}if("`"!==line[i]){result+=line[i++];continue}let runLen=0;for(;i+runLen<line.length&&"`"===line[i+runLen];)runLen+=1;let j=i+runLen,found=!1;for(;j<line.length;){if("`"!==line[j]){j+=1;continue}let closeLen=0;for(;j+closeLen<line.length&&"`"===line[j+closeLen];)closeLen+=1;if(closeLen===runLen){const spanContent=line.slice(i+runLen,j);result+=line.slice(i,i+runLen)+spanContent.replace(/\\\||\|/g,match=>"|"===match?"\\|":match)+line.slice(j,j+runLen),i=j+runLen,found=!0;break}j+=closeLen}found||(result+=line.slice(i,i+runLen),i+=runLen)}return result}function preprocessTablePipes(src){return src.split("\n").map(line=>line.includes("|")&&line.includes("`")?escapeTableCellPipes(line):line).join("\n")}function renderTableToMarkdown(node,h,options={}){var _options$cellLineSepa;const cellSep=null!==(_options$cellLineSepa=options.cellLineSeparator)&&void 0!==_options$cellLineSepa?_options$cellLineSepa:"";if(!node||!node.content||0===node.content.length)return"";const rows=[];node.content.forEach(rowNode=>{const cells=[];rowNode.content&&rowNode.content.forEach(cellNode=>{let raw="";raw=cellNode.content&&Array.isArray(cellNode.content)&&cellNode.content.length>1?cellNode.content.map(child=>h.renderChildren(child)).join(cellSep):cellNode.content?h.renderChildren(cellNode.content):"";const text=function collapseWhitespace(s){return(s||"").replace(/\s+/g," ").trim()}(raw.split(cellSep).join("\n").replace(/[ \t]*\r?\n[ \t]*/g,"<br>")),isHeader="tableHeader"===cellNode.type,align=function normalizeTableCellAlignFromAttributes(attributes){return normalizeTableCellAlign(null==attributes?void 0:attributes.align)}(cellNode.attrs);cells.push({text,isHeader,align})}),rows.push(cells)});const columnCount=rows.reduce((max,r)=>Math.max(max,r.length),0);if(0===columnCount)return"";const colWidths=Array.from({length:columnCount}).fill(0);rows.forEach(r=>{for(let i=0;i<columnCount;i+=1){var _r$i;const len=((null===(_r$i=r[i])||void 0===_r$i?void 0:_r$i.text)||"").length;len>colWidths[i]&&(colWidths[i]=len),colWidths[i]<3&&(colWidths[i]=3)}});const pad=(s,width)=>s+" ".repeat(Math.max(0,width-s.length)),headerRow=rows[0],hasHeader=headerRow.some(c=>c.isHeader),colAlignments=Array.from({length:columnCount}).fill(null);rows.forEach(r=>{for(let i=0;i<columnCount;i+=1){var _r$i2;!colAlignments[i]&&(null===(_r$i2=r[i])||void 0===_r$i2?void 0:_r$i2.align)&&(colAlignments[i]=r[i].align)}});let out="\n";const headerTexts=Array.from({length:columnCount}).map((_,i)=>hasHeader&&headerRow[i]&&headerRow[i].text||"");return out+=`| ${headerTexts.map((t,i)=>pad(t,colWidths[i])).join(" | ")} |\n`,out+=`| ${colWidths.map((w,index)=>{const dashCount=Math.max(3,w),alignment=colAlignments[index];return"left"===alignment?`:${"-".repeat(dashCount)}`:"right"===alignment?`${"-".repeat(dashCount)}:`:"center"===alignment?`:${"-".repeat(dashCount)}:`:"-".repeat(dashCount)}).join(" | ")} |\n`,(hasHeader?rows.slice(1):rows).forEach(r=>{out+=`| ${Array.from({length:columnCount}).fill(0).map((_,i)=>pad(r[i]&&r[i].text||"",colWidths[i])).join(" | ")} |\n`}),out}const Table=_tiptap_core.Node.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:TableView,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node,HTMLAttributes}){const{colgroup,tableWidth,tableMinWidth}=createColGroup(node,this.options.cellMinWidth),userStyles=HTMLAttributes.style;const table=["table",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes,{style:function getTableStyle(){return userStyles||(tableWidth?`width: ${tableWidth}`:`min-width: ${tableMinWidth}`)}()}),colgroup,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},table]:table},parseMarkdown:(token,h)=>{const rows=[],alignments=Array.isArray(token.align)?token.align:[];if(token.header){const headerCells=[];token.header.forEach((cell,index)=>{var _alignments$index;const align=normalizeTableCellAlign(null!==(_alignments$index=alignments[index])&&void 0!==_alignments$index?_alignments$index:cell.align),attrs=align?{align}:{};headerCells.push(h.createNode("tableHeader",attrs,[{type:"paragraph",content:h.parseInline(cell.tokens)}]))}),rows.push(h.createNode("tableRow",{},headerCells))}return token.rows&&token.rows.forEach(row=>{const bodyCells=[];row.forEach((cell,index)=>{var _alignments$index2;const align=normalizeTableCellAlign(null!==(_alignments$index2=alignments[index])&&void 0!==_alignments$index2?_alignments$index2:cell.align),attrs=align?{align}:{};bodyCells.push(h.createNode("tableCell",attrs,[{type:"paragraph",content:h.parseInline(cell.tokens)}]))}),rows.push(h.createNode("tableRow",{},bodyCells))}),h.createNode("table",void 0,rows)},renderMarkdown:(node,h)=>renderTableToMarkdown(node,h),markdownTokenizer:{name:"table",level:"block",start:src=>{const lines=src.split("\n");if(lines.length<2)return-1;const sep=lines[1];return/^[ \t|:]*-[ \t|:-]*$/.test(sep)&&sep.includes("|")&&lines[0].includes("|")?0:-1},tokenize(src,_tokens,helper){const blankLineIndex=src.indexOf("\n\n"),candidate=blankLineIndex>=0?src.slice(0,blankLineIndex):src,candidateLines=candidate.split("\n");if(candidateLines.length<2)return;const sep=candidateLines[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(sep)||!sep.includes("|"))return;const preprocessed=preprocessTablePipes(candidate);if(preprocessed===candidate)return;const tableToken=helper.blockTokens(preprocessed)[0];if("table"!==(null==tableToken?void 0:tableToken.type)||!tableToken.raw)return;const lineCount=tableToken.raw.split("\n").length,raw=src.split("\n").slice(0,lineCount).join("\n");return{...tableToken,raw}}},addCommands:()=>({insertTable:({rows=3,cols=3,withHeaderRow=!0}={})=>({tr,dispatch,editor})=>{const node=createTable(editor.schema,rows,cols,withHeaderRow);if(dispatch){const offset=tr.selection.from+1;tr.replaceSelectionWith(node).scrollIntoView().setSelection(_tiptap_pm_state.TextSelection.near(tr.doc.resolve(offset)))}return!0},addColumnBefore:()=>({state,dispatch})=>(0,_tiptap_pm_tables.addColumnBefore)(state,dispatch),addColumnAfter:()=>({state,dispatch})=>(0,_tiptap_pm_tables.addColumnAfter)(state,dispatch),deleteColumn:()=>({state,dispatch})=>{const table=(0,_tiptap_core.findParentNodeClosestToPos)(state.selection.$from,node=>"table"===node.type.name);return(0,_tiptap_pm_tables.deleteColumn)(state,dispatch&&(tr=>{table&&keepCursorInTable(tr,table.pos),dispatch(tr)}))},addRowBefore:()=>({state,dispatch})=>(0,_tiptap_pm_tables.addRowBefore)(state,dispatch),addRowAfter:()=>({state,dispatch})=>(0,_tiptap_pm_tables.addRowAfter)(state,dispatch),deleteRow:()=>({state,dispatch})=>{const table=(0,_tiptap_core.findParentNodeClosestToPos)(state.selection.$from,node=>"table"===node.type.name);return(0,_tiptap_pm_tables.deleteRow)(state,dispatch&&(tr=>{table&&keepCursorInTable(tr,table.pos),dispatch(tr)}))},deleteTable:()=>({state,dispatch})=>(0,_tiptap_pm_tables.deleteTable)(state,dispatch),mergeCells:()=>({state,dispatch})=>(0,_tiptap_pm_tables.mergeCells)(state,dispatch),splitCell:()=>({state,dispatch})=>(0,_tiptap_pm_tables.splitCell)(state,dispatch),toggleHeaderColumn:()=>({state,dispatch})=>(0,_tiptap_pm_tables.toggleHeader)("column")(state,dispatch),toggleHeaderRow:()=>({state,dispatch})=>(0,_tiptap_pm_tables.toggleHeader)("row")(state,dispatch),toggleHeaderCell:()=>({state,dispatch})=>(0,_tiptap_pm_tables.toggleHeaderCell)(state,dispatch),mergeOrSplit:()=>({state,dispatch})=>!!(0,_tiptap_pm_tables.mergeCells)(state,dispatch)||(0,_tiptap_pm_tables.splitCell)(state,dispatch),setCellAttribute:(name,value)=>({state,dispatch})=>(0,_tiptap_pm_tables.setCellAttr)(name,value)(state,dispatch),goToNextCell:()=>({state,dispatch})=>(0,_tiptap_pm_tables.goToNextCell)(1)(state,dispatch),goToPreviousCell:()=>({state,dispatch})=>(0,_tiptap_pm_tables.goToNextCell)(-1)(state,dispatch),fixTables:()=>({state,dispatch})=>(dispatch&&(0,_tiptap_pm_tables.fixTables)(state),!0),setCellSelection:position=>({tr,dispatch})=>{if(dispatch){const selection=_tiptap_pm_tables.CellSelection.create(tr.doc,position.anchorCell,position.headCell);tr.setSelection(selection)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:deleteTableWhenAllCellsSelected,"Mod-Backspace":deleteTableWhenAllCellsSelected,Delete:deleteTableWhenAllCellsSelected,"Mod-Delete":deleteTableWhenAllCellsSelected}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[(0,_tiptap_pm_tables.columnResizing)({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],(0,_tiptap_pm_tables.tableEditing)({allowTableNodeSelection:this.options.allowTableNodeSelection})]},addNodeView(){const isResizable=this.options.resizable&&this.editor.isEditable,View=this.options.View;return isResizable||!View?null:({node,view,HTMLAttributes})=>{const mergedAttributes=(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes);return new View(node,this.options.cellMinWidth,view,mergedAttributes)}},extendNodeSchema(extension){const context={name:extension.name,options:extension.options,storage:extension.storage};return{tableRole:(0,_tiptap_core.callOrReturn)((0,_tiptap_core.getExtensionField)(extension,"tableRole",context))}}}),TableKit=_tiptap_core.Extension.create({name:"tableKit",addExtensions(){const extensions=[];return!1!==this.options.table&&extensions.push(Table.configure(this.options.table)),!1!==this.options.tableCell&&extensions.push(TableCell.configure(this.options.tableCell)),!1!==this.options.tableHeader&&extensions.push(TableHeader.configure(this.options.tableHeader)),!1!==this.options.tableRow&&extensions.push(TableRow.configure(this.options.tableRow)),extensions}});exports.DEFAULT_CELL_LINE_SEPARATOR="",exports.Table=Table,exports.TableCell=TableCell,exports.TableHeader=TableHeader,exports.TableKit=TableKit,exports.TableRow=TableRow,exports.TableView=TableView,exports.createColGroup=createColGroup,exports.createTable=createTable,exports.escapeTableCellPipes=escapeTableCellPipes,exports.preprocessTablePipes=preprocessTablePipes,exports.renderTableToMarkdown=renderTableToMarkdown,exports.updateColumns=updateColumns},"./node_modules/@tiptap/extension-text/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Text=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs").Node.create({name:"text",group:"inline",parseMarkdown:token=>({type:"text",text:token.text||""}),renderMarkdown:node=>node.text||""});var src_default=Text;exports.Text=Text,exports.default=src_default},"./node_modules/@tiptap/extension-underline/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs");const Underline=_tiptap_core.Mark.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:style=>!!style.includes("underline")&&{}}],renderHTML({HTMLAttributes}){return["u",(0,_tiptap_core.mergeAttributes)(this.options.HTMLAttributes,HTMLAttributes),0]},parseMarkdown(token,helpers){return helpers.applyMark(this.name||"underline",helpers.parseInline(token.tokens||[]))},renderMarkdown:(node,helpers)=>`++${helpers.renderChildren(node)}++`,markdownTokenizer:{name:"underline",level:"inline",start:src=>src.indexOf("++"),tokenize(src,_tokens,lexer){const match=/^(\+\+)([\s\S]+?)(\+\+)/.exec(src);if(!match)return;const innerContent=match[2].trim();return{type:"underline",raw:match[0],text:innerContent,tokens:lexer.inlineTokens(innerContent)}}},addCommands(){return{setUnderline:()=>({commands})=>commands.setMark(this.name),toggleUnderline:()=>({commands})=>commands.toggleMark(this.name),unsetUnderline:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var src_default=Underline;exports.Underline=Underline,exports.default=src_default},"./node_modules/@tiptap/extensions/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),_tiptap_pm_state=__webpack_require__("./node_modules/@tiptap/pm/dist/state/index.cjs"),_tiptap_pm_dropcursor=__webpack_require__("./node_modules/@tiptap/pm/dist/dropcursor/index.cjs"),_tiptap_pm_view=__webpack_require__("./node_modules/@tiptap/pm/dist/view/index.cjs"),_tiptap_pm_gapcursor=__webpack_require__("./node_modules/@tiptap/pm/dist/gapcursor/index.cjs"),_tiptap_pm_history=__webpack_require__("./node_modules/@tiptap/pm/dist/history/index.cjs");const CharacterCount=_tiptap_core.Extension.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:text=>text.length,wordCounter:text=>text.split(" ").filter(word=>""!==word).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=options=>{const node=(null==options?void 0:options.node)||this.editor.state.doc;if("textSize"===((null==options?void 0:options.mode)||this.options.mode)){const text=node.textBetween(0,node.content.size,void 0," ");return this.options.textCounter(text)}return node.nodeSize},this.storage.words=options=>{const node=(null==options?void 0:options.node)||this.editor.state.doc,text=node.textBetween(0,node.content.size," "," ");return this.options.wordCounter(text)}},addProseMirrorPlugins(){let initialEvaluationDone=!1;return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("characterCount"),appendTransaction:(transactions,oldState,newState)=>{if(initialEvaluationDone)return;const limit=this.options.limit,autoTrim=this.options.autoTrim;if(null==limit||0===limit||!1===autoTrim)return void(initialEvaluationDone=!0);const initialContentSize=this.storage.characters({node:newState.doc});if(initialContentSize>limit){const from=0,to=initialContentSize-limit;console.warn(`[CharacterCount] Initial content exceeded limit of ${limit} characters. Content was automatically trimmed.`);const tr=newState.tr.deleteRange(from,to);return initialEvaluationDone=!0,tr}initialEvaluationDone=!0},filterTransaction:(transaction,state)=>{const limit=this.options.limit;if(!transaction.docChanged||0===limit||null==limit)return!0;const oldSize=this.storage.characters({node:state.doc}),newSize=this.storage.characters({node:transaction.doc});if(newSize<=limit)return!0;if(oldSize>limit&&newSize>limit&&newSize<=oldSize)return!0;if(oldSize>limit&&newSize>limit&&newSize>oldSize)return!1;if(!transaction.getMeta("paste"))return!1;const pos=transaction.selection.$head.pos,from=pos-(newSize-limit),to=pos;return transaction.deleteRange(from,to),!(this.storage.characters({node:transaction.doc})>limit)}})]}}),Dropcursor=_tiptap_core.Extension.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[(0,_tiptap_pm_dropcursor.dropCursor)(this.options)]}}),Focus=_tiptap_core.Extension.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("focus"),props:{decorations:({doc,selection})=>{const{isEditable,isFocused}=this.editor,{anchor}=selection,decorations=[];if(!isEditable||!isFocused)return _tiptap_pm_view.DecorationSet.create(doc,[]);let maxLevels=0;"deepest"===this.options.mode&&doc.descendants((node,pos)=>{if(!node.isText)return anchor>=pos&&anchor<=pos+node.nodeSize-1&&void(maxLevels+=1)});let currentLevel=0;return doc.descendants((node,pos)=>!node.isText&&(anchor>=pos&&anchor<=pos+node.nodeSize-1&&(currentLevel+=1,"deepest"===this.options.mode&&maxLevels-currentLevel>0||"shallowest"===this.options.mode&&currentLevel>1?"deepest"===this.options.mode:void decorations.push(_tiptap_pm_view.Decoration.node(pos,pos+node.nodeSize,{class:this.options.className}))))),_tiptap_pm_view.DecorationSet.create(doc,decorations)}}})]}}),Gapcursor=_tiptap_core.Extension.create({name:"gapCursor",addProseMirrorPlugins:()=>[(0,_tiptap_pm_gapcursor.gapCursor)()],extendNodeSchema(extension){var _callOrReturn;const context={name:extension.name,options:extension.options,storage:extension.storage};return{allowGapCursor:null!==(_callOrReturn=(0,_tiptap_core.callOrReturn)((0,_tiptap_core.getExtensionField)(extension,"allowGapCursor",context)))&&void 0!==_callOrReturn?_callOrReturn:null}}}),PLUGIN_KEY=new _tiptap_pm_state.PluginKey("tiptap__placeholder");function createPlaceholderDecoration(options){const{editor,placeholder,dataAttribute,pos,node,isEmptyDoc,hasAnchor,classes:{emptyNode,emptyEditor}}=options,classes=[emptyNode];return isEmptyDoc&&classes.push(emptyEditor),_tiptap_pm_view.Decoration.node(pos,pos+node.nodeSize,{class:classes.join(" "),[dataAttribute]:"function"==typeof placeholder?placeholder({editor,node,pos,hasAnchor}):placeholder})}function resolveEmptyNodeClass(emptyNodeClass,props){return"function"==typeof emptyNodeClass?emptyNodeClass(props):emptyNodeClass}function scanRangeForDecorations({editor,options,dataAttribute,doc,selection,from,to}){const{anchor}=selection,decorations=[],isEmptyDoc=editor.isEmpty;return doc.nodesBetween(from,to,(node,pos)=>{const hasAnchor=anchor>=pos&&anchor<=pos+node.nodeSize,isEmpty=!node.isLeaf&&(0,_tiptap_core.isNodeEmpty)(node);return node.type.isTextblock?(!hasAnchor&&options.showOnlyCurrent||!isEmpty||decorations.push(createPlaceholderDecoration({editor,isEmptyDoc,dataAttribute,hasAnchor,placeholder:options.placeholder,classes:{emptyEditor:options.emptyEditorClass,emptyNode:resolveEmptyNodeClass(options.emptyNodeClass,{editor,node,pos,hasAnchor})},node,pos})),options.includeChildren):options.includeChildren}),decorations}function buildPlaceholderDecorations({editor,options,dataAttribute,doc,selection}){if(!editor.isEditable&&options.showOnlyWhenEditable)return null;const{anchor}=selection,decorations=[],isEmptyDoc=editor.isEmpty;if(options.showOnlyCurrent&&!options.includeChildren){const resolved=doc.resolve(anchor),node=resolved.depth>0?resolved.node(1):resolved.nodeAfter,nodeStart=resolved.depth>0?resolved.before(1):anchor;if(node&&node.type.isTextblock&&(0,_tiptap_core.isNodeEmpty)(node)){const hasAnchor=anchor>=nodeStart&&anchor<=nodeStart+node.nodeSize;decorations.push(createPlaceholderDecoration({editor,isEmptyDoc,dataAttribute,hasAnchor,placeholder:options.placeholder,classes:{emptyEditor:options.emptyEditorClass,emptyNode:resolveEmptyNodeClass(options.emptyNodeClass,{editor,node,pos:nodeStart,hasAnchor})},node,pos:nodeStart}))}}else decorations.push(...scanRangeForDecorations({editor,options,dataAttribute,doc,selection,from:0,to:doc.content.size}));return _tiptap_pm_view.DecorationSet.create(doc,decorations)}function resolveTopLevelRange(doc,pos){const resolved=doc.resolve(pos);if(0===resolved.depth){var _resolved$nodeAfter;const node=null!==(_resolved$nodeAfter=resolved.nodeAfter)&&void 0!==_resolved$nodeAfter?_resolved$nodeAfter:resolved.nodeBefore;if(!node)return{from:pos,to:pos};const nodePos=resolved.nodeAfter?pos:pos-node.nodeSize;return{from:nodePos,to:nodePos+node.nodeSize}}const topLevelPos=resolved.before(1);return{from:topLevelPos,to:topLevelPos+resolved.node(1).nodeSize}}function toContentRelativeRange(doc,range){return{from:Math.max(0,range.from-1),to:Math.min(doc.content.size,range.to-1)}}function collectBlocksForChange(doc,change){const ranges=function getTopLevelBlocksInRange(doc,from,to){const ranges=[];return doc.forEach((node,offset)=>{const nodeStart=offset,nodeEnd=nodeStart+node.nodeSize;nodeStart+1<to&&nodeEnd+1>from&&ranges.push({from:nodeStart,to:nodeEnd})}),ranges}(doc,change.from,change.to);return ranges.push(toContentRelativeRange(doc,resolveTopLevelRange(doc,change.from))),change.to>change.from?ranges.push(toContentRelativeRange(doc,resolveTopLevelRange(doc,Math.min(change.to,doc.content.size+1)-1))):change.from<doc.content.size+1&&ranges.push(toContentRelativeRange(doc,resolveTopLevelRange(doc,Math.min(change.from+1,doc.content.size)))),ranges}function collectRescanRanges(tr,oldState,newState){const ranges=[];if(tr.docChanged){const changes=(0,_tiptap_core.getChangedRanges)(tr);for(const change of changes)ranges.push(...collectBlocksForChange(newState.doc,change.newRange))}return tr.selectionSet&&(ranges.push(toContentRelativeRange(newState.doc,resolveTopLevelRange(newState.doc,tr.mapping.map(oldState.selection.anchor)))),ranges.push(toContentRelativeRange(newState.doc,resolveTopLevelRange(newState.doc,newState.selection.anchor)))),function mergeRanges(ranges){if(0===ranges.length)return[];const sorted=[...ranges].sort((a,b)=>a.from-b.from),merged=[{...sorted[0]}];for(let i=1;i<sorted.length;i+=1){const last=merged[merged.length-1],current=sorted[i];current.from<=last.to?last.to=Math.max(last.to,current.to):merged.push({...current})}return merged}(ranges)}function clampRange(from,to,doc){const clampedFrom=Math.max(0,Math.min(from,doc.content.size));return{from:clampedFrom,to:Math.max(clampedFrom,Math.min(to,doc.content.size))}}function createPlaceholderStateField({editor,options,dataAttribute}){return{init(_config,state){const decorations=buildPlaceholderDecorations({editor,options,dataAttribute,doc:state.doc,selection:state.selection});return null!=decorations?decorations:_tiptap_pm_view.DecorationSet.empty},apply:(tr,prev,oldState,newState)=>tr.docChanged||tr.selectionSet?function updateDecorationsInRanges({decorations,ranges,editor,options,dataAttribute,doc,selection}){let next=decorations;for(const range of ranges){const{from,to}=clampRange(range.from,range.to,doc),existing=next.find(from,to).filter(decoration=>decoration.from>=from&&decoration.to<=to);existing.length&&(next=next.remove(existing));const newDecos=scanRangeForDecorations({editor,options,dataAttribute,doc,selection,from,to});newDecos.length&&(next=next.add(doc,newDecos))}return next}({decorations:prev.map(tr.mapping,tr.doc),ranges:collectRescanRanges(tr,oldState,newState),editor,options,dataAttribute,doc:newState.doc,selection:newState.selection}):prev}}function preparePlaceholderAttribute(attr){return attr.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function createPlaceholderPlugin({editor,options}){const dataAttribute=options.dataAttribute?`data-${preparePlaceholderAttribute(options.dataAttribute)}`:"data-placeholder",useResolvedPath=options.showOnlyCurrent&&!options.includeChildren;return new _tiptap_pm_state.Plugin({key:PLUGIN_KEY,...useResolvedPath?{}:{state:createPlaceholderStateField({editor,options,dataAttribute})},props:{decorations:useResolvedPath?({doc,selection})=>buildPlaceholderDecorations({editor,options,dataAttribute,doc,selection}):state=>{var _PLUGIN_KEY$getState;return options.showOnlyWhenEditable&&!editor.isEditable?_tiptap_pm_view.DecorationSet.empty:null!==(_PLUGIN_KEY$getState=PLUGIN_KEY.getState(state))&&void 0!==_PLUGIN_KEY$getState?_PLUGIN_KEY$getState:_tiptap_pm_view.DecorationSet.empty}}})}const Placeholder=_tiptap_core.Extension.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:"placeholder",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[createPlaceholderPlugin({editor:this.editor,options:this.options})]}});function shouldSyncDomSelection(state,editor){return!state.selection.empty&&!(0,_tiptap_core.isNodeSelection)(state.selection)&&editor.isEditable}const Selection=_tiptap_core.Extension.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor,options}=this;return[new _tiptap_pm_state.Plugin({key:new _tiptap_pm_state.PluginKey("selection"),props:{decorations:state=>function shouldPreserveSelection(state,editor){return shouldSyncDomSelection(state,editor)&&!editor.isFocused&&!editor.view.dragging}(state,editor)?_tiptap_pm_view.DecorationSet.create(state.doc,[_tiptap_pm_view.Decoration.inline(state.selection.from,state.selection.to,{class:options.className})]):null,handleDOMEvents:{blur:view=>!!shouldSyncDomSelection(view.state,editor)&&(function clearDomSelection(){var _window$getSelection;null===(_window$getSelection=window.getSelection())||void 0===_window$getSelection||_window$getSelection.removeAllRanges()}(),!1),focus:view=>!!shouldSyncDomSelection(view.state,editor)&&(requestAnimationFrame(()=>{!editor.isDestroyed&&view.hasFocus()&&function restoreDomSelection(view){view.focus()}(view)}),!1)}}})]}});function nodeEqualsType({types,node}){return node&&Array.isArray(types)&&types.includes(node.type)||(null==node?void 0:node.type)===types}const TrailingNode=_tiptap_core.Extension.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var _this$editor$schema$t;const plugin=new _tiptap_pm_state.PluginKey(this.name),defaultNode=this.options.node||(null===(_this$editor$schema$t=this.editor.schema.topNodeType.contentMatch.defaultType)||void 0===_this$editor$schema$t?void 0:_this$editor$schema$t.name)||"paragraph",disabledNodes=Object.entries(this.editor.schema.nodes).map(([,value])=>value).filter(node=>(this.options.notAfter||[]).concat(defaultNode).includes(node.name));return[new _tiptap_pm_state.Plugin({key:plugin,appendTransaction:(transactions,__,state)=>{const{doc,tr,schema}=state,shouldInsertNodeAtEnd=plugin.getState(state),endPosition=doc.content.size,type=schema.nodes[defaultNode];if(!transactions.some(transaction=>transaction.getMeta("skipTrailingNode"))&&shouldInsertNodeAtEnd)return tr.insert(endPosition,type.create())},state:{init:(_,state)=>!nodeEqualsType({node:state.tr.doc.lastChild,types:disabledNodes}),apply:(tr,value)=>{if(!tr.docChanged)return value;if(tr.getMeta("__uniqueIDTransaction"))return value;return!nodeEqualsType({node:tr.doc.lastChild,types:disabledNodes})}}})]}}),UndoRedo=_tiptap_core.Extension.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state,dispatch})=>(0,_tiptap_pm_history.undo)(state,dispatch),redo:()=>({state,dispatch})=>(0,_tiptap_pm_history.redo)(state,dispatch)}),addProseMirrorPlugins(){return[(0,_tiptap_pm_history.history)(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}});exports.CharacterCount=CharacterCount,exports.DEFAULT_DATA_ATTRIBUTE="placeholder",exports.Dropcursor=Dropcursor,exports.Focus=Focus,exports.Gapcursor=Gapcursor,exports.PLUGIN_KEY=PLUGIN_KEY,exports.Placeholder=Placeholder,exports.Selection=Selection,exports.TrailingNode=TrailingNode,exports.UndoRedo=UndoRedo,exports.preparePlaceholderAttribute=preparePlaceholderAttribute,exports.skipTrailingNodeMeta="skipTrailingNode"},"./node_modules/@tiptap/pm/dist/commands/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_commands=__webpack_require__("./node_modules/prosemirror-commands/dist/index.cjs");Object.keys(prosemirror_commands).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_commands[k]}})})},"./node_modules/@tiptap/pm/dist/dropcursor/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_dropcursor=__webpack_require__("./node_modules/prosemirror-dropcursor/dist/index.cjs");Object.keys(prosemirror_dropcursor).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_dropcursor[k]}})})},"./node_modules/@tiptap/pm/dist/gapcursor/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_gapcursor=__webpack_require__("./node_modules/prosemirror-gapcursor/dist/index.cjs");Object.keys(prosemirror_gapcursor).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_gapcursor[k]}})})},"./node_modules/@tiptap/pm/dist/history/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_history=__webpack_require__("./node_modules/prosemirror-history/dist/index.cjs");Object.keys(prosemirror_history).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_history[k]}})})},"./node_modules/@tiptap/pm/dist/keymap/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_keymap=__webpack_require__("./node_modules/prosemirror-keymap/dist/index.cjs");Object.keys(prosemirror_keymap).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_keymap[k]}})})},"./node_modules/@tiptap/pm/dist/model/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_model=__webpack_require__("./node_modules/prosemirror-model/dist/index.cjs");Object.keys(prosemirror_model).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_model[k]}})})},"./node_modules/@tiptap/pm/dist/schema-list/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_schema_list=__webpack_require__("./node_modules/prosemirror-schema-list/dist/index.cjs");Object.keys(prosemirror_schema_list).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_schema_list[k]}})})},"./node_modules/@tiptap/pm/dist/state/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_state=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs");Object.keys(prosemirror_state).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_state[k]}})})},"./node_modules/@tiptap/pm/dist/tables/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_tables=__webpack_require__("./node_modules/prosemirror-tables/dist/index.cjs");Object.keys(prosemirror_tables).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_tables[k]}})})},"./node_modules/@tiptap/pm/dist/transform/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_transform=__webpack_require__("./node_modules/prosemirror-transform/dist/index.cjs");Object.keys(prosemirror_transform).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_transform[k]}})})},"./node_modules/@tiptap/pm/dist/view/index.cjs"(__unused_webpack_module,exports,__webpack_require__){var prosemirror_view=__webpack_require__("./node_modules/prosemirror-view/dist/index.cjs");Object.keys(prosemirror_view).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return prosemirror_view[k]}})})},"./node_modules/@tiptap/react/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__toESM=(mod,isNodeMode,target)=>(target=null!=mod?__create(__getProtoOf(mod)):{},((to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(var key,keys=__getOwnPropNames(from),i=0,n=keys.length;i<n;i++)key=keys[i],__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:(k=>from[k]).bind(null,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to})(!isNodeMode&&mod&&mod.__esModule&&__hasOwnProp.call(mod,"default")?target:__defProp(target,"default",{value:mod,enumerable:!0}),mod));let react=__webpack_require__("./node_modules/react/index.js");react=__toESM(react,1);let react_dom=__webpack_require__("./node_modules/react-dom/index.js");react_dom=__toESM(react_dom,1);let use_sync_external_store_shim_index_js=__webpack_require__("./node_modules/use-sync-external-store/shim/index.js"),react_jsx_runtime=__webpack_require__("./node_modules/react/jsx-runtime.js"),_tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),fast_equals=__webpack_require__("./node_modules/fast-equals/dist/cjs/index.cjs"),use_sync_external_store_shim_with_selector_js=__webpack_require__("./node_modules/use-sync-external-store/shim/with-selector.js");const mergeRefs=(...refs)=>node=>{refs.forEach(ref=>{"function"==typeof ref?ref(node):ref&&(ref.current=node)})},Portals=({contentComponent})=>{const renderers=(0,use_sync_external_store_shim_index_js.useSyncExternalStore)(contentComponent.subscribe,contentComponent.getSnapshot,contentComponent.getServerSnapshot);return(0,react_jsx_runtime.jsx)(react_jsx_runtime.Fragment,{children:Object.values(renderers)})};function createContentComponent(){const subscribers=new Set;let renderers={},isNotificationQueued=!1;const notifySubscribers=()=>{!isNotificationQueued&&subscribers.size&&(isNotificationQueued=!0,queueMicrotask(()=>{isNotificationQueued=!1,subscribers.forEach(subscriber=>subscriber())}))};return{subscribe:callback=>(subscribers.add(callback),()=>{subscribers.delete(callback)}),getSnapshot:()=>renderers,getServerSnapshot:()=>renderers,setRenderer(id,renderer){renderers={...renderers,[id]:react_dom.default.createPortal(renderer.reactElement,renderer.element,id)},notifySubscribers()},removeRenderer(id){const nextRenderers={...renderers};delete nextRenderers[id],renderers=nextRenderers,notifySubscribers()}}}var PureEditorContent=class extends react.default.Component{constructor(props){super(props),this.editorContentRef=react.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var _editor$view$dom;const editor=this.props.editor;if(editor&&!editor.isDestroyed&&(null===(_editor$view$dom=editor.view.dom)||void 0===_editor$view$dom?void 0:_editor$view$dom.parentNode)){if(editor.contentComponent)return;const element=this.editorContentRef.current;element.append(...editor.view.dom.parentNode.childNodes),editor.setOptions({element}),editor.contentComponent=createContentComponent(),editor.createNodeViews(),editor.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const editor=this.props.editor;if(editor){editor.isEditorContentInitialized=!1,editor.isDestroyed||editor.view.setProps({nodeViews:{}}),editor.contentComponent=null;try{var _editor$view$dom2;if(!(null===(_editor$view$dom2=editor.view.dom)||void 0===_editor$view$dom2?void 0:_editor$view$dom2.parentNode))return;const newElement=document.createElement("div");newElement.append(...editor.view.dom.parentNode.childNodes),editor.setOptions({element:newElement})}catch{}}}render(){const{editor,innerRef,...rest}=this.props;return(0,react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment,{children:[(0,react_jsx_runtime.jsx)("div",{ref:mergeRefs(innerRef,this.editorContentRef),...rest}),(null==editor?void 0:editor.contentComponent)&&(0,react_jsx_runtime.jsx)(Portals,{contentComponent:editor.contentComponent})]})}};const EditorContentWithKey=(0,react.forwardRef)((props,ref)=>{const key=react.default.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[props.editor]);return react.default.createElement(PureEditorContent,{key,innerRef:ref,...props})}),EditorContent=react.default.memo(EditorContentWithKey),useIsomorphicLayoutEffect="undefined"!=typeof window?react.useLayoutEffect:react.useEffect;var EditorStateManager=class{constructor(initialEditor){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=initialEditor,this.lastSnapshot={editor:initialEditor,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.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(callback){return this.subscribers.add(callback),()=>{this.subscribers.delete(callback)}}watch(nextEditor){if(this.editor=nextEditor,this.editor){let lastTransaction;const fn=props=>{void 0!==(null==props?void 0:props.transaction)&&props.transaction===lastTransaction||(lastTransaction=null==props?void 0:props.transaction,this.transactionNumber+=1,this.subscribers.forEach(callback=>callback()))},currentEditor=this.editor;return currentEditor.on("transaction",fn),currentEditor.on("update",fn),()=>{currentEditor.off("transaction",fn),currentEditor.off("update",fn)}}}};function useEditorState(options){var _options$equalityFn;const[editorStateManager]=(0,react.useState)(()=>new EditorStateManager(options.editor)),selectedState=(0,use_sync_external_store_shim_with_selector_js.useSyncExternalStoreWithSelector)(editorStateManager.subscribe,editorStateManager.getSnapshot,editorStateManager.getServerSnapshot,options.selector,null!==(_options$equalityFn=options.equalityFn)&&void 0!==_options$equalityFn?_options$equalityFn:fast_equals.deepEqual);return useIsomorphicLayoutEffect(()=>editorStateManager.watch(options.editor),[options.editor,editorStateManager]),(0,react.useDebugValue)(selectedState),selectedState}const isSSR="undefined"==typeof window,isNext=isSSR||Boolean("undefined"!=typeof window&&window.next);var EditorInstanceManager=class EditorInstanceManager{constructor(options){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=options,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(editor){this.editor=editor,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(cb=>cb())}getInitialEditor(){const explicit=this.options.current.immediatelyRender;let immediatelyRender=null==explicit||explicit;return(isSSR||isNext&&void 0===explicit)&&(immediatelyRender=!1),immediatelyRender?this.createEditor():null}createEditor(){const optionsToApply={...this.options.current,onBeforeCreate:(...args)=>{var _this$options$current,_this$options$current2;return null===(_this$options$current=(_this$options$current2=this.options.current).onBeforeCreate)||void 0===_this$options$current?void 0:_this$options$current.call(_this$options$current2,...args)},onBlur:(...args)=>{var _this$options$current3,_this$options$current4;return null===(_this$options$current3=(_this$options$current4=this.options.current).onBlur)||void 0===_this$options$current3?void 0:_this$options$current3.call(_this$options$current4,...args)},onCreate:(...args)=>{var _this$options$current5,_this$options$current6;return null===(_this$options$current5=(_this$options$current6=this.options.current).onCreate)||void 0===_this$options$current5?void 0:_this$options$current5.call(_this$options$current6,...args)},onDestroy:(...args)=>{var _this$options$current7,_this$options$current8;return null===(_this$options$current7=(_this$options$current8=this.options.current).onDestroy)||void 0===_this$options$current7?void 0:_this$options$current7.call(_this$options$current8,...args)},onFocus:(...args)=>{var _this$options$current9,_this$options$current10;return null===(_this$options$current9=(_this$options$current10=this.options.current).onFocus)||void 0===_this$options$current9?void 0:_this$options$current9.call(_this$options$current10,...args)},onSelectionUpdate:(...args)=>{var _this$options$current11,_this$options$current12;return null===(_this$options$current11=(_this$options$current12=this.options.current).onSelectionUpdate)||void 0===_this$options$current11?void 0:_this$options$current11.call(_this$options$current12,...args)},onTransaction:(...args)=>{var _this$options$current13,_this$options$current14;return null===(_this$options$current13=(_this$options$current14=this.options.current).onTransaction)||void 0===_this$options$current13?void 0:_this$options$current13.call(_this$options$current14,...args)},onUpdate:(...args)=>{var _this$options$current15,_this$options$current16;return null===(_this$options$current15=(_this$options$current16=this.options.current).onUpdate)||void 0===_this$options$current15?void 0:_this$options$current15.call(_this$options$current16,...args)},onContentError:(...args)=>{var _this$options$current17,_this$options$current18;return null===(_this$options$current17=(_this$options$current18=this.options.current).onContentError)||void 0===_this$options$current17?void 0:_this$options$current17.call(_this$options$current18,...args)},onDrop:(...args)=>{var _this$options$current19,_this$options$current20;return null===(_this$options$current19=(_this$options$current20=this.options.current).onDrop)||void 0===_this$options$current19?void 0:_this$options$current19.call(_this$options$current20,...args)},onPaste:(...args)=>{var _this$options$current21,_this$options$current22;return null===(_this$options$current21=(_this$options$current22=this.options.current).onPaste)||void 0===_this$options$current21?void 0:_this$options$current21.call(_this$options$current22,...args)},onDelete:(...args)=>{var _this$options$current23,_this$options$current24;return null===(_this$options$current23=(_this$options$current24=this.options.current).onDelete)||void 0===_this$options$current23?void 0:_this$options$current23.call(_this$options$current24,...args)},onMount:(...args)=>{var _this$options$current25,_this$options$current26;return null===(_this$options$current25=(_this$options$current26=this.options.current).onMount)||void 0===_this$options$current25?void 0:_this$options$current25.call(_this$options$current26,...args)},onUnmount:(...args)=>{var _this$options$current27,_this$options$current28;return null===(_this$options$current27=(_this$options$current28=this.options.current).onUnmount)||void 0===_this$options$current27?void 0:_this$options$current27.call(_this$options$current28,...args)}};return new _tiptap_core.Editor(optionsToApply)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(onStoreChange){return this.subscriptions.add(onStoreChange),()=>{this.subscriptions.delete(onStoreChange)}}static compareOptions(a,b){return Object.keys(a).every(key=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(key)||("extensions"===key&&a.extensions&&b.extensions?a.extensions.length===b.extensions.length&&a.extensions.every((extension,index)=>{var _b$extensions;return extension===(null===(_b$extensions=b.extensions)||void 0===_b$extensions?void 0:_b$extensions[index])}):a[key]===b[key]))}onRender(deps){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===deps.length?EditorInstanceManager.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(deps),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(deps){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=deps);if(this.previousDeps.length===deps.length&&this.previousDeps.every((dep,index)=>dep===deps[index]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=deps}scheduleDestroy(){const currentInstanceId=this.instanceId,currentEditor=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===currentInstanceId?currentEditor&&currentEditor.setOptions(this.options.current):currentEditor&&!currentEditor.isDestroyed&&(currentEditor.destroy(),this.instanceId===currentInstanceId&&this.setEditor(null))},1)}};function useEditor(options={},deps=[]){const mostRecentOptions=(0,react.useRef)(options);mostRecentOptions.current=options;const[instanceManager]=(0,react.useState)(()=>new EditorInstanceManager(mostRecentOptions)),editor=(0,use_sync_external_store_shim_index_js.useSyncExternalStore)(instanceManager.subscribe,instanceManager.getEditor,instanceManager.getServerSnapshot);return(0,react.useDebugValue)(editor),(0,react.useEffect)(instanceManager.onRender(deps)),useEditorState({editor,selector:({transactionNumber})=>!1===options.shouldRerenderOnTransaction||void 0===options.shouldRerenderOnTransaction?null:options.immediatelyRender&&0===transactionNumber?0:transactionNumber+1}),editor}const EditorContext=(0,react.createContext)({editor:null}),EditorConsumer=EditorContext.Consumer;const ReactNodeViewContext=(0,react.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),useReactNodeView=()=>(0,react.useContext)(ReactNodeViewContext);const NodeViewWrapper=react.default.forwardRef((props,ref)=>{const{onDragStart}=useReactNodeView(),Tag=props.as||"div";return(0,react_jsx_runtime.jsx)(Tag,{...props,ref,"data-node-view-wrapper":"",onDragStart,style:{whiteSpace:"normal",...props.style}})});function isClassComponent(Component){return!("function"!=typeof Component||!Component.prototype||!Component.prototype.isReactComponent)}function isForwardRefComponent(Component){return!("object"!=typeof Component||!Component.$$typeof||"Symbol(react.forward_ref)"!==Component.$$typeof.toString()&&"react.forward_ref"!==Component.$$typeof.description)}var ReactRenderer=class{constructor(component,{editor,props={},as="div",className=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(4294967295*Math.random()).toString(),this.component=component,this.editor=editor,this.props=props,this.element=document.createElement(as),this.element.classList.add("react-renderer"),className&&this.element.classList.add(...className.split(" ")),this.editor.isEditorContentInitialized?(0,react_dom.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var _editor$contentCompon;if(this.destroyed)return;const Component=this.component,props=this.props,editor=this.editor,isReact19=function isReact19Plus(){try{if(react.version)return parseInt(react.version.split(".")[0],10)>=19}catch{}return!1}(),componentCanReceiveRef=function canReceiveRef(Component){if(isClassComponent(Component))return!0;if(isForwardRefComponent(Component))return!0;if(function isMemoComponent(Component){return!("object"!=typeof Component||!Component.$$typeof||"Symbol(react.memo)"!==Component.$$typeof.toString()&&"react.memo"!==Component.$$typeof.description)}(Component)){const wrappedComponent=Component.type;if(wrappedComponent)return isClassComponent(wrappedComponent)||isForwardRefComponent(wrappedComponent)}return!1}(Component),elementProps={...props};!elementProps.ref||isReact19||componentCanReceiveRef||delete elementProps.ref,elementProps.ref||!isReact19&&!componentCanReceiveRef||(elementProps.ref=ref=>{this.ref=ref}),this.reactElement=(0,react_jsx_runtime.jsx)(Component,{...elementProps}),null==editor||null===(_editor$contentCompon=editor.contentComponent)||void 0===_editor$contentCompon||_editor$contentCompon.setRenderer(this.id,this)}updateProps(props={}){if(this.destroyed)return;let changed=!1;const keys=Object.keys(props);for(let i=0;i<keys.length;i+=1){const key=keys[i];if(props[key]!==this.props[key]){changed=!0;break}}changed&&(this.props={...this.props,...props},this.render())}destroy(){var _editor$contentCompon2;this.destroyed=!0;const editor=this.editor;null==editor||null===(_editor$contentCompon2=editor.contentComponent)||void 0===_editor$contentCompon2||_editor$contentCompon2.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(attributes){Object.keys(attributes).forEach(key=>{this.element.setAttribute(key,attributes[key])})}};const ReactMarkViewContext=react.default.createContext({markViewContentRef:()=>{}});var ReactMarkView=class extends _tiptap_core.MarkView{constructor(component,props,options){super(component,props,options);const{as="span",attrs,className=""}=options||{},componentProps={...props,updateAttributes:this.updateAttributes.bind(this)};this.contentDOMElement=document.createElement("span");const context={markViewContentRef:el=>{el&&!el.contains(this.contentDOMElement)&&el.appendChild(this.contentDOMElement)}},ReactMarkViewProvider=react.default.memo(componentProps=>(0,react_jsx_runtime.jsx)(ReactMarkViewContext.Provider,{value:context,children:react.default.createElement(component,componentProps)}));ReactMarkViewProvider.displayName="ReactMarkView",this.renderer=new ReactRenderer(ReactMarkViewProvider,{editor:props.editor,props:componentProps,as,className:`mark-${props.mark.type.name} ${className}`.trim()}),attrs&&this.renderer.updateAttributes(attrs)}get dom(){return this.renderer.element}get contentDOM(){return this.contentDOMElement}};function isSameAncestor($from,$to,depth){return $from.node(depth)===$to.node(depth)&&$from.before(depth)===$to.before(depth)}function getTextSelectionAncestorPositions(selection){if(!(0,_tiptap_core.isTextSelection)(selection))return[];const{$from,$to}=selection,positions=[],maxDepth=Math.min($from.depth,$to.depth);for(let depth=1;depth<=maxDepth&&isSameAncestor($from,$to,depth);depth+=1)positions.push($from.before(depth));return positions}var ReactNodeViewSelectionTracker=class{constructor(editor){this.views=new WeakMap,this.viewCount=0,this.insideViews=new Set,this.syncQueued=!1,this.scheduleSync=()=>{this.syncQueued||(this.syncQueued=!0,queueMicrotask(()=>{this.syncQueued=!1,this.sync()}))},this.handleTransaction=()=>this.scheduleSync(),this.editor=editor}register(view){0===this.viewCount&&this.editor.on("transaction",this.handleTransaction),this.views.set(view.dom,view),this.viewCount+=1,this.scheduleSync()}unregister(view){this.views.delete(view.dom),this.viewCount-=1,this.insideViews.delete(view),0===this.viewCount&&this.editor.off("transaction",this.handleTransaction)}sync(){if(0===this.viewCount||this.editor.isDestroyed)return;const nextInsideViews=this.findInsideViews();this.updateViews(this.insideViews,nextInsideViews,!1),this.updateViews(nextInsideViews,this.insideViews,!0),this.insideViews=nextInsideViews}updateViews(views,unchangedViews,selectionInside){for(const view of views)unchangedViews.has(view)||view.setSelectionInside(selectionInside)}findInsideViews(){const insideViews=new Set;for(const position of getTextSelectionAncestorPositions(this.editor.state.selection)){const dom=this.editor.view.nodeDOM(position),view=dom?this.views.get(dom):void 0;view&&insideViews.add(view)}return insideViews}};const trackers=new WeakMap;function getReactNodeViewSelectionTracker(editor){let tracker=trackers.get(editor);return tracker||(tracker=new ReactNodeViewSelectionTracker(editor),trackers.set(editor,tracker)),tracker}var ReactNodeView=class extends _tiptap_core.NodeView{constructor(component,props,options){if(super(component,props,options),this.nodeSelected=!1,this.handlePositionUpdate=()=>{const newPos=this.getPos();"number"==typeof newPos&&newPos!==this.currentPos&&(this.currentPos=newPos,this.renderer.updateProps({getPos:()=>this.getPos()}),"function"==typeof this.options.attrs&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const contentTarget=this.dom.querySelector("[data-node-view-content]");contentTarget?contentTarget.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const editor=this.editor,extension=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(extension,{get(target,prop,receiver){var _editor$storage;return"storage"===prop?null!==(_editor$storage=editor.storage[extension.name])&&void 0!==_editor$storage?_editor$storage:{}:Reflect.get(target,prop,receiver)}})}return this.cachedExtensionWithSyncedStorage}mount(){const mountProps={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,selectionInside:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(attributes={})=>this.updateAttributes(attributes),deleteNode:()=>this.deleteNode(),ref:(0,react.createRef)()};if(!this.component.displayName){const capitalizeFirstChar=string=>string.charAt(0).toUpperCase()+string.substring(1);this.component.displayName=capitalizeFirstChar(this.extension.name)}const context={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:element=>{if(element&&this.contentDOMElement&&element.firstChild!==this.contentDOMElement){element.hasAttribute("data-node-view-wrapper")&&element.removeAttribute("data-node-view-wrapper");const restoreSelection=function captureDOMSelection(element){var _element$ownerDocumen;const root=element.getRootNode(),selection="function"==typeof root.getSelection?root.getSelection():null===(_element$ownerDocumen=element.ownerDocument)||void 0===_element$ownerDocumen||null===(_element$ownerDocumen=_element$ownerDocumen.defaultView)||void 0===_element$ownerDocumen?void 0:_element$ownerDocumen.getSelection();if(!selection||0===selection.rangeCount)return null;const{anchorNode,anchorOffset,focusNode,focusOffset}=selection;return anchorNode&&focusNode&&element.contains(anchorNode)&&element.contains(focusNode)?()=>{try{selection.setBaseAndExtent(anchorNode,anchorOffset,focusNode,focusOffset)}catch{}}:null}(this.contentDOMElement);element.appendChild(this.contentDOMElement),null==restoreSelection||restoreSelection()}}},Component=this.component,ReactNodeViewProvider=(0,react.memo)(componentProps=>(0,react_jsx_runtime.jsx)(ReactNodeViewContext.Provider,{value:context,children:(0,react.createElement)(Component,componentProps)}));ReactNodeViewProvider.displayName="ReactNodeView";let as=this.node.isInline?"span":"div";this.options.as&&(as=this.options.as);const{className=""}=this.options;this.renderer=new ReactRenderer(ReactNodeViewProvider,{editor:this.editor,props:mountProps,as,className:`node-${this.node.type.name} ${className}`.trim()}),getReactNodeViewSelectionTracker(this.editor).register(this),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var _this$renderer$elemen;if(this.renderer.element.firstElementChild&&!(null===(_this$renderer$elemen=this.renderer.element.firstElementChild)||void 0===_this$renderer$elemen?void 0:_this$renderer$elemen.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(node,decorations,innerDecorations){const rerenderComponent=props=>{this.renderer.updateProps(props),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(node.type!==this.node.type)return!1;if("function"==typeof this.options.update){const oldNode=this.node,oldDecorations=this.decorations,oldInnerDecorations=this.innerDecorations;return this.node=node,this.decorations=decorations,this.innerDecorations=innerDecorations,this.currentPos=this.getPos(),this.options.update({oldNode,oldDecorations,newNode:node,newDecorations:decorations,oldInnerDecorations,innerDecorations,updateProps:()=>rerenderComponent({node,decorations,innerDecorations,extension:this.extensionWithSyncedStorage})})}if(node===this.node)return this.node=node,this.decorations=decorations,this.innerDecorations=innerDecorations,!0;const newPos=this.getPos();this.node=node,this.decorations=decorations,this.innerDecorations=innerDecorations,this.currentPos=newPos;const extraProps={node,decorations,innerDecorations,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(extraProps.getPos=()=>this.getPos()),rerenderComponent(extraProps),!0}selectNode(){this.nodeSelected=!0,this.updateSelectedState(!0)}deselectNode(){this.nodeSelected=!1,this.updateSelectedState(!0===this.options.selectedOnTextSelection&&this.isTextSelectionInside())}setSelectionInside(selectionInside){const selected=this.nodeSelected||!0===this.options.selectedOnTextSelection&&selectionInside;this.renderer.updateProps({selectionInside,selected}),this.renderer.element.classList.toggle("ProseMirror-selectednode",selected)}updateSelectedState(selected){this.renderer.updateProps({selected}),this.renderer.element.classList.toggle("ProseMirror-selectednode",selected)}isTextSelectionInside(){const pos=this.getPos();return"number"==typeof pos&&getTextSelectionAncestorPositions(this.editor.state.selection).includes(pos)}destroy(){this.renderer.destroy(),getReactNodeViewSelectionTracker(this.editor).unregister(this),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let attrsObj={};if("function"==typeof this.options.attrs){const extensionAttributes=this.editor.extensionManager.attributes,HTMLAttributes=(0,_tiptap_core.getRenderedAttributes)(this.node,extensionAttributes);attrsObj=this.options.attrs({node:this.node,HTMLAttributes})}else attrsObj=this.options.attrs;this.renderer.updateAttributes(attrsObj)}}};const WIDGET_CACHE=Symbol("tiptapReactWidgetCache");const TiptapContext=(0,react.createContext)({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});TiptapContext.displayName="TiptapContext";const useTiptap=()=>(0,react.useContext)(TiptapContext);function TiptapWrapper({children,...props}){const resolvedEditor="editor"in props?props.editor:props.instance;if(!resolvedEditor)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const tiptapContextValue=(0,react.useMemo)(()=>({editor:resolvedEditor}),[resolvedEditor]),legacyContextValue=(0,react.useMemo)(()=>({editor:resolvedEditor}),[resolvedEditor]);return(0,react_jsx_runtime.jsx)(EditorContext.Provider,{value:legacyContextValue,children:(0,react_jsx_runtime.jsx)(TiptapContext.Provider,{value:tiptapContextValue,children})})}function TiptapContent({...rest}){const{editor}=useTiptap();return(0,react_jsx_runtime.jsx)(EditorContent,{editor,...rest})}TiptapWrapper.displayName="Tiptap",TiptapContent.displayName="Tiptap.Content";const Tiptap=Object.assign(TiptapWrapper,{Content:TiptapContent});exports.EditorConsumer=EditorConsumer,exports.EditorContent=EditorContent,exports.EditorContext=EditorContext,exports.EditorProvider=function EditorProvider({children,slotAfter,slotBefore,editorContainerProps={},...editorOptions}){const editor=useEditor(editorOptions),contextValue=(0,react.useMemo)(()=>({editor}),[editor]);return editor?(0,react_jsx_runtime.jsxs)(EditorContext.Provider,{value:contextValue,children:[slotBefore,(0,react_jsx_runtime.jsx)(EditorConsumer,{children:({editor:currentEditor})=>(0,react_jsx_runtime.jsx)(EditorContent,{editor:currentEditor,...editorContainerProps})}),children,slotAfter]}):null},exports.MarkViewContent=props=>{const{as:Tag="span",...rest}=props,{markViewContentRef}=react.default.useContext(ReactMarkViewContext);return(0,react_jsx_runtime.jsx)(Tag,{...rest,ref:markViewContentRef,"data-mark-view-content":""})},exports.NodeViewContent=function NodeViewContent({as:Tag="div",...props}){const{nodeViewContentRef,nodeViewContentChildren}=useReactNodeView();return(0,react_jsx_runtime.jsx)(Tag,{...props,ref:nodeViewContentRef,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...props.style},children:nodeViewContentChildren})},exports.NodeViewWrapper=NodeViewWrapper,exports.PureEditorContent=PureEditorContent,exports.ReactMarkView=ReactMarkView,exports.ReactMarkViewContext=ReactMarkViewContext,exports.ReactMarkViewRenderer=function ReactMarkViewRenderer(component,options={}){return props=>new ReactMarkView(component,props,options)},exports.ReactNodeView=ReactNodeView,exports.ReactNodeViewContentProvider=({children,content})=>(0,react.createElement)(ReactNodeViewContext.Provider,{value:{nodeViewContentChildren:content}},children),exports.ReactNodeViewContext=ReactNodeViewContext,exports.ReactNodeViewRenderer=function ReactNodeViewRenderer(component,options){return props=>props.editor.contentComponent?new ReactNodeView(component,props,options):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}},exports.ReactRenderer=ReactRenderer,exports.ReactWidgetRenderer=function ReactWidgetRenderer(component,options){const{editor,props={},as="span",className}=options;return(0,_tiptap_core.createWidgetDecoration)({...options,props,cacheKey:WIDGET_CACHE,context:getPos=>({editor,getPos}),create:renderProps=>new ReactRenderer(component,{editor,as,className,props:renderProps}),materialize:renderer=>(renderer.render(),renderer.element)})},exports.Tiptap=Tiptap,exports.TiptapContent=TiptapContent,exports.TiptapContext=TiptapContext,exports.TiptapWrapper=TiptapWrapper,exports.createContentComponent=createContentComponent,exports.useCurrentEditor=()=>(0,react.useContext)(EditorContext),exports.useEditor=useEditor,exports.useEditorState=useEditorState,exports.useReactNodeView=useReactNodeView,exports.useTiptap=useTiptap,exports.useTiptapState=function useTiptapState(selector,equalityFn){const{editor}=useTiptap();return useEditorState({editor,selector,equalityFn})},Object.keys(_tiptap_core).forEach(function(k){"default"===k||Object.prototype.hasOwnProperty.call(exports,k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return _tiptap_core[k]}})})},"./node_modules/@tiptap/starter-kit/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let _tiptap_core=__webpack_require__("./node_modules/@tiptap/core/dist/index.cjs"),_tiptap_extension_blockquote=__webpack_require__("./node_modules/@tiptap/extension-blockquote/dist/index.cjs"),_tiptap_extension_bold=__webpack_require__("./node_modules/@tiptap/extension-bold/dist/index.cjs"),_tiptap_extension_code=__webpack_require__("./node_modules/@tiptap/extension-code/dist/index.cjs"),_tiptap_extension_code_block=__webpack_require__("./node_modules/@tiptap/extension-code-block/dist/index.cjs"),_tiptap_extension_document=__webpack_require__("./node_modules/@tiptap/extension-document/dist/index.cjs"),_tiptap_extension_hard_break=__webpack_require__("./node_modules/@tiptap/extension-hard-break/dist/index.cjs"),_tiptap_extension_heading=__webpack_require__("./node_modules/@tiptap/extension-heading/dist/index.cjs"),_tiptap_extension_horizontal_rule=__webpack_require__("./node_modules/@tiptap/extension-horizontal-rule/dist/index.cjs"),_tiptap_extension_italic=__webpack_require__("./node_modules/@tiptap/extension-italic/dist/index.cjs"),_tiptap_extension_link=__webpack_require__("./node_modules/@tiptap/extension-link/dist/index.cjs"),_tiptap_extension_list=__webpack_require__("./node_modules/@tiptap/extension-list/dist/index.cjs"),_tiptap_extension_paragraph=__webpack_require__("./node_modules/@tiptap/extension-paragraph/dist/index.cjs"),_tiptap_extension_strike=__webpack_require__("./node_modules/@tiptap/extension-strike/dist/index.cjs"),_tiptap_extension_text=__webpack_require__("./node_modules/@tiptap/extension-text/dist/index.cjs"),_tiptap_extension_underline=__webpack_require__("./node_modules/@tiptap/extension-underline/dist/index.cjs"),_tiptap_extensions=__webpack_require__("./node_modules/@tiptap/extensions/dist/index.cjs");const StarterKit=_tiptap_core.Extension.create({name:"starterKit",addExtensions(){const extensions=[];var _this$options,_this$options2,_this$options3,_this$options4;(!1!==this.options.bold&&extensions.push(_tiptap_extension_bold.Bold.configure(this.options.bold)),!1!==this.options.blockquote&&extensions.push(_tiptap_extension_blockquote.Blockquote.configure(this.options.blockquote)),!1!==this.options.bulletList&&extensions.push(_tiptap_extension_list.BulletList.configure(this.options.bulletList)),!1!==this.options.code&&extensions.push(_tiptap_extension_code.Code.configure(this.options.code)),!1!==this.options.codeBlock&&extensions.push(_tiptap_extension_code_block.CodeBlock.configure(this.options.codeBlock)),!1!==this.options.document&&extensions.push(_tiptap_extension_document.Document.configure(this.options.document)),!1!==this.options.dropcursor&&extensions.push(_tiptap_extensions.Dropcursor.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&extensions.push(_tiptap_extensions.Gapcursor.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&extensions.push(_tiptap_extension_hard_break.HardBreak.configure(this.options.hardBreak)),!1!==this.options.heading&&extensions.push(_tiptap_extension_heading.Heading.configure(this.options.heading)),!1!==this.options.undoRedo&&extensions.push(_tiptap_extensions.UndoRedo.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&extensions.push(_tiptap_extension_horizontal_rule.HorizontalRule.configure(this.options.horizontalRule)),!1!==this.options.italic&&extensions.push(_tiptap_extension_italic.Italic.configure(this.options.italic)),!1!==this.options.listItem&&extensions.push(_tiptap_extension_list.ListItem.configure(this.options.listItem)),!1!==this.options.listKeymap)&&extensions.push(_tiptap_extension_list.ListKeymap.configure(null===(_this$options=this.options)||void 0===_this$options?void 0:_this$options.listKeymap));!1!==this.options.link&&extensions.push(_tiptap_extension_link.Link.configure(null===(_this$options2=this.options)||void 0===_this$options2?void 0:_this$options2.link));(!1!==this.options.orderedList&&extensions.push(_tiptap_extension_list.OrderedList.configure(this.options.orderedList)),!1!==this.options.paragraph&&extensions.push(_tiptap_extension_paragraph.Paragraph.configure(this.options.paragraph)),!1!==this.options.strike&&extensions.push(_tiptap_extension_strike.Strike.configure(this.options.strike)),!1!==this.options.text&&extensions.push(_tiptap_extension_text.Text.configure(this.options.text)),!1!==this.options.underline)&&extensions.push(_tiptap_extension_underline.Underline.configure(null===(_this$options3=this.options)||void 0===_this$options3?void 0:_this$options3.underline));!1!==this.options.trailingNode&&extensions.push(_tiptap_extensions.TrailingNode.configure(null===(_this$options4=this.options)||void 0===_this$options4?void 0:_this$options4.trailingNode));return extensions}});var src_default=StarterKit;exports.StarterKit=StarterKit,exports.default=src_default},"./node_modules/fast-equals/dist/cjs/index.cjs"(__unused_webpack_module,exports){"use strict";const{getOwnPropertyNames,getOwnPropertySymbols}=Object,{hasOwnProperty}=Object.prototype;function combineComparators(comparatorA,comparatorB){return function isEqual(a,b,state){return comparatorA(a,b,state)&&comparatorB(a,b,state)}}function createIsCircular(areItemsEqual){return function isCircular(a,b,state){if(!a||!b||"object"!=typeof a||"object"!=typeof b)return areItemsEqual(a,b,state);const{cache}=state,cachedA=cache.get(a),cachedB=cache.get(b);if(cachedA&&cachedB)return cachedA===b&&cachedB===a;cache.set(a,b),cache.set(b,a);const result=areItemsEqual(a,b,state);return cache.delete(a),cache.delete(b),result}}function getStrictProperties(object){return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object))}const hasOwn=Object.hasOwn||((object,property)=>hasOwnProperty.call(object,property));function sameValueZeroEqual(a,b){return a===b||!a&&!b&&a!=a&&b!=b}const HAS_FLOAT_16_ARRAY="undefined"!=typeof Float16Array,{getOwnPropertyDescriptor,keys}=Object;function areArrayBuffersEqual(a,b){return a.byteLength===b.byteLength&&areTypedArraysEqual(new Uint8Array(a),new Uint8Array(b))}function areArraysEqual(a,b,state){let index=a.length;if(b.length!==index)return!1;for(;index-- >0;)if(!state.equals(a[index],b[index],index,index,a,b,state))return!1;return!0}function areDataViewsEqual(a,b){return a.byteLength===b.byteLength&&areTypedArraysEqual(new Uint8Array(a.buffer,a.byteOffset,a.byteLength),new Uint8Array(b.buffer,b.byteOffset,b.byteLength))}function areDatesEqual(a,b){return sameValueZeroEqual(a.getTime(),b.getTime())}function areErrorsEqual(a,b,state){return a.name===b.name&&a.message===b.message&&a.stack===b.stack&&state.equals(a.cause,b.cause,"cause","cause",a,b,state)}function areFunctionsEqual(a,b){return a===b}function areMapsEqual(a,b,state){const size=a.size;if(size!==b.size)return!1;if(!size)return!0;const matchedIndices=new Array(size),aIterable=a.entries();let aResult,bResult,index=0;for(;(aResult=aIterable.next())&&!aResult.done;){const bIterable=b.entries();let hasMatch=!1,matchIndex=0;for(;(bResult=bIterable.next())&&!bResult.done;){if(matchedIndices[matchIndex]){matchIndex++;continue}const aEntry=aResult.value,bEntry=bResult.value;if(state.equals(aEntry[0],bEntry[0],index,matchIndex,a,b,state)&&state.equals(aEntry[1],bEntry[1],aEntry[0],bEntry[0],a,b,state)){hasMatch=matchedIndices[matchIndex]=!0;break}matchIndex++}if(!hasMatch)return!1;index++}return!0}const areNumbersEqual=sameValueZeroEqual;function areObjectsEqual(a,b,state){const properties=keys(a);let index=properties.length;if(keys(b).length!==index)return!1;for(;index-- >0;)if(!isPropertyEqual(a,b,state,properties[index]))return!1;return!0}function areObjectsEqualStrict(a,b,state){const properties=getStrictProperties(a);let property,descriptorA,descriptorB,index=properties.length;if(getStrictProperties(b).length!==index)return!1;for(;index-- >0;){if(property=properties[index],!isPropertyEqual(a,b,state,property))return!1;if(descriptorA=getOwnPropertyDescriptor(a,property),descriptorB=getOwnPropertyDescriptor(b,property),(descriptorA||descriptorB)&&(!descriptorA||!descriptorB||descriptorA.configurable!==descriptorB.configurable||descriptorA.enumerable!==descriptorB.enumerable||descriptorA.writable!==descriptorB.writable))return!1}return!0}function arePrimitiveWrappersEqual(a,b){return sameValueZeroEqual(a.valueOf(),b.valueOf())}function areRegExpsEqual(a,b){return a.source===b.source&&a.flags===b.flags}function areSetsEqual(a,b,state){const size=a.size;if(size!==b.size)return!1;if(!size)return!0;const matchedIndices=new Array(size),aIterable=a.values();let aResult,bResult;for(;(aResult=aIterable.next())&&!aResult.done;){const bIterable=b.values();let hasMatch=!1,matchIndex=0;for(;(bResult=bIterable.next())&&!bResult.done;){if(!matchedIndices[matchIndex]&&state.equals(aResult.value,bResult.value,aResult.value,bResult.value,a,b,state)){hasMatch=matchedIndices[matchIndex]=!0;break}matchIndex++}if(!hasMatch)return!1}return!0}function areTypedArraysEqual(a,b){let index=a.length;if(b.length!==index||a.byteOffset!==b.byteOffset)return!1;if(a instanceof Float64Array||a instanceof Float32Array||HAS_FLOAT_16_ARRAY&&a instanceof Float16Array){for(;index-- >0;)if(a[index]!==b[index]&&(a[index]==a[index]||b[index]==b[index]))return!1;return!0}for(;index-- >0;)if(a[index]!==b[index])return!1;return!0}function areUrlsEqual(a,b){return a.href===b.href||a.protocol===b.protocol&&a.username===b.username&&a.password===b.password&&a.host===b.host&&a.pathname===b.pathname&&a.hash===b.hash&&function areSearchParamsEqual(a,b){const serializedA=a.toString(),serializedB=b.toString();return serializedA===serializedB||sortSearchParams(serializedA)===sortSearchParams(serializedB)}(a.searchParams,b.searchParams)}function sortSearchParams(serialized){return serialized.split("&").sort().join("&")}function isPropertyEqual(a,b,state,property){return!("_owner"!==property&&"__o"!==property&&"__v"!==property||!a.$$typeof&&!b.$$typeof)||hasOwn(b,property)&&state.equals(a[property],b[property],property,property,a,b,state)}const TYPED_ARRAY_TAGS={"[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},toString=Object.prototype.toString;function createEqualityComparator({areArrayBuffersEqual,areArraysEqual,areDataViewsEqual,areDatesEqual,areErrorsEqual,areFunctionsEqual,areMapsEqual,areNumbersEqual,areObjectsEqual,arePrimitiveWrappersEqual,areRegExpsEqual,areSetsEqual,areTypedArraysEqual,areUrlsEqual,unknownTagComparators}){return function comparator(a,b,state){if(a===b)return!0;if(null==a||null==b)return!1;const type=typeof a;if(type!==typeof b)return!1;if("object"!==type)return"number"===type?areNumbersEqual(a,b,state):"function"===type&&areFunctionsEqual(a,b,state);const constructor=a.constructor;if(constructor!==b.constructor)return!1;if(constructor===Object)return areObjectsEqual(a,b,state);if(Array.isArray(a))return areArraysEqual(a,b,state);if(constructor===Date)return areDatesEqual(a,b,state);if(constructor===RegExp)return areRegExpsEqual(a,b,state);if(constructor===Map)return areMapsEqual(a,b,state);if(constructor===Set)return areSetsEqual(a,b,state);const tag=toString.call(a);if("[object Date]"===tag)return areDatesEqual(a,b,state);if("[object RegExp]"===tag)return areRegExpsEqual(a,b,state);if("[object Map]"===tag)return areMapsEqual(a,b,state);if("[object Set]"===tag)return areSetsEqual(a,b,state);if("[object Object]"===tag)return"function"!=typeof a.then&&"function"!=typeof b.then&&areObjectsEqual(a,b,state);if("[object URL]"===tag)return areUrlsEqual(a,b,state);if("[object Error]"===tag)return areErrorsEqual(a,b,state);if("[object Arguments]"===tag)return areObjectsEqual(a,b,state);if(TYPED_ARRAY_TAGS[tag])return areTypedArraysEqual(a,b,state);if("[object ArrayBuffer]"===tag)return areArrayBuffersEqual(a,b,state);if("[object DataView]"===tag)return areDataViewsEqual(a,b,state);if("[object Boolean]"===tag||"[object Number]"===tag||"[object String]"===tag)return arePrimitiveWrappersEqual(a,b,state);if(unknownTagComparators){let unknownTagComparator=unknownTagComparators[tag];if(!unknownTagComparator){const shortTag=function getShortTag(value){return null!=value?value[Symbol.toStringTag]:void 0}(a);shortTag&&(unknownTagComparator=unknownTagComparators[shortTag])}if(unknownTagComparator)return unknownTagComparator(a,b,state)}return!1}}const deepEqual=createCustomEqual(),strictDeepEqual=createCustomEqual({strict:!0}),circularDeepEqual=createCustomEqual({circular:!0}),strictCircularDeepEqual=createCustomEqual({circular:!0,strict:!0}),shallowEqual=createCustomEqual({createInternalComparator:()=>sameValueZeroEqual}),strictShallowEqual=createCustomEqual({strict:!0,createInternalComparator:()=>sameValueZeroEqual}),circularShallowEqual=createCustomEqual({circular:!0,createInternalComparator:()=>sameValueZeroEqual}),strictCircularShallowEqual=createCustomEqual({circular:!0,createInternalComparator:()=>sameValueZeroEqual,strict:!0});function createCustomEqual(options={}){const{circular=!1,createInternalComparator:createCustomInternalComparator,createState,strict=!1}=options,config=function createEqualityComparatorConfig({circular,createCustomConfig,strict}){let config={areArrayBuffersEqual,areArraysEqual:strict?areObjectsEqualStrict:areArraysEqual,areDataViewsEqual,areDatesEqual,areErrorsEqual:combineComparators(areErrorsEqual,strict?areObjectsEqualStrict:areObjectsEqual),areFunctionsEqual,areMapsEqual:strict?combineComparators(areMapsEqual,areObjectsEqualStrict):areMapsEqual,areNumbersEqual,areObjectsEqual:strict?areObjectsEqualStrict:areObjectsEqual,arePrimitiveWrappersEqual,areRegExpsEqual,areSetsEqual:strict?combineComparators(areSetsEqual,areObjectsEqualStrict):areSetsEqual,areTypedArraysEqual:strict?combineComparators(areTypedArraysEqual,areObjectsEqualStrict):areTypedArraysEqual,areUrlsEqual,unknownTagComparators:void 0};if(createCustomConfig&&(config=Object.assign({},config,createCustomConfig(config))),circular){const areArraysEqual=createIsCircular(config.areArraysEqual),areErrorsEqual=createIsCircular(config.areErrorsEqual),areMapsEqual=createIsCircular(config.areMapsEqual),areObjectsEqual=createIsCircular(config.areObjectsEqual),areSetsEqual=createIsCircular(config.areSetsEqual);config=Object.assign({},config,{areArraysEqual,areErrorsEqual,areMapsEqual,areObjectsEqual,areSetsEqual})}return config}(options),comparator=createEqualityComparator(config);return function createIsEqual({circular,comparator,createState,equals,strict}){if(createState)return function isEqual(a,b){const{cache=circular?new WeakMap:void 0,meta}=createState();return comparator(a,b,{cache,equals,meta,strict})};if(circular)return function isEqual(a,b){return comparator(a,b,{cache:new WeakMap,equals,meta:void 0,strict})};const state={cache:void 0,equals,meta:void 0,strict};return function isEqual(a,b){return comparator(a,b,state)}}({circular,comparator,createState,equals:createCustomInternalComparator?createCustomInternalComparator(comparator):function createInternalEqualityComparator(compare){return function(a,b,_indexOrKeyA,_indexOrKeyB,_parentA,_parentB,state){return compare(a,b,state)}}(comparator),strict})}exports.circularDeepEqual=circularDeepEqual,exports.circularShallowEqual=circularShallowEqual,exports.createCustomEqual=createCustomEqual,exports.deepEqual=deepEqual,exports.sameValueZeroEqual=sameValueZeroEqual,exports.shallowEqual=shallowEqual,exports.strictCircularDeepEqual=strictCircularDeepEqual,exports.strictCircularShallowEqual=strictCircularShallowEqual,exports.strictDeepEqual=strictDeepEqual,exports.strictShallowEqual=strictShallowEqual},"./node_modules/orderedmap/dist/index.cjs"(module){"use strict";function OrderedMap(content){this.content=content}OrderedMap.prototype={constructor:OrderedMap,find:function(key){for(var i=0;i<this.content.length;i+=2)if(this.content[i]===key)return i;return-1},get:function(key){var found=this.find(key);return-1==found?void 0:this.content[found+1]},update:function(key,value,newKey){var self=newKey&&newKey!=key?this.remove(newKey):this,found=self.find(key),content=self.content.slice();return-1==found?content.push(newKey||key,value):(content[found+1]=value,newKey&&(content[found]=newKey)),new OrderedMap(content)},remove:function(key){var found=this.find(key);if(-1==found)return this;var content=this.content.slice();return content.splice(found,2),new OrderedMap(content)},addToStart:function(key,value){return new OrderedMap([key,value].concat(this.remove(key).content))},addToEnd:function(key,value){var content=this.remove(key).content.slice();return content.push(key,value),new OrderedMap(content)},addBefore:function(place,key,value){var without=this.remove(key),content=without.content.slice(),found=without.find(place);return content.splice(-1==found?content.length:found,0,key,value),new OrderedMap(content)},forEach:function(f){for(var i=0;i<this.content.length;i+=2)f(this.content[i],this.content[i+1])},prepend:function(map){return(map=OrderedMap.from(map)).size?new OrderedMap(map.content.concat(this.subtract(map).content)):this},append:function(map){return(map=OrderedMap.from(map)).size?new OrderedMap(this.subtract(map).content.concat(map.content)):this},subtract:function(map){var result=this;map=OrderedMap.from(map);for(var i=0;i<map.content.length;i+=2)result=result.remove(map.content[i]);return result},toObject:function(){var result={};return this.forEach(function(key,value){result[key]=value}),result},get size(){return this.content.length>>1}},OrderedMap.from=function(value){if(value instanceof OrderedMap)return value;var content=[];if(value)for(var prop in value)content.push(prop,value[prop]);return new OrderedMap(content)},module.exports=OrderedMap},"./node_modules/prosemirror-commands/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";var prosemirrorTransform=__webpack_require__("./node_modules/prosemirror-transform/dist/index.cjs"),prosemirrorModel=__webpack_require__("./node_modules/prosemirror-model/dist/index.cjs"),prosemirrorState=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs"),deleteSelection=function deleteSelection(state,dispatch){return!state.selection.empty&&(dispatch&&dispatch(state.tr.deleteSelection().scrollIntoView()),!0)};function atBlockStart(state,view){var $cursor=state.selection.$cursor;return!$cursor||(view?!view.endOfTextblock("backward",state):$cursor.parentOffset>0)?null:$cursor}var joinBackward=function joinBackward(state,dispatch,view){var $cursor=atBlockStart(state,view);if(!$cursor)return!1;var $cut=findCutBefore($cursor);if(!$cut){var range=$cursor.blockRange(),target=range&&prosemirrorTransform.liftTarget(range);return null!=target&&(dispatch&&dispatch(state.tr.lift(range,target).scrollIntoView()),!0)}var before=$cut.nodeBefore;if(deleteBarrier(state,$cut,dispatch,-1))return!0;if(0==$cursor.parent.content.size&&(textblockAt(before,"end")||prosemirrorState.NodeSelection.isSelectable(before)))for(var depth=$cursor.depth;;depth--){var delStep=prosemirrorTransform.replaceStep(state.doc,$cursor.before(depth),$cursor.after(depth),prosemirrorModel.Slice.empty);if(delStep&&delStep.slice.size<delStep.to-delStep.from){if(dispatch){var tr=state.tr.step(delStep);tr.setSelection(textblockAt(before,"end")?prosemirrorState.Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos,-1)),-1):prosemirrorState.NodeSelection.create(tr.doc,$cut.pos-before.nodeSize)),dispatch(tr.scrollIntoView())}return!0}if(1==depth||$cursor.node(depth-1).childCount>1)break}return!(!before.isAtom||$cut.depth!=$cursor.depth-1)&&(dispatch&&dispatch(state.tr.delete($cut.pos-before.nodeSize,$cut.pos).scrollIntoView()),!0)};function joinTextblocksAround(state,$cut,dispatch){for(var beforeText=$cut.nodeBefore,beforePos=$cut.pos-1;!beforeText.isTextblock;beforePos--){if(beforeText.type.spec.isolating)return!1;var child=beforeText.lastChild;if(!child)return!1;beforeText=child}for(var afterText=$cut.nodeAfter,afterPos=$cut.pos+1;!afterText.isTextblock;afterPos++){if(afterText.type.spec.isolating)return!1;var _child=afterText.firstChild;if(!_child)return!1;afterText=_child}var step=prosemirrorTransform.replaceStep(state.doc,beforePos,afterPos,prosemirrorModel.Slice.empty);if(!step||step.from!=beforePos||step instanceof prosemirrorTransform.ReplaceStep&&step.slice.size>=afterPos-beforePos)return!1;if(dispatch){var tr=state.tr.step(step);tr.setSelection(prosemirrorState.TextSelection.create(tr.doc,beforePos)),dispatch(tr.scrollIntoView())}return!0}function textblockAt(node,side){for(var only=arguments.length>2&&void 0!==arguments[2]&&arguments[2],scan=node;scan;scan="start"==side?scan.firstChild:scan.lastChild){if(scan.isTextblock)return!0;if(only&&1!=scan.childCount)return!1}return!1}var selectNodeBackward=function selectNodeBackward(state,dispatch,view){var _state$selection=state.selection,$head=_state$selection.$head,$cut=$head;if(!_state$selection.empty)return!1;if($head.parent.isTextblock){if(view?!view.endOfTextblock("backward",state):$head.parentOffset>0)return!1;$cut=findCutBefore($head)}var node=$cut&&$cut.nodeBefore;return!(!node||!prosemirrorState.NodeSelection.isSelectable(node))&&(dispatch&&dispatch(state.tr.setSelection(prosemirrorState.NodeSelection.create(state.doc,$cut.pos-node.nodeSize)).scrollIntoView()),!0)};function findCutBefore($pos){if(!$pos.parent.type.spec.isolating)for(var i=$pos.depth-1;i>=0;i--){if($pos.index(i)>0)return $pos.doc.resolve($pos.before(i+1));if($pos.node(i).type.spec.isolating)break}return null}function atBlockEnd(state,view){var $cursor=state.selection.$cursor;return!$cursor||(view?!view.endOfTextblock("forward",state):$cursor.parentOffset<$cursor.parent.content.size)?null:$cursor}var joinForward=function joinForward(state,dispatch,view){var $cursor=atBlockEnd(state,view);if(!$cursor)return!1;var $cut=findCutAfter($cursor);if(!$cut)return!1;var after=$cut.nodeAfter;if(deleteBarrier(state,$cut,dispatch,1))return!0;if(0==$cursor.parent.content.size&&(textblockAt(after,"start")||prosemirrorState.NodeSelection.isSelectable(after))){var delStep=prosemirrorTransform.replaceStep(state.doc,$cursor.before(),$cursor.after(),prosemirrorModel.Slice.empty);if(delStep&&delStep.slice.size<delStep.to-delStep.from){if(dispatch){var tr=state.tr.step(delStep);tr.setSelection(textblockAt(after,"start")?prosemirrorState.Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)),1):prosemirrorState.NodeSelection.create(tr.doc,tr.mapping.map($cut.pos))),dispatch(tr.scrollIntoView())}return!0}}return!(!after.isAtom||$cut.depth!=$cursor.depth-1)&&(dispatch&&dispatch(state.tr.delete($cut.pos,$cut.pos+after.nodeSize).scrollIntoView()),!0)},selectNodeForward=function selectNodeForward(state,dispatch,view){var _state$selection2=state.selection,$head=_state$selection2.$head,$cut=$head;if(!_state$selection2.empty)return!1;if($head.parent.isTextblock){if(view?!view.endOfTextblock("forward",state):$head.parentOffset<$head.parent.content.size)return!1;$cut=findCutAfter($head)}var node=$cut&&$cut.nodeAfter;return!(!node||!prosemirrorState.NodeSelection.isSelectable(node))&&(dispatch&&dispatch(state.tr.setSelection(prosemirrorState.NodeSelection.create(state.doc,$cut.pos)).scrollIntoView()),!0)};function findCutAfter($pos){if(!$pos.parent.type.spec.isolating)for(var i=$pos.depth-1;i>=0;i--){var parent=$pos.node(i);if($pos.index(i)+1<parent.childCount)return $pos.doc.resolve($pos.after(i+1));if(parent.type.spec.isolating)break}return null}var newlineInCode=function newlineInCode(state,dispatch){var _state$selection4=state.selection,$head=_state$selection4.$head,$anchor=_state$selection4.$anchor;return!(!$head.parent.type.spec.code||!$head.sameParent($anchor))&&(dispatch&&dispatch(state.tr.insertText("\n").scrollIntoView()),!0)};function defaultBlockAt(match){for(var i=0;i<match.edgeCount;i++){var type=match.edge(i).type;if(type.isTextblock&&!type.hasRequiredAttrs())return type}return null}var exitCode=function exitCode(state,dispatch){var _state$selection5=state.selection,$head=_state$selection5.$head,$anchor=_state$selection5.$anchor;if(!$head.parent.type.spec.code||!$head.sameParent($anchor))return!1;var above=$head.node(-1),after=$head.indexAfter(-1),type=defaultBlockAt(above.contentMatchAt(after));if(!type||!above.canReplaceWith(after,after,type))return!1;if(dispatch){var pos=$head.after(),tr=state.tr.replaceWith(pos,pos,type.createAndFill());tr.setSelection(prosemirrorState.Selection.near(tr.doc.resolve(pos),1)),dispatch(tr.scrollIntoView())}return!0},createParagraphNear=function createParagraphNear(state,dispatch){var sel=state.selection,$from=sel.$from,$to=sel.$to;if(sel instanceof prosemirrorState.AllSelection||$from.parent.inlineContent||$to.parent.inlineContent)return!1;var type=defaultBlockAt($to.parent.contentMatchAt($to.indexAfter()));if(!type||!type.isTextblock)return!1;if(dispatch){var side=(!$from.parentOffset&&$to.index()<$to.parent.childCount?$from:$to).pos,tr=state.tr.insert(side,type.createAndFill());tr.setSelection(prosemirrorState.TextSelection.create(tr.doc,side+1)),dispatch(tr.scrollIntoView())}return!0},liftEmptyBlock=function liftEmptyBlock(state,dispatch){var $cursor=state.selection.$cursor;if(!$cursor||$cursor.parent.content.size)return!1;if($cursor.depth>1&&$cursor.after()!=$cursor.end(-1)){var before=$cursor.before();if(prosemirrorTransform.canSplit(state.doc,before))return dispatch&&dispatch(state.tr.split(before).scrollIntoView()),!0}var range=$cursor.blockRange(),target=range&&prosemirrorTransform.liftTarget(range);return null!=target&&(dispatch&&dispatch(state.tr.lift(range,target).scrollIntoView()),!0)};function splitBlockAs(splitNode){return function(state,dispatch){if(state.selection instanceof prosemirrorState.NodeSelection&&state.selection.node.isBlock){var _$from=state.selection.$from;return!(!_$from.parentOffset||!prosemirrorTransform.canSplit(state.doc,_$from.pos))&&(dispatch&&dispatch(state.tr.split(_$from.pos).scrollIntoView()),!0)}if(!state.selection.$from.depth)return!1;var tr=state.tr;!state.selection.empty&&(state.selection instanceof prosemirrorState.TextSelection||state.selection instanceof prosemirrorState.AllSelection)&&tr.deleteSelection();for(var splitDepth,deflt,$from=tr.selection.$from,mapFrom=tr.steps.length,types=[],atEnd=!1,atStart=!1,d=$from.depth;;d--){if($from.node(d).isBlock){atEnd=$from.end(d)==$from.pos+($from.depth-d),atStart=$from.start(d)==$from.pos-($from.depth-d),deflt=defaultBlockAt($from.node(d-1).contentMatchAt($from.indexAfter(d-1)));var splitType=splitNode&&splitNode($from.parent,atEnd,$from);types.unshift(splitType||(atEnd&&deflt?{type:deflt}:null)),splitDepth=d;break}if(1==d)return!1;types.unshift(null)}var splitPos=$from.pos,can=prosemirrorTransform.canSplit(tr.doc,splitPos,types.length,types);if(can||(types[0]=deflt?{type:deflt}:null,can=prosemirrorTransform.canSplit(tr.doc,splitPos,types.length,types)),!can)return!1;if(tr.split(splitPos,types.length,types),!atEnd&&atStart&&$from.node(splitDepth).type!=deflt){var mapping=tr.mapping.slice(mapFrom),first=mapping.map($from.before(splitDepth)),$first=tr.doc.resolve(first);deflt&&$from.node(splitDepth-1).canReplaceWith($first.index(),$first.index()+1,deflt)&&tr.setNodeMarkup(mapping.map($from.before(splitDepth)),deflt)}return dispatch&&dispatch(tr.scrollIntoView()),!0}}var splitBlock=splitBlockAs(),selectAll=function selectAll(state,dispatch){return dispatch&&dispatch(state.tr.setSelection(new prosemirrorState.AllSelection(state.doc))),!0};function deleteBarrier(state,$cut,dispatch,dir){var conn,match,before=$cut.nodeBefore,after=$cut.nodeAfter,isolated=before.type.spec.isolating||after.type.spec.isolating;if(!isolated&&function joinMaybeClear(state,$pos,dispatch){var before=$pos.nodeBefore,after=$pos.nodeAfter,index=$pos.index();return!(!(before&&after&&before.type.compatibleContent(after.type))||(!before.content.size&&$pos.parent.canReplace(index-1,index)?(dispatch&&dispatch(state.tr.delete($pos.pos-before.nodeSize,$pos.pos).scrollIntoView()),0):!$pos.parent.canReplace(index,index+1)||!after.isTextblock&&!prosemirrorTransform.canJoin(state.doc,$pos.pos)||(dispatch&&dispatch(state.tr.join($pos.pos).scrollIntoView()),0)))}(state,$cut,dispatch))return!0;var canDelAfter=!isolated&&$cut.parent.canReplace($cut.index(),$cut.index()+1);if(canDelAfter&&(conn=(match=before.contentMatchAt(before.childCount)).findWrapping(after.type))&&match.matchType(conn[0]||after.type).validEnd){if(dispatch){for(var end=$cut.pos+after.nodeSize,wrap=prosemirrorModel.Fragment.empty,i=conn.length-1;i>=0;i--)wrap=prosemirrorModel.Fragment.from(conn[i].create(null,wrap));wrap=prosemirrorModel.Fragment.from(before.copy(wrap));var tr=state.tr.step(new prosemirrorTransform.ReplaceAroundStep($cut.pos-1,end,$cut.pos,end,new prosemirrorModel.Slice(wrap,1,0),conn.length,!0)),$joinAt=tr.doc.resolve(end+2*conn.length);$joinAt.nodeAfter&&$joinAt.nodeAfter.type==before.type&&prosemirrorTransform.canJoin(tr.doc,$joinAt.pos)&&tr.join($joinAt.pos),dispatch(tr.scrollIntoView())}return!0}var selAfter=after.type.spec.isolating||dir>0&&isolated?null:prosemirrorState.Selection.findFrom($cut,1),range=selAfter&&selAfter.$from.blockRange(selAfter.$to),target=range&&prosemirrorTransform.liftTarget(range);if(null!=target&&target>=$cut.depth)return dispatch&&dispatch(state.tr.lift(range,target).scrollIntoView()),!0;if(canDelAfter&&textblockAt(after,"start",!0)&&textblockAt(before,"end")){for(var at=before,_wrap=[];_wrap.push(at),!at.isTextblock;)at=at.lastChild;for(var afterText=after,afterDepth=1;!afterText.isTextblock;afterText=afterText.firstChild)afterDepth++;if(at.canReplace(at.childCount,at.childCount,afterText.content)){if(dispatch){for(var _end=prosemirrorModel.Fragment.empty,_i=_wrap.length-1;_i>=0;_i--)_end=prosemirrorModel.Fragment.from(_wrap[_i].copy(_end));dispatch(state.tr.step(new prosemirrorTransform.ReplaceAroundStep($cut.pos-_wrap.length,$cut.pos+after.nodeSize,$cut.pos+afterDepth,$cut.pos+after.nodeSize-afterDepth,new prosemirrorModel.Slice(_end,_wrap.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function selectTextblockSide(side){return function(state,dispatch){for(var sel=state.selection,$pos=side<0?sel.$from:sel.$to,depth=$pos.depth;$pos.node(depth).isInline;){if(!depth)return!1;depth--}return!!$pos.node(depth).isTextblock&&(dispatch&&dispatch(state.tr.setSelection(prosemirrorState.TextSelection.create(state.doc,side<0?$pos.start(depth):$pos.end(depth)))),!0)}}var selectTextblockStart=selectTextblockSide(-1),selectTextblockEnd=selectTextblockSide(1);function chainCommands(){for(var _len=arguments.length,commands=new Array(_len),_key=0;_key<_len;_key++)commands[_key]=arguments[_key];return function(state,dispatch,view){for(var i=0;i<commands.length;i++)if(commands[i](state,dispatch,view))return!0;return!1}}var backspace=chainCommands(deleteSelection,joinBackward,selectNodeBackward),del=chainCommands(deleteSelection,joinForward,selectNodeForward),pcBaseKeymap={Enter:chainCommands(newlineInCode,createParagraphNear,liftEmptyBlock,splitBlock),"Mod-Enter":exitCode,Backspace:backspace,"Mod-Backspace":backspace,"Shift-Backspace":backspace,Delete:del,"Mod-Delete":del,"Mod-a":selectAll},macBaseKeymap={"Ctrl-h":pcBaseKeymap.Backspace,"Alt-Backspace":pcBaseKeymap["Mod-Backspace"],"Ctrl-d":pcBaseKeymap.Delete,"Ctrl-Alt-Backspace":pcBaseKeymap["Mod-Delete"],"Alt-Delete":pcBaseKeymap["Mod-Delete"],"Alt-d":pcBaseKeymap["Mod-Delete"],"Ctrl-a":selectTextblockStart,"Ctrl-e":selectTextblockEnd};for(var key in pcBaseKeymap)macBaseKeymap[key]=pcBaseKeymap[key];var baseKeymap=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?macBaseKeymap:pcBaseKeymap;exports.autoJoin=function autoJoin(command,isJoinable){var canJoin=Array.isArray(isJoinable)?function(node){return isJoinable.indexOf(node.type.name)>-1}:isJoinable;return function(state,dispatch,view){return command(state,dispatch&&function wrapDispatchForJoin(dispatch,isJoinable){return function(tr){if(!tr.isGeneric)return dispatch(tr);for(var ranges=[],i=0;i<tr.mapping.maps.length;i++){for(var map=tr.mapping.maps[i],j=0;j<ranges.length;j++)ranges[j]=map.map(ranges[j]);map.forEach(function(_s,_e,from,to){return ranges.push(from,to)})}for(var joinable=[],_i3=0;_i3<ranges.length;_i3+=2)for(var from=ranges[_i3],to=ranges[_i3+1],$from=tr.doc.resolve(from),depth=$from.sharedDepth(to),parent=$from.node(depth),index=$from.indexAfter(depth),pos=$from.after(depth+1);pos<=to;++index){var after=parent.maybeChild(index);if(!after)break;if(index&&-1==joinable.indexOf(pos)){var before=parent.child(index-1);before.type==after.type&&isJoinable(before,after)&&joinable.push(pos)}pos+=after.nodeSize}joinable.sort(function(a,b){return a-b});for(var _i4=joinable.length-1;_i4>=0;_i4--)prosemirrorTransform.canJoin(tr.doc,joinable[_i4])&&tr.join(joinable[_i4]);dispatch(tr)}}(dispatch,canJoin),view)}},exports.baseKeymap=baseKeymap,exports.chainCommands=chainCommands,exports.createParagraphNear=createParagraphNear,exports.deleteSelection=deleteSelection,exports.exitCode=exitCode,exports.joinBackward=joinBackward,exports.joinDown=function joinDown(state,dispatch){var point,sel=state.selection;if(sel instanceof prosemirrorState.NodeSelection){if(sel.node.isTextblock||!prosemirrorTransform.canJoin(state.doc,sel.to))return!1;point=sel.to}else if(null==(point=prosemirrorTransform.joinPoint(state.doc,sel.to,1)))return!1;return dispatch&&dispatch(state.tr.join(point).scrollIntoView()),!0},exports.joinForward=joinForward,exports.joinTextblockBackward=function joinTextblockBackward(state,dispatch,view){var $cursor=atBlockStart(state,view);if(!$cursor)return!1;var $cut=findCutBefore($cursor);return!!$cut&&joinTextblocksAround(state,$cut,dispatch)},exports.joinTextblockForward=function joinTextblockForward(state,dispatch,view){var $cursor=atBlockEnd(state,view);if(!$cursor)return!1;var $cut=findCutAfter($cursor);return!!$cut&&joinTextblocksAround(state,$cut,dispatch)},exports.joinUp=function joinUp(state,dispatch){var point,sel=state.selection,nodeSel=sel instanceof prosemirrorState.NodeSelection;if(nodeSel){if(sel.node.isTextblock||!prosemirrorTransform.canJoin(state.doc,sel.from))return!1;point=sel.from}else if(null==(point=prosemirrorTransform.joinPoint(state.doc,sel.from,-1)))return!1;if(dispatch){var tr=state.tr.join(point);nodeSel&&tr.setSelection(prosemirrorState.NodeSelection.create(tr.doc,point-state.doc.resolve(point).nodeBefore.nodeSize)),dispatch(tr.scrollIntoView())}return!0},exports.lift=function lift(state,dispatch){var _state$selection3=state.selection,$from=_state$selection3.$from,$to=_state$selection3.$to,range=$from.blockRange($to),target=range&&prosemirrorTransform.liftTarget(range);return null!=target&&(dispatch&&dispatch(state.tr.lift(range,target).scrollIntoView()),!0)},exports.liftEmptyBlock=liftEmptyBlock,exports.macBaseKeymap=macBaseKeymap,exports.newlineInCode=newlineInCode,exports.pcBaseKeymap=pcBaseKeymap,exports.selectAll=selectAll,exports.selectNodeBackward=selectNodeBackward,exports.selectNodeForward=selectNodeForward,exports.selectParentNode=function selectParentNode(state,dispatch){var pos,_state$selection6=state.selection,$from=_state$selection6.$from,to=_state$selection6.to,same=$from.sharedDepth(to);return 0!=same&&(pos=$from.before(same),dispatch&&dispatch(state.tr.setSelection(prosemirrorState.NodeSelection.create(state.doc,pos))),!0)},exports.selectTextblockEnd=selectTextblockEnd,exports.selectTextblockStart=selectTextblockStart,exports.setBlockType=function setBlockType(nodeType){var attrs=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(state,dispatch){for(var applicable=!1,i=0;i<state.selection.ranges.length&&!applicable;i++){var _state$selection$rang=state.selection.ranges[i],from=_state$selection$rang.$from.pos,to=_state$selection$rang.$to.pos;state.doc.nodesBetween(from,to,function(node,pos){if(applicable)return!1;if(node.isTextblock&&!node.hasMarkup(nodeType,attrs))if(node.type==nodeType)applicable=!0;else{var $pos=state.doc.resolve(pos),index=$pos.index();applicable=$pos.parent.canReplaceWith(index,index+1,nodeType)}})}if(!applicable)return!1;if(dispatch){for(var tr=state.tr,_i2=0;_i2<state.selection.ranges.length;_i2++){var _state$selection$rang2=state.selection.ranges[_i2],_from=_state$selection$rang2.$from.pos,_to=_state$selection$rang2.$to.pos;tr.setBlockType(_from,_to,nodeType,attrs)}dispatch(tr.scrollIntoView())}return!0}},exports.splitBlock=splitBlock,exports.splitBlockAs=splitBlockAs,exports.splitBlockKeepMarks=function splitBlockKeepMarks(state,dispatch){return splitBlock(state,dispatch&&function(tr){var marks=state.storedMarks||state.selection.$to.parentOffset&&state.selection.$from.marks();marks&&tr.ensureMarks(marks),dispatch(tr)})},exports.toggleMark=function toggleMark(markType){var attrs=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,options=arguments.length>2?arguments[2]:void 0,removeWhenPresent=!1!==(options&&options.removeWhenPresent),enterAtoms=!1!==(options&&options.enterInlineAtoms),dropSpace=!(options&&options.includeWhitespace);return function(state,dispatch){var _state$selection8=state.selection,empty=_state$selection8.empty,$cursor=_state$selection8.$cursor,ranges=_state$selection8.ranges;if(empty&&!$cursor||!function markApplies(doc,ranges,type,enterAtoms){for(var _ret,_loop=function _loop(){var _ranges$i=ranges[i],$from=_ranges$i.$from,$to=_ranges$i.$to,can=0==$from.depth&&doc.inlineContent&&doc.type.allowsMarkType(type);if(doc.nodesBetween($from.pos,$to.pos,function(node,pos){if(can||!enterAtoms&&node.isAtom&&node.isInline&&pos>=$from.pos&&pos+node.nodeSize<=$to.pos)return!1;can=node.inlineContent&&node.type.allowsMarkType(type)}),can)return{v:!0}},i=0;i<ranges.length;i++)if(_ret=_loop())return _ret.v;return!1}(state.doc,ranges,markType,enterAtoms))return!1;if(dispatch)if($cursor)markType.isInSet(state.storedMarks||$cursor.marks())?dispatch(state.tr.removeStoredMark(markType)):dispatch(state.tr.addStoredMark(markType.create(attrs)));else{var add,tr=state.tr;enterAtoms||(ranges=function removeInlineAtoms(ranges){for(var result=[],_loop2=function _loop2(){var _ranges$i2=ranges[i],$from=_ranges$i2.$from,$to=_ranges$i2.$to;$from.doc.nodesBetween($from.pos,$to.pos,function(node,pos){if(node.isAtom&&node.content.size&&node.isInline&&pos>=$from.pos&&pos+node.nodeSize<=$to.pos)return pos+1>$from.pos&&result.push(new prosemirrorState.SelectionRange($from,$from.doc.resolve(pos+1))),$from=$from.doc.resolve(pos+1+node.content.size),!1}),$from.pos<$to.pos&&result.push(new prosemirrorState.SelectionRange($from,$to))},i=0;i<ranges.length;i++)_loop2();return result}(ranges)),add=removeWhenPresent?!ranges.some(function(r){return state.doc.rangeHasMark(r.$from.pos,r.$to.pos,markType)}):!ranges.every(function(r){var missing=!1;return tr.doc.nodesBetween(r.$from.pos,r.$to.pos,function(node,pos,parent){if(missing)return!1;missing=!markType.isInSet(node.marks)&&!!parent&&parent.type.allowsMarkType(markType)&&!(node.isText&&/^\s*$/.test(node.textBetween(Math.max(0,r.$from.pos-pos),Math.min(node.nodeSize,r.$to.pos-pos))))}),!missing});for(var i=0;i<ranges.length;i++){var _ranges$i3=ranges[i],$from=_ranges$i3.$from,$to=_ranges$i3.$to;if(add){var from=$from.pos,to=$to.pos,start=$from.nodeAfter,end=$to.nodeBefore,spaceStart=dropSpace&&start&&start.isText?/^\s*/.exec(start.text)[0].length:0,spaceEnd=dropSpace&&end&&end.isText?/\s*$/.exec(end.text)[0].length:0;from+spaceStart<to&&(from+=spaceStart,to-=spaceEnd),tr.addMark(from,to,markType.create(attrs))}else tr.removeMark($from.pos,$to.pos,markType)}dispatch(tr.scrollIntoView())}return!0}},exports.wrapIn=function wrapIn(nodeType){var attrs=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(state,dispatch){var _state$selection7=state.selection,$from=_state$selection7.$from,$to=_state$selection7.$to,range=$from.blockRange($to),wrapping=range&&prosemirrorTransform.findWrapping(range,nodeType,attrs);return!!wrapping&&(dispatch&&dispatch(state.tr.wrap(range,wrapping).scrollIntoView()),!0)}}},"./node_modules/prosemirror-dropcursor/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===_typeof(key)?key:String(key)}var prosemirrorState=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs"),prosemirrorTransform=__webpack_require__("./node_modules/prosemirror-transform/dist/index.cjs");var DropCursorView=function(){function DropCursorView(editorView,options){var _a,_this=this;!function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,DropCursorView),this.editorView=editorView,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=null!==(_a=options.width)&&void 0!==_a?_a:1,this.color=!1===options.color?void 0:options.color||"black",this.class=options.class,this.handlers=["dragover","dragend","drop","dragleave"].map(function(name){var handler=function handler(e){_this[name](e)};return editorView.dom.addEventListener(name,handler),{name,handler}})}return function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}(DropCursorView,[{key:"destroy",value:function destroy(){var _this2=this;this.handlers.forEach(function(_ref){var name=_ref.name,handler=_ref.handler;return _this2.editorView.dom.removeEventListener(name,handler)})}},{key:"update",value:function update(editorView,prevState){if(null!=this.cursorPos&&prevState.doc!=editorView.state.doc)if(this.lastDragEvent){var target=this.computeTarget(this.lastDragEvent);target==this.cursorPos?this.updateOverlay():this.setCursor(target)}else this.updateOverlay()}},{key:"setCursor",value:function setCursor(pos){pos!=this.cursorPos&&(this.cursorPos=pos,null==pos?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}},{key:"updateOverlay",value:function updateOverlay(){var rect,$pos=this.editorView.state.doc.resolve(this.cursorPos),isBlock=!$pos.parent.inlineContent,editorDOM=this.editorView.dom,editorRect=editorDOM.getBoundingClientRect(),scaleX=editorRect.width/editorDOM.offsetWidth,scaleY=editorRect.height/editorDOM.offsetHeight;if(isBlock){var before=$pos.nodeBefore,after=$pos.nodeAfter;if(before||after){var node=this.editorView.nodeDOM(this.cursorPos-(before?before.nodeSize:0));if(node){var nodeRect=node.getBoundingClientRect(),top=before?nodeRect.bottom:nodeRect.top;before&&after&&(top=(top+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);var halfWidth=this.width/2*scaleY;rect={left:nodeRect.left,right:nodeRect.right,top:top-halfWidth,bottom:top+halfWidth}}}}if(!rect){var coords=this.editorView.coordsAtPos(this.cursorPos),_halfWidth=this.width/2*scaleX;rect={left:coords.left-_halfWidth,right:coords.left+_halfWidth,top:coords.top,bottom:coords.bottom}}var parentLeft,parentTop,parent=this.editorView.dom.offsetParent;if(this.element||(this.element=parent.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",isBlock),this.element.classList.toggle("prosemirror-dropcursor-inline",!isBlock),!parent||parent==document.body&&"static"==getComputedStyle(parent).position)parentLeft=-pageXOffset,parentTop=-pageYOffset;else{var _rect=parent.getBoundingClientRect(),parentScaleX=_rect.width/parent.offsetWidth,parentScaleY=_rect.height/parent.offsetHeight;parentLeft=_rect.left-parent.scrollLeft*parentScaleX,parentTop=_rect.top-parent.scrollTop*parentScaleY}this.element.style.left=(rect.left-parentLeft)/scaleX+"px",this.element.style.top=(rect.top-parentTop)/scaleY+"px",this.element.style.width=(rect.right-rect.left)/scaleX+"px",this.element.style.height=(rect.bottom-rect.top)/scaleY+"px"}},{key:"scheduleRemoval",value:function scheduleRemoval(timeout){var _this3=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return _this3.setCursor(null)},timeout)}},{key:"computeTarget",value:function computeTarget(event){var pos=this.editorView.posAtCoords({left:event.clientX,top:event.clientY}),node=pos&&pos.inside>=0&&this.editorView.state.doc.nodeAt(pos.inside),disableDropCursor=node&&node.type.spec.disableDropCursor,disabled="function"==typeof disableDropCursor?disableDropCursor(this.editorView,pos,event):disableDropCursor;if(!pos||disabled)return null;var target=pos.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){var point=prosemirrorTransform.dropPoint(this.editorView.state.doc,target,this.editorView.dragging.slice);null!=point&&(target=point)}return target}},{key:"dragover",value:function dragover(event){if(this.editorView.editable){this.lastDragEvent=event;var target=this.computeTarget(event);null!=target&&(this.setCursor(target),this.scheduleRemoval(5e3))}}},{key:"dragend",value:function dragend(){this.scheduleRemoval(20)}},{key:"drop",value:function drop(){this.scheduleRemoval(20)}},{key:"dragleave",value:function dragleave(event){this.editorView.dom.contains(event.relatedTarget)||this.setCursor(null)}}]),DropCursorView}();exports.dropCursor=function dropCursor(){var options=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new prosemirrorState.Plugin({view:function view(editorView){return new DropCursorView(editorView,options)}})}},"./node_modules/prosemirror-gapcursor/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===_typeof(key)?key:String(key)}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return function _possibleConstructorReturn(self,call){if(call&&("object"===_typeof(call)||"function"==typeof call))return call;if(void 0!==call)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}(self)}(this,result)}}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}var prosemirrorKeymap=__webpack_require__("./node_modules/prosemirror-keymap/dist/index.cjs"),prosemirrorState=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs"),prosemirrorModel=__webpack_require__("./node_modules/prosemirror-model/dist/index.cjs"),prosemirrorView=__webpack_require__("./node_modules/prosemirror-view/dist/index.cjs"),GapCursor=function(_prosemirrorState$Sel){!function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&_setPrototypeOf(subClass,superClass)}(GapCursor,_prosemirrorState$Sel);var _super=_createSuper(GapCursor);function GapCursor($pos){return _classCallCheck(this,GapCursor),_super.call(this,$pos,$pos)}return _createClass(GapCursor,[{key:"map",value:function map(doc,mapping){var $pos=doc.resolve(mapping.map(this.head));return GapCursor.valid($pos)?new GapCursor($pos):prosemirrorState.Selection.near($pos)}},{key:"content",value:function content(){return prosemirrorModel.Slice.empty}},{key:"eq",value:function eq(other){return other instanceof GapCursor&&other.head==this.head}},{key:"toJSON",value:function toJSON(){return{type:"gapcursor",pos:this.head}}},{key:"getBookmark",value:function getBookmark(){return new GapBookmark(this.anchor)}}],[{key:"fromJSON",value:function fromJSON(doc,json){if("number"!=typeof json.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new GapCursor(doc.resolve(json.pos))}},{key:"valid",value:function valid($pos){var parent=$pos.parent;if(parent.inlineContent||!function closedBefore($pos){for(var d=$pos.depth;d>=0;d--){var index=$pos.index(d),parent=$pos.node(d);if(0!=index)for(var before=parent.child(index-1);;before=before.lastChild){if(0==before.childCount&&!before.inlineContent||needsGap(before.type))return!0;if(before.inlineContent)return!1}else if(parent.type.spec.isolating)return!0}return!0}($pos)||!function closedAfter($pos){for(var d=$pos.depth;d>=0;d--){var index=$pos.indexAfter(d),parent=$pos.node(d);if(index!=parent.childCount)for(var after=parent.child(index);;after=after.firstChild){if(0==after.childCount&&!after.inlineContent||needsGap(after.type))return!0;if(after.inlineContent)return!1}else if(parent.type.spec.isolating)return!0}return!0}($pos))return!1;var override=parent.type.spec.allowGapCursor;if(null!=override)return override;var deflt=parent.contentMatchAt($pos.index()).defaultType;return deflt&&deflt.isTextblock}},{key:"findGapCursorFrom",value:function findGapCursorFrom($pos,dir){var mustMove=arguments.length>2&&void 0!==arguments[2]&&arguments[2];search:for(;;){if(!mustMove&&GapCursor.valid($pos))return $pos;for(var pos=$pos.pos,next=null,d=$pos.depth;;d--){var parent=$pos.node(d);if(dir>0?$pos.indexAfter(d)<parent.childCount:$pos.index(d)>0){next=parent.child(dir>0?$pos.indexAfter(d):$pos.index(d)-1);break}if(0==d)return null;pos+=dir;var $cur=$pos.doc.resolve(pos);if(GapCursor.valid($cur))return $cur}for(;;){var inside=dir>0?next.firstChild:next.lastChild;if(!inside){if(next.isAtom&&!next.isText&&!prosemirrorState.NodeSelection.isSelectable(next)){$pos=$pos.doc.resolve(pos+next.nodeSize*dir),mustMove=!1;continue search}break}next=inside,pos+=dir;var _$cur=$pos.doc.resolve(pos);if(GapCursor.valid(_$cur))return _$cur}return null}}}]),GapCursor}(prosemirrorState.Selection);GapCursor.prototype.visible=!1,GapCursor.findFrom=GapCursor.findGapCursorFrom,prosemirrorState.Selection.jsonID("gapcursor",GapCursor);var GapBookmark=function(){function GapBookmark(pos){_classCallCheck(this,GapBookmark),this.pos=pos}return _createClass(GapBookmark,[{key:"map",value:function map(mapping){return new GapBookmark(mapping.map(this.pos))}},{key:"resolve",value:function resolve(doc){var $pos=doc.resolve(this.pos);return GapCursor.valid($pos)?new GapCursor($pos):prosemirrorState.Selection.near($pos)}}]),GapBookmark}();function needsGap(type){return type.isAtom||type.spec.isolating||type.spec.createGapCursor}var handleKeyDown=prosemirrorKeymap.keydownHandler({ArrowLeft:arrow("horiz",-1),ArrowRight:arrow("horiz",1),ArrowUp:arrow("vert",-1),ArrowDown:arrow("vert",1)});function arrow(axis,dir){var dirStr="vert"==axis?dir>0?"down":"up":dir>0?"right":"left";return function(state,dispatch,view){var sel=state.selection,$start=dir>0?sel.$to:sel.$from,mustMove=sel.empty;if(sel instanceof prosemirrorState.TextSelection){if(!view.endOfTextblock(dirStr)||0==$start.depth)return!1;mustMove=!1,$start=state.doc.resolve(dir>0?$start.after():$start.before())}var $found=GapCursor.findGapCursorFrom($start,dir,mustMove);return!!$found&&(dispatch&&dispatch(state.tr.setSelection(new GapCursor($found))),!0)}}function handleClick(view,pos,event){if(!view||!view.editable)return!1;var $pos=view.state.doc.resolve(pos);if(!GapCursor.valid($pos))return!1;var clickPos=view.posAtCoords({left:event.clientX,top:event.clientY});return!(clickPos&&clickPos.inside>-1&&prosemirrorState.NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside)))&&(view.dispatch(view.state.tr.setSelection(new GapCursor($pos))),!0)}function beforeinput(view,event){if("insertCompositionText"!=event.inputType||!(view.state.selection instanceof GapCursor))return!1;var $from=view.state.selection.$from,insert=$from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);if(!insert)return!1;for(var frag=prosemirrorModel.Fragment.empty,i=insert.length-1;i>=0;i--)frag=prosemirrorModel.Fragment.from(insert[i].createAndFill(null,frag));var tr=view.state.tr.replace($from.pos,$from.pos,new prosemirrorModel.Slice(frag,0,0));return tr.setSelection(prosemirrorState.TextSelection.near(tr.doc.resolve($from.pos+1))),view.dispatch(tr),!1}function drawGapCursor(state){if(!(state.selection instanceof GapCursor))return null;var node=document.createElement("div");return node.className="ProseMirror-gapcursor",prosemirrorView.DecorationSet.create(state.doc,[prosemirrorView.Decoration.widget(state.selection.head,node,{key:"gapcursor"})])}exports.GapCursor=GapCursor,exports.gapCursor=function gapCursor(){return new prosemirrorState.Plugin({props:{decorations:drawGapCursor,createSelectionBetween:function createSelectionBetween(_view,$anchor,$head){return $anchor.pos==$head.pos&&GapCursor.valid($head)?new GapCursor($head):null},handleClick,handleKeyDown,handleDOMEvents:{beforeinput}}})}},"./node_modules/prosemirror-history/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===_typeof(key)?key:String(key)}var RopeSequence=__webpack_require__("./node_modules/rope-sequence/dist/index.cjs"),prosemirrorTransform=__webpack_require__("./node_modules/prosemirror-transform/dist/index.cjs"),prosemirrorState=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs"),Branch=function(){function Branch(items,eventCount){_classCallCheck(this,Branch),this.items=items,this.eventCount=eventCount}return _createClass(Branch,[{key:"popEvent",value:function popEvent(state,preserveItems){var _this=this;if(0==this.eventCount)return null;for(var remap,mapFrom,end=this.items.length;;end--){if(this.items.get(end-1).selection){--end;break}}preserveItems&&(remap=this.remapping(end,this.items.length),mapFrom=remap.maps.length);var selection,remaining,transform=state.tr,addAfter=[],addBefore=[];return this.items.forEach(function(item,i){if(!item.step)return remap||(remap=_this.remapping(end,i+1),mapFrom=remap.maps.length),mapFrom--,void addBefore.push(item);if(remap){addBefore.push(new Item(item.map));var map,step=item.step.map(remap.slice(mapFrom));step&&transform.maybeStep(step).doc&&(map=transform.mapping.maps[transform.mapping.maps.length-1],addAfter.push(new Item(map,void 0,void 0,addAfter.length+addBefore.length))),mapFrom--,map&&remap.appendMap(map,mapFrom)}else transform.maybeStep(item.step);return item.selection?(selection=remap?item.selection.map(remap.slice(mapFrom)):item.selection,remaining=new Branch(_this.items.slice(0,end).append(addBefore.reverse().concat(addAfter)),_this.eventCount-1),!1):void 0},this.items.length,0),{remaining,transform,selection}}},{key:"addTransform",value:function addTransform(transform,selection,histOptions,preserveItems){for(var newItems=[],eventCount=this.eventCount,oldItems=this.items,lastItem=!preserveItems&&oldItems.length?oldItems.get(oldItems.length-1):null,i=0;i<transform.steps.length;i++){var merged,step=transform.steps[i].invert(transform.docs[i]),item=new Item(transform.mapping.maps[i],step,selection);(merged=lastItem&&lastItem.merge(item))&&(item=merged,i?newItems.pop():oldItems=oldItems.slice(0,oldItems.length-1)),newItems.push(item),selection&&(eventCount++,selection=void 0),preserveItems||(lastItem=item)}var overflow=eventCount-histOptions.depth;return overflow>DEPTH_OVERFLOW&&(oldItems=function cutOffEvents(items,n){var cutPoint;return items.forEach(function(item,i){if(item.selection&&0==n--)return cutPoint=i,!1}),items.slice(cutPoint)}(oldItems,overflow),eventCount-=overflow),new Branch(oldItems.append(newItems),eventCount)}},{key:"remapping",value:function remapping(from,to){var maps=new prosemirrorTransform.Mapping;return this.items.forEach(function(item,i){var mirrorPos=null!=item.mirrorOffset&&i-item.mirrorOffset>=from?maps.maps.length-item.mirrorOffset:void 0;maps.appendMap(item.map,mirrorPos)},from,to),maps}},{key:"addMaps",value:function addMaps(array){return 0==this.eventCount?this:new Branch(this.items.append(array.map(function(map){return new Item(map)})),this.eventCount)}},{key:"rebased",value:function rebased(rebasedTransform,rebasedCount){if(!this.eventCount)return this;var rebasedItems=[],start=Math.max(0,this.items.length-rebasedCount),mapping=rebasedTransform.mapping,newUntil=rebasedTransform.steps.length,eventCount=this.eventCount;this.items.forEach(function(item){item.selection&&eventCount--},start);var iRebased=rebasedCount;this.items.forEach(function(item){var pos=mapping.getMirror(--iRebased);if(null!=pos){newUntil=Math.min(newUntil,pos);var map=mapping.maps[pos];if(item.step){var step=rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]),selection=item.selection&&item.selection.map(mapping.slice(iRebased+1,pos));selection&&eventCount++,rebasedItems.push(new Item(map,step,selection))}else rebasedItems.push(new Item(map))}},start);for(var newMaps=[],i=rebasedCount;i<newUntil;i++)newMaps.push(new Item(mapping.maps[i]));var branch=new Branch(this.items.slice(0,start).append(newMaps).append(rebasedItems),eventCount);return branch.emptyItemCount()>500&&(branch=branch.compress(this.items.length-rebasedItems.length)),branch}},{key:"emptyItemCount",value:function emptyItemCount(){var count=0;return this.items.forEach(function(item){item.step||count++}),count}},{key:"compress",value:function compress(){var upto=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.items.length,remap=this.remapping(0,upto),mapFrom=remap.maps.length,items=[],events=0;return this.items.forEach(function(item,i){if(i>=upto)items.push(item),item.selection&&events++;else if(item.step){var step=item.step.map(remap.slice(mapFrom)),map=step&&step.getMap();if(mapFrom--,map&&remap.appendMap(map,mapFrom),step){var selection=item.selection&&item.selection.map(remap.slice(mapFrom));selection&&events++;var merged,newItem=new Item(map.invert(),step,selection),last=items.length-1;(merged=items.length&&items[last].merge(newItem))?items[last]=merged:items.push(newItem)}}else item.map&&mapFrom--},this.items.length,0),new Branch(RopeSequence.from(items.reverse()),events)}}]),Branch}();Branch.empty=new Branch(RopeSequence.empty,0);var Item=function(){function Item(map,step,selection,mirrorOffset){_classCallCheck(this,Item),this.map=map,this.step=step,this.selection=selection,this.mirrorOffset=mirrorOffset}return _createClass(Item,[{key:"merge",value:function merge(other){if(this.step&&other.step&&!other.selection){var step=other.step.merge(this.step);if(step)return new Item(step.getMap().invert(),step,this.selection)}}}]),Item}(),HistoryState=_createClass(function HistoryState(done,undone,prevRanges,prevTime,prevComposition){_classCallCheck(this,HistoryState),this.done=done,this.undone=undone,this.prevRanges=prevRanges,this.prevTime=prevTime,this.prevComposition=prevComposition}),DEPTH_OVERFLOW=20;function rangesFor(maps){for(var result=[],i=maps.length-1;i>=0&&0==result.length;i--)maps[i].forEach(function(_from,_to,from,to){return result.push(from,to)});return result}function mapRanges(ranges,mapping){if(!ranges)return null;for(var result=[],i=0;i<ranges.length;i+=2){var from=mapping.map(ranges[i],1),to=mapping.map(ranges[i+1],-1);from<=to&&result.push(from,to)}return result}var cachedPreserveItems=!1,cachedPreserveItemsPlugins=null;function mustPreserveItems(state){var plugins=state.plugins;if(cachedPreserveItemsPlugins!=plugins){cachedPreserveItems=!1,cachedPreserveItemsPlugins=plugins;for(var i=0;i<plugins.length;i++)if(plugins[i].spec.historyPreserveItems){cachedPreserveItems=!0;break}}return cachedPreserveItems}var historyKey=new prosemirrorState.PluginKey("history"),closeHistoryKey=new prosemirrorState.PluginKey("closeHistory");function buildCommand(redo,scroll){return function(state,dispatch){var hist=historyKey.getState(state);if(!hist||0==(redo?hist.undone:hist.done).eventCount)return!1;if(dispatch){var tr=function histTransaction(history,state,redo){var preserveItems=mustPreserveItems(state),histOptions=historyKey.get(state).spec.config,pop=(redo?history.undone:history.done).popEvent(state,preserveItems);if(!pop)return null;var selection=pop.selection.resolve(pop.transform.doc),added=(redo?history.done:history.undone).addTransform(pop.transform,state.selection.getBookmark(),histOptions,preserveItems),newHist=new HistoryState(redo?added:pop.remaining,redo?pop.remaining:added,null,0,-1);return pop.transform.setSelection(selection).setMeta(historyKey,{redo,historyState:newHist})}(hist,state,redo);tr&&dispatch(scroll?tr.scrollIntoView():tr)}return!0}}var undo=buildCommand(!1,!0),redo=buildCommand(!0,!0),undoNoScroll=buildCommand(!1,!1),redoNoScroll=buildCommand(!0,!1);exports.closeHistory=function closeHistory(tr){return tr.setMeta(closeHistoryKey,!0)},exports.history=function history(){var config=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return config={depth:config.depth||100,newGroupDelay:config.newGroupDelay||500},new prosemirrorState.Plugin({key:historyKey,state:{init:function init(){return new HistoryState(Branch.empty,Branch.empty,null,0,-1)},apply:function apply(tr,hist,state){return function applyTransaction(history,state,tr,options){var rebased,historyTr=tr.getMeta(historyKey);if(historyTr)return historyTr.historyState;tr.getMeta(closeHistoryKey)&&(history=new HistoryState(history.done,history.undone,null,0,-1));var appended=tr.getMeta("appendedTransaction");if(0==tr.steps.length)return history;if(appended&&appended.getMeta(historyKey))return appended.getMeta(historyKey).redo?new HistoryState(history.done.addTransform(tr,void 0,options,mustPreserveItems(state)),history.undone,rangesFor(tr.mapping.maps),history.prevTime,history.prevComposition):new HistoryState(history.done,history.undone.addTransform(tr,void 0,options,mustPreserveItems(state)),null,history.prevTime,history.prevComposition);if(!1===tr.getMeta("addToHistory")||appended&&!1===appended.getMeta("addToHistory"))return(rebased=tr.getMeta("rebased"))?new HistoryState(history.done.rebased(tr,rebased),history.undone.rebased(tr,rebased),mapRanges(history.prevRanges,tr.mapping),history.prevTime,history.prevComposition):new HistoryState(history.done.addMaps(tr.mapping.maps),history.undone.addMaps(tr.mapping.maps),mapRanges(history.prevRanges,tr.mapping),history.prevTime,history.prevComposition);var composition=tr.getMeta("composition"),newGroup=0==history.prevTime||!appended&&history.prevComposition!=composition&&(history.prevTime<(tr.time||0)-options.newGroupDelay||!function isAdjacentTo(transform,prevRanges){if(!prevRanges)return!1;if(!transform.docChanged)return!0;var adjacent=!1;return transform.mapping.maps[0].forEach(function(start,end){for(var i=0;i<prevRanges.length;i+=2)start<=prevRanges[i+1]&&end>=prevRanges[i]&&(adjacent=!0)}),adjacent}(tr,history.prevRanges)),prevRanges=appended?mapRanges(history.prevRanges,tr.mapping):rangesFor(tr.mapping.maps);return new HistoryState(history.done.addTransform(tr,newGroup?state.selection.getBookmark():void 0,options,mustPreserveItems(state)),Branch.empty,prevRanges,tr.time,composition??history.prevComposition)}(hist,state,tr,config)}},config,props:{handleDOMEvents:{beforeinput:function beforeinput(view,e){var inputType=e.inputType,command="historyUndo"==inputType?undo:"historyRedo"==inputType?redo:null;return!(!command||!view.editable)&&(e.preventDefault(),command(view.state,view.dispatch))}}}})},exports.isHistoryTransaction=function isHistoryTransaction(tr){return null!=tr.getMeta(historyKey)},exports.redo=redo,exports.redoDepth=function redoDepth(state){var hist=historyKey.getState(state);return hist?hist.undone.eventCount:0},exports.redoNoScroll=redoNoScroll,exports.undo=undo,exports.undoDepth=function undoDepth(state){var hist=historyKey.getState(state);return hist?hist.done.eventCount:0},exports.undoNoScroll=undoNoScroll},"./node_modules/prosemirror-keymap/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";var w3cKeyname=__webpack_require__("./node_modules/w3c-keyname/index.cjs"),prosemirrorState=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs"),mac="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),windows="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function normalizeKeyName(name){var alt,ctrl,shift,meta,parts=name.split(/-(?!$)/),result=parts[parts.length-1];"Space"==result&&(result=" ");for(var i=0;i<parts.length-1;i++){var mod=parts[i];if(/^(cmd|meta|m)$/i.test(mod))meta=!0;else if(/^a(lt)?$/i.test(mod))alt=!0;else if(/^(c|ctrl|control)$/i.test(mod))ctrl=!0;else if(/^s(hift)?$/i.test(mod))shift=!0;else{if(!/^mod$/i.test(mod))throw new Error("Unrecognized modifier name: "+mod);mac?meta=!0:ctrl=!0}}return alt&&(result="Alt-"+result),ctrl&&(result="Ctrl-"+result),meta&&(result="Meta-"+result),shift&&(result="Shift-"+result),result}function modifiers(name,event){var shift=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return event.altKey&&(name="Alt-"+name),event.ctrlKey&&(name="Ctrl-"+name),event.metaKey&&(name="Meta-"+name),shift&&event.shiftKey&&(name="Shift-"+name),name}function keydownHandler(bindings){var map=function normalize(map){var copy=Object.create(null);for(var prop in map)copy[normalizeKeyName(prop)]=map[prop];return copy}(bindings);return function(view,event){var baseName,name=w3cKeyname.keyName(event),direct=map[modifiers(name,event)];if(direct&&direct(view.state,view.dispatch,view))return!0;if(1==name.length&&" "!=name){if(event.shiftKey){var noShift=map[modifiers(name,event,!1)];if(noShift&&noShift(view.state,view.dispatch,view))return!0}if((event.altKey||event.metaKey||event.ctrlKey)&&!(windows&&event.ctrlKey&&event.altKey)&&(baseName=w3cKeyname.base[event.keyCode])&&baseName!=name){var fromCode=map[modifiers(baseName,event)];if(fromCode&&fromCode(view.state,view.dispatch,view))return!0}}return!1}}exports.keydownHandler=keydownHandler,exports.keymap=function keymap(bindings){return new prosemirrorState.Plugin({props:{handleKeyDown:keydownHandler(bindings)}})}},"./node_modules/prosemirror-model/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";function _createForOfIteratorHelper(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=function _unsupportedIterableToArray(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(o))||allowArrayLike&&o&&"number"==typeof o.length){it&&(o=it);var i=0,F=function F(){};return{s:F,n:function n(){return i>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var err,normalCompletion=!0,didErr=!1;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();return normalCompletion=step.done,step},e:function e(_e2){didErr=!0,err=_e2},f:function f(){try{normalCompletion||null==it.return||it.return()}finally{if(didErr)throw err}}}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function _get(target,property,receiver){var base=function _superPropBase(object,property){for(;!Object.prototype.hasOwnProperty.call(object,property)&&null!==(object=_getPrototypeOf(object)););return object}(target,property);if(base){var desc=Object.getOwnPropertyDescriptor(base,property);return desc.get?desc.get.call(arguments.length<3?target:receiver):desc.value}},_get.apply(this,arguments)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&_setPrototypeOf(subClass,superClass)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return function _possibleConstructorReturn(self,call){if(call&&("object"===_typeof(call)||"function"==typeof call))return call;if(void 0!==call)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}(self)}(this,result)}}function _wrapNativeSuper(Class){var _cache="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function _wrapNativeSuper(Class){if(null===Class||!function _isNativeFunction(fn){try{return-1!==Function.toString.call(fn).indexOf("[native code]")}catch(e){return"function"==typeof fn}}(Class))return Class;if("function"!=typeof Class)throw new TypeError("Super expression must either be null or a function");if(void 0!==_cache){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper)}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,Class)},_wrapNativeSuper(Class)}function _construct(Parent,args,Class){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var instance=new(Function.bind.apply(Parent,a));return Class&&_setPrototypeOf(instance,Class.prototype),instance},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===_typeof(key)?key:String(key)}var OrderedMap=__webpack_require__("./node_modules/orderedmap/dist/index.cjs");function _findDiffStart(a,b,pos){for(var i=0;;i++){if(i==a.childCount||i==b.childCount)return a.childCount==b.childCount?null:pos;var childA=a.child(i),childB=b.child(i);if(childA!=childB){if(!childA.sameMarkup(childB))return pos;if(childA.isText&&childA.text!=childB.text){for(var tA=childA.text,tB=childB.text,j=0;tA[j]==tB[j];j++)pos++;return j&&j<tA.length&&j<tB.length&&surrogateHigh(tA.charCodeAt(j-1))&&surrogateLow(tA.charCodeAt(j))&&pos--,pos}if(childA.content.size||childB.content.size){var inner=_findDiffStart(childA.content,childB.content,pos+1);if(null!=inner)return inner}pos+=childA.nodeSize}else pos+=childA.nodeSize}}function _findDiffEnd(a,b,posA,posB){for(var iA=a.childCount,iB=b.childCount;;){if(0==iA||0==iB)return iA==iB?null:{a:posA,b:posB};var childA=a.child(--iA),childB=b.child(--iB),size=childA.nodeSize;if(childA!=childB){if(!childA.sameMarkup(childB))return{a:posA,b:posB};if(childA.isText&&childA.text!=childB.text){for(var tA=childA.text,tB=childB.text,_iA=tA.length,_iB=tB.length;_iA>0&&_iB>0&&tA[_iA-1]==tB[_iB-1];)_iA--,_iB--,posA--,posB--;return _iA&&_iB&&_iA<tA.length&&surrogateHigh(tA.charCodeAt(_iA-1))&&surrogateLow(tA.charCodeAt(_iA))&&(posA++,posB++),{a:posA,b:posB}}if(childA.content.size||childB.content.size){var inner=_findDiffEnd(childA.content,childB.content,posA-1,posB-1);if(inner)return inner}posA-=size,posB-=size}else posA-=size,posB-=size}}function surrogateLow(ch){return ch>=56320&&ch<57344}function surrogateHigh(ch){return ch>=55296&&ch<56320}var Fragment=function(){function Fragment(content,size){if(_classCallCheck(this,Fragment),this.content=content,this.size=size||0,null==size)for(var i=0;i<content.length;i++)this.size+=content[i].nodeSize}return _createClass(Fragment,[{key:"nodesBetween",value:function nodesBetween(from,to,f){for(var nodeStart=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,parent=arguments.length>4?arguments[4]:void 0,i=0,pos=0;pos<to;i++){var child=this.content[i],end=pos+child.nodeSize;if(end>from&&!1!==f(child,nodeStart+pos,parent||null,i)&&child.content.size){var start=pos+1;child.nodesBetween(Math.max(0,from-start),Math.min(child.content.size,to-start),f,nodeStart+start)}pos=end}}},{key:"descendants",value:function descendants(f){this.nodesBetween(0,this.size,f)}},{key:"textBetween",value:function textBetween(from,to,blockSeparator,leafText){var text="",first=!0;return this.nodesBetween(from,to,function(node,pos){var nodeText=node.isText?node.text.slice(Math.max(from,pos)-pos,to-pos):node.isLeaf?leafText?"function"==typeof leafText?leafText(node):leafText:node.type.spec.leafText?node.type.spec.leafText(node):"":"";node.isBlock&&(node.isLeaf&&nodeText||node.isTextblock)&&blockSeparator&&(first?first=!1:text+=blockSeparator),text+=nodeText},0),text}},{key:"append",value:function append(other){if(!other.size)return this;if(!this.size)return other;var last=this.lastChild,first=other.firstChild,content=this.content.slice(),i=0;for(last.isText&&last.sameMarkup(first)&&(content[content.length-1]=last.withText(last.text+first.text),i=1);i<other.content.length;i++)content.push(other.content[i]);return new Fragment(content,this.size+other.size)}},{key:"cut",value:function cut(from){var to=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==from&&to==this.size)return this;var result=[],size=0;if(to>from)for(var i=0,pos=0;pos<to;i++){var child=this.content[i],end=pos+child.nodeSize;end>from&&((pos<from||end>to)&&(child=child.isText?child.cut(Math.max(0,from-pos),Math.min(child.text.length,to-pos)):child.cut(Math.max(0,from-pos-1),Math.min(child.content.size,to-pos-1))),result.push(child),size+=child.nodeSize),pos=end}return new Fragment(result,size)}},{key:"cutByIndex",value:function cutByIndex(from,to){return from==to?Fragment.empty:0==from&&to==this.content.length?this:new Fragment(this.content.slice(from,to))}},{key:"replaceChild",value:function replaceChild(index,node){var current=this.content[index];if(current==node)return this;var copy=this.content.slice(),size=this.size+node.nodeSize-current.nodeSize;return copy[index]=node,new Fragment(copy,size)}},{key:"addToStart",value:function addToStart(node){return new Fragment([node].concat(this.content),this.size+node.nodeSize)}},{key:"addToEnd",value:function addToEnd(node){return new Fragment(this.content.concat(node),this.size+node.nodeSize)}},{key:"eq",value:function eq(other){if(this.content.length!=other.content.length)return!1;for(var i=0;i<this.content.length;i++)if(!this.content[i].eq(other.content[i]))return!1;return!0}},{key:"firstChild",get:function get(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function get(){return this.content.length?this.content[this.content.length-1]:null}},{key:"childCount",get:function get(){return this.content.length}},{key:"child",value:function child(index){var found=this.content[index];if(!found)throw new RangeError("Index "+index+" out of range for "+this);return found}},{key:"maybeChild",value:function maybeChild(index){return this.content[index]||null}},{key:"forEach",value:function forEach(f){for(var i=0,p=0;i<this.content.length;i++){var child=this.content[i];f(child,p,i),p+=child.nodeSize}}},{key:"findDiffStart",value:function findDiffStart(other){return _findDiffStart(this,other,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"findDiffEnd",value:function findDiffEnd(other){return _findDiffEnd(this,other,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,arguments.length>2&&void 0!==arguments[2]?arguments[2]:other.size)}},{key:"findIndex",value:function findIndex(pos){if(0==pos)return retIndex(0,pos);if(pos==this.size)return retIndex(this.content.length,pos);if(pos>this.size||pos<0)throw new RangeError("Position ".concat(pos," outside of fragment (").concat(this,")"));for(var i=0,curPos=0;;i++){var end=curPos+this.child(i).nodeSize;if(end>=pos)return end==pos?retIndex(i+1,end):retIndex(i,curPos);curPos=end}}},{key:"toString",value:function toString(){return"<"+this.toStringInner()+">"}},{key:"toStringInner",value:function toStringInner(){return this.content.join(", ")}},{key:"toJSON",value:function toJSON(){return this.content.length?this.content.map(function(n){return n.toJSON()}):null}}],[{key:"fromJSON",value:function fromJSON(schema,value){if(!value)return Fragment.empty;if(!Array.isArray(value))throw new RangeError("Invalid input for Fragment.fromJSON");return Fragment.fromArray(value.map(schema.nodeFromJSON))}},{key:"fromArray",value:function fromArray(array){if(!array.length)return Fragment.empty;for(var joined,size=0,i=0;i<array.length;i++){var node=array[i];size+=node.nodeSize,i&&node.isText&&array[i-1].sameMarkup(node)?(joined||(joined=array.slice(0,i)),joined[joined.length-1]=node.withText(joined[joined.length-1].text+node.text)):joined&&joined.push(node)}return new Fragment(joined||array,size)}},{key:"from",value:function from(nodes){if(!nodes)return Fragment.empty;if(nodes instanceof Fragment)return nodes;if(Array.isArray(nodes))return this.fromArray(nodes);if(nodes.attrs)return new Fragment([nodes],nodes.nodeSize);throw new RangeError("Can not convert "+nodes+" to a Fragment"+(nodes.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}]),Fragment}();Fragment.empty=new Fragment([],0);var found={index:0,offset:0};function retIndex(index,offset){return found.index=index,found.offset=offset,found}function compareDeep(a,b){if(a===b)return!0;if(!a||"object"!=_typeof(a)||!b||"object"!=_typeof(b))return!1;var array=Array.isArray(a);if(Array.isArray(b)!=array)return!1;if(array){if(a.length!=b.length)return!1;for(var i=0;i<a.length;i++)if(!compareDeep(a[i],b[i]))return!1}else{for(var p in a)if(!(p in b)||!compareDeep(a[p],b[p]))return!1;for(var _p in b)if(!(_p in a))return!1}return!0}var Mark=function(){function Mark(type,attrs){_classCallCheck(this,Mark),this.type=type,this.attrs=attrs}return _createClass(Mark,[{key:"addToSet",value:function addToSet(set){for(var copy,placed=!1,i=0;i<set.length;i++){var other=set[i];if(this.eq(other))return set;if(this.type.excludes(other.type))copy||(copy=set.slice(0,i));else{if(other.type.excludes(this.type))return set;!placed&&other.type.rank>this.type.rank&&(copy||(copy=set.slice(0,i)),copy.push(this),placed=!0),copy&&copy.push(other)}}return copy||(copy=set.slice()),placed||copy.push(this),copy}},{key:"removeFromSet",value:function removeFromSet(set){for(var i=0;i<set.length;i++)if(this.eq(set[i]))return set.slice(0,i).concat(set.slice(i+1));return set}},{key:"isInSet",value:function isInSet(set){for(var i=0;i<set.length;i++)if(this.eq(set[i]))return!0;return!1}},{key:"eq",value:function eq(other){return this==other||this.type==other.type&&compareDeep(this.attrs,other.attrs)}},{key:"toJSON",value:function toJSON(){var obj={type:this.type.name};for(var _ in this.attrs){obj.attrs=this.attrs;break}return obj}}],[{key:"fromJSON",value:function fromJSON(schema,json){if(!json)throw new RangeError("Invalid input for Mark.fromJSON");var type=schema.marks[json.type];if(!type)throw new RangeError("There is no mark type ".concat(json.type," in this schema"));var mark=type.create(json.attrs);return type.checkAttrs(mark.attrs),mark}},{key:"sameSet",value:function sameSet(a,b){if(a==b)return!0;if(a.length!=b.length)return!1;for(var i=0;i<a.length;i++)if(!a[i].eq(b[i]))return!1;return!0}},{key:"setFrom",value:function setFrom(marks){if(!marks||Array.isArray(marks)&&0==marks.length)return Mark.none;if(marks instanceof Mark)return[marks];var copy=marks.slice();return copy.sort(function(a,b){return a.type.rank-b.type.rank}),copy}}]),Mark}();Mark.none=[];var ReplaceError=function(_Error){_inherits(ReplaceError,_Error);var _super=_createSuper(ReplaceError);function ReplaceError(){return _classCallCheck(this,ReplaceError),_super.apply(this,arguments)}return _createClass(ReplaceError)}(_wrapNativeSuper(Error)),Slice=function(){function Slice(content,openStart,openEnd){_classCallCheck(this,Slice),this.content=content,this.openStart=openStart,this.openEnd=openEnd}return _createClass(Slice,[{key:"size",get:function get(){return this.content.size-this.openStart-this.openEnd}},{key:"insertAt",value:function insertAt(pos,fragment){var content=insertInto(this.content,pos+this.openStart,fragment,this.openStart+1,this.openEnd+1);return content&&new Slice(content,this.openStart,this.openEnd)}},{key:"removeBetween",value:function removeBetween(from,to){return new Slice(removeRange(this.content,from+this.openStart,to+this.openStart),this.openStart,this.openEnd)}},{key:"eq",value:function eq(other){return this.content.eq(other.content)&&this.openStart==other.openStart&&this.openEnd==other.openEnd}},{key:"toString",value:function toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}},{key:"toJSON",value:function toJSON(){if(!this.content.size)return null;var json={content:this.content.toJSON()};return this.openStart>0&&(json.openStart=this.openStart),this.openEnd>0&&(json.openEnd=this.openEnd),json}}],[{key:"fromJSON",value:function fromJSON(schema,json){if(!json)return Slice.empty;var openStart=json.openStart||0,openEnd=json.openEnd||0;if("number"!=typeof openStart||"number"!=typeof openEnd)throw new RangeError("Invalid input for Slice.fromJSON");return new Slice(Fragment.fromJSON(schema,json.content),openStart,openEnd)}},{key:"maxOpen",value:function maxOpen(fragment){for(var openIsolating=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],openStart=0,openEnd=0,n=fragment.firstChild;n&&!n.isLeaf&&(openIsolating||!n.type.spec.isolating);n=n.firstChild)openStart++;for(var _n=fragment.lastChild;_n&&!_n.isLeaf&&(openIsolating||!_n.type.spec.isolating);_n=_n.lastChild)openEnd++;return new Slice(fragment,openStart,openEnd)}}]),Slice}();function removeRange(content,from,to){var _content$findIndex=content.findIndex(from),index=_content$findIndex.index,offset=_content$findIndex.offset,child=content.maybeChild(index),_content$findIndex2=content.findIndex(to),indexTo=_content$findIndex2.index,offsetTo=_content$findIndex2.offset;if(offset==from||child.isText){if(offsetTo!=to&&!content.child(indexTo).isText)throw new RangeError("Removing non-flat range");return content.cut(0,from).append(content.cut(to))}if(index!=indexTo)throw new RangeError("Removing non-flat range");return content.replaceChild(index,child.copy(removeRange(child.content,from-offset-1,to-offset-1)))}function insertInto(content,dist,insert,openStart,openEnd,parent){var _content$findIndex3=content.findIndex(dist),index=_content$findIndex3.index,offset=_content$findIndex3.offset,child=content.maybeChild(index);if(offset==dist||child.isText)return parent&&openStart<=0&&openEnd<=0&&!parent.canReplace(index,index,insert)?null:content.cut(0,dist).append(insert).append(content.cut(dist));var inner=insertInto(child.content,dist-offset-1,insert,0==index?openStart-1:0,index==content.childCount-1?openEnd-1:0,child);return inner&&content.replaceChild(index,child.copy(inner))}function _replace($from,$to,slice){if(slice.openStart>$from.depth)throw new ReplaceError("Inserted content deeper than insertion position");if($from.depth-slice.openStart!=$to.depth-slice.openEnd)throw new ReplaceError("Inconsistent open depths");return replaceOuter($from,$to,slice,0)}function replaceOuter($from,$to,slice,depth){var index=$from.index(depth),node=$from.node(depth);if(index==$to.index(depth)&&depth<$from.depth-slice.openStart){var inner=replaceOuter($from,$to,slice,depth+1);return node.copy(node.content.replaceChild(index,inner))}if(slice.content.size){if(slice.openStart||slice.openEnd||$from.depth!=depth||$to.depth!=depth){var _prepareSliceForRepla=function prepareSliceForReplace(slice,$along){for(var extra=$along.depth-slice.openStart,node=$along.node(extra).copy(slice.content),i=extra-1;i>=0;i--)node=$along.node(i).copy(Fragment.from(node));return{start:node.resolveNoCache(slice.openStart+extra),end:node.resolveNoCache(node.content.size-slice.openEnd-extra)}}(slice,$from);return close(node,replaceThreeWay($from,_prepareSliceForRepla.start,_prepareSliceForRepla.end,$to,depth))}var parent=$from.parent,content=parent.content;return close(parent,content.cut(0,$from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)))}return close(node,replaceTwoWay($from,$to,depth))}function checkJoin(main,sub){if(!sub.type.compatibleContent(main.type))throw new ReplaceError("Cannot join "+sub.type.name+" onto "+main.type.name)}function joinable($before,$after,depth){var node=$before.node(depth);return checkJoin(node,$after.node(depth)),node}function addNode(child,target){var last=target.length-1;last>=0&&child.isText&&child.sameMarkup(target[last])?target[last]=child.withText(target[last].text+child.text):target.push(child)}function addRange($start,$end,depth,target){var node=($end||$start).node(depth),startIndex=0,endIndex=$end?$end.index(depth):node.childCount;$start&&(startIndex=$start.index(depth),$start.depth>depth?startIndex++:$start.textOffset&&(addNode($start.nodeAfter,target),startIndex++));for(var i=startIndex;i<endIndex;i++)addNode(node.child(i),target);$end&&$end.depth==depth&&$end.textOffset&&addNode($end.nodeBefore,target)}function close(node,content){if(!node.type.validContent(content))throw new ReplaceError("Invalid content for node "+node.type.name);return node.copy(content)}function replaceThreeWay($from,$start,$end,$to,depth){var openStart=$from.depth>depth&&joinable($from,$start,depth+1),openEnd=$to.depth>depth&&joinable($end,$to,depth+1),content=[];return addRange(null,$from,depth,content),openStart&&openEnd&&$start.index(depth)==$end.index(depth)?(checkJoin(openStart,openEnd),addNode(close(openStart,replaceThreeWay($from,$start,$end,$to,depth+1)),content)):(openStart&&addNode(close(openStart,replaceTwoWay($from,$start,depth+1)),content),addRange($start,$end,depth,content),openEnd&&addNode(close(openEnd,replaceTwoWay($end,$to,depth+1)),content)),addRange($to,null,depth,content),new Fragment(content)}function replaceTwoWay($from,$to,depth){var content=[];(addRange(null,$from,depth,content),$from.depth>depth)&&addNode(close(joinable($from,$to,depth+1),replaceTwoWay($from,$to,depth+1)),content);return addRange($to,null,depth,content),new Fragment(content)}Slice.empty=new Slice(Fragment.empty,0,0);var ResolvedPos=function(){function ResolvedPos(pos,path,parentOffset){_classCallCheck(this,ResolvedPos),this.pos=pos,this.path=path,this.parentOffset=parentOffset,this.depth=path.length/3-1}return _createClass(ResolvedPos,[{key:"resolveDepth",value:function resolveDepth(val){return null==val?this.depth:val<0?this.depth+val:val}},{key:"parent",get:function get(){return this.node(this.depth)}},{key:"doc",get:function get(){return this.node(0)}},{key:"node",value:function node(depth){return this.path[3*this.resolveDepth(depth)]}},{key:"index",value:function index(depth){return this.path[3*this.resolveDepth(depth)+1]}},{key:"indexAfter",value:function indexAfter(depth){return depth=this.resolveDepth(depth),this.index(depth)+(depth!=this.depth||this.textOffset?1:0)}},{key:"start",value:function start(depth){return 0==(depth=this.resolveDepth(depth))?0:this.path[3*depth-1]+1}},{key:"end",value:function end(depth){return depth=this.resolveDepth(depth),this.start(depth)+this.node(depth).content.size}},{key:"before",value:function before(depth){if(!(depth=this.resolveDepth(depth)))throw new RangeError("There is no position before the top-level node");return depth==this.depth+1?this.pos:this.path[3*depth-1]}},{key:"after",value:function after(depth){if(!(depth=this.resolveDepth(depth)))throw new RangeError("There is no position after the top-level node");return depth==this.depth+1?this.pos:this.path[3*depth-1]+this.path[3*depth].nodeSize}},{key:"textOffset",get:function get(){return this.pos-this.path[this.path.length-1]}},{key:"nodeAfter",get:function get(){var parent=this.parent,index=this.index(this.depth);if(index==parent.childCount)return null;var dOff=this.pos-this.path[this.path.length-1],child=parent.child(index);return dOff?parent.child(index).cut(dOff):child}},{key:"nodeBefore",get:function get(){var index=this.index(this.depth),dOff=this.pos-this.path[this.path.length-1];return dOff?this.parent.child(index).cut(0,dOff):0==index?null:this.parent.child(index-1)}},{key:"posAtIndex",value:function posAtIndex(index,depth){depth=this.resolveDepth(depth);for(var node=this.path[3*depth],pos=0==depth?0:this.path[3*depth-1]+1,i=0;i<index;i++)pos+=node.child(i).nodeSize;return pos}},{key:"marks",value:function marks(){var parent=this.parent,index=this.index();if(0==parent.content.size)return Mark.none;if(this.textOffset)return parent.child(index).marks;var main=parent.maybeChild(index-1),other=parent.maybeChild(index);if(!main){var tmp=main;main=other,other=tmp}for(var marks=main.marks,i=0;i<marks.length;i++)!1!==marks[i].type.spec.inclusive||other&&marks[i].isInSet(other.marks)||(marks=marks[i--].removeFromSet(marks));return marks}},{key:"marksAcross",value:function marksAcross($end){var after=this.parent.maybeChild(this.index());if(!after||!after.isInline)return null;for(var marks=after.marks,next=$end.parent.maybeChild($end.index()),i=0;i<marks.length;i++)!1!==marks[i].type.spec.inclusive||next&&marks[i].isInSet(next.marks)||(marks=marks[i--].removeFromSet(marks));return marks}},{key:"sharedDepth",value:function sharedDepth(pos){for(var depth=this.depth;depth>0;depth--)if(this.start(depth)<=pos&&this.end(depth)>=pos)return depth;return 0}},{key:"blockRange",value:function blockRange(){var other=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,pred=arguments.length>1?arguments[1]:void 0;if(other.pos<this.pos)return other.blockRange(this);for(var d=this.depth-(this.parent.inlineContent||this.pos==other.pos?1:0);d>=0;d--)if(other.pos<=this.end(d)&&(!pred||pred(this.node(d))))return new NodeRange(this,other,d);return null}},{key:"sameParent",value:function sameParent(other){return this.pos-this.parentOffset==other.pos-other.parentOffset}},{key:"max",value:function max(other){return other.pos>this.pos?other:this}},{key:"min",value:function min(other){return other.pos<this.pos?other:this}},{key:"toString",value:function toString(){for(var str="",i=1;i<=this.depth;i++)str+=(str?"/":"")+this.node(i).type.name+"_"+this.index(i-1);return str+":"+this.parentOffset}}],[{key:"resolve",value:function resolve(doc,pos){if(!(pos>=0&&pos<=doc.content.size))throw new RangeError("Position "+pos+" out of range");for(var path=[],start=0,parentOffset=pos,node=doc;;){var _node$content$findInd=node.content.findIndex(parentOffset),index=_node$content$findInd.index,offset=_node$content$findInd.offset,rem=parentOffset-offset;if(path.push(node,index,start+offset),!rem)break;if((node=node.child(index)).isText)break;parentOffset=rem-1,start+=offset+1}return new ResolvedPos(pos,path,parentOffset)}},{key:"resolveCached",value:function resolveCached(doc,pos){var cache=resolveCache.get(doc);if(cache)for(var i=0;i<cache.elts.length;i++){var elt=cache.elts[i];if(elt.pos==pos)return elt}else resolveCache.set(doc,cache=new ResolveCache);var result=cache.elts[cache.i]=ResolvedPos.resolve(doc,pos);return cache.i=(cache.i+1)%resolveCacheSize,result}}]),ResolvedPos}(),ResolveCache=_createClass(function ResolveCache(){_classCallCheck(this,ResolveCache),this.elts=[],this.i=0}),resolveCacheSize=12,resolveCache=new WeakMap,NodeRange=function(){function NodeRange($from,$to,depth){_classCallCheck(this,NodeRange),this.$from=$from,this.$to=$to,this.depth=depth}return _createClass(NodeRange,[{key:"start",get:function get(){return this.$from.before(this.depth+1)}},{key:"end",get:function get(){return this.$to.after(this.depth+1)}},{key:"parent",get:function get(){return this.$from.node(this.depth)}},{key:"startIndex",get:function get(){return this.$from.index(this.depth)}},{key:"endIndex",get:function get(){return this.$to.indexAfter(this.depth)}}]),NodeRange}(),emptyAttrs=Object.create(null),Node=function(){function Node(type,attrs,content){var marks=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Mark.none;_classCallCheck(this,Node),this.type=type,this.attrs=attrs,this.marks=marks,this.content=content||Fragment.empty}return _createClass(Node,[{key:"children",get:function get(){return this.content.content}},{key:"nodeSize",get:function get(){return this.isLeaf?1:2+this.content.size}},{key:"childCount",get:function get(){return this.content.childCount}},{key:"child",value:function child(index){return this.content.child(index)}},{key:"maybeChild",value:function maybeChild(index){return this.content.maybeChild(index)}},{key:"forEach",value:function forEach(f){this.content.forEach(f)}},{key:"nodesBetween",value:function nodesBetween(from,to,f){var startPos=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(from,to,f,startPos,this)}},{key:"descendants",value:function descendants(f){this.nodesBetween(0,this.content.size,f)}},{key:"textContent",get:function get(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}},{key:"textBetween",value:function textBetween(from,to,blockSeparator,leafText){return this.content.textBetween(from,to,blockSeparator,leafText)}},{key:"firstChild",get:function get(){return this.content.firstChild}},{key:"lastChild",get:function get(){return this.content.lastChild}},{key:"eq",value:function eq(other){return this==other||this.sameMarkup(other)&&this.content.eq(other.content)}},{key:"sameMarkup",value:function sameMarkup(other){return this.hasMarkup(other.type,other.attrs,other.marks)}},{key:"hasMarkup",value:function hasMarkup(type,attrs,marks){return this.type==type&&compareDeep(this.attrs,attrs||type.defaultAttrs||emptyAttrs)&&Mark.sameSet(this.marks,marks||Mark.none)}},{key:"copy",value:function copy(){var content=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return content==this.content?this:new Node(this.type,this.attrs,content,this.marks)}},{key:"mark",value:function mark(marks){return marks==this.marks?this:new Node(this.type,this.attrs,this.content,marks)}},{key:"cut",value:function cut(from){var to=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==from&&to==this.content.size?this:this.copy(this.content.cut(from,to))}},{key:"slice",value:function slice(from){var to=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,includeParents=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(from==to)return Slice.empty;var $from=this.resolve(from),$to=this.resolve(to),depth=includeParents?0:$from.sharedDepth(to),start=$from.start(depth),content=$from.node(depth).content.cut($from.pos-start,$to.pos-start);return new Slice(content,$from.depth-depth,$to.depth-depth)}},{key:"replace",value:function replace(from,to,slice){return _replace(this.resolve(from),this.resolve(to),slice)}},{key:"nodeAt",value:function nodeAt(pos){for(var node=this;;){var _node$content$findInd2=node.content.findIndex(pos),index=_node$content$findInd2.index,offset=_node$content$findInd2.offset;if(!(node=node.maybeChild(index)))return null;if(offset==pos||node.isText)return node;pos-=offset+1}}},{key:"childAfter",value:function childAfter(pos){var _this$content$findInd=this.content.findIndex(pos),index=_this$content$findInd.index,offset=_this$content$findInd.offset;return{node:this.content.maybeChild(index),index,offset}}},{key:"childBefore",value:function childBefore(pos){if(0==pos)return{node:null,index:0,offset:0};var _this$content$findInd2=this.content.findIndex(pos),index=_this$content$findInd2.index,offset=_this$content$findInd2.offset;if(offset<pos)return{node:this.content.child(index),index,offset};var node=this.content.child(index-1);return{node,index:index-1,offset:offset-node.nodeSize}}},{key:"resolve",value:function resolve(pos){return ResolvedPos.resolveCached(this,pos)}},{key:"resolveNoCache",value:function resolveNoCache(pos){return ResolvedPos.resolve(this,pos)}},{key:"rangeHasMark",value:function rangeHasMark(from,to,type){var found=!1;return to>from&&this.nodesBetween(from,to,function(node){return type.isInSet(node.marks)&&(found=!0),!found}),found}},{key:"isBlock",get:function get(){return this.type.isBlock}},{key:"isTextblock",get:function get(){return this.type.isTextblock}},{key:"inlineContent",get:function get(){return this.type.inlineContent}},{key:"isInline",get:function get(){return this.type.isInline}},{key:"isText",get:function get(){return this.type.isText}},{key:"isLeaf",get:function get(){return this.type.isLeaf}},{key:"isAtom",get:function get(){return this.type.isAtom}},{key:"toString",value:function toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var name=this.type.name;return this.content.size&&(name+="("+this.content.toStringInner()+")"),wrapMarks(this.marks,name)}},{key:"contentMatchAt",value:function contentMatchAt(index){var match=this.type.contentMatch.matchFragment(this.content,0,index);if(!match)throw new Error("Called contentMatchAt on a node with invalid content");return match}},{key:"canReplace",value:function canReplace(from,to){var replacement=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Fragment.empty,start=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,end=arguments.length>4&&void 0!==arguments[4]?arguments[4]:replacement.childCount,one=this.contentMatchAt(from).matchFragment(replacement,start,end),two=one&&one.matchFragment(this.content,to);if(!two||!two.validEnd)return!1;for(var i=start;i<end;i++)if(!this.type.allowsMarks(replacement.child(i).marks))return!1;return!0}},{key:"canReplaceWith",value:function canReplaceWith(from,to,type,marks){if(marks&&!this.type.allowsMarks(marks))return!1;var start=this.contentMatchAt(from).matchType(type),end=start&&start.matchFragment(this.content,to);return!!end&&end.validEnd}},{key:"canAppend",value:function canAppend(other){return other.content.size?this.canReplace(this.childCount,this.childCount,other.content):this.type.compatibleContent(other.type)}},{key:"check",value:function check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);for(var copy=Mark.none,i=0;i<this.marks.length;i++){var mark=this.marks[i];mark.type.checkAttrs(mark.attrs),copy=mark.addToSet(copy)}if(!Mark.sameSet(copy,this.marks))throw new RangeError("Invalid collection of marks for node ".concat(this.type.name,": ").concat(this.marks.map(function(m){return m.type.name})));this.content.forEach(function(node){return node.check()})}},{key:"toJSON",value:function toJSON(){var obj={type:this.type.name};for(var _ in this.attrs){obj.attrs=this.attrs;break}return this.content.size&&(obj.content=this.content.toJSON()),this.marks.length&&(obj.marks=this.marks.map(function(n){return n.toJSON()})),obj}}],[{key:"fromJSON",value:function fromJSON(schema,json){if(!json)throw new RangeError("Invalid input for Node.fromJSON");var marks=void 0;if(json.marks){if(!Array.isArray(json.marks))throw new RangeError("Invalid mark data for Node.fromJSON");marks=json.marks.map(schema.markFromJSON)}if("text"==json.type){if("string"!=typeof json.text)throw new RangeError("Invalid text node in JSON");return schema.text(json.text,marks)}var content=Fragment.fromJSON(schema,json.content),node=schema.nodeType(json.type).create(json.attrs,content,marks);return node.type.checkAttrs(node.attrs),node}}]),Node}();Node.prototype.text=void 0;var TextNode=function(_Node){_inherits(TextNode,_Node);var _super2=_createSuper(TextNode);function TextNode(type,attrs,content,marks){var _this;if(_classCallCheck(this,TextNode),_this=_super2.call(this,type,attrs,null,marks),!content)throw new RangeError("Empty text nodes are not allowed");return _this.text=content,_this}return _createClass(TextNode,[{key:"toString",value:function toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wrapMarks(this.marks,JSON.stringify(this.text))}},{key:"textContent",get:function get(){return this.text}},{key:"textBetween",value:function textBetween(from,to){return this.text.slice(from,to)}},{key:"nodeSize",get:function get(){return this.text.length}},{key:"mark",value:function mark(marks){return marks==this.marks?this:new TextNode(this.type,this.attrs,this.text,marks)}},{key:"withText",value:function withText(text){return text==this.text?this:new TextNode(this.type,this.attrs,text,this.marks)}},{key:"cut",value:function cut(){var from=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,to=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==from&&to==this.text.length?this:this.withText(this.text.slice(from,to))}},{key:"eq",value:function eq(other){return this.sameMarkup(other)&&this.text==other.text}},{key:"toJSON",value:function toJSON(){var base=_get(_getPrototypeOf(TextNode.prototype),"toJSON",this).call(this);return base.text=this.text,base}}]),TextNode}(Node);function wrapMarks(marks,str){for(var i=marks.length-1;i>=0;i--)str=marks[i].type.name+"("+str+")";return str}var ContentMatch=function(){function ContentMatch(validEnd){_classCallCheck(this,ContentMatch),this.validEnd=validEnd,this.next=[],this.wrapCache=[]}return _createClass(ContentMatch,[{key:"matchType",value:function matchType(type){for(var i=0;i<this.next.length;i++)if(this.next[i].type==type)return this.next[i].next;return null}},{key:"matchFragment",value:function matchFragment(frag){for(var start=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,end=arguments.length>2&&void 0!==arguments[2]?arguments[2]:frag.childCount,cur=this,i=start;cur&&i<end;i++)cur=cur.matchType(frag.child(i).type);return cur}},{key:"inlineContent",get:function get(){return 0!=this.next.length&&this.next[0].type.isInline}},{key:"defaultType",get:function get(){for(var i=0;i<this.next.length;i++){var type=this.next[i].type;if(!type.isText&&!type.hasRequiredAttrs())return type}return null}},{key:"compatible",value:function compatible(other){for(var i=0;i<this.next.length;i++)for(var j=0;j<other.next.length;j++)if(this.next[i].type==other.next[j].type)return!0;return!1}},{key:"fillBefore",value:function fillBefore(after){var toEnd=arguments.length>1&&void 0!==arguments[1]&&arguments[1],startIndex=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,seen=[this];return function search(match,types){var finished=match.matchFragment(after,startIndex);if(finished&&(!toEnd||finished.validEnd))return Fragment.from(types.map(function(tp){return tp.createAndFill()}));for(var i=0;i<match.next.length;i++){var _match$next$i=match.next[i],type=_match$next$i.type,next=_match$next$i.next;if(!type.isText&&!type.hasRequiredAttrs()&&-1==seen.indexOf(next)){seen.push(next);var _found=search(next,types.concat(type));if(_found)return _found}}return null}(this,[])}},{key:"findWrapping",value:function findWrapping(target){for(var i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==target)return this.wrapCache[i+1];var computed=this.computeWrapping(target);return this.wrapCache.push(target,computed),computed}},{key:"computeWrapping",value:function computeWrapping(target){for(var seen=Object.create(null),active=[{match:this,type:null,via:null}];active.length;){var current=active.shift(),match=current.match;if(match.matchType(target)){for(var result=[],obj=current;obj.type;obj=obj.via)result.push(obj.type);return result.reverse()}for(var i=0;i<match.next.length;i++){var _match$next$i2=match.next[i],type=_match$next$i2.type,next=_match$next$i2.next;type.isLeaf||type.hasRequiredAttrs()||type.name in seen||current.type&&!next.validEnd||(active.push({match:type.contentMatch,type,via:current}),seen[type.name]=!0)}}return null}},{key:"edgeCount",get:function get(){return this.next.length}},{key:"edge",value:function edge(n){if(n>=this.next.length)throw new RangeError("There's no ".concat(n,"th edge in this content match"));return this.next[n]}},{key:"toString",value:function toString(){var seen=[];return function scan(m){seen.push(m);for(var i=0;i<m.next.length;i++)-1==seen.indexOf(m.next[i].next)&&scan(m.next[i].next)}(this),seen.map(function(m,i){for(var out=i+(m.validEnd?"*":" ")+" ",_i=0;_i<m.next.length;_i++)out+=(_i?", ":"")+m.next[_i].type.name+"->"+seen.indexOf(m.next[_i].next);return out}).join("\n")}}],[{key:"parse",value:function parse(string,nodeTypes){var stream=new TokenStream(string,nodeTypes);if(null==stream.next)return ContentMatch.empty;var expr=parseExpr(stream);stream.next&&stream.err("Unexpected trailing text");var match=dfa(function nfa(expr){var nfa=[[]];return connect(compile(expr,0),node()),nfa;function node(){return nfa.push([])-1}function edge(from,to,term){var edge={term,to};return nfa[from].push(edge),edge}function connect(edges,to){edges.forEach(function(edge){return edge.to=to})}function compile(expr,from){if("choice"==expr.type)return expr.exprs.reduce(function(out,expr){return out.concat(compile(expr,from))},[]);if("seq"!=expr.type){if("star"==expr.type){var loop=node();return edge(from,loop),connect(compile(expr.expr,loop),loop),[edge(loop)]}if("plus"==expr.type){var _loop=node();return connect(compile(expr.expr,from),_loop),connect(compile(expr.expr,_loop),_loop),[edge(_loop)]}if("opt"==expr.type)return[edge(from)].concat(compile(expr.expr,from));if("range"==expr.type){for(var cur=from,_i2=0;_i2<expr.min;_i2++){var _next=node();connect(compile(expr.expr,cur),_next),cur=_next}if(-1==expr.max)connect(compile(expr.expr,cur),cur);else for(var _i3=expr.min;_i3<expr.max;_i3++){var _next2=node();edge(cur,_next2),connect(compile(expr.expr,cur),_next2),cur=_next2}return[edge(cur)]}if("name"==expr.type)return[edge(from,void 0,expr.value)];throw new Error("Unknown expr type")}for(var i=0;;i++){var next=compile(expr.exprs[i],from);if(i==expr.exprs.length-1)return next;connect(next,from=node())}}}(expr));return function checkForDeadEnds(match,stream){for(var i=0,work=[match];i<work.length;i++){for(var state=work[i],dead=!state.validEnd,nodes=[],j=0;j<state.next.length;j++){var _state$next$j=state.next[j],type=_state$next$j.type,next=_state$next$j.next;nodes.push(type.name),!dead||type.isText||type.hasRequiredAttrs()||(dead=!1),-1==work.indexOf(next)&&work.push(next)}dead&&stream.err("Only non-generatable nodes ("+nodes.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(match,stream),match}}]),ContentMatch}();ContentMatch.empty=new ContentMatch(!0);var TokenStream=function(){function TokenStream(string,nodeTypes){_classCallCheck(this,TokenStream),this.string=string,this.nodeTypes=nodeTypes,this.inline=null,this.pos=0,this.tokens=string.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}return _createClass(TokenStream,[{key:"next",get:function get(){return this.tokens[this.pos]}},{key:"eat",value:function eat(tok){return this.next==tok&&(this.pos++||!0)}},{key:"err",value:function err(str){throw new SyntaxError(str+" (in content expression '"+this.string+"')")}}]),TokenStream}();function parseExpr(stream){var exprs=[];do{exprs.push(parseExprSeq(stream))}while(stream.eat("|"));return 1==exprs.length?exprs[0]:{type:"choice",exprs}}function parseExprSeq(stream){var exprs=[];do{exprs.push(parseExprSubscript(stream))}while(stream.next&&")"!=stream.next&&"|"!=stream.next);return 1==exprs.length?exprs[0]:{type:"seq",exprs}}function parseExprSubscript(stream){for(var expr=function parseExprAtom(stream){if(stream.eat("(")){var expr=parseExpr(stream);return stream.eat(")")||stream.err("Missing closing paren"),expr}if(!/\W/.test(stream.next)){var exprs=function resolveName(stream,name){var types=stream.nodeTypes,type=types[name];if(type)return[type];var result=[];for(var typeName in types){var _type=types[typeName];_type.isInGroup(name)&&result.push(_type)}0==result.length&&stream.err("No node type or group '"+name+"' found");return result}(stream,stream.next).map(function(type){return null==stream.inline?stream.inline=type.isInline:stream.inline!=type.isInline&&stream.err("Mixing inline and block content"),{type:"name",value:type}});return stream.pos++,1==exprs.length?exprs[0]:{type:"choice",exprs}}stream.err("Unexpected token '"+stream.next+"'")}(stream);;)if(stream.eat("+"))expr={type:"plus",expr};else if(stream.eat("*"))expr={type:"star",expr};else if(stream.eat("?"))expr={type:"opt",expr};else{if(!stream.eat("{"))break;expr=parseExprRange(stream,expr)}return expr}function parseNum(stream){/\D/.test(stream.next)&&stream.err("Expected number, got '"+stream.next+"'");var result=Number(stream.next);return stream.pos++,result}function parseExprRange(stream,expr){var min=parseNum(stream),max=min;return stream.eat(",")&&(max="}"!=stream.next?parseNum(stream):-1),stream.eat("}")||stream.err("Unclosed braced range"),{type:"range",min,max,expr}}function cmp(a,b){return b-a}function nullFrom(nfa,node){var result=[];return function scan(node){var edges=nfa[node];if(1==edges.length&&!edges[0].term)return scan(edges[0].to);result.push(node);for(var i=0;i<edges.length;i++){var _edges$i=edges[i],term=_edges$i.term,to=_edges$i.to;term||-1!=result.indexOf(to)||scan(to)}}(node),result.sort(cmp)}function dfa(nfa){var labeled=Object.create(null);return function explore(states){var out=[];states.forEach(function(node){nfa[node].forEach(function(_ref){var term=_ref.term,to=_ref.to;if(term){for(var set,i=0;i<out.length;i++)out[i][0]==term&&(set=out[i][1]);nullFrom(nfa,to).forEach(function(node){set||out.push([term,set=[]]),-1==set.indexOf(node)&&set.push(node)})}})});for(var state=labeled[states.join(",")]=new ContentMatch(states.indexOf(nfa.length-1)>-1),i=0;i<out.length;i++){var _states=out[i][1].sort(cmp);state.next.push({type:out[i][0],next:labeled[_states.join(",")]||explore(_states)})}return state}(nullFrom(nfa,0))}function defaultAttrs(attrs){var defaults=Object.create(null);for(var attrName in attrs){var attr=attrs[attrName];if(!attr.hasDefault)return null;defaults[attrName]=attr.default}return defaults}function _computeAttrs(attrs,value){var built=Object.create(null);for(var name in attrs){var given=value&&value[name];if(void 0===given){var attr=attrs[name];if(!attr.hasDefault)throw new RangeError("No value supplied for attribute "+name);given=attr.default}built[name]=given}return built}function _checkAttrs(attrs,values,type,name){for(var attr in values)if(!(attr in attrs))throw new RangeError("Unsupported attribute ".concat(attr," for ").concat(type," of type ").concat(name));for(var _attr in attrs)attrs[_attr].validate&&attrs[_attr].validate(values[_attr])}function initAttrs(typeName,attrs){var result=Object.create(null);if(attrs)for(var name in attrs)result[name]=new Attribute(typeName,name,attrs[name]);return result}var NodeType=function(){function NodeType(name,schema,spec){_classCallCheck(this,NodeType),this.name=name,this.schema=schema,this.spec=spec,this.markSet=null,this.groups=spec.group?spec.group.split(" "):[],this.attrs=initAttrs(name,spec.attrs),this.defaultAttrs=defaultAttrs(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(spec.inline||"text"==name),this.isText="text"==name}return _createClass(NodeType,[{key:"isInline",get:function get(){return!this.isBlock}},{key:"isTextblock",get:function get(){return this.isBlock&&this.inlineContent}},{key:"isLeaf",get:function get(){return this.contentMatch==ContentMatch.empty}},{key:"isAtom",get:function get(){return this.isLeaf||!!this.spec.atom}},{key:"isInGroup",value:function isInGroup(group){return this.groups.indexOf(group)>-1}},{key:"whitespace",get:function get(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}},{key:"hasRequiredAttrs",value:function hasRequiredAttrs(){for(var n in this.attrs)if(this.attrs[n].isRequired)return!0;return!1}},{key:"compatibleContent",value:function compatibleContent(other){return this==other||this.contentMatch.compatible(other.contentMatch)}},{key:"computeAttrs",value:function computeAttrs(attrs){return!attrs&&this.defaultAttrs?this.defaultAttrs:_computeAttrs(this.attrs,attrs)}},{key:"create",value:function create(){var attrs=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,content=arguments.length>1?arguments[1]:void 0,marks=arguments.length>2?arguments[2]:void 0;if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Node(this,this.computeAttrs(attrs),Fragment.from(content),Mark.setFrom(marks))}},{key:"createChecked",value:function createChecked(){var attrs=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,content=arguments.length>1?arguments[1]:void 0,marks=arguments.length>2?arguments[2]:void 0;return content=Fragment.from(content),this.checkContent(content),new Node(this,this.computeAttrs(attrs),content,Mark.setFrom(marks))}},{key:"createAndFill",value:function createAndFill(){var attrs=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,content=arguments.length>1?arguments[1]:void 0,marks=arguments.length>2?arguments[2]:void 0;if(attrs=this.computeAttrs(attrs),(content=Fragment.from(content)).size){var before=this.contentMatch.fillBefore(content);if(!before)return null;content=before.append(content)}var matched=this.contentMatch.matchFragment(content),after=matched&&matched.fillBefore(Fragment.empty,!0);return after?new Node(this,attrs,content.append(after),Mark.setFrom(marks)):null}},{key:"validContent",value:function validContent(content){var result=this.contentMatch.matchFragment(content);if(!result||!result.validEnd)return!1;for(var i=0;i<content.childCount;i++)if(!this.allowsMarks(content.child(i).marks))return!1;return!0}},{key:"checkContent",value:function checkContent(content){if(!this.validContent(content))throw new RangeError("Invalid content for node ".concat(this.name,": ").concat(content.toString().slice(0,50)))}},{key:"checkAttrs",value:function checkAttrs(attrs){_checkAttrs(this.attrs,attrs,"node",this.name)}},{key:"allowsMarkType",value:function allowsMarkType(markType){return null==this.markSet||this.markSet.indexOf(markType)>-1}},{key:"allowsMarks",value:function allowsMarks(marks){if(null==this.markSet)return!0;for(var i=0;i<marks.length;i++)if(!this.allowsMarkType(marks[i].type))return!1;return!0}},{key:"allowedMarks",value:function allowedMarks(marks){if(null==this.markSet)return marks;for(var copy,i=0;i<marks.length;i++)this.allowsMarkType(marks[i].type)?copy&&copy.push(marks[i]):copy||(copy=marks.slice(0,i));return copy?copy.length?copy:Mark.none:marks}}],[{key:"compile",value:function compile(nodes,schema){var result=Object.create(null);nodes.forEach(function(name,spec){return result[name]=new NodeType(name,schema,spec)});var topType=schema.spec.topNode||"doc";if(!result[topType])throw new RangeError("Schema is missing its top node type ('"+topType+"')");if(!result.text)throw new RangeError("Every schema needs a 'text' type");for(var _ in result.text.attrs)throw new RangeError("The text node type should not have attributes");return result}}]),NodeType}();var Attribute=function(){function Attribute(typeName,attrName,options){_classCallCheck(this,Attribute),this.hasDefault=Object.prototype.hasOwnProperty.call(options,"default"),this.default=options.default,this.validate="string"==typeof options.validate?function validateType(typeName,attrName,type){var types=type.split("|");return function(value){var name=null===value?"null":_typeof(value);if(types.indexOf(name)<0)throw new RangeError("Expected value of type ".concat(types," for attribute ").concat(attrName," on type ").concat(typeName,", got ").concat(name))}}(typeName,attrName,options.validate):options.validate}return _createClass(Attribute,[{key:"isRequired",get:function get(){return!this.hasDefault}}]),Attribute}(),MarkType=function(){function MarkType(name,rank,schema,spec){_classCallCheck(this,MarkType),this.name=name,this.rank=rank,this.schema=schema,this.spec=spec,this.attrs=initAttrs(name,spec.attrs),this.excluded=null;var defaults=defaultAttrs(this.attrs);this.instance=defaults?new Mark(this,defaults):null}return _createClass(MarkType,[{key:"create",value:function create(){var attrs=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!attrs&&this.instance?this.instance:new Mark(this,_computeAttrs(this.attrs,attrs))}},{key:"removeFromSet",value:function removeFromSet(set){for(var i=0;i<set.length;i++)set[i].type==this&&(set=set.slice(0,i).concat(set.slice(i+1)),i--);return set}},{key:"isInSet",value:function isInSet(set){for(var i=0;i<set.length;i++)if(set[i].type==this)return set[i]}},{key:"checkAttrs",value:function checkAttrs(attrs){_checkAttrs(this.attrs,attrs,"mark",this.name)}},{key:"excludes",value:function excludes(other){return this.excluded.indexOf(other)>-1}}],[{key:"compile",value:function compile(marks,schema){var result=Object.create(null),rank=0;return marks.forEach(function(name,spec){return result[name]=new MarkType(name,rank++,schema,spec)}),result}}]),MarkType}(),Schema=function(){function Schema(spec){var _this2=this;_classCallCheck(this,Schema),this.linebreakReplacement=null,this.cached=Object.create(null);var instanceSpec=this.spec={};for(var prop in spec)instanceSpec[prop]=spec[prop];instanceSpec.nodes=OrderedMap.from(spec.nodes),instanceSpec.marks=OrderedMap.from(spec.marks||{}),this.nodes=NodeType.compile(this.spec.nodes,this),this.marks=MarkType.compile(this.spec.marks,this);var contentExprCache=Object.create(null);for(var _prop in this.nodes){if(_prop in this.marks)throw new RangeError(_prop+" can not be both a node and a mark");var type=this.nodes[_prop],contentExpr=type.spec.content||"",markExpr=type.spec.marks;if(type.contentMatch=contentExprCache[contentExpr]||(contentExprCache[contentExpr]=ContentMatch.parse(contentExpr,this.nodes)),type.inlineContent=type.contentMatch.inlineContent,type.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!type.isInline||!type.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=type}type.markSet="_"==markExpr?null:markExpr?gatherMarks(this,markExpr.split(" ")):""!=markExpr&&type.inlineContent?null:[]}for(var _prop2 in this.marks){var _type2=this.marks[_prop2],excl=_type2.spec.excludes;_type2.excluded=null==excl?[_type2]:""==excl?[]:gatherMarks(this,excl.split(" "))}this.nodeFromJSON=function(json){return Node.fromJSON(_this2,json)},this.markFromJSON=function(json){return Mark.fromJSON(_this2,json)},this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}return _createClass(Schema,[{key:"node",value:function node(type){var attrs=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,content=arguments.length>2?arguments[2]:void 0,marks=arguments.length>3?arguments[3]:void 0;if("string"==typeof type)type=this.nodeType(type);else{if(!(type instanceof NodeType))throw new RangeError("Invalid node type: "+type);if(type.schema!=this)throw new RangeError("Node type from different schema used ("+type.name+")")}return type.createChecked(attrs,content,marks)}},{key:"text",value:function text(_text,marks){var type=this.nodes.text;return new TextNode(type,type.defaultAttrs,_text,Mark.setFrom(marks))}},{key:"mark",value:function mark(type,attrs){return"string"==typeof type&&(type=this.marks[type]),type.create(attrs)}},{key:"nodeType",value:function nodeType(name){var found=this.nodes[name];if(!found)throw new RangeError("Unknown node type: "+name);return found}}]),Schema}();function gatherMarks(schema,marks){for(var found=[],i=0;i<marks.length;i++){var name=marks[i],mark=schema.marks[name],ok=mark;if(mark)found.push(mark);else for(var prop in schema.marks){var _mark=schema.marks[prop];("_"==name||_mark.spec.group&&_mark.spec.group.split(" ").indexOf(name)>-1)&&found.push(ok=_mark)}if(!ok)throw new SyntaxError("Unknown mark type: '"+marks[i]+"'")}return found}var DOMParser=function(){function DOMParser(schema,rules){var _this3=this;_classCallCheck(this,DOMParser),this.schema=schema,this.rules=rules,this.tags=[],this.styles=[];var matchedStyles=this.matchedStyles=[];rules.forEach(function(rule){if(function isTagRule(rule){return null!=rule.tag}(rule))_this3.tags.push(rule);else if(function isStyleRule(rule){return null!=rule.style}(rule)){var prop=/[^=]*/.exec(rule.style)[0];matchedStyles.indexOf(prop)<0&&matchedStyles.push(prop),_this3.styles.push(rule)}}),this.normalizeLists=!this.tags.some(function(r){if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;var node=schema.nodes[r.node];return node.contentMatch.matchType(node)})}return _createClass(DOMParser,[{key:"parse",value:function parse(dom){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},context=new ParseContext(this,options,!1);return context.addAll(dom,Mark.none,options.from,options.to),context.finish()}},{key:"parseSlice",value:function parseSlice(dom){var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},context=new ParseContext(this,options,!0);return context.addAll(dom,Mark.none,options.from,options.to),Slice.maxOpen(context.finish())}},{key:"matchTag",value:function matchTag(dom,context,after){for(var i=after?this.tags.indexOf(after)+1:0;i<this.tags.length;i++){var rule=this.tags[i];if(matches(dom,rule.tag)&&(void 0===rule.namespace||dom.namespaceURI==rule.namespace)&&(!rule.context||context.matchesContext(rule.context))){if(rule.getAttrs){var result=rule.getAttrs(dom);if(!1===result)continue;rule.attrs=result||void 0}return rule}}}},{key:"matchStyle",value:function matchStyle(prop,value,context,after){for(var i=after?this.styles.indexOf(after)+1:0;i<this.styles.length;i++){var rule=this.styles[i],style=rule.style;if(!(0!=style.indexOf(prop)||rule.context&&!context.matchesContext(rule.context)||style.length>prop.length&&(61!=style.charCodeAt(prop.length)||style.slice(prop.length+1)!=value))){if(rule.getAttrs){var result=rule.getAttrs(value);if(!1===result)continue;rule.attrs=result||void 0}return rule}}}}],[{key:"schemaRules",value:function schemaRules(schema){var result=[];function insert(rule){for(var priority=null==rule.priority?50:rule.priority,i=0;i<result.length;i++){var next=result[i];if((null==next.priority?50:next.priority)<priority)break}result.splice(i,0,rule)}var _loop2=function _loop2(name){var rules=schema.marks[name].spec.parseDOM;rules&&rules.forEach(function(rule){insert(rule=copy(rule)),rule.mark||rule.ignore||rule.clearMark||(rule.mark=name)})};for(var name in schema.marks)_loop2(name);var _loop3=function _loop3(_name){var rules=schema.nodes[_name].spec.parseDOM;rules&&rules.forEach(function(rule){insert(rule=copy(rule)),rule.node||rule.ignore||rule.mark||(rule.node=_name)})};for(var _name in schema.nodes)_loop3(_name);return result}},{key:"fromSchema",value:function fromSchema(schema){return schema.cached.domParser||(schema.cached.domParser=new DOMParser(schema,DOMParser.schemaRules(schema)))}}]),DOMParser}(),blockTags={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},ignoreTags={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},listTags={ol:!0,ul:!0};function wsOptionsFor(type,preserveWhitespace,base){return null!=preserveWhitespace?(preserveWhitespace?1:0)|("full"===preserveWhitespace?2:0):type&&"pre"==type.whitespace?3:-5&base}var NodeContext=function(){function NodeContext(type,attrs,marks,solid,match,options){_classCallCheck(this,NodeContext),this.type=type,this.attrs=attrs,this.marks=marks,this.solid=solid,this.options=options,this.content=[],this.activeMarks=Mark.none,this.match=match||(4&options?null:type.contentMatch)}return _createClass(NodeContext,[{key:"findWrapping",value:function findWrapping(node){if(!this.match){if(!this.type)return[];var fill=this.type.contentMatch.fillBefore(Fragment.from(node));if(!fill){var wrap,start=this.type.contentMatch;return(wrap=start.findWrapping(node.type))?(this.match=start,wrap):null}this.match=this.type.contentMatch.matchFragment(fill)}return this.match.findWrapping(node.type)}},{key:"finish",value:function finish(openEnd){if(!(1&this.options)){var m,last=this.content[this.content.length-1];if(last&&last.isText&&(m=/[ \t\r\n\u000c]+$/.exec(last.text))){var text=last;last.text.length==m[0].length?this.content.pop():this.content[this.content.length-1]=text.withText(text.text.slice(0,text.text.length-m[0].length))}}var content=Fragment.from(this.content);return!openEnd&&this.match&&(content=content.append(this.match.fillBefore(Fragment.empty,!0))),this.type?this.type.create(this.attrs,content,this.marks):content}},{key:"inlineContext",value:function inlineContext(node){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:node.parentNode&&!blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase())}}]),NodeContext}(),ParseContext=function(){function ParseContext(parser,options,isOpen){_classCallCheck(this,ParseContext),this.parser=parser,this.options=options,this.isOpen=isOpen,this.open=0,this.localPreserveWS=!1;var topContext,topNode=options.topNode,topOptions=wsOptionsFor(null,options.preserveWhitespace,0)|(isOpen?4:0);topContext=topNode?new NodeContext(topNode.type,topNode.attrs,Mark.none,!0,options.topMatch||topNode.type.contentMatch,topOptions):new NodeContext(isOpen?null:parser.schema.topNodeType,null,Mark.none,!0,null,topOptions),this.nodes=[topContext],this.find=options.findPositions,this.needsBlock=!1}return _createClass(ParseContext,[{key:"top",get:function get(){return this.nodes[this.open]}},{key:"addDOM",value:function addDOM(dom,marks){3==dom.nodeType?this.addTextNode(dom,marks):1==dom.nodeType&&this.addElement(dom,marks)}},{key:"addTextNode",value:function addTextNode(dom,marks){var value=dom.nodeValue,top=this.top,preserveWS=2&top.options?"full":this.localPreserveWS||(1&top.options)>0,schema=this.parser.schema;if("full"===preserveWS||top.inlineContext(dom)||/[^ \t\r\n\u000c]/.test(value)){if(preserveWS)if("full"===preserveWS)value=value.replace(/\r\n?/g,"\n");else if(schema.linebreakReplacement&&/[\r\n]/.test(value)&&this.top.findWrapping(schema.linebreakReplacement.create())){for(var lines=value.split(/\r?\n|\r/),i=0;i<lines.length;i++)i&&this.insertNode(schema.linebreakReplacement.create(),marks,!0),lines[i]&&this.insertNode(schema.text(lines[i]),marks,!/\S/.test(lines[i]));value=""}else value=value.replace(/\r?\n|\r/g," ");else if(value=value.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(value)&&this.open==this.nodes.length-1){var nodeBefore=top.content[top.content.length-1],domNodeBefore=dom.previousSibling;(!nodeBefore||domNodeBefore&&"BR"==domNodeBefore.nodeName||nodeBefore.isText&&/[ \t\r\n\u000c]$/.test(nodeBefore.text))&&(value=value.slice(1))}value&&this.insertNode(schema.text(value),marks,!/\S/.test(value)),this.findInText(dom)}else this.findInside(dom)}},{key:"addElement",value:function addElement(dom,marks,matchAfter){var outerWS=this.localPreserveWS,top=this.top;("PRE"==dom.tagName||/pre/.test(dom.style&&dom.style.whiteSpace))&&(this.localPreserveWS=!0);var ruleID,name=dom.nodeName.toLowerCase();listTags.hasOwnProperty(name)&&this.parser.normalizeLists&&function normalizeList(dom){for(var child=dom.firstChild,prevItem=null;child;child=child.nextSibling){var name=1==child.nodeType?child.nodeName.toLowerCase():null;name&&listTags.hasOwnProperty(name)&&prevItem?(prevItem.appendChild(child),child=prevItem):"li"==name?prevItem=child:name&&(prevItem=null)}}(dom);var rule=this.options.ruleFromNode&&this.options.ruleFromNode(dom)||(ruleID=this.parser.matchTag(dom,this,matchAfter));out:if(rule?rule.ignore:ignoreTags.hasOwnProperty(name))this.findInside(dom),this.ignoreFallback(dom,marks);else if(!rule||rule.skip||rule.closeParent){rule&&rule.closeParent?this.open=Math.max(0,this.open-1):rule&&rule.skip.nodeType&&(dom=rule.skip);var sync,oldNeedsBlock=this.needsBlock;if(blockTags.hasOwnProperty(name))top.content.length&&top.content[0].isInline&&this.open&&(this.open--,top=this.top),sync=!0,top.type||(this.needsBlock=!0);else if(!dom.firstChild){this.leafFallback(dom,marks);break out}var innerMarks=rule&&rule.skip?marks:this.readStyles(dom,marks);innerMarks&&this.addAll(dom,innerMarks),sync&&this.sync(top),this.needsBlock=oldNeedsBlock}else{var _innerMarks=this.readStyles(dom,marks);_innerMarks&&this.addElementByRule(dom,rule,_innerMarks,!1===rule.consuming?ruleID:void 0)}this.localPreserveWS=outerWS}},{key:"leafFallback",value:function leafFallback(dom,marks){"BR"==dom.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(dom.ownerDocument.createTextNode("\n"),marks)}},{key:"ignoreFallback",value:function ignoreFallback(dom,marks){"BR"!=dom.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),marks,!0)}},{key:"readStyles",value:function readStyles(dom,marks){var _this4=this,styles=dom.style;if(styles&&styles.length)for(var i=0;i<this.parser.matchedStyles.length;i++){var name=this.parser.matchedStyles[i],value=styles.getPropertyValue(name);if(value)for(var _ret,_loop4=function _loop4(_after){var rule=_this4.parser.matchStyle(name,value,_this4,_after);return rule?rule.ignore?{v:null}:(marks=rule.clearMark?marks.filter(function(m){return!rule.clearMark(m)}):marks.concat(_this4.parser.schema.marks[rule.mark].create(rule.attrs)),!1!==rule.consuming?(after=_after,0):void(after=_after=rule)):(after=_after,0)},after=void 0;0!==(_ret=_loop4(after));)if(_ret)return _ret.v}return marks}},{key:"addElementByRule",value:function addElementByRule(dom,rule,marks,continueAfter){var sync,nodeType,_this5=this;if(rule.node)if((nodeType=this.parser.schema.nodes[rule.node]).isLeaf)this.insertNode(nodeType.create(rule.attrs),marks,"BR"==dom.nodeName)||this.leafFallback(dom,marks);else{var inner=this.enter(nodeType,rule.attrs||null,marks,rule.preserveWhitespace);inner&&(sync=!0,marks=inner)}else{var markType=this.parser.schema.marks[rule.mark];marks=marks.concat(markType.create(rule.attrs))}var startIn=this.top;if(nodeType&&nodeType.isLeaf)this.findInside(dom);else if(continueAfter)this.addElement(dom,marks,continueAfter);else if(rule.getContent)this.findInside(dom),rule.getContent(dom,this.parser.schema).forEach(function(node){return _this5.insertNode(node,marks,!1)});else{var contentDOM=dom;"string"==typeof rule.contentElement?contentDOM=dom.querySelector(rule.contentElement):"function"==typeof rule.contentElement?contentDOM=rule.contentElement(dom):rule.contentElement&&(contentDOM=rule.contentElement),this.findAround(dom,contentDOM,!0),this.addAll(contentDOM,marks),this.findAround(dom,contentDOM,!1)}sync&&this.sync(startIn)&&this.open--}},{key:"addAll",value:function addAll(parent,marks,startIndex,endIndex){for(var index=startIndex||0,dom=startIndex?parent.childNodes[startIndex]:parent.firstChild,end=null==endIndex?null:parent.childNodes[endIndex];dom!=end;dom=dom.nextSibling,++index)this.findAtPoint(parent,index),this.addDOM(dom,marks);this.findAtPoint(parent,index)}},{key:"findPlace",value:function findPlace(node,marks,cautious){for(var route,sync,depth=this.open,penalty=0;depth>=0;depth--){var cx=this.nodes[depth],_found2=cx.findWrapping(node);if(_found2&&(!route||route.length>_found2.length+penalty)&&(route=_found2,sync=cx,!_found2.length))break;if(cx.solid){if(cautious)break;penalty+=2}}if(!route)return null;this.sync(sync);for(var i=0;i<route.length;i++)marks=this.enterInner(route[i],null,marks,!1);return marks}},{key:"insertNode",value:function insertNode(node,marks,cautious){if(node.isInline&&this.needsBlock&&!this.top.type){var block=this.textblockFromContext();block&&(marks=this.enterInner(block,null,marks))}var innerMarks=this.findPlace(node,marks,cautious);if(innerMarks){this.closeExtra();var top=this.top;top.match&&(top.match=top.match.matchType(node.type));var _step,nodeMarks=Mark.none,_iterator=_createForOfIteratorHelper(innerMarks.concat(node.marks));try{for(_iterator.s();!(_step=_iterator.n()).done;){var m=_step.value;(top.type?top.type.allowsMarkType(m.type):markMayApply(m.type,node.type))&&(nodeMarks=m.addToSet(nodeMarks))}}catch(err){_iterator.e(err)}finally{_iterator.f()}return top.content.push(node.mark(nodeMarks)),!0}return!1}},{key:"enter",value:function enter(type,attrs,marks,preserveWS){var innerMarks=this.findPlace(type.create(attrs),marks,!1);return innerMarks&&(innerMarks=this.enterInner(type,attrs,marks,!0,preserveWS)),innerMarks}},{key:"enterInner",value:function enterInner(type,attrs,marks){var solid=arguments.length>3&&void 0!==arguments[3]&&arguments[3],preserveWS=arguments.length>4?arguments[4]:void 0;this.closeExtra();var top=this.top;top.match=top.match&&top.match.matchType(type);var options=wsOptionsFor(type,preserveWS,top.options);4&top.options&&0==top.content.length&&(options|=4);var applyMarks=Mark.none;return marks=marks.filter(function(m){return!(top.type?top.type.allowsMarkType(m.type):markMayApply(m.type,type))||(applyMarks=m.addToSet(applyMarks),!1)}),this.nodes.push(new NodeContext(type,attrs,applyMarks,solid,null,options)),this.open++,marks}},{key:"closeExtra",value:function closeExtra(){var openEnd=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.nodes.length-1;if(i>this.open){for(;i>this.open;i--)this.nodes[i-1].content.push(this.nodes[i].finish(openEnd));this.nodes.length=this.open+1}}},{key:"finish",value:function finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}},{key:"sync",value:function sync(to){for(var i=this.open;i>=0;i--){if(this.nodes[i]==to)return this.open=i,!0;this.localPreserveWS&&(this.nodes[i].options|=1)}return!1}},{key:"currentPos",get:function get(){this.closeExtra();for(var pos=0,i=this.open;i>=0;i--){for(var content=this.nodes[i].content,j=content.length-1;j>=0;j--)pos+=content[j].nodeSize;i&&pos++}return pos}},{key:"findAtPoint",value:function findAtPoint(parent,offset){if(this.find)for(var i=0;i<this.find.length;i++)this.find[i].node==parent&&this.find[i].offset==offset&&(this.find[i].pos=this.currentPos)}},{key:"findInside",value:function findInside(parent){if(this.find)for(var i=0;i<this.find.length;i++)null==this.find[i].pos&&1==parent.nodeType&&parent.contains(this.find[i].node)&&(this.find[i].pos=this.currentPos)}},{key:"findAround",value:function findAround(parent,content,before){if(parent!=content&&this.find)for(var i=0;i<this.find.length;i++){if(null==this.find[i].pos&&1==parent.nodeType&&parent.contains(this.find[i].node))content.compareDocumentPosition(this.find[i].node)&(before?2:4)&&(this.find[i].pos=this.currentPos)}}},{key:"findInText",value:function findInText(textNode){if(this.find)for(var i=0;i<this.find.length;i++)this.find[i].node==textNode&&(this.find[i].pos=this.currentPos-(textNode.nodeValue.length-this.find[i].offset))}},{key:"matchesContext",value:function matchesContext(context){var _this6=this;if(context.indexOf("|")>-1)return context.split(/\s*\|\s*/).some(this.matchesContext,this);var parts=context.split("/"),option=this.options.context,useRoot=!(this.isOpen||option&&option.parent.type!=this.nodes[0].type),minDepth=-(option?option.depth+1:0)+(useRoot?0:1);return function match(i,depth){for(;i>=0;i--){var part=parts[i];if(""==part){if(i==parts.length-1||0==i)continue;for(;depth>=minDepth;depth--)if(match(i-1,depth))return!0;return!1}var next=depth>0||0==depth&&useRoot?_this6.nodes[depth].type:option&&depth>=minDepth?option.node(depth-minDepth).type:null;if(!next||next.name!=part&&!next.isInGroup(part))return!1;depth--}return!0}(parts.length-1,this.open)}},{key:"textblockFromContext",value:function textblockFromContext(){var $context=this.options.context;if($context)for(var d=$context.depth;d>=0;d--){var deflt=$context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;if(deflt&&deflt.isTextblock&&deflt.defaultAttrs)return deflt}for(var name in this.parser.schema.nodes){var type=this.parser.schema.nodes[name];if(type.isTextblock&&type.defaultAttrs)return type}}}]),ParseContext}();function matches(dom,selector){return(dom.matches||dom.msMatchesSelector||dom.webkitMatchesSelector||dom.mozMatchesSelector).call(dom,selector)}function copy(obj){var copy={};for(var prop in obj)copy[prop]=obj[prop];return copy}function markMayApply(markType,nodeType){var _ret2,nodes=nodeType.schema.nodes,_loop5=function _loop5(){var parent=nodes[name];if(!parent.allowsMarkType(markType))return 0;var seen=[];return function scan(match){seen.push(match);for(var i=0;i<match.edgeCount;i++){var _match$edge=match.edge(i),type=_match$edge.type,next=_match$edge.next;if(type==nodeType)return!0;if(seen.indexOf(next)<0&&scan(next))return!0}}(parent.contentMatch)?{v:!0}:void 0};for(var name in nodes)if(0!==(_ret2=_loop5())&&_ret2)return _ret2.v}var DOMSerializer=function(){function DOMSerializer(nodes,marks){_classCallCheck(this,DOMSerializer),this.nodes=nodes,this.marks=marks}return _createClass(DOMSerializer,[{key:"serializeFragment",value:function serializeFragment(fragment){var _this7=this,options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},target=arguments.length>2?arguments[2]:void 0;target||(target=doc(options).createDocumentFragment());var top=target,active=[];return fragment.forEach(function(node){if(active.length||node.marks.length){for(var keep=0,rendered=0;keep<active.length&&rendered<node.marks.length;){var next=node.marks[rendered];if(_this7.marks[next.type.name]){if(!next.eq(active[keep][0])||!1===next.type.spec.spanning)break;keep++,rendered++}else rendered++}for(;keep<active.length;)top=active.pop()[1];for(;rendered<node.marks.length;){var add=node.marks[rendered++],markDOM=_this7.serializeMark(add,node.isInline,options);markDOM&&(active.push([add,top]),top.appendChild(markDOM.dom),top=markDOM.contentDOM||markDOM.dom)}}top.appendChild(_this7.serializeNodeInner(node,options))}),target}},{key:"serializeNodeInner",value:function serializeNodeInner(node,options){if(node.isText)return doc(options).createTextNode(node.text);var _renderSpec2=_renderSpec(doc(options),this.nodes[node.type.name](node),null,node.attrs),dom=_renderSpec2.dom,contentDOM=_renderSpec2.contentDOM;if(contentDOM){if(node.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(node.content,options,contentDOM)}return dom}},{key:"serializeNode",value:function serializeNode(node){for(var options=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},dom=this.serializeNodeInner(node,options),i=node.marks.length-1;i>=0;i--){var wrap=this.serializeMark(node.marks[i],node.isInline,options);wrap&&((wrap.contentDOM||wrap.dom).appendChild(dom),dom=wrap.dom)}return dom}},{key:"serializeMark",value:function serializeMark(mark,inline){var options=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},toDOM=this.marks[mark.type.name];return toDOM&&_renderSpec(doc(options),toDOM(mark,inline),null,mark.attrs)}}],[{key:"renderSpec",value:function renderSpec(doc,structure){var xmlNS=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,blockArraysIn=arguments.length>3?arguments[3]:void 0;return"string"==typeof structure?{dom:doc.createTextNode(structure)}:_renderSpec(doc,structure,xmlNS,blockArraysIn)}},{key:"fromSchema",value:function fromSchema(schema){return schema.cached.domSerializer||(schema.cached.domSerializer=new DOMSerializer(this.nodesFromSchema(schema),this.marksFromSchema(schema)))}},{key:"nodesFromSchema",value:function nodesFromSchema(schema){var result=gatherToDOM(schema.nodes);return result.text||(result.text=function(node){return node.text}),result}},{key:"marksFromSchema",value:function marksFromSchema(schema){return gatherToDOM(schema.marks)}}]),DOMSerializer}();function gatherToDOM(obj){var result={};for(var name in obj){var toDOM=obj[name].spec.toDOM;toDOM&&(result[name]=toDOM)}return result}function doc(options){return options.document||window.document}var suspiciousAttributeCache=new WeakMap;function suspiciousAttributes(attrs){var value=suspiciousAttributeCache.get(attrs);return void 0===value&&suspiciousAttributeCache.set(attrs,value=function suspiciousAttributesInner(attrs){var result=null;function scan(value){if(value&&"object"==_typeof(value))if(Array.isArray(value))if("string"==typeof value[0])result||(result=[]),result.push(value);else for(var i=0;i<value.length;i++)scan(value[i]);else for(var prop in value)scan(value[prop])}return scan(attrs),result}(attrs)),value}function _renderSpec(doc,structure,xmlNS,blockArraysIn){if(1==structure.nodeType)return{dom:structure};if(structure.dom&&1==structure.dom.nodeType)return structure;var suspicious,tagName=structure[0];if("string"!=typeof tagName)throw new RangeError("Invalid array passed to renderSpec");if(blockArraysIn&&(suspicious=suspiciousAttributes(blockArraysIn))&&suspicious.indexOf(structure)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");var contentDOM,space=tagName.indexOf(" ");space>0&&(xmlNS=tagName.slice(0,space),tagName=tagName.slice(space+1));var dom=xmlNS?doc.createElementNS(xmlNS,tagName):doc.createElement(tagName),attrs=structure[1],start=1;if(attrs&&"object"==_typeof(attrs)&&null==attrs.nodeType&&!Array.isArray(attrs))for(var name in start=2,attrs)if(null!=attrs[name]){var _space=name.indexOf(" ");_space>0?dom.setAttributeNS(name.slice(0,_space),name.slice(_space+1),attrs[name]):"style"==name&&dom.style?dom.style.cssText=attrs[name]:dom.setAttribute(name,attrs[name])}for(var i=start;i<structure.length;i++){var child=structure[i];if(0===child){if(i<structure.length-1||i>start)throw new RangeError("Content hole must be the only child of its parent node");return{dom,contentDOM:dom}}if("string"==typeof child)dom.appendChild(doc.createTextNode(child));else{var _renderSpec3=_renderSpec(doc,child,xmlNS,blockArraysIn),inner=_renderSpec3.dom,innerContent=_renderSpec3.contentDOM;if(dom.appendChild(inner),innerContent){if(contentDOM)throw new RangeError("Multiple content holes");contentDOM=innerContent}}}return{dom,contentDOM}}exports.ContentMatch=ContentMatch,exports.DOMParser=DOMParser,exports.DOMSerializer=DOMSerializer,exports.Fragment=Fragment,exports.Mark=Mark,exports.MarkType=MarkType,exports.Node=Node,exports.NodeRange=NodeRange,exports.NodeType=NodeType,exports.ReplaceError=ReplaceError,exports.ResolvedPos=ResolvedPos,exports.Schema=Schema,exports.Slice=Slice},"./node_modules/prosemirror-schema-list/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";var prosemirrorTransform=__webpack_require__("./node_modules/prosemirror-transform/dist/index.cjs"),prosemirrorModel=__webpack_require__("./node_modules/prosemirror-model/dist/index.cjs"),prosemirrorState=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs"),olDOM=["ol",0],ulDOM=["ul",0],liDOM=["li",0],orderedList={attrs:{order:{default:1,validate:"number"}},parseDOM:[{tag:"ol",getAttrs:function getAttrs(dom){return{order:dom.hasAttribute("start")?+dom.getAttribute("start"):1}}}],toDOM:function toDOM(node){return 1==node.attrs.order?olDOM:["ol",{start:node.attrs.order},0]}},bulletList={parseDOM:[{tag:"ul"}],toDOM:function toDOM(){return ulDOM}},listItem={parseDOM:[{tag:"li"}],toDOM:function toDOM(){return liDOM},defining:!0};function add(obj,props){var copy={};for(var prop in obj)copy[prop]=obj[prop];for(var _prop in props)copy[_prop]=props[_prop];return copy}function wrapRangeInList(tr,range,listType){var attrs=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,doJoin=!1,outerRange=range,doc=range.$from.doc;if(range.depth>=2&&range.$from.node(range.depth-1).type.compatibleContent(listType)&&0==range.startIndex){if(0==range.$from.index(range.depth-1))return!1;var $insert=doc.resolve(range.start-2);outerRange=new prosemirrorModel.NodeRange($insert,$insert,range.depth),range.endIndex<range.parent.childCount&&(range=new prosemirrorModel.NodeRange(range.$from,doc.resolve(range.$to.end(range.depth)),range.depth)),doJoin=!0}var wrap=prosemirrorTransform.findWrapping(outerRange,listType,attrs,range);return!!wrap&&(tr&&function doWrapInList(tr,range,wrappers,joinBefore,listType){for(var content=prosemirrorModel.Fragment.empty,i=wrappers.length-1;i>=0;i--)content=prosemirrorModel.Fragment.from(wrappers[i].type.create(wrappers[i].attrs,content));tr.step(new prosemirrorTransform.ReplaceAroundStep(range.start-(joinBefore?2:0),range.end,range.start,range.end,new prosemirrorModel.Slice(content,0,0),wrappers.length,!0));for(var found=0,_i=0;_i<wrappers.length;_i++)wrappers[_i].type==listType&&(found=_i+1);for(var splitDepth=wrappers.length-found,splitPos=range.start+wrappers.length-(joinBefore?2:0),parent=range.parent,_i2=range.startIndex,e=range.endIndex,first=!0;_i2<e;_i2++,first=!1)!first&&prosemirrorTransform.canSplit(tr.doc,splitPos,splitDepth)&&(tr.split(splitPos,splitDepth),splitPos+=2*splitDepth),splitPos+=parent.child(_i2).nodeSize;return tr}(tr,range,wrap,doJoin,listType),!0)}function splitListItem(itemType,itemAttrs){return function(state,dispatch){var _state$selection2=state.selection,$from=_state$selection2.$from,$to=_state$selection2.$to,node=_state$selection2.node;if(node&&node.isBlock||$from.depth<2||!$from.sameParent($to))return!1;var grandParent=$from.node(-1);if(grandParent.type!=itemType)return!1;if(0==$from.parent.content.size&&$from.node(-1).childCount==$from.indexAfter(-1)){if(3==$from.depth||$from.node(-3).type!=itemType||$from.index(-2)!=$from.node(-2).childCount-1)return!1;if(dispatch){for(var wrap=prosemirrorModel.Fragment.empty,depthBefore=$from.index(-1)?1:$from.index(-2)?2:3,d=$from.depth-depthBefore;d>=$from.depth-3;d--)wrap=prosemirrorModel.Fragment.from($from.node(d).copy(wrap));var depthAfter=$from.indexAfter(-1)<$from.node(-2).childCount?1:$from.indexAfter(-2)<$from.node(-3).childCount?2:3;wrap=wrap.append(prosemirrorModel.Fragment.from(itemType.createAndFill()));var start=$from.before($from.depth-(depthBefore-1)),_tr=state.tr.replace(start,$from.after(-depthAfter),new prosemirrorModel.Slice(wrap,4-depthBefore,0)),sel=-1;_tr.doc.nodesBetween(start,_tr.doc.content.size,function(node,pos){if(sel>-1)return!1;node.isTextblock&&0==node.content.size&&(sel=pos+1)}),sel>-1&&_tr.setSelection(prosemirrorState.Selection.near(_tr.doc.resolve(sel))),dispatch(_tr.scrollIntoView())}return!0}var nextType=$to.pos==$from.end()?grandParent.contentMatchAt(0).defaultType:null,tr=state.tr.delete($from.pos,$to.pos),types=nextType?[itemAttrs?{type:itemType,attrs:itemAttrs}:null,{type:nextType}]:void 0;return!!prosemirrorTransform.canSplit(tr.doc,$from.pos,2,types)&&(dispatch&&dispatch(tr.split($from.pos,2,types).scrollIntoView()),!0)}}exports.addListNodes=function addListNodes(nodes,itemContent,listGroup){return nodes.append({ordered_list:add(orderedList,{content:"list_item+",group:listGroup}),bullet_list:add(bulletList,{content:"list_item+",group:listGroup}),list_item:add(listItem,{content:itemContent})})},exports.bulletList=bulletList,exports.liftListItem=function liftListItem(itemType){return function(state,dispatch){var _state$selection3=state.selection,$from=_state$selection3.$from,$to=_state$selection3.$to,range=$from.blockRange($to,function(node){return node.childCount>0&&node.firstChild.type==itemType});return!!range&&(!dispatch||($from.node(range.depth-1).type==itemType?function liftToOuterList(state,dispatch,itemType,range){var tr=state.tr,end=range.end,endOfList=range.$to.end(range.depth);end<endOfList&&(tr.step(new prosemirrorTransform.ReplaceAroundStep(end-1,endOfList,end,endOfList,new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(itemType.create(null,range.parent.copy())),1,0),1,!0)),range=new prosemirrorModel.NodeRange(tr.doc.resolve(range.$from.pos),tr.doc.resolve(endOfList),range.depth));var target=prosemirrorTransform.liftTarget(range);if(null==target)return!1;tr.lift(range,target);var $after=tr.doc.resolve(tr.mapping.map(end,-1)-1);prosemirrorTransform.canJoin(tr.doc,$after.pos)&&$after.nodeBefore.type==$after.nodeAfter.type&&tr.join($after.pos);return dispatch(tr.scrollIntoView()),!0}(state,dispatch,itemType,range):function liftOutOfList(state,dispatch,range){for(var tr=state.tr,list=range.parent,pos=range.end,i=range.endIndex-1,e=range.startIndex;i>e;i--)pos-=list.child(i).nodeSize,tr.delete(pos-1,pos+1);var $start=tr.doc.resolve(range.start),item=$start.nodeAfter;if(tr.mapping.map(range.end)!=range.start+$start.nodeAfter.nodeSize)return!1;var atStart=0==range.startIndex,atEnd=range.endIndex==list.childCount,parent=$start.node(-1),indexBefore=$start.index(-1);if(!parent.canReplace(indexBefore+(atStart?0:1),indexBefore+1,item.content.append(atEnd?prosemirrorModel.Fragment.empty:prosemirrorModel.Fragment.from(list))))return!1;var start=$start.pos,end=start+item.nodeSize;return tr.step(new prosemirrorTransform.ReplaceAroundStep(start-(atStart?1:0),end+(atEnd?1:0),start+1,end-1,new prosemirrorModel.Slice((atStart?prosemirrorModel.Fragment.empty:prosemirrorModel.Fragment.from(list.copy(prosemirrorModel.Fragment.empty))).append(atEnd?prosemirrorModel.Fragment.empty:prosemirrorModel.Fragment.from(list.copy(prosemirrorModel.Fragment.empty))),atStart?0:1,atEnd?0:1),atStart?0:1)),dispatch(tr.scrollIntoView()),!0}(state,dispatch,range)))}},exports.listItem=listItem,exports.orderedList=orderedList,exports.sinkListItem=function sinkListItem(itemType){return function(state,dispatch){var _state$selection4=state.selection,$from=_state$selection4.$from,$to=_state$selection4.$to,range=$from.blockRange($to,function(node){return node.childCount>0&&node.firstChild.type==itemType});if(!range)return!1;var startIndex=range.startIndex;if(0==startIndex)return!1;var parent=range.parent,nodeBefore=parent.child(startIndex-1);if(nodeBefore.type!=itemType)return!1;if(dispatch){var nestedBefore=nodeBefore.lastChild&&nodeBefore.lastChild.type==parent.type,inner=prosemirrorModel.Fragment.from(nestedBefore?itemType.create():null),slice=new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(itemType.create(null,prosemirrorModel.Fragment.from(parent.type.create(null,inner)))),nestedBefore?3:1,0),before=range.start,after=range.end;dispatch(state.tr.step(new prosemirrorTransform.ReplaceAroundStep(before-(nestedBefore?3:1),after,before,after,slice,1,!0)).scrollIntoView())}return!0}},exports.splitListItem=splitListItem,exports.splitListItemKeepMarks=function splitListItemKeepMarks(itemType,itemAttrs){var split=splitListItem(itemType,itemAttrs);return function(state,dispatch){return split(state,dispatch&&function(tr){var marks=state.storedMarks||state.selection.$to.parentOffset&&state.selection.$from.marks();marks&&tr.ensureMarks(marks),dispatch(tr)})}},exports.wrapInList=function wrapInList(listType){var attrs=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(state,dispatch){var _state$selection=state.selection,$from=_state$selection.$from,$to=_state$selection.$to,range=$from.blockRange($to);if(!range)return!1;var tr=dispatch?state.tr:null;return!!wrapRangeInList(tr,range,listType,attrs)&&(dispatch&&dispatch(tr.scrollIntoView()),!0)}},exports.wrapRangeInList=wrapRangeInList},"./node_modules/prosemirror-state/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function _get(target,property,receiver){var base=function _superPropBase(object,property){for(;!Object.prototype.hasOwnProperty.call(object,property)&&null!==(object=_getPrototypeOf(object)););return object}(target,property);if(base){var desc=Object.getOwnPropertyDescriptor(base,property);return desc.get?desc.get.call(arguments.length<3?target:receiver):desc.value}},_get.apply(this,arguments)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return function _possibleConstructorReturn(self,call){if(call&&("object"===_typeof(call)||"function"==typeof call))return call;if(void 0!==call)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}(self)}(this,result)}}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===_typeof(key)?key:String(key)}var prosemirrorModel=__webpack_require__("./node_modules/prosemirror-model/dist/index.cjs"),prosemirrorTransform=__webpack_require__("./node_modules/prosemirror-transform/dist/index.cjs"),classesById=Object.create(null),Selection=function(){function Selection($anchor,$head,ranges){_classCallCheck(this,Selection),this.$anchor=$anchor,this.$head=$head,this.ranges=ranges||[new SelectionRange($anchor.min($head),$anchor.max($head))]}return _createClass(Selection,[{key:"anchor",get:function get(){return this.$anchor.pos}},{key:"head",get:function get(){return this.$head.pos}},{key:"from",get:function get(){return this.$from.pos}},{key:"to",get:function get(){return this.$to.pos}},{key:"$from",get:function get(){return this.ranges[0].$from}},{key:"$to",get:function get(){return this.ranges[0].$to}},{key:"empty",get:function get(){for(var ranges=this.ranges,i=0;i<ranges.length;i++)if(ranges[i].$from.pos!=ranges[i].$to.pos)return!1;return!0}},{key:"content",value:function content(){return this.$from.doc.slice(this.from,this.to,!0)}},{key:"replace",value:function replace(tr){for(var content=arguments.length>1&&void 0!==arguments[1]?arguments[1]:prosemirrorModel.Slice.empty,lastNode=content.content.lastChild,lastParent=null,i=0;i<content.openEnd;i++)lastParent=lastNode,lastNode=lastNode.lastChild;for(var mapFrom=tr.steps.length,ranges=this.ranges,_i=0;_i<ranges.length;_i++){var _ranges$_i=ranges[_i],$from=_ranges$_i.$from,$to=_ranges$_i.$to,mapping=tr.mapping.slice(mapFrom);tr.replaceRange(mapping.map($from.pos),mapping.map($to.pos),_i?prosemirrorModel.Slice.empty:content),0==_i&&selectionToInsertionEnd(tr,mapFrom,(lastNode?lastNode.isInline:lastParent&&lastParent.isTextblock)?-1:1)}}},{key:"replaceWith",value:function replaceWith(tr,node){for(var mapFrom=tr.steps.length,ranges=this.ranges,i=0;i<ranges.length;i++){var _ranges$i=ranges[i],$from=_ranges$i.$from,$to=_ranges$i.$to,mapping=tr.mapping.slice(mapFrom),from=mapping.map($from.pos),to=mapping.map($to.pos);i?tr.deleteRange(from,to):(tr.replaceRangeWith(from,to,node),selectionToInsertionEnd(tr,mapFrom,node.isInline?-1:1))}}},{key:"getBookmark",value:function getBookmark(){return TextSelection.between(this.$anchor,this.$head).getBookmark()}}],[{key:"findFrom",value:function findFrom($pos,dir){var textOnly=arguments.length>2&&void 0!==arguments[2]&&arguments[2],inner=$pos.parent.inlineContent?new TextSelection($pos):findSelectionIn($pos.node(0),$pos.parent,$pos.pos,$pos.index(),dir,textOnly);if(inner)return inner;for(var depth=$pos.depth-1;depth>=0;depth--){var found=dir<0?findSelectionIn($pos.node(0),$pos.node(depth),$pos.before(depth+1),$pos.index(depth),dir,textOnly):findSelectionIn($pos.node(0),$pos.node(depth),$pos.after(depth+1),$pos.index(depth)+1,dir,textOnly);if(found)return found}return null}},{key:"near",value:function near($pos){var bias=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.findFrom($pos,bias)||this.findFrom($pos,-bias)||new AllSelection($pos.node(0))}},{key:"atStart",value:function atStart(doc){return findSelectionIn(doc,doc,0,0,1)||new AllSelection(doc)}},{key:"atEnd",value:function atEnd(doc){return findSelectionIn(doc,doc,doc.content.size,doc.childCount,-1)||new AllSelection(doc)}},{key:"fromJSON",value:function fromJSON(doc,json){if(!json||!json.type)throw new RangeError("Invalid input for Selection.fromJSON");var cls=classesById[json.type];if(!cls)throw new RangeError("No selection type ".concat(json.type," defined"));return cls.fromJSON(doc,json)}},{key:"jsonID",value:function jsonID(id,selectionClass){if(id in classesById)throw new RangeError("Duplicate use of selection JSON ID "+id);return classesById[id]=selectionClass,selectionClass.prototype.jsonID=id,selectionClass}}]),Selection}();Selection.prototype.visible=!0;var SelectionRange=_createClass(function SelectionRange($from,$to){_classCallCheck(this,SelectionRange),this.$from=$from,this.$to=$to}),warnedAboutTextSelection=!1;function checkTextSelection($pos){warnedAboutTextSelection||$pos.parent.inlineContent||(warnedAboutTextSelection=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+$pos.parent.type.name+")"))}var TextSelection=function(_Selection){_inherits(TextSelection,_Selection);var _super=_createSuper(TextSelection);function TextSelection($anchor){var $head=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$anchor;return _classCallCheck(this,TextSelection),checkTextSelection($anchor),checkTextSelection($head),_super.call(this,$anchor,$head)}return _createClass(TextSelection,[{key:"$cursor",get:function get(){return this.$anchor.pos==this.$head.pos?this.$head:null}},{key:"map",value:function map(doc,mapping){var $head=doc.resolve(mapping.map(this.head));if(!$head.parent.inlineContent)return Selection.near($head);var $anchor=doc.resolve(mapping.map(this.anchor));return new TextSelection($anchor.parent.inlineContent?$anchor:$head,$head)}},{key:"replace",value:function replace(tr){var content=arguments.length>1&&void 0!==arguments[1]?arguments[1]:prosemirrorModel.Slice.empty;if(_get(_getPrototypeOf(TextSelection.prototype),"replace",this).call(this,tr,content),content==prosemirrorModel.Slice.empty){var marks=this.$from.marksAcross(this.$to);marks&&tr.ensureMarks(marks)}}},{key:"eq",value:function eq(other){return other instanceof TextSelection&&other.anchor==this.anchor&&other.head==this.head}},{key:"getBookmark",value:function getBookmark(){return new TextBookmark(this.anchor,this.head)}},{key:"toJSON",value:function toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function fromJSON(doc,json){if("number"!=typeof json.anchor||"number"!=typeof json.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new TextSelection(doc.resolve(json.anchor),doc.resolve(json.head))}},{key:"create",value:function create(doc,anchor){var head=arguments.length>2&&void 0!==arguments[2]?arguments[2]:anchor,$anchor=doc.resolve(anchor);return new this($anchor,head==anchor?$anchor:doc.resolve(head))}},{key:"between",value:function between($anchor,$head,bias){var dPos=$anchor.pos-$head.pos;if(bias&&!dPos||(bias=dPos>=0?1:-1),!$head.parent.inlineContent){var found=Selection.findFrom($head,bias,!0)||Selection.findFrom($head,-bias,!0);if(!found)return Selection.near($head,bias);$head=found.$head}return $anchor.parent.inlineContent||(0==dPos||($anchor=(Selection.findFrom($anchor,-bias,!0)||Selection.findFrom($anchor,bias,!0)).$anchor).pos<$head.pos!=dPos<0)&&($anchor=$head),new TextSelection($anchor,$head)}}]),TextSelection}(Selection);Selection.jsonID("text",TextSelection);var TextBookmark=function(){function TextBookmark(anchor,head){_classCallCheck(this,TextBookmark),this.anchor=anchor,this.head=head}return _createClass(TextBookmark,[{key:"map",value:function map(mapping){return new TextBookmark(mapping.map(this.anchor),mapping.map(this.head))}},{key:"resolve",value:function resolve(doc){return TextSelection.between(doc.resolve(this.anchor),doc.resolve(this.head))}}]),TextBookmark}(),NodeSelection=function(_Selection2){_inherits(NodeSelection,_Selection2);var _super2=_createSuper(NodeSelection);function NodeSelection($pos){var _this;_classCallCheck(this,NodeSelection);var node=$pos.nodeAfter,$end=$pos.node(0).resolve($pos.pos+node.nodeSize);return(_this=_super2.call(this,$pos,$end)).node=node,_this}return _createClass(NodeSelection,[{key:"map",value:function map(doc,mapping){var _mapping$mapResult=mapping.mapResult(this.anchor),deleted=_mapping$mapResult.deleted,pos=_mapping$mapResult.pos,$pos=doc.resolve(pos);return deleted?Selection.near($pos):new NodeSelection($pos)}},{key:"content",value:function content(){return new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(this.node),0,0)}},{key:"eq",value:function eq(other){return other instanceof NodeSelection&&other.anchor==this.anchor}},{key:"toJSON",value:function toJSON(){return{type:"node",anchor:this.anchor}}},{key:"getBookmark",value:function getBookmark(){return new NodeBookmark(this.anchor)}}],[{key:"fromJSON",value:function fromJSON(doc,json){if("number"!=typeof json.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new NodeSelection(doc.resolve(json.anchor))}},{key:"create",value:function create(doc,from){return new NodeSelection(doc.resolve(from))}},{key:"isSelectable",value:function isSelectable(node){return!node.isText&&!1!==node.type.spec.selectable}}]),NodeSelection}(Selection);NodeSelection.prototype.visible=!1,Selection.jsonID("node",NodeSelection);var NodeBookmark=function(){function NodeBookmark(anchor){_classCallCheck(this,NodeBookmark),this.anchor=anchor}return _createClass(NodeBookmark,[{key:"map",value:function map(mapping){var _mapping$mapResult2=mapping.mapResult(this.anchor),deleted=_mapping$mapResult2.deleted,pos=_mapping$mapResult2.pos;return deleted?new TextBookmark(pos,pos):new NodeBookmark(pos)}},{key:"resolve",value:function resolve(doc){var $pos=doc.resolve(this.anchor),node=$pos.nodeAfter;return node&&NodeSelection.isSelectable(node)?new NodeSelection($pos):Selection.near($pos)}}]),NodeBookmark}(),AllSelection=function(_Selection3){_inherits(AllSelection,_Selection3);var _super3=_createSuper(AllSelection);function AllSelection(doc){return _classCallCheck(this,AllSelection),_super3.call(this,doc.resolve(0),doc.resolve(doc.content.size))}return _createClass(AllSelection,[{key:"replace",value:function replace(tr){var content=arguments.length>1&&void 0!==arguments[1]?arguments[1]:prosemirrorModel.Slice.empty;if(content==prosemirrorModel.Slice.empty){tr.delete(0,tr.doc.content.size);var sel=Selection.atStart(tr.doc);sel.eq(tr.selection)||tr.setSelection(sel)}else _get(_getPrototypeOf(AllSelection.prototype),"replace",this).call(this,tr,content)}},{key:"toJSON",value:function toJSON(){return{type:"all"}}},{key:"map",value:function map(doc){return new AllSelection(doc)}},{key:"eq",value:function eq(other){return other instanceof AllSelection}},{key:"getBookmark",value:function getBookmark(){return AllBookmark}}],[{key:"fromJSON",value:function fromJSON(doc){return new AllSelection(doc)}}]),AllSelection}(Selection);Selection.jsonID("all",AllSelection);var AllBookmark={map:function map(){return this},resolve:function resolve(doc){return new AllSelection(doc)}};function findSelectionIn(doc,node,pos,index,dir){var text=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(node.inlineContent)return TextSelection.create(doc,pos);for(var i=index-(dir>0?0:1);dir>0?i<node.childCount:i>=0;i+=dir){var child=node.child(i);if(child.isAtom){if(!text&&NodeSelection.isSelectable(child))return NodeSelection.create(doc,pos-(dir<0?child.nodeSize:0))}else{var inner=findSelectionIn(doc,child,pos+dir,dir<0?child.childCount:0,dir,text);if(inner)return inner}pos+=child.nodeSize*dir}return null}function selectionToInsertionEnd(tr,startLen,bias){var last=tr.steps.length-1;if(!(last<startLen)){var end,step=tr.steps[last];if(step instanceof prosemirrorTransform.ReplaceStep||step instanceof prosemirrorTransform.ReplaceAroundStep)tr.mapping.maps[last].forEach(function(_from,_to,_newFrom,newTo){null==end&&(end=newTo)}),tr.setSelection(Selection.near(tr.doc.resolve(end),bias))}}var Transaction=function(_prosemirrorTransform){_inherits(Transaction,_prosemirrorTransform);var _super4=_createSuper(Transaction);function Transaction(state){var _this2;return _classCallCheck(this,Transaction),(_this2=_super4.call(this,state.doc)).curSelectionFor=0,_this2.updated=0,_this2.meta=Object.create(null),_this2.time=Date.now(),_this2.curSelection=state.selection,_this2.storedMarks=state.storedMarks,_this2}return _createClass(Transaction,[{key:"selection",get:function get(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}},{key:"setSelection",value:function setSelection(selection){if(selection.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=selection,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}},{key:"selectionSet",get:function get(){return(1&this.updated)>0}},{key:"setStoredMarks",value:function setStoredMarks(marks){return this.storedMarks=marks,this.updated|=2,this}},{key:"ensureMarks",value:function ensureMarks(marks){return prosemirrorModel.Mark.sameSet(this.storedMarks||this.selection.$from.marks(),marks)||this.setStoredMarks(marks),this}},{key:"addStoredMark",value:function addStoredMark(mark){return this.ensureMarks(mark.addToSet(this.storedMarks||this.selection.$head.marks()))}},{key:"removeStoredMark",value:function removeStoredMark(mark){return this.ensureMarks(mark.removeFromSet(this.storedMarks||this.selection.$head.marks()))}},{key:"storedMarksSet",get:function get(){return(2&this.updated)>0}},{key:"addStep",value:function addStep(step,doc){_get(_getPrototypeOf(Transaction.prototype),"addStep",this).call(this,step,doc),this.updated=-3&this.updated,this.storedMarks=null}},{key:"setTime",value:function setTime(time){return this.time=time,this}},{key:"replaceSelection",value:function replaceSelection(slice){return this.selection.replace(this,slice),this}},{key:"replaceSelectionWith",value:function replaceSelectionWith(node){var inheritMarks=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],selection=this.selection;return inheritMarks&&(node=node.mark(this.storedMarks||(selection.empty?selection.$from.marks():selection.$from.marksAcross(selection.$to)||prosemirrorModel.Mark.none))),selection.replaceWith(this,node),this}},{key:"deleteSelection",value:function deleteSelection(){return this.selection.replace(this),this}},{key:"insertText",value:function insertText(text,from,to){var schema=this.doc.type.schema;if(null==from)return text?this.replaceSelectionWith(schema.text(text),!0):this.deleteSelection();if(null==to&&(to=from),!text)return this.deleteRange(from,to);var marks=this.storedMarks;if(!marks){var $from=this.doc.resolve(from);marks=to==from?$from.marks():$from.marksAcross(this.doc.resolve(to))}return this.replaceRangeWith(from,to,schema.text(text,marks)),this.selection.empty||this.selection.to!=from+text.length||this.setSelection(Selection.near(this.selection.$to)),this}},{key:"setMeta",value:function setMeta(key,value){return this.meta["string"==typeof key?key:key.key]=value,this}},{key:"getMeta",value:function getMeta(key){return this.meta["string"==typeof key?key:key.key]}},{key:"isGeneric",get:function get(){for(var _ in this.meta)return!1;return!0}},{key:"scrollIntoView",value:function scrollIntoView(){return this.updated|=4,this}},{key:"scrolledIntoView",get:function get(){return(4&this.updated)>0}}]),Transaction}(prosemirrorTransform.Transform);function bind(f,self){return self&&f?f.bind(self):f}var FieldDesc=_createClass(function FieldDesc(name,desc,self){_classCallCheck(this,FieldDesc),this.name=name,this.init=bind(desc.init,self),this.apply=bind(desc.apply,self)}),baseFields=[new FieldDesc("doc",{init:function init(config){return config.doc||config.schema.topNodeType.createAndFill()},apply:function apply(tr){return tr.doc}}),new FieldDesc("selection",{init:function init(config,instance){return config.selection||Selection.atStart(instance.doc)},apply:function apply(tr){return tr.selection}}),new FieldDesc("storedMarks",{init:function init(config){return config.storedMarks||null},apply:function apply(tr,_marks,_old,state){return state.selection.$cursor?tr.storedMarks:null}}),new FieldDesc("scrollToSelection",{init:function init(){return 0},apply:function apply(tr,prev){return tr.scrolledIntoView?prev+1:prev}})],Configuration=_createClass(function Configuration(schema,plugins){var _this3=this;_classCallCheck(this,Configuration),this.schema=schema,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=baseFields.slice(),plugins&&plugins.forEach(function(plugin){if(_this3.pluginsByKey[plugin.key])throw new RangeError("Adding different instances of a keyed plugin ("+plugin.key+")");_this3.plugins.push(plugin),_this3.pluginsByKey[plugin.key]=plugin,plugin.spec.state&&_this3.fields.push(new FieldDesc(plugin.key,plugin.spec.state,plugin))})}),EditorState=function(){function EditorState(config){_classCallCheck(this,EditorState),this.config=config}return _createClass(EditorState,[{key:"schema",get:function get(){return this.config.schema}},{key:"plugins",get:function get(){return this.config.plugins}},{key:"apply",value:function apply(tr){return this.applyTransaction(tr).state}},{key:"filterTransaction",value:function filterTransaction(tr){for(var ignore=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=0;i<this.config.plugins.length;i++)if(i!=ignore){var plugin=this.config.plugins[i];if(plugin.spec.filterTransaction&&!plugin.spec.filterTransaction.call(plugin,tr,this))return!1}return!0}},{key:"applyTransaction",value:function applyTransaction(rootTr){if(!this.filterTransaction(rootTr))return{state:this,transactions:[]};for(var trs=[rootTr],newState=this.applyInner(rootTr),seen=null;;){for(var haveNew=!1,i=0;i<this.config.plugins.length;i++){var plugin=this.config.plugins[i];if(plugin.spec.appendTransaction){var n=seen?seen[i].n:0,oldState=seen?seen[i].state:this,tr=n<trs.length&&plugin.spec.appendTransaction.call(plugin,n?trs.slice(n):trs,oldState,newState);if(tr&&newState.filterTransaction(tr,i)){if(tr.setMeta("appendedTransaction",rootTr),!seen){seen=[];for(var j=0;j<this.config.plugins.length;j++)seen.push(j<i?{state:newState,n:trs.length}:{state:this,n:0})}trs.push(tr),newState=newState.applyInner(tr),haveNew=!0}seen&&(seen[i]={state:newState,n:trs.length})}}if(!haveNew)return{state:newState,transactions:trs}}}},{key:"applyInner",value:function applyInner(tr){if(!tr.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var newInstance=new EditorState(this.config),fields=this.config.fields,i=0;i<fields.length;i++){var field=fields[i];newInstance[field.name]=field.apply(tr,this[field.name],this,newInstance)}return newInstance}},{key:"tr",get:function get(){return new Transaction(this)}},{key:"reconfigure",value:function reconfigure(config){for(var $config=new Configuration(this.schema,config.plugins),fields=$config.fields,instance=new EditorState($config),i=0;i<fields.length;i++){var name=fields[i].name;instance[name]=this.hasOwnProperty(name)?this[name]:fields[i].init(config,instance)}return instance}},{key:"toJSON",value:function toJSON(pluginFields){var result={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(result.storedMarks=this.storedMarks.map(function(m){return m.toJSON()})),pluginFields&&"object"==_typeof(pluginFields))for(var prop in pluginFields){if("doc"==prop||"selection"==prop)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var plugin=pluginFields[prop],state=plugin.spec.state;state&&state.toJSON&&(result[prop]=state.toJSON.call(plugin,this[plugin.key]))}return result}}],[{key:"create",value:function create(config){for(var $config=new Configuration(config.doc?config.doc.type.schema:config.schema,config.plugins),instance=new EditorState($config),i=0;i<$config.fields.length;i++)instance[$config.fields[i].name]=$config.fields[i].init(config,instance);return instance}},{key:"fromJSON",value:function fromJSON(config,json,pluginFields){if(!json)throw new RangeError("Invalid input for EditorState.fromJSON");if(!config.schema)throw new RangeError("Required config field 'schema' missing");var $config=new Configuration(config.schema,config.plugins),instance=new EditorState($config);return $config.fields.forEach(function(field){if("doc"==field.name)instance.doc=prosemirrorModel.Node.fromJSON(config.schema,json.doc);else if("selection"==field.name)instance.selection=Selection.fromJSON(instance.doc,json.selection);else if("storedMarks"==field.name)json.storedMarks&&(instance.storedMarks=json.storedMarks.map(config.schema.markFromJSON));else{if(pluginFields)for(var prop in pluginFields){var plugin=pluginFields[prop],state=plugin.spec.state;if(plugin.key==field.name&&state&&state.fromJSON&&Object.prototype.hasOwnProperty.call(json,prop))return void(instance[field.name]=state.fromJSON.call(plugin,config,json[prop],instance))}instance[field.name]=field.init(config,instance)}}),instance}}]),EditorState}();function bindProps(obj,self,target){for(var prop in obj){var val=obj[prop];val instanceof Function?val=val.bind(self):"handleDOMEvents"==prop&&(val=bindProps(val,self,{})),target[prop]=val}return target}var Plugin=function(){function Plugin(spec){_classCallCheck(this,Plugin),this.spec=spec,this.props={},spec.props&&bindProps(spec.props,this,this.props),this.key=spec.key?spec.key.key:createKey("plugin")}return _createClass(Plugin,[{key:"getState",value:function getState(state){return state[this.key]}}]),Plugin}(),keys=Object.create(null);function createKey(name){return name in keys?name+"$"+ ++keys[name]:(keys[name]=0,name+"$")}var PluginKey=function(){function PluginKey(){var name=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"key";_classCallCheck(this,PluginKey),this.key=createKey(name)}return _createClass(PluginKey,[{key:"get",value:function get(state){return state.config.pluginsByKey[this.key]}},{key:"getState",value:function getState(state){return state[this.key]}}]),PluginKey}();exports.AllSelection=AllSelection,exports.EditorState=EditorState,exports.NodeSelection=NodeSelection,exports.Plugin=Plugin,exports.PluginKey=PluginKey,exports.Selection=Selection,exports.SelectionRange=SelectionRange,exports.TextSelection=TextSelection,exports.Transaction=Transaction},"./node_modules/prosemirror-tables/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){let readFromCache,addToCache,prosemirror_state=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs"),prosemirror_model=__webpack_require__("./node_modules/prosemirror-model/dist/index.cjs"),prosemirror_view=__webpack_require__("./node_modules/prosemirror-view/dist/index.cjs"),prosemirror_keymap=__webpack_require__("./node_modules/prosemirror-keymap/dist/index.cjs"),prosemirror_transform=__webpack_require__("./node_modules/prosemirror-transform/dist/index.cjs");if("undefined"!=typeof WeakMap){let cache=new WeakMap;readFromCache=key=>cache.get(key),addToCache=(key,value)=>(cache.set(key,value),value)}else{const cache=[],cacheSize=10;let cachePos=0;readFromCache=key=>{for(let i=0;i<cache.length;i+=2)if(cache[i]==key)return cache[i+1]},addToCache=(key,value)=>(cachePos==cacheSize&&(cachePos=0),cache[cachePos++]=key,cache[cachePos++]=value)}var TableMap=class{constructor(width,height,map,problems){this.width=width,this.height=height,this.map=map,this.problems=problems}findCell(pos){for(let i=0;i<this.map.length;i++){const curPos=this.map[i];if(curPos!=pos)continue;const left=i%this.width,top=i/this.width|0;let right=left+1,bottom=top+1;for(let j=1;right<this.width&&this.map[i+j]==curPos;j++)right++;for(let j=1;bottom<this.height&&this.map[i+this.width*j]==curPos;j++)bottom++;return{left,top,right,bottom}}throw new RangeError(`No cell with offset ${pos} found`)}colCount(pos){for(let i=0;i<this.map.length;i++)if(this.map[i]==pos)return i%this.width;throw new RangeError(`No cell with offset ${pos} found`)}nextCell(pos,axis,dir){const{left,right,top,bottom}=this.findCell(pos);return"horiz"==axis?(dir<0?0==left:right==this.width)?null:this.map[top*this.width+(dir<0?left-1:right)]:(dir<0?0==top:bottom==this.height)?null:this.map[left+this.width*(dir<0?top-1:bottom)]}rectBetween(a,b){const{left:leftA,right:rightA,top:topA,bottom:bottomA}=this.findCell(a),{left:leftB,right:rightB,top:topB,bottom:bottomB}=this.findCell(b);return{left:Math.min(leftA,leftB),top:Math.min(topA,topB),right:Math.max(rightA,rightB),bottom:Math.max(bottomA,bottomB)}}cellsInRect(rect){const result=[],seen={};for(let row=rect.top;row<rect.bottom;row++)for(let col=rect.left;col<rect.right;col++){const index=row*this.width+col,pos=this.map[index];seen[pos]||(seen[pos]=!0,col==rect.left&&col&&this.map[index-1]==pos||row==rect.top&&row&&this.map[index-this.width]==pos||result.push(pos))}return result}positionAt(row,col,table){for(let i=0,rowStart=0;;i++){const rowEnd=rowStart+table.child(i).nodeSize;if(i==row){let index=col+row*this.width;const rowEndIndex=(row+1)*this.width;for(;index<rowEndIndex&&this.map[index]<rowStart;)index++;return index==rowEndIndex?rowEnd-1:this.map[index]}rowStart=rowEnd}}static get(table){return readFromCache(table)||addToCache(table,function computeMap(table){if("table"!=table.type.spec.tableRole)throw new RangeError("Not a table node: "+table.type.name);const width=function findWidth(table){let width=-1,hasRowSpan=!1;for(let row=0;row<table.childCount;row++){const rowNode=table.child(row);let rowWidth=0;if(hasRowSpan)for(let j=0;j<row;j++){const prevRow=table.child(j);for(let i=0;i<prevRow.childCount;i++){const cell=prevRow.child(i);j+cell.attrs.rowspan>row&&(rowWidth+=cell.attrs.colspan)}}for(let i=0;i<rowNode.childCount;i++){const cell=rowNode.child(i);rowWidth+=cell.attrs.colspan,cell.attrs.rowspan>1&&(hasRowSpan=!0)}-1==width?width=rowWidth:width!=rowWidth&&(width=Math.max(width,rowWidth))}return width}(table),height=table.childCount,map=[];let mapPos=0,problems=null;const colWidths=[];for(let i=0,e=width*height;i<e;i++)map[i]=0;for(let row=0,pos=0;row<height;row++){const rowNode=table.child(row);pos++;for(let i=0;;i++){for(;mapPos<map.length&&0!=map[mapPos];)mapPos++;if(i==rowNode.childCount)break;const cellNode=rowNode.child(i),{colspan,rowspan,colwidth}=cellNode.attrs;for(let h=0;h<rowspan;h++){if(h+row>=height){(problems||(problems=[])).push({type:"overlong_rowspan",pos,n:rowspan-h});break}const start=mapPos+h*width;for(let w=0;w<colspan;w++){0==map[start+w]?map[start+w]=pos:(problems||(problems=[])).push({type:"collision",row,pos,n:colspan-w});const colW=colwidth&&colwidth[w];if(colW){const widthIndex=(start+w)%width*2,prev=colWidths[widthIndex];null==prev||prev!=colW&&1==colWidths[widthIndex+1]?(colWidths[widthIndex]=colW,colWidths[widthIndex+1]=1):prev==colW&&colWidths[widthIndex+1]++}}}mapPos+=colspan,pos+=cellNode.nodeSize}const expectedPos=(row+1)*width;let missing=0;for(;mapPos<expectedPos;)0==map[mapPos++]&&missing++;missing&&(problems||(problems=[])).push({type:"missing",row,n:missing}),pos++}0!==width&&0!==height||(problems||(problems=[])).push({type:"zero_sized"});const tableMap=new TableMap(width,height,map,problems);let badWidths=!1;for(let i=0;!badWidths&&i<colWidths.length;i+=2)null!=colWidths[i]&&colWidths[i+1]<height&&(badWidths=!0);badWidths&&function findBadColWidths(map,colWidths,table){map.problems||(map.problems=[]);const seen={};for(let i=0;i<map.map.length;i++){const pos=map.map[i];if(seen[pos])continue;seen[pos]=!0;const node=table.nodeAt(pos);if(!node)throw new RangeError(`No cell with offset ${pos} found`);let updated=null;const attrs=node.attrs;for(let j=0;j<attrs.colspan;j++){const colWidth=colWidths[(i+j)%map.width*2];null==colWidth||attrs.colwidth&&attrs.colwidth[j]==colWidth||((updated||(updated=freshColWidth(attrs)))[j]=colWidth)}updated&&map.problems.unshift({type:"colwidth mismatch",pos,colwidth:updated})}}(tableMap,colWidths,table);return tableMap}(table))}};function freshColWidth(attrs){if(attrs.colwidth)return attrs.colwidth.slice();const result=[];for(let i=0;i<attrs.colspan;i++)result.push(0);return result}function getCellAttrs(dom,extraAttrs){if("string"==typeof dom)return{};const widthAttr=dom.getAttribute("data-colwidth"),widths=widthAttr&&/^\d+(,\d+)*$/.test(widthAttr)?widthAttr.split(",").map(s=>Number(s)):null,colspan=Number(dom.getAttribute("colspan")||1),result={colspan,rowspan:Number(dom.getAttribute("rowspan")||1),colwidth:widths&&widths.length==colspan?widths:null};for(const prop in extraAttrs){const getter=extraAttrs[prop].getFromDOM,value=getter&&getter(dom);null!=value&&(result[prop]=value)}return result}function setCellAttrs(node,extraAttrs){const attrs={};1!=node.attrs.colspan&&(attrs.colspan=node.attrs.colspan),1!=node.attrs.rowspan&&(attrs.rowspan=node.attrs.rowspan),node.attrs.colwidth&&(attrs["data-colwidth"]=node.attrs.colwidth.join(","));for(const prop in extraAttrs){const setter=extraAttrs[prop].setDOMAttr;setter&&setter(node.attrs[prop],attrs)}return attrs}function validateColwidth(value){if(null!==value){if(!Array.isArray(value))throw new TypeError("colwidth must be null or an array");for(const item of value)if("number"!=typeof item)throw new TypeError("colwidth must be null or an array of numbers")}}function tableNodeTypes(schema){let result=schema.cached.tableNodeTypes;if(!result){result=schema.cached.tableNodeTypes={};for(const name in schema.nodes){const type=schema.nodes[name],role=type.spec.tableRole;role&&(result[role]=type)}}return result}const tableEditingKey=new prosemirror_state.PluginKey("selectingCells");function cellAround($pos){for(let d=$pos.depth-1;d>0;d--)if("row"==$pos.node(d).type.spec.tableRole)return $pos.node(0).resolve($pos.before(d+1));return null}function isInTable(state){const $head=state.selection.$head;for(let d=$head.depth;d>0;d--)if("row"==$head.node(d).type.spec.tableRole)return!0;return!1}function selectionCell(state){const sel=state.selection;if("$anchorCell"in sel&&sel.$anchorCell)return sel.$anchorCell.pos>sel.$headCell.pos?sel.$anchorCell:sel.$headCell;if("node"in sel&&sel.node&&"cell"==sel.node.type.spec.tableRole)return sel.$anchor;const $cell=cellAround(sel.$head)||cellNear(sel.$head);if($cell)return $cell;throw new RangeError(`No cell found around position ${sel.head}`)}function cellNear($pos){for(let after=$pos.nodeAfter,pos=$pos.pos;after;after=after.firstChild,pos++){const role=after.type.spec.tableRole;if("cell"==role||"header_cell"==role)return $pos.doc.resolve(pos)}for(let before=$pos.nodeBefore,pos=$pos.pos;before;before=before.lastChild,pos--){const role=before.type.spec.tableRole;if("cell"==role||"header_cell"==role)return $pos.doc.resolve(pos-before.nodeSize)}}function pointsAtCell($pos){return"row"==$pos.parent.type.spec.tableRole&&!!$pos.nodeAfter}function moveCellForward($pos){return $pos.node(0).resolve($pos.pos+$pos.nodeAfter.nodeSize)}function inSameTable($cellA,$cellB){return $cellA.depth==$cellB.depth&&$cellA.pos>=$cellB.start(-1)&&$cellA.pos<=$cellB.end(-1)}function nextCell($pos,axis,dir){const table=$pos.node(-1),map=TableMap.get(table),tableStart=$pos.start(-1),moved=map.nextCell($pos.pos-tableStart,axis,dir);return null==moved?null:$pos.node(0).resolve(tableStart+moved)}function removeColSpan(attrs,pos,n=1){const result={...attrs,colspan:attrs.colspan-n};return result.colwidth&&(result.colwidth=result.colwidth.slice(),result.colwidth.splice(pos,n),result.colwidth.some(w=>w>0)||(result.colwidth=null)),result}function addColSpan(attrs,pos,n=1){const result={...attrs,colspan:attrs.colspan+n};if(result.colwidth){result.colwidth=result.colwidth.slice();for(let i=0;i<n;i++)result.colwidth.splice(pos,0,0)}return result}function columnIsHeader(map,table,col){const headerCell=tableNodeTypes(table.type.schema).header_cell;for(let row=0;row<map.height;row++)if(table.nodeAt(map.map[col+row*map.width]).type!=headerCell)return!1;return!0}var CellSelection=class CellSelection extends prosemirror_state.Selection{constructor($anchorCell,$headCell=$anchorCell){const table=$anchorCell.node(-1),map=TableMap.get(table),tableStart=$anchorCell.start(-1),rect=map.rectBetween($anchorCell.pos-tableStart,$headCell.pos-tableStart),doc=$anchorCell.node(0),cells=map.cellsInRect(rect).filter(p=>p!=$headCell.pos-tableStart);cells.unshift($headCell.pos-tableStart);const ranges=cells.map(pos=>{const cell=table.nodeAt(pos);if(!cell)throw new RangeError(`No cell with offset ${pos} found`);const from=tableStart+pos+1;return new prosemirror_state.SelectionRange(doc.resolve(from),doc.resolve(from+cell.content.size))});super(ranges[0].$from,ranges[0].$to,ranges),this.$anchorCell=$anchorCell,this.$headCell=$headCell}map(doc,mapping){const $anchorCell=doc.resolve(mapping.map(this.$anchorCell.pos)),$headCell=doc.resolve(mapping.map(this.$headCell.pos));if(pointsAtCell($anchorCell)&&pointsAtCell($headCell)&&inSameTable($anchorCell,$headCell)){const tableChanged=this.$anchorCell.node(-1)!=$anchorCell.node(-1);return tableChanged&&this.isRowSelection()?CellSelection.rowSelection($anchorCell,$headCell):tableChanged&&this.isColSelection()?CellSelection.colSelection($anchorCell,$headCell):new CellSelection($anchorCell,$headCell)}return prosemirror_state.TextSelection.between($anchorCell,$headCell)}content(){const table=this.$anchorCell.node(-1),map=TableMap.get(table),tableStart=this.$anchorCell.start(-1),rect=map.rectBetween(this.$anchorCell.pos-tableStart,this.$headCell.pos-tableStart),seen={},rows=[];for(let row=rect.top;row<rect.bottom;row++){const rowContent=[];for(let index=row*map.width+rect.left,col=rect.left;col<rect.right;col++,index++){const pos=map.map[index];if(seen[pos])continue;seen[pos]=!0;const cellRect=map.findCell(pos);let cell=table.nodeAt(pos);if(!cell)throw new RangeError(`No cell with offset ${pos} found`);const extraLeft=rect.left-cellRect.left,extraRight=cellRect.right-rect.right;if(extraLeft>0||extraRight>0){let attrs=cell.attrs;if(extraLeft>0&&(attrs=removeColSpan(attrs,0,extraLeft)),extraRight>0&&(attrs=removeColSpan(attrs,attrs.colspan-extraRight,extraRight)),cellRect.left<rect.left){if(cell=cell.type.createAndFill(attrs),!cell)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(attrs)}`)}else cell=cell.type.create(attrs,cell.content)}if(cellRect.top<rect.top||cellRect.bottom>rect.bottom){const attrs={...cell.attrs,rowspan:Math.min(cellRect.bottom,rect.bottom)-Math.max(cellRect.top,rect.top)};cell=cellRect.top<rect.top?cell.type.createAndFill(attrs):cell.type.create(attrs,cell.content)}rowContent.push(cell)}rows.push(table.child(row).copy(prosemirror_model.Fragment.from(rowContent)))}const fragment=this.isColSelection()&&this.isRowSelection()?table:rows;return new prosemirror_model.Slice(prosemirror_model.Fragment.from(fragment),1,1)}replace(tr,content=prosemirror_model.Slice.empty){const mapFrom=tr.steps.length,ranges=this.ranges;for(let i=0;i<ranges.length;i++){const{$from,$to}=ranges[i],mapping=tr.mapping.slice(mapFrom);tr.replace(mapping.map($from.pos),mapping.map($to.pos),i?prosemirror_model.Slice.empty:content)}const sel=prosemirror_state.Selection.findFrom(tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)),-1);sel&&tr.setSelection(sel)}replaceWith(tr,node){this.replace(tr,new prosemirror_model.Slice(prosemirror_model.Fragment.from(node),0,0))}forEachCell(f){const table=this.$anchorCell.node(-1),map=TableMap.get(table),tableStart=this.$anchorCell.start(-1),cells=map.cellsInRect(map.rectBetween(this.$anchorCell.pos-tableStart,this.$headCell.pos-tableStart));for(let i=0;i<cells.length;i++)f(table.nodeAt(cells[i]),tableStart+cells[i])}isColSelection(){const anchorTop=this.$anchorCell.index(-1),headTop=this.$headCell.index(-1);if(Math.min(anchorTop,headTop)>0)return!1;const anchorBottom=anchorTop+this.$anchorCell.nodeAfter.attrs.rowspan,headBottom=headTop+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(anchorBottom,headBottom)==this.$headCell.node(-1).childCount}static colSelection($anchorCell,$headCell=$anchorCell){const table=$anchorCell.node(-1),map=TableMap.get(table),tableStart=$anchorCell.start(-1),anchorRect=map.findCell($anchorCell.pos-tableStart),headRect=map.findCell($headCell.pos-tableStart),doc=$anchorCell.node(0);return anchorRect.top<=headRect.top?(anchorRect.top>0&&($anchorCell=doc.resolve(tableStart+map.map[anchorRect.left])),headRect.bottom<map.height&&($headCell=doc.resolve(tableStart+map.map[map.width*(map.height-1)+headRect.right-1]))):(headRect.top>0&&($headCell=doc.resolve(tableStart+map.map[headRect.left])),anchorRect.bottom<map.height&&($anchorCell=doc.resolve(tableStart+map.map[map.width*(map.height-1)+anchorRect.right-1]))),new CellSelection($anchorCell,$headCell)}isRowSelection(){const table=this.$anchorCell.node(-1),map=TableMap.get(table),tableStart=this.$anchorCell.start(-1),anchorLeft=map.colCount(this.$anchorCell.pos-tableStart),headLeft=map.colCount(this.$headCell.pos-tableStart);if(Math.min(anchorLeft,headLeft)>0)return!1;const anchorRight=anchorLeft+this.$anchorCell.nodeAfter.attrs.colspan,headRight=headLeft+this.$headCell.nodeAfter.attrs.colspan;return Math.max(anchorRight,headRight)==map.width}eq(other){return other instanceof CellSelection&&other.$anchorCell.pos==this.$anchorCell.pos&&other.$headCell.pos==this.$headCell.pos}static rowSelection($anchorCell,$headCell=$anchorCell){const table=$anchorCell.node(-1),map=TableMap.get(table),tableStart=$anchorCell.start(-1),anchorRect=map.findCell($anchorCell.pos-tableStart),headRect=map.findCell($headCell.pos-tableStart),doc=$anchorCell.node(0);return anchorRect.left<=headRect.left?(anchorRect.left>0&&($anchorCell=doc.resolve(tableStart+map.map[anchorRect.top*map.width])),headRect.right<map.width&&($headCell=doc.resolve(tableStart+map.map[map.width*(headRect.top+1)-1]))):(headRect.left>0&&($headCell=doc.resolve(tableStart+map.map[headRect.top*map.width])),anchorRect.right<map.width&&($anchorCell=doc.resolve(tableStart+map.map[map.width*(anchorRect.top+1)-1]))),new CellSelection($anchorCell,$headCell)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(doc,json){return new CellSelection(doc.resolve(json.anchor),doc.resolve(json.head))}static create(doc,anchorCell,headCell=anchorCell){return new CellSelection(doc.resolve(anchorCell),doc.resolve(headCell))}getBookmark(){return new CellBookmark(this.$anchorCell.pos,this.$headCell.pos)}};CellSelection.prototype.visible=!1,prosemirror_state.Selection.jsonID("cell",CellSelection);var CellBookmark=class CellBookmark{constructor(anchor,head){this.anchor=anchor,this.head=head}map(mapping){return new CellBookmark(mapping.map(this.anchor),mapping.map(this.head))}resolve(doc){const $anchorCell=doc.resolve(this.anchor),$headCell=doc.resolve(this.head);return"row"==$anchorCell.parent.type.spec.tableRole&&"row"==$headCell.parent.type.spec.tableRole&&$anchorCell.index()<$anchorCell.parent.childCount&&$headCell.index()<$headCell.parent.childCount&&inSameTable($anchorCell,$headCell)?new CellSelection($anchorCell,$headCell):prosemirror_state.Selection.near($headCell,1)}};function drawCellSelection(state){if(!(state.selection instanceof CellSelection))return null;const cells=[];return state.selection.forEachCell((node,pos)=>{cells.push(prosemirror_view.Decoration.node(pos,pos+node.nodeSize,{class:"selectedCell"}))}),prosemirror_view.DecorationSet.create(state.doc,cells)}const fixTablesKey=new prosemirror_state.PluginKey("fix-tables");function changedDescendants(old,cur,offset,f){const oldSize=old.childCount,curSize=cur.childCount;outer:for(let i=0,j=0;i<curSize;i++){const child=cur.child(i);for(let scan=j,e=Math.min(oldSize,i+3);scan<e;scan++)if(old.child(scan)==child){j=scan+1,offset+=child.nodeSize;continue outer}f(child,offset),j<oldSize&&old.child(j).sameMarkup(child)?changedDescendants(old.child(j),child,offset+1,f):child.nodesBetween(0,child.content.size,f,offset+1),offset+=child.nodeSize}}function fixTables(state,oldState){let tr;const check=(node,pos)=>{"table"==node.type.spec.tableRole&&(tr=function fixTable(state,table,tablePos,tr){const map=TableMap.get(table);if(!map.problems)return tr;tr||(tr=state.tr);const mustAdd=[];for(let i=0;i<map.height;i++)mustAdd.push(0);for(let i=0;i<map.problems.length;i++){const prob=map.problems[i];if("collision"==prob.type){const cell=table.nodeAt(prob.pos);if(!cell)continue;const attrs=cell.attrs;for(let j=0;j<attrs.rowspan;j++)mustAdd[prob.row+j]+=prob.n;tr.setNodeMarkup(tr.mapping.map(tablePos+1+prob.pos),null,removeColSpan(attrs,attrs.colspan-prob.n,prob.n))}else if("missing"==prob.type)mustAdd[prob.row]+=prob.n;else if("overlong_rowspan"==prob.type){const cell=table.nodeAt(prob.pos);if(!cell)continue;tr.setNodeMarkup(tr.mapping.map(tablePos+1+prob.pos),null,{...cell.attrs,rowspan:cell.attrs.rowspan-prob.n})}else if("colwidth mismatch"==prob.type){const cell=table.nodeAt(prob.pos);if(!cell)continue;tr.setNodeMarkup(tr.mapping.map(tablePos+1+prob.pos),null,{...cell.attrs,colwidth:prob.colwidth})}else if("zero_sized"==prob.type){const pos=tr.mapping.map(tablePos);tr.delete(pos,pos+table.nodeSize)}}let first,last;for(let i=0;i<mustAdd.length;i++)mustAdd[i]&&(null==first&&(first=i),last=i);for(let i=0,pos=tablePos+1;i<map.height;i++){const row=table.child(i),end=pos+row.nodeSize,add=mustAdd[i];if(add>0){let role="cell";row.firstChild&&(role=row.firstChild.type.spec.tableRole);const nodes=[];for(let j=0;j<add;j++){const node=tableNodeTypes(state.schema)[role].createAndFill();node&&nodes.push(node)}const side=0!=i&&first!=i-1||last!=i?end-1:pos+1;tr.insert(tr.mapping.map(side),nodes)}pos=end}return tr.setMeta(fixTablesKey,{fixTables:!0})}(state,node,pos,tr))};return oldState?oldState.doc!=state.doc&&changedDescendants(oldState.doc,state.doc,0,check):state.doc.descendants(check),tr}function convertTableNodeToArrayOfRows(tableNode){const map=TableMap.get(tableNode),rows=[],rowCount=map.height,colCount$1=map.width;for(let rowIndex=0;rowIndex<rowCount;rowIndex++){const row=[];for(let colIndex=0;colIndex<colCount$1;colIndex++){const cellIndex=rowIndex*colCount$1+colIndex,cellPos=map.map[cellIndex];if(rowIndex>0){const topCellIndex=cellIndex-colCount$1;if(cellPos===map.map[topCellIndex]){row.push(null);continue}}if(colIndex>0){const leftCellIndex=cellIndex-1;if(cellPos===map.map[leftCellIndex]){row.push(null);continue}}row.push(tableNode.nodeAt(cellPos))}rows.push(row)}return rows}function convertArrayOfRowsToTableNode(tableNode,arrayOfNodes){const newRows=[],map=TableMap.get(tableNode),rowCount=map.height,colCount$1=map.width;for(let rowIndex=0;rowIndex<rowCount;rowIndex++){const oldRow=tableNode.child(rowIndex),newCells=[];for(let colIndex=0;colIndex<colCount$1;colIndex++){const cell=arrayOfNodes[rowIndex][colIndex];if(!cell)continue;const cellPos=map.map[rowIndex*map.width+colIndex],oldCell=tableNode.nodeAt(cellPos);if(!oldCell)continue;const newCell=oldCell.type.createChecked(cell.attrs,cell.content,cell.marks);newCells.push(newCell)}const newRow=oldRow.type.createChecked(oldRow.attrs,newCells,oldRow.marks);newRows.push(newRow)}return tableNode.type.createChecked(tableNode.attrs,newRows,tableNode.marks)}function moveRowInArrayOfRows(rows,indexesOrigin,indexesTarget,directionOverride){const direction=indexesOrigin[0]>indexesTarget[0]?-1:1,rowsExtracted=rows.splice(indexesOrigin[0],indexesOrigin.length),positionOffset=rowsExtracted.length%2==0?1:0;let target;return target=-1===directionOverride&&1===direction?indexesTarget[0]-1:1===directionOverride&&-1===direction?indexesTarget[indexesTarget.length-1]-positionOffset+1:-1===direction?indexesTarget[0]:indexesTarget[indexesTarget.length-1]-positionOffset,rows.splice(target,0,...rowsExtracted),rows}function findTable($pos){return function findParentNode(predicate,$pos){for(let depth=$pos.depth;depth>=0;depth-=1){const node=$pos.node(depth);if(predicate(node))return{node,pos:0===depth?0:$pos.before(depth),start:$pos.start(depth),depth}}return null}(node=>"table"===node.type.spec.tableRole,$pos)}function findCellPos(doc,pos){const $pos=doc.resolve(pos);return cellAround($pos)||cellNear($pos)}function getCellsInColumn(columnIndex,selection){const table=findTable(selection.$from);if(!table)return;const map=TableMap.get(table.node);return columnIndex<0||columnIndex>map.width-1?void 0:map.cellsInRect({left:columnIndex,right:columnIndex+1,top:0,bottom:map.height}).map(nodePos=>{const node=table.node.nodeAt(nodePos),pos=nodePos+table.start;return{pos,start:pos+1,node,depth:table.depth+2}})}function getCellsInRow(rowIndex,selection){const table=findTable(selection.$from);if(!table)return;const map=TableMap.get(table.node);return rowIndex<0||rowIndex>map.height-1?void 0:map.cellsInRect({left:0,right:map.width,top:rowIndex,bottom:rowIndex+1}).map(nodePos=>{const node=table.node.nodeAt(nodePos),pos=nodePos+table.start;return{pos,start:pos+1,node,depth:table.depth+2}})}function getSelectionRangeInColumn(tr,startColIndex,endColIndex=startColIndex){let startIndex=startColIndex,endIndex=endColIndex;for(let i=startColIndex;i>=0;i--){const cells=getCellsInColumn(i,tr.selection);cells&&cells.forEach(cell=>{const maybeEndIndex=cell.node.attrs.colspan+i-1;maybeEndIndex>=startIndex&&(startIndex=i),maybeEndIndex>endIndex&&(endIndex=maybeEndIndex)})}for(let i=startColIndex;i<=endIndex;i++){const cells=getCellsInColumn(i,tr.selection);cells&&cells.forEach(cell=>{const maybeEndIndex=cell.node.attrs.colspan+i-1;cell.node.attrs.colspan>1&&maybeEndIndex>endIndex&&(endIndex=maybeEndIndex)})}const indexes=[];for(let i=startIndex;i<=endIndex;i++){const maybeCells=getCellsInColumn(i,tr.selection);maybeCells&&maybeCells.length>0&&indexes.push(i)}startIndex=indexes[0],endIndex=indexes[indexes.length-1];const firstSelectedColumnCells=getCellsInColumn(startIndex,tr.selection),firstRowCells=getCellsInRow(0,tr.selection);if(!firstSelectedColumnCells||!firstRowCells)return;const $anchor=tr.doc.resolve(firstSelectedColumnCells[firstSelectedColumnCells.length-1].pos);let headCell;for(let i=endIndex;i>=startIndex;i--){const columnCells=getCellsInColumn(i,tr.selection);if(columnCells&&columnCells.length>0){for(let j=firstRowCells.length-1;j>=0;j--)if(firstRowCells[j].pos===columnCells[0].pos){headCell=columnCells[0];break}if(headCell)break}}return headCell?{$anchor,$head:tr.doc.resolve(headCell.pos),indexes}:void 0}function getSelectionRangeInRow(tr,startRowIndex,endRowIndex=startRowIndex){let startIndex=startRowIndex,endIndex=endRowIndex;for(let i=startRowIndex;i>=0;i--){const cells=getCellsInRow(i,tr.selection);cells&&cells.forEach(cell=>{const maybeEndIndex=cell.node.attrs.rowspan+i-1;maybeEndIndex>=startIndex&&(startIndex=i),maybeEndIndex>endIndex&&(endIndex=maybeEndIndex)})}for(let i=startRowIndex;i<=endIndex;i++){const cells=getCellsInRow(i,tr.selection);cells&&cells.forEach(cell=>{const maybeEndIndex=cell.node.attrs.rowspan+i-1;cell.node.attrs.rowspan>1&&maybeEndIndex>endIndex&&(endIndex=maybeEndIndex)})}const indexes=[];for(let i=startIndex;i<=endIndex;i++){const maybeCells=getCellsInRow(i,tr.selection);maybeCells&&maybeCells.length>0&&indexes.push(i)}startIndex=indexes[0],endIndex=indexes[indexes.length-1];const firstSelectedRowCells=getCellsInRow(startIndex,tr.selection),firstColumnCells=getCellsInColumn(0,tr.selection);if(!firstSelectedRowCells||!firstColumnCells)return;const $anchor=tr.doc.resolve(firstSelectedRowCells[firstSelectedRowCells.length-1].pos);let headCell;for(let i=endIndex;i>=startIndex;i--){const rowCells=getCellsInRow(i,tr.selection);if(rowCells&&rowCells.length>0){for(let j=firstColumnCells.length-1;j>=0;j--)if(firstColumnCells[j].pos===rowCells[0].pos){headCell=rowCells[0];break}if(headCell)break}}return headCell?{$anchor,$head:tr.doc.resolve(headCell.pos),indexes}:void 0}function transpose(array){return array[0].map((_,i)=>array.map(column=>column[i]))}function moveColumn(moveColParams){var _getSelectionRangeInC,_getSelectionRangeInC2;const{tr,originIndex,targetIndex,select,pos}=moveColParams,table=findTable(tr.doc.resolve(pos));if(!table)return!1;const indexesOriginColumn=null===(_getSelectionRangeInC=getSelectionRangeInColumn(tr,originIndex))||void 0===_getSelectionRangeInC?void 0:_getSelectionRangeInC.indexes,indexesTargetColumn=null===(_getSelectionRangeInC2=getSelectionRangeInColumn(tr,targetIndex))||void 0===_getSelectionRangeInC2?void 0:_getSelectionRangeInC2.indexes;if(!indexesOriginColumn||!indexesTargetColumn)return!1;if(indexesOriginColumn.includes(targetIndex))return!1;const newTable=function moveTableColumn$1(table,indexesOrigin,indexesTarget,direction){let rows=transpose(convertTableNodeToArrayOfRows(table));return rows=moveRowInArrayOfRows(rows,indexesOrigin,indexesTarget,direction),rows=transpose(rows),convertArrayOfRowsToTableNode(table,rows)}(table.node,indexesOriginColumn,indexesTargetColumn,0);if(tr.replaceWith(table.pos,table.pos+table.node.nodeSize,newTable),!select)return!0;const map=TableMap.get(newTable),start=table.start,index=targetIndex,lastCell=map.positionAt(map.height-1,index,newTable),$lastCell=tr.doc.resolve(start+lastCell),firstCell=map.positionAt(0,index,newTable),$firstCell=tr.doc.resolve(start+firstCell);return tr.setSelection(CellSelection.colSelection($lastCell,$firstCell)),!0}function moveRow(moveRowParams){var _getSelectionRangeInR,_getSelectionRangeInR2;const{tr,originIndex,targetIndex,select,pos}=moveRowParams,table=findTable(tr.doc.resolve(pos));if(!table)return!1;const indexesOriginRow=null===(_getSelectionRangeInR=getSelectionRangeInRow(tr,originIndex))||void 0===_getSelectionRangeInR?void 0:_getSelectionRangeInR.indexes,indexesTargetRow=null===(_getSelectionRangeInR2=getSelectionRangeInRow(tr,targetIndex))||void 0===_getSelectionRangeInR2?void 0:_getSelectionRangeInR2.indexes;if(!indexesOriginRow||!indexesTargetRow)return!1;if(indexesOriginRow.includes(targetIndex))return!1;const newTable=function moveTableRow$1(table,indexesOrigin,indexesTarget,direction){let rows=convertTableNodeToArrayOfRows(table);return rows=moveRowInArrayOfRows(rows,indexesOrigin,indexesTarget,direction),convertArrayOfRowsToTableNode(table,rows)}(table.node,indexesOriginRow,indexesTargetRow,0);if(tr.replaceWith(table.pos,table.pos+table.node.nodeSize,newTable),!select)return!0;const map=TableMap.get(newTable),start=table.start,index=targetIndex,lastCell=map.positionAt(index,map.width-1,newTable),$lastCell=tr.doc.resolve(start+lastCell),firstCell=map.positionAt(index,0,newTable),$firstCell=tr.doc.resolve(start+firstCell);return tr.setSelection(CellSelection.rowSelection($lastCell,$firstCell)),!0}function selectedRect(state){const sel=state.selection,$pos=selectionCell(state),table=$pos.node(-1),tableStart=$pos.start(-1),map=TableMap.get(table);return{...sel instanceof CellSelection?map.rectBetween(sel.$anchorCell.pos-tableStart,sel.$headCell.pos-tableStart):map.findCell($pos.pos-tableStart),tableStart,map,table}}function addColumn(tr,{map,tableStart,table},col){let refColumn=col>0?-1:0;columnIsHeader(map,table,col+refColumn)&&(refColumn=0==col||col==map.width?null:0);for(let row=0;row<map.height;row++){const index=row*map.width+col;if(col>0&&col<map.width&&map.map[index-1]==map.map[index]){const pos=map.map[index],cell=table.nodeAt(pos);tr.setNodeMarkup(tr.mapping.map(tableStart+pos),null,addColSpan(cell.attrs,col-map.colCount(pos))),row+=cell.attrs.rowspan-1}else{const type=null==refColumn?tableNodeTypes(table.type.schema).cell:table.nodeAt(map.map[index+refColumn]).type,pos=map.positionAt(row,col,table);tr.insert(tr.mapping.map(tableStart+pos),type.createAndFill())}}return tr}function removeColumn(tr,{map,table,tableStart},col){const mapStart=tr.mapping.maps.length;for(let row=0;row<map.height;){const index=row*map.width+col,pos=map.map[index],cell=table.nodeAt(pos),attrs=cell.attrs;if(col>0&&map.map[index-1]==pos||col<map.width-1&&map.map[index+1]==pos)tr.setNodeMarkup(tr.mapping.slice(mapStart).map(tableStart+pos),null,removeColSpan(attrs,col-map.colCount(pos)));else{const start=tr.mapping.slice(mapStart).map(tableStart+pos);tr.delete(start,start+cell.nodeSize)}row+=attrs.rowspan}}function rowIsHeader(map,table,row){var _table$nodeAt;const headerCell=tableNodeTypes(table.type.schema).header_cell;for(let col=0;col<map.width;col++)if((null===(_table$nodeAt=table.nodeAt(map.map[col+row*map.width]))||void 0===_table$nodeAt?void 0:_table$nodeAt.type)!=headerCell)return!1;return!0}function addRow(tr,{map,tableStart,table},row){let rowPos=tableStart;for(let i=0;i<row;i++)rowPos+=table.child(i).nodeSize;const cells=[];let refRow=row>0?-1:0;rowIsHeader(map,table,row+refRow)&&(refRow=0==row||row==map.height?null:0);for(let col=0,index=map.width*row;col<map.width;col++,index++)if(row>0&&row<map.height&&map.map[index]==map.map[index-map.width]){const pos=map.map[index],attrs=table.nodeAt(pos).attrs;tr.setNodeMarkup(tableStart+pos,null,{...attrs,rowspan:attrs.rowspan+1}),col+=attrs.colspan-1}else{var _table$nodeAt2;const type=null==refRow?tableNodeTypes(table.type.schema).cell:null===(_table$nodeAt2=table.nodeAt(map.map[index+refRow*map.width]))||void 0===_table$nodeAt2?void 0:_table$nodeAt2.type,node=null==type?void 0:type.createAndFill();node&&cells.push(node)}return tr.insert(rowPos,tableNodeTypes(table.type.schema).row.create(null,cells)),tr}function removeRow(tr,{map,table,tableStart},row){let rowPos=0;for(let i=0;i<row;i++)rowPos+=table.child(i).nodeSize;const nextRow=rowPos+table.child(row).nodeSize,mapFrom=tr.mapping.maps.length;tr.delete(rowPos+tableStart,nextRow+tableStart);const seen=new Set;for(let col=0,index=row*map.width;col<map.width;col++,index++){const pos=map.map[index];if(!seen.has(pos))if(seen.add(pos),row>0&&pos==map.map[index-map.width]){const attrs=table.nodeAt(pos).attrs;tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos+tableStart),null,{...attrs,rowspan:attrs.rowspan-1}),col+=attrs.colspan-1}else if(row<map.height&&pos==map.map[index+map.width]){const cell=table.nodeAt(pos),attrs=cell.attrs,copy=cell.type.create({...attrs,rowspan:cell.attrs.rowspan-1},cell.content),newPos=map.positionAt(row+1,col,table);tr.insert(tr.mapping.slice(mapFrom).map(tableStart+newPos),copy),col+=attrs.colspan-1}}}function isEmpty(cell){const c=cell.content;return 1==c.childCount&&c.child(0).isTextblock&&0==c.child(0).childCount}function splitCellWithType(getCellType){return(state,dispatch)=>{const sel=state.selection;let cellNode,cellPos;if(sel instanceof CellSelection){if(sel.$anchorCell.pos!=sel.$headCell.pos)return!1;cellNode=sel.$anchorCell.nodeAfter,cellPos=sel.$anchorCell.pos}else{var _cellAround;if(cellNode=function cellWrapping($pos){for(let d=$pos.depth;d>0;d--){const role=$pos.node(d).type.spec.tableRole;if("cell"===role||"header_cell"===role)return $pos.node(d)}return null}(sel.$from),!cellNode)return!1;cellPos=null===(_cellAround=cellAround(sel.$from))||void 0===_cellAround?void 0:_cellAround.pos}if(null==cellNode||null==cellPos)return!1;if(1==cellNode.attrs.colspan&&1==cellNode.attrs.rowspan)return!1;if(dispatch){let baseAttrs=cellNode.attrs;const attrs=[],colwidth=baseAttrs.colwidth;baseAttrs.rowspan>1&&(baseAttrs={...baseAttrs,rowspan:1}),baseAttrs.colspan>1&&(baseAttrs={...baseAttrs,colspan:1});const rect=selectedRect(state),tr=state.tr;for(let i=0;i<rect.right-rect.left;i++)attrs.push(colwidth?{...baseAttrs,colwidth:colwidth&&colwidth[i]?[colwidth[i]]:null}:baseAttrs);let lastCell;for(let row=rect.top;row<rect.bottom;row++){let pos=rect.map.positionAt(row,rect.left,rect.table);row==rect.top&&(pos+=cellNode.nodeSize);for(let col=rect.left,i=0;col<rect.right;col++,i++)col==rect.left&&row==rect.top||tr.insert(lastCell=tr.mapping.map(pos+rect.tableStart,1),getCellType({node:cellNode,row,col}).createAndFill(attrs[i]))}tr.setNodeMarkup(cellPos,getCellType({node:cellNode,row:rect.top,col:rect.left}),attrs[0]),sel instanceof CellSelection&&tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos),lastCell?tr.doc.resolve(lastCell):void 0)),dispatch(tr)}return!0}}function isHeaderEnabledByType(type,rect,types){const cellPositions=rect.map.cellsInRect({left:0,top:0,right:"row"==type?rect.map.width:1,bottom:"column"==type?rect.map.height:1});for(let i=0;i<cellPositions.length;i++){const cell=rect.table.nodeAt(cellPositions[i]);if(cell&&cell.type!==types.header_cell)return!1}return!0}function toggleHeader(type,options){return(options=options||{useDeprecatedLogic:!1}).useDeprecatedLogic?function deprecated_toggleHeader(type){return function(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const types=tableNodeTypes(state.schema),rect=selectedRect(state),tr=state.tr,cells=rect.map.cellsInRect("column"==type?{left:rect.left,top:0,right:rect.right,bottom:rect.map.height}:"row"==type?{left:0,top:rect.top,right:rect.map.width,bottom:rect.bottom}:rect),nodes=cells.map(pos=>rect.table.nodeAt(pos));for(let i=0;i<cells.length;i++)nodes[i].type==types.header_cell&&tr.setNodeMarkup(rect.tableStart+cells[i],types.cell,nodes[i].attrs);if(0===tr.steps.length)for(let i=0;i<cells.length;i++)tr.setNodeMarkup(rect.tableStart+cells[i],types.header_cell,nodes[i].attrs);dispatch(tr)}return!0}}(type):function(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const types=tableNodeTypes(state.schema),rect=selectedRect(state),tr=state.tr,isHeaderRowEnabled=isHeaderEnabledByType("row",rect,types),isHeaderColumnEnabled=isHeaderEnabledByType("column",rect,types),selectionStartsAt=("column"===type?isHeaderRowEnabled:"row"===type&&isHeaderColumnEnabled)?1:0,cellsRect="column"==type?{left:0,top:selectionStartsAt,right:1,bottom:rect.map.height}:"row"==type?{left:selectionStartsAt,top:0,right:rect.map.width,bottom:1}:rect,newType="column"==type?isHeaderColumnEnabled?types.cell:types.header_cell:"row"==type?isHeaderRowEnabled?types.cell:types.header_cell:types.cell;rect.map.cellsInRect(cellsRect).forEach(relativeCellPos=>{const cellPos=relativeCellPos+rect.tableStart,cell=tr.doc.nodeAt(cellPos);cell&&tr.setNodeMarkup(cellPos,newType,cell.attrs)}),dispatch(tr)}return!0}}const toggleHeaderRow=toggleHeader("row",{useDeprecatedLogic:!0}),toggleHeaderColumn=toggleHeader("column",{useDeprecatedLogic:!0}),toggleHeaderCell=toggleHeader("cell",{useDeprecatedLogic:!0});function deleteCellSelection(state,dispatch){const sel=state.selection;if(!(sel instanceof CellSelection))return!1;if(dispatch){const tr=state.tr,baseContent=tableNodeTypes(state.schema).cell.createAndFill().content;sel.forEachCell((cell,pos)=>{cell.content.eq(baseContent)||tr.replace(tr.mapping.map(pos+1),tr.mapping.map(pos+cell.nodeSize-1),new prosemirror_model.Slice(baseContent,0,0))}),tr.docChanged&&dispatch(tr)}return!0}function pastedCells(slice){if(0===slice.size)return null;let{content,openStart,openEnd}=slice;for(;1==content.childCount&&(openStart>0&&openEnd>0||"table"==content.child(0).type.spec.tableRole);)openStart--,openEnd--,content=content.child(0).content;const first=content.child(0),role=first.type.spec.tableRole,schema=first.type.schema,rows=[];if("row"==role)for(let i=0;i<content.childCount;i++){let cells=content.child(i).content;const left=i?0:Math.max(0,openStart-1),right=i<content.childCount-1?0:Math.max(0,openEnd-1);(left||right)&&(cells=fitSlice(tableNodeTypes(schema).row,new prosemirror_model.Slice(cells,left,right)).content),rows.push(cells)}else{if("cell"!=role&&"header_cell"!=role)return null;rows.push(openStart||openEnd?fitSlice(tableNodeTypes(schema).row,new prosemirror_model.Slice(content,openStart,openEnd)).content:content)}return function ensureRectangular(schema,rows){const widths=[];for(let i=0;i<rows.length;i++){const row=rows[i];for(let j=row.childCount-1;j>=0;j--){const{rowspan,colspan}=row.child(j).attrs;for(let r=i;r<i+rowspan;r++)widths[r]=(widths[r]||0)+colspan}}let width=0;for(let r=0;r<widths.length;r++)width=Math.max(width,widths[r]);for(let r=0;r<widths.length;r++)if(r>=rows.length&&rows.push(prosemirror_model.Fragment.empty),widths[r]<width){const empty=tableNodeTypes(schema).cell.createAndFill(),cells=[];for(let i=widths[r];i<width;i++)cells.push(empty);rows[r]=rows[r].append(prosemirror_model.Fragment.from(cells))}return{height:rows.length,width,rows}}(schema,rows)}function fitSlice(nodeType,slice){const node=nodeType.createAndFill();return new prosemirror_transform.Transform(node).replace(0,node.content.size,slice).doc}function clipCells({width,height,rows},newWidth,newHeight){if(width!=newWidth){const added=[],newRows=[];for(let row=0;row<rows.length;row++){const frag=rows[row],cells=[];for(let col=added[row]||0,i=0;col<newWidth;i++){let cell=frag.child(i%frag.childCount);col+cell.attrs.colspan>newWidth&&(cell=cell.type.createChecked(removeColSpan(cell.attrs,cell.attrs.colspan,col+cell.attrs.colspan-newWidth),cell.content)),cells.push(cell),col+=cell.attrs.colspan;for(let j=1;j<cell.attrs.rowspan;j++)added[row+j]=(added[row+j]||0)+cell.attrs.colspan}newRows.push(prosemirror_model.Fragment.from(cells))}rows=newRows,width=newWidth}if(height!=newHeight){const newRows=[];for(let row=0,i=0;row<newHeight;row++,i++){const cells=[],source=rows[i%height];for(let j=0;j<source.childCount;j++){let cell=source.child(j);row+cell.attrs.rowspan>newHeight&&(cell=cell.type.create({...cell.attrs,rowspan:Math.max(1,newHeight-cell.attrs.rowspan)},cell.content)),cells.push(cell)}newRows.push(prosemirror_model.Fragment.from(cells))}rows=newRows,height=newHeight}return{width,height,rows}}function isolateHorizontal(tr,map,table,start,left,right,top,mapFrom){if(0==top||top==map.height)return!1;let found=!1;for(let col=left;col<right;col++){const index=top*map.width+col,pos=map.map[index];if(map.map[index-map.width]==pos){found=!0;const cell=table.nodeAt(pos),{top:cellTop,left:cellLeft}=map.findCell(pos);tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos+start),null,{...cell.attrs,rowspan:top-cellTop}),tr.insert(tr.mapping.slice(mapFrom).map(map.positionAt(top,cellLeft,table)),cell.type.createAndFill({...cell.attrs,rowspan:cellTop+cell.attrs.rowspan-top})),col+=cell.attrs.colspan-1}}return found}function isolateVertical(tr,map,table,start,top,bottom,left,mapFrom){if(0==left||left==map.width)return!1;let found=!1;for(let row=top;row<bottom;row++){const index=row*map.width+left,pos=map.map[index];if(map.map[index-1]==pos){found=!0;const cell=table.nodeAt(pos),cellLeft=map.colCount(pos),updatePos=tr.mapping.slice(mapFrom).map(pos+start);tr.setNodeMarkup(updatePos,null,removeColSpan(cell.attrs,left-cellLeft,cell.attrs.colspan-(left-cellLeft))),tr.insert(updatePos+cell.nodeSize,cell.type.createAndFill(removeColSpan(cell.attrs,0,left-cellLeft))),row+=cell.attrs.rowspan-1}}return found}function insertCells(state,dispatch,tableStart,rect,cells){let table=tableStart?state.doc.nodeAt(tableStart-1):state.doc;if(!table)throw new Error("No table found");let map=TableMap.get(table);const{top,left}=rect,right=left+cells.width,bottom=top+cells.height,tr=state.tr;let mapFrom=0;function recomp(){if(table=tableStart?tr.doc.nodeAt(tableStart-1):tr.doc,!table)throw new Error("No table found");map=TableMap.get(table),mapFrom=tr.mapping.maps.length}(function growTable(tr,map,table,start,width,height,mapFrom){const types=tableNodeTypes(tr.doc.type.schema);let empty,emptyHead;if(width>map.width)for(let row=0,rowEnd=0;row<map.height;row++){const rowNode=table.child(row);rowEnd+=rowNode.nodeSize;const cells=[];let add;add=null==rowNode.lastChild||rowNode.lastChild.type==types.cell?empty||(empty=types.cell.createAndFill()):emptyHead||(emptyHead=types.header_cell.createAndFill());for(let i=map.width;i<width;i++)cells.push(add);tr.insert(tr.mapping.slice(mapFrom).map(rowEnd-1+start),cells)}if(height>map.height){const cells=[];for(let i=0,start$1=(map.height-1)*map.width;i<Math.max(map.width,width);i++){const header=!(i>=map.width)&&table.nodeAt(map.map[start$1+i]).type==types.header_cell;cells.push(header?emptyHead||(emptyHead=types.header_cell.createAndFill()):empty||(empty=types.cell.createAndFill()))}const emptyRow=types.row.create(null,prosemirror_model.Fragment.from(cells)),rows=[];for(let i=map.height;i<height;i++)rows.push(emptyRow);tr.insert(tr.mapping.slice(mapFrom).map(start+table.nodeSize-2),rows)}return!(!empty&&!emptyHead)})(tr,map,table,tableStart,right,bottom,mapFrom)&&recomp(),isolateHorizontal(tr,map,table,tableStart,left,right,top,mapFrom)&&recomp(),isolateHorizontal(tr,map,table,tableStart,left,right,bottom,mapFrom)&&recomp(),isolateVertical(tr,map,table,tableStart,top,bottom,left,mapFrom)&&recomp(),isolateVertical(tr,map,table,tableStart,top,bottom,right,mapFrom)&&recomp();for(let row=top;row<bottom;row++){const from=map.positionAt(row,left,table),to=map.positionAt(row,right,table);tr.replace(tr.mapping.slice(mapFrom).map(from+tableStart),tr.mapping.slice(mapFrom).map(to+tableStart),new prosemirror_model.Slice(cells.rows[row-top],0,0))}recomp(),tr.setSelection(new CellSelection(tr.doc.resolve(tableStart+map.positionAt(top,left,table)),tr.doc.resolve(tableStart+map.positionAt(bottom-1,right-1,table)))),dispatch(tr)}const handleKeyDown=(0,prosemirror_keymap.keydownHandler)({ArrowLeft:arrow("horiz",-1),ArrowRight:arrow("horiz",1),ArrowUp:arrow("vert",-1),ArrowDown:arrow("vert",1),"Shift-ArrowLeft":shiftArrow("horiz",-1),"Shift-ArrowRight":shiftArrow("horiz",1),"Shift-ArrowUp":shiftArrow("vert",-1),"Shift-ArrowDown":shiftArrow("vert",1),Backspace:deleteCellSelection,"Mod-Backspace":deleteCellSelection,Delete:deleteCellSelection,"Mod-Delete":deleteCellSelection});function maybeSetSelection(state,dispatch,selection){return!selection.eq(state.selection)&&(dispatch&&dispatch(state.tr.setSelection(selection).scrollIntoView()),!0)}function arrow(axis,dir){return(state,dispatch,view)=>{if(!view)return!1;const sel=state.selection;if(sel instanceof CellSelection)return maybeSetSelection(state,dispatch,prosemirror_state.Selection.near(sel.$headCell,dir));if("horiz"!=axis&&!sel.empty)return!1;const end=atEndOfCell(view,axis,dir);if(null==end)return!1;if("horiz"==axis)return maybeSetSelection(state,dispatch,prosemirror_state.Selection.near(state.doc.resolve(sel.head+dir),dir));{const $cell=state.doc.resolve(end),$next=nextCell($cell,axis,dir);let newSel;return newSel=$next?prosemirror_state.Selection.near($next,1):dir<0?prosemirror_state.Selection.near(state.doc.resolve($cell.before(-1)),-1):prosemirror_state.Selection.near(state.doc.resolve($cell.after(-1)),1),maybeSetSelection(state,dispatch,newSel)}}}function shiftArrow(axis,dir){return(state,dispatch,view)=>{if(!view)return!1;const sel=state.selection;let cellSel;if(sel instanceof CellSelection)cellSel=sel;else{const end=atEndOfCell(view,axis,dir);if(null==end)return!1;cellSel=new CellSelection(state.doc.resolve(end))}const $head=nextCell(cellSel.$headCell,axis,dir);return!!$head&&maybeSetSelection(state,dispatch,new CellSelection(cellSel.$anchorCell,$head))}}function handleTripleClick(view,pos){const $cell=cellAround(view.state.doc.resolve(pos));return!!$cell&&(view.dispatch(view.state.tr.setSelection(new CellSelection($cell))),!0)}function handlePaste(view,_,slice){if(!isInTable(view.state))return!1;let cells=pastedCells(slice);const sel=view.state.selection;if(sel instanceof CellSelection){cells||(cells={width:1,height:1,rows:[prosemirror_model.Fragment.from(fitSlice(tableNodeTypes(view.state.schema).cell,slice))]});const table=sel.$anchorCell.node(-1),start=sel.$anchorCell.start(-1),rect=TableMap.get(table).rectBetween(sel.$anchorCell.pos-start,sel.$headCell.pos-start);return cells=clipCells(cells,rect.right-rect.left,rect.bottom-rect.top),insertCells(view.state,view.dispatch,start,rect,cells),!0}if(cells){const $cell=selectionCell(view.state),start=$cell.start(-1);return insertCells(view.state,view.dispatch,start,TableMap.get($cell.node(-1)).findCell($cell.pos-start),cells),!0}return!1}function handleMouseDown$1(view,startEvent){var _cellUnderMouse;if(0!=startEvent.button)return;if(startEvent.ctrlKey||startEvent.metaKey)return;const startDOMCell=domInCell(view,startEvent.target);let $anchor;if(startEvent.shiftKey&&view.state.selection instanceof CellSelection)setCellSelection(view.state.selection.$anchorCell,startEvent),startEvent.preventDefault();else if(startEvent.shiftKey&&startDOMCell&&null!=($anchor=cellAround(view.state.selection.$anchor))&&(null===(_cellUnderMouse=cellUnderMouse(view,startEvent))||void 0===_cellUnderMouse?void 0:_cellUnderMouse.pos)!=$anchor.pos)setCellSelection($anchor,startEvent),startEvent.preventDefault();else if(!startDOMCell)return;function setCellSelection($anchor$1,event){let $head=cellUnderMouse(view,event);const starting=null==tableEditingKey.getState(view.state);if(!$head||!inSameTable($anchor$1,$head)){if(!starting)return;$head=$anchor$1}const selection=new CellSelection($anchor$1,$head);if(starting||!view.state.selection.eq(selection)){const tr=view.state.tr.setSelection(selection);starting&&tr.setMeta(tableEditingKey,$anchor$1.pos),view.dispatch(tr)}}function stop(){view.root.removeEventListener("mouseup",stop),view.root.removeEventListener("dragstart",stop),view.root.removeEventListener("mousemove",move),null!=tableEditingKey.getState(view.state)&&view.dispatch(view.state.tr.setMeta(tableEditingKey,-1))}function move(_event){const event=_event,anchor=tableEditingKey.getState(view.state);let $anchor$1;if(null!=anchor)$anchor$1=view.state.doc.resolve(anchor);else if(domInCell(view,event.target)!=startDOMCell&&($anchor$1=cellUnderMouse(view,startEvent),!$anchor$1))return stop();$anchor$1&&setCellSelection($anchor$1,event)}view.root.addEventListener("mouseup",stop),view.root.addEventListener("dragstart",stop),view.root.addEventListener("mousemove",move)}function atEndOfCell(view,axis,dir){if(!(view.state.selection instanceof prosemirror_state.TextSelection))return null;const{$head}=view.state.selection;for(let d=$head.depth-1;d>=0;d--){const parent=$head.node(d);if((dir<0?$head.index(d):$head.indexAfter(d))!=(dir<0?0:parent.childCount))return null;if("cell"==parent.type.spec.tableRole||"header_cell"==parent.type.spec.tableRole){const cellPos=$head.before(d),dirStr="vert"==axis?dir>0?"down":"up":dir>0?"right":"left";return view.endOfTextblock(dirStr)?cellPos:null}}return null}function domInCell(view,dom){for(;dom&&dom!=view.dom;dom=dom.parentNode)if("TD"==dom.nodeName||"TH"==dom.nodeName)return dom;return null}function cellUnderMouse(view,event){const mousePos=view.posAtCoords({left:event.clientX,top:event.clientY});if(!mousePos)return null;let{inside,pos}=mousePos;return inside>=0&&cellAround(view.state.doc.resolve(inside))||cellAround(view.state.doc.resolve(pos))}var TableView=class{constructor(node,defaultCellMinWidth){this.node=node,this.defaultCellMinWidth=defaultCellMinWidth,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",`${defaultCellMinWidth}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),updateColumnsOnResize(node,this.colgroup,this.table,defaultCellMinWidth),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(node){return node.type==this.node.type&&(this.node=node,updateColumnsOnResize(node,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(record){return"attributes"==record.type&&(record.target==this.table||this.colgroup.contains(record.target))}};function updateColumnsOnResize(node,colgroup,table,defaultCellMinWidth,overrideCol,overrideValue){let totalWidth=0,fixedWidth=!0,nextDOM=colgroup.firstChild;const row=node.firstChild;if(row){for(let i=0,col=0;i<row.childCount;i++){const{colspan,colwidth}=row.child(i).attrs;for(let j=0;j<colspan;j++,col++){const hasWidth=overrideCol==col?overrideValue:colwidth&&colwidth[j],cssWidth=hasWidth?hasWidth+"px":"";if(totalWidth+=hasWidth||defaultCellMinWidth,hasWidth||(fixedWidth=!1),nextDOM)nextDOM.style.width!=cssWidth&&(nextDOM.style.width=cssWidth),nextDOM=nextDOM.nextSibling;else{const col$1=document.createElement("col");col$1.style.width=cssWidth,colgroup.appendChild(col$1)}}}for(;nextDOM;){var _nextDOM$parentNode;const after=nextDOM.nextSibling;null===(_nextDOM$parentNode=nextDOM.parentNode)||void 0===_nextDOM$parentNode||_nextDOM$parentNode.removeChild(nextDOM),nextDOM=after}fixedWidth?(table.style.width=totalWidth+"px",table.style.minWidth=""):(table.style.width="",table.style.minWidth=totalWidth+"px")}}const columnResizingPluginKey=new prosemirror_state.PluginKey("tableColumnResizing");var ResizeState=class ResizeState{constructor(activeHandle,dragging){this.activeHandle=activeHandle,this.dragging=dragging}apply(tr){const state=this,action=tr.getMeta(columnResizingPluginKey);if(action&&null!=action.setHandle)return new ResizeState(action.setHandle,!1);if(action&&void 0!==action.setDragging)return new ResizeState(state.activeHandle,action.setDragging);if(state.activeHandle>-1&&tr.docChanged){let handle=tr.mapping.map(state.activeHandle,-1);return pointsAtCell(tr.doc.resolve(handle))||(handle=-1),new ResizeState(handle,state.dragging)}return state}};function edgeCell(view,event,side,handleWidth){const offset="right"==side?-handleWidth:handleWidth,found=view.posAtCoords({left:event.clientX+offset,top:event.clientY});if(!found)return-1;const{pos}=found,$cell=cellAround(view.state.doc.resolve(pos));if(!$cell)return-1;if("right"==side)return $cell.pos;const map=TableMap.get($cell.node(-1)),start=$cell.start(-1),index=map.map.indexOf($cell.pos-start);return index%map.width==0?-1:start+map.map[index-1]}function draggedWidth(dragging,event,resizeMinWidth){const offset=event.clientX-dragging.startX;return Math.max(resizeMinWidth,dragging.startWidth+offset)}function updateHandle(view,value){view.dispatch(view.state.tr.setMeta(columnResizingPluginKey,{setHandle:value}))}function displayColumnWidth(view,cell,width,defaultCellMinWidth){const $cell=view.state.doc.resolve(cell),table=$cell.node(-1),start=$cell.start(-1),col=TableMap.get(table).colCount($cell.pos-start)+$cell.nodeAfter.attrs.colspan-1;let dom=view.domAtPos($cell.start(-1)).node;for(;dom&&"TABLE"!=dom.nodeName;)dom=dom.parentNode;dom&&updateColumnsOnResize(table,dom.firstChild,dom,defaultCellMinWidth,col,width)}function zeroes(n){return Array(n).fill(0)}exports.CellBookmark=CellBookmark,exports.CellSelection=CellSelection,exports.ResizeState=ResizeState,exports.TableMap=TableMap,exports.TableView=TableView,exports.__clipCells=clipCells,exports.__insertCells=insertCells,exports.__pastedCells=pastedCells,exports.addColSpan=addColSpan,exports.addColumn=addColumn,exports.addColumnAfter=function addColumnAfter(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state);dispatch(addColumn(state.tr,rect,rect.right))}return!0},exports.addColumnBefore=function addColumnBefore(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state);dispatch(addColumn(state.tr,rect,rect.left))}return!0},exports.addRow=addRow,exports.addRowAfter=function addRowAfter(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state);dispatch(addRow(state.tr,rect,rect.bottom))}return!0},exports.addRowBefore=function addRowBefore(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state);dispatch(addRow(state.tr,rect,rect.top))}return!0},exports.cellAround=cellAround,exports.cellNear=cellNear,exports.colCount=function colCount($pos){return TableMap.get($pos.node(-1)).colCount($pos.pos-$pos.start(-1))},exports.columnIsHeader=columnIsHeader,exports.columnResizing=function columnResizing({handleWidth=5,cellMinWidth=25,defaultCellMinWidth=100,View=TableView,lastColumnResizable=!0}={}){const plugin=new prosemirror_state.Plugin({key:columnResizingPluginKey,state:{init(_,state){var _plugin$spec;const nodeViews=null===(_plugin$spec=plugin.spec)||void 0===_plugin$spec||null===(_plugin$spec=_plugin$spec.props)||void 0===_plugin$spec?void 0:_plugin$spec.nodeViews,tableName=tableNodeTypes(state.schema).table.name;return View&&nodeViews&&(nodeViews[tableName]=(node,view)=>new View(node,defaultCellMinWidth,view)),new ResizeState(-1,!1)},apply:(tr,prev)=>prev.apply(tr)},props:{attributes:state=>{const pluginState=columnResizingPluginKey.getState(state);return pluginState&&pluginState.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(view,event)=>{!function handleMouseMove(view,event,handleWidth,lastColumnResizable){if(!view.editable)return;const pluginState=columnResizingPluginKey.getState(view.state);if(!pluginState)return;if(!pluginState.dragging){const target=function domCellAround(target){for(;target&&"TD"!=target.nodeName&&"TH"!=target.nodeName;)target=target.classList&&target.classList.contains("ProseMirror")?null:target.parentNode;return target}(event.target);let cell=-1;if(target){const{left,right}=target.getBoundingClientRect();event.clientX-left<=handleWidth?cell=edgeCell(view,event,"left",handleWidth):right-event.clientX<=handleWidth&&(cell=edgeCell(view,event,"right",handleWidth))}if(cell!=pluginState.activeHandle){if(!lastColumnResizable&&-1!==cell){const $cell=view.state.doc.resolve(cell),table=$cell.node(-1),map=TableMap.get(table),tableStart=$cell.start(-1);if(map.colCount($cell.pos-tableStart)+$cell.nodeAfter.attrs.colspan-1==map.width-1)return}updateHandle(view,cell)}}}(view,event,handleWidth,lastColumnResizable)},mouseleave:view=>{!function handleMouseLeave(view){if(!view.editable)return;const pluginState=columnResizingPluginKey.getState(view.state);pluginState&&pluginState.activeHandle>-1&&!pluginState.dragging&&updateHandle(view,-1)}(view)},mousedown:(view,event)=>{!function handleMouseDown(view,event,cellMinWidth,defaultCellMinWidth){var _view$dom$ownerDocume;if(!view.editable)return!1;const win=null!==(_view$dom$ownerDocume=view.dom.ownerDocument.defaultView)&&void 0!==_view$dom$ownerDocume?_view$dom$ownerDocume:window,pluginState=columnResizingPluginKey.getState(view.state);if(!pluginState||-1==pluginState.activeHandle||pluginState.dragging)return!1;const cell=view.state.doc.nodeAt(pluginState.activeHandle),width=function currentColWidth(view,cellPos,{colspan,colwidth}){const width=colwidth&&colwidth[colwidth.length-1];if(width)return width;const dom=view.domAtPos(cellPos);let domWidth=dom.node.childNodes[dom.offset].offsetWidth,parts=colspan;if(colwidth)for(let i=0;i<colspan;i++)colwidth[i]&&(domWidth-=colwidth[i],parts--);return domWidth/parts}(view,pluginState.activeHandle,cell.attrs);function finish(event$1){win.removeEventListener("mouseup",finish),win.removeEventListener("mousemove",move);const pluginState$1=columnResizingPluginKey.getState(view.state);(null==pluginState$1?void 0:pluginState$1.dragging)&&(!function updateColumnWidth(view,cell,width){const $cell=view.state.doc.resolve(cell),table=$cell.node(-1),map=TableMap.get(table),start=$cell.start(-1),col=map.colCount($cell.pos-start)+$cell.nodeAfter.attrs.colspan-1,tr=view.state.tr;for(let row=0;row<map.height;row++){const mapIndex=row*map.width+col;if(row&&map.map[mapIndex]==map.map[mapIndex-map.width])continue;const pos=map.map[mapIndex],attrs=table.nodeAt(pos).attrs,index=1==attrs.colspan?0:col-map.colCount(pos);if(attrs.colwidth&&attrs.colwidth[index]==width)continue;const colwidth=attrs.colwidth?attrs.colwidth.slice():zeroes(attrs.colspan);colwidth[index]=width,tr.setNodeMarkup(start+pos,null,{...attrs,colwidth})}tr.docChanged&&view.dispatch(tr)}(view,pluginState$1.activeHandle,draggedWidth(pluginState$1.dragging,event$1,cellMinWidth)),view.dispatch(view.state.tr.setMeta(columnResizingPluginKey,{setDragging:null})))}function move(event$1){if(!event$1.which)return finish(event$1);const pluginState$1=columnResizingPluginKey.getState(view.state);if(pluginState$1&&pluginState$1.dragging){const dragged=draggedWidth(pluginState$1.dragging,event$1,cellMinWidth);displayColumnWidth(view,pluginState$1.activeHandle,dragged,defaultCellMinWidth)}}return view.dispatch(view.state.tr.setMeta(columnResizingPluginKey,{setDragging:{startX:event.clientX,startWidth:width}})),displayColumnWidth(view,pluginState.activeHandle,width,defaultCellMinWidth),win.addEventListener("mouseup",finish),win.addEventListener("mousemove",move),event.preventDefault(),!0}(view,event,cellMinWidth,defaultCellMinWidth)}},decorations:state=>{const pluginState=columnResizingPluginKey.getState(state);if(pluginState&&pluginState.activeHandle>-1)return function handleDecorations(state,cell){const decorations=[],$cell=state.doc.resolve(cell),table=$cell.node(-1);if(!table)return prosemirror_view.DecorationSet.empty;const map=TableMap.get(table),start=$cell.start(-1),col=map.colCount($cell.pos-start)+$cell.nodeAfter.attrs.colspan-1;for(let row=0;row<map.height;row++){const index=col+row*map.width;if(!(col!=map.width-1&&map.map[index]==map.map[index+1]||0!=row&&map.map[index]==map.map[index-map.width])){var _columnResizingPlugin;const cellPos=map.map[index],pos=start+cellPos+table.nodeAt(cellPos).nodeSize-1,dom=document.createElement("div");dom.className="column-resize-handle",(null===(_columnResizingPlugin=columnResizingPluginKey.getState(state))||void 0===_columnResizingPlugin?void 0:_columnResizingPlugin.dragging)&&decorations.push(prosemirror_view.Decoration.node(start+cellPos,start+cellPos+table.nodeAt(cellPos).nodeSize,{class:"column-resize-dragging"})),decorations.push(prosemirror_view.Decoration.widget(pos,dom))}}return prosemirror_view.DecorationSet.create(state.doc,decorations)}(state,pluginState.activeHandle)},nodeViews:{}}});return plugin},exports.columnResizingPluginKey=columnResizingPluginKey,exports.deleteCellSelection=deleteCellSelection,exports.deleteColumn=function deleteColumn(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state),tr=state.tr;if(0==rect.left&&rect.right==rect.map.width)return!1;for(let i=rect.right-1;removeColumn(tr,rect,i),i!=rect.left;i--){const table=rect.tableStart?tr.doc.nodeAt(rect.tableStart-1):tr.doc;if(!table)throw new RangeError("No table found");rect.table=table,rect.map=TableMap.get(table)}dispatch(tr)}return!0},exports.deleteRow=function deleteRow(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state),tr=state.tr;if(0==rect.top&&rect.bottom==rect.map.height)return!1;for(let i=rect.bottom-1;removeRow(tr,rect,i),i!=rect.top;i--){const table=rect.tableStart?tr.doc.nodeAt(rect.tableStart-1):tr.doc;if(!table)throw new RangeError("No table found");rect.table=table,rect.map=TableMap.get(rect.table)}dispatch(tr)}return!0},exports.deleteTable=function deleteTable(state,dispatch){const $pos=state.selection.$anchor;for(let d=$pos.depth;d>0;d--)if("table"==$pos.node(d).type.spec.tableRole)return dispatch&&dispatch(state.tr.delete($pos.before(d),$pos.after(d)).scrollIntoView()),!0;return!1},exports.findCell=function findCell($pos){return TableMap.get($pos.node(-1)).findCell($pos.pos-$pos.start(-1))},exports.findCellPos=findCellPos,exports.findCellRange=function findCellRange(selection,anchorHit,headHit){var _ref,_ref2;if(null==anchorHit&&null==headHit&&function isCellSelection(value){return value instanceof CellSelection}(selection))return[selection.$anchorCell,selection.$headCell];const anchor=null!==(_ref=null!=anchorHit?anchorHit:headHit)&&void 0!==_ref?_ref:selection.anchor,head=null!==(_ref2=null!=headHit?headHit:anchorHit)&&void 0!==_ref2?_ref2:selection.head,doc=selection.$head.doc,$anchorCell=findCellPos(doc,anchor),$headCell=findCellPos(doc,head);return $anchorCell&&$headCell&&inSameTable($anchorCell,$headCell)?[$anchorCell,$headCell]:null},exports.findTable=findTable,exports.fixTables=fixTables,exports.fixTablesKey=fixTablesKey,exports.goToNextCell=function goToNextCell(direction){return function(state,dispatch){if(!isInTable(state))return!1;const cell=function findNextCell($cell,dir){if(dir<0){const before=$cell.nodeBefore;if(before)return $cell.pos-before.nodeSize;for(let row=$cell.index(-1)-1,rowEnd=$cell.before();row>=0;row--){const rowNode=$cell.node(-1).child(row),lastChild=rowNode.lastChild;if(lastChild)return rowEnd-1-lastChild.nodeSize;rowEnd-=rowNode.nodeSize}}else{if($cell.index()<$cell.parent.childCount-1)return $cell.pos+$cell.nodeAfter.nodeSize;const table=$cell.node(-1);for(let row=$cell.indexAfter(-1),rowStart=$cell.after();row<table.childCount;row++){const rowNode=table.child(row);if(rowNode.childCount)return rowStart+1;rowStart+=rowNode.nodeSize}}return null}(selectionCell(state),direction);if(null==cell)return!1;if(dispatch){const $cell=state.doc.resolve(cell);dispatch(state.tr.setSelection(prosemirror_state.TextSelection.between($cell,moveCellForward($cell))).scrollIntoView())}return!0}},exports.handlePaste=handlePaste,exports.inSameTable=inSameTable,exports.isInTable=isInTable,exports.mergeCells=function mergeCells(state,dispatch){const sel=state.selection;if(!(sel instanceof CellSelection)||sel.$anchorCell.pos==sel.$headCell.pos)return!1;const rect=selectedRect(state),{map}=rect;if(function cellsOverlapRectangle({width,height,map},rect){let indexTop=rect.top*width+rect.left,indexLeft=indexTop,indexBottom=(rect.bottom-1)*width+rect.left,indexRight=indexTop+(rect.right-rect.left-1);for(let i=rect.top;i<rect.bottom;i++){if(rect.left>0&&map[indexLeft]==map[indexLeft-1]||rect.right<width&&map[indexRight]==map[indexRight+1])return!0;indexLeft+=width,indexRight+=width}for(let i=rect.left;i<rect.right;i++){if(rect.top>0&&map[indexTop]==map[indexTop-width]||rect.bottom<height&&map[indexBottom]==map[indexBottom+width])return!0;indexTop++,indexBottom++}return!1}(map,rect))return!1;if(dispatch){const tr=state.tr,seen={};let mergedPos,mergedCell,content=prosemirror_model.Fragment.empty;for(let row=rect.top;row<rect.bottom;row++)for(let col=rect.left;col<rect.right;col++){const cellPos=map.map[row*map.width+col],cell=rect.table.nodeAt(cellPos);if(!seen[cellPos]&&cell)if(seen[cellPos]=!0,null==mergedPos)mergedPos=cellPos,mergedCell=cell;else{isEmpty(cell)||(content=content.append(cell.content));const mapped=tr.mapping.map(cellPos+rect.tableStart);tr.delete(mapped,mapped+cell.nodeSize)}}if(null==mergedPos||null==mergedCell)return!0;if(tr.setNodeMarkup(mergedPos+rect.tableStart,null,{...addColSpan(mergedCell.attrs,mergedCell.attrs.colspan,rect.right-rect.left-mergedCell.attrs.colspan),rowspan:rect.bottom-rect.top}),content.size>0){const end=mergedPos+1+mergedCell.content.size,start=isEmpty(mergedCell)?mergedPos+1:end;tr.replaceWith(start+rect.tableStart,end+rect.tableStart,content)}tr.setSelection(new CellSelection(tr.doc.resolve(mergedPos+rect.tableStart))),dispatch(tr)}return!0},exports.moveCellForward=moveCellForward,exports.moveTableColumn=function moveTableColumn(options){return(state,dispatch)=>{const{from:originIndex,to:targetIndex,select=!0,pos=state.selection.from}=options,tr=state.tr;return!!moveColumn({tr,originIndex,targetIndex,select,pos})&&(null==dispatch||dispatch(tr),!0)}},exports.moveTableRow=function moveTableRow(options){return(state,dispatch)=>{const{from:originIndex,to:targetIndex,select=!0,pos=state.selection.from}=options,tr=state.tr;return!!moveRow({tr,originIndex,targetIndex,select,pos})&&(null==dispatch||dispatch(tr),!0)}},exports.nextCell=nextCell,exports.pointsAtCell=pointsAtCell,exports.removeColSpan=removeColSpan,exports.removeColumn=removeColumn,exports.removeRow=removeRow,exports.rowIsHeader=rowIsHeader,exports.selectedRect=selectedRect,exports.selectionCell=selectionCell,exports.setCellAttr=function setCellAttr(name,value){return function(state,dispatch){if(!isInTable(state))return!1;const $cell=selectionCell(state);if($cell.nodeAfter.attrs[name]===value)return!1;if(dispatch){const tr=state.tr;state.selection instanceof CellSelection?state.selection.forEachCell((node,pos)=>{node.attrs[name]!==value&&tr.setNodeMarkup(pos,null,{...node.attrs,[name]:value})}):tr.setNodeMarkup($cell.pos,null,{...$cell.nodeAfter.attrs,[name]:value}),dispatch(tr)}return!0}},exports.splitCell=function splitCell(state,dispatch){const nodeTypes=tableNodeTypes(state.schema);return splitCellWithType(({node})=>nodeTypes[node.type.spec.tableRole])(state,dispatch)},exports.splitCellWithType=splitCellWithType,exports.tableEditing=function tableEditing({allowTableNodeSelection=!1}={}){return new prosemirror_state.Plugin({key:tableEditingKey,state:{init:()=>null,apply(tr,cur){const set=tr.getMeta(tableEditingKey);if(null!=set)return-1==set?null:set;if(null==cur||!tr.docChanged)return cur;const{deleted,pos}=tr.mapping.mapResult(cur);return deleted?null:pos}},props:{decorations:drawCellSelection,handleDOMEvents:{mousedown:handleMouseDown$1},createSelectionBetween:view=>null!=tableEditingKey.getState(view.state)?view.state.selection:null,handleTripleClick,handleKeyDown,handlePaste},appendTransaction:(_,oldState,state)=>function normalizeSelection(state,tr,allowTableNodeSelection){const sel=(tr||state).selection,doc=(tr||state).doc;let normalize,role;if(sel instanceof prosemirror_state.NodeSelection&&(role=sel.node.type.spec.tableRole)){if("cell"==role||"header_cell"==role)normalize=CellSelection.create(doc,sel.from);else if("row"==role){const $cell=doc.resolve(sel.from+1);normalize=CellSelection.rowSelection($cell,$cell)}else if(!allowTableNodeSelection){const map=TableMap.get(sel.node),start=sel.from+1,lastCell=start+map.map[map.width*map.height-1];normalize=CellSelection.create(doc,start+1,lastCell)}}else sel instanceof prosemirror_state.TextSelection&&function isCellBoundarySelection({$from,$to}){if($from.pos==$to.pos||$from.pos<$to.pos-6)return!1;let afterFrom=$from.pos,beforeTo=$to.pos,depth=$from.depth;for(;depth>=0&&!($from.after(depth+1)<$from.end(depth));depth--,afterFrom++);for(let d=$to.depth;d>=0&&!($to.before(d+1)>$to.start(d));d--,beforeTo--);return afterFrom==beforeTo&&/row|table/.test($from.node(depth).type.spec.tableRole)}(sel)?normalize=prosemirror_state.TextSelection.create(doc,sel.from):sel instanceof prosemirror_state.TextSelection&&function isTextSelectionAcrossCells({$from,$to}){let fromCellBoundaryNode,toCellBoundaryNode;for(let i=$from.depth;i>0;i--){const node=$from.node(i);if("cell"===node.type.spec.tableRole||"header_cell"===node.type.spec.tableRole){fromCellBoundaryNode=node;break}}for(let i=$to.depth;i>0;i--){const node=$to.node(i);if("cell"===node.type.spec.tableRole||"header_cell"===node.type.spec.tableRole){toCellBoundaryNode=node;break}}return fromCellBoundaryNode!==toCellBoundaryNode&&0===$to.parentOffset}(sel)&&(normalize=prosemirror_state.TextSelection.create(doc,sel.$from.start(),sel.$from.end()));return normalize&&(tr||(tr=state.tr)).setSelection(normalize),tr}(state,fixTables(state,oldState),allowTableNodeSelection)})},exports.tableEditingKey=tableEditingKey,exports.tableNodeTypes=tableNodeTypes,exports.tableNodes=function tableNodes(options){const extraAttrs=options.cellAttributes||{},cellAttrs={colspan:{default:1,validate:"number"},rowspan:{default:1,validate:"number"},colwidth:{default:null,validate:validateColwidth}};for(const prop in extraAttrs)cellAttrs[prop]={default:extraAttrs[prop].default,validate:extraAttrs[prop].validate};return{table:{content:"table_row+",tableRole:"table",isolating:!0,group:options.tableGroup,parseDOM:[{tag:"table"}],toDOM:()=>["table",["tbody",0]]},table_row:{content:"(table_cell | table_header)*",tableRole:"row",parseDOM:[{tag:"tr"}],toDOM:()=>["tr",0]},table_cell:{content:options.cellContent,attrs:cellAttrs,tableRole:"cell",isolating:!0,parseDOM:[{tag:"td",getAttrs:dom=>getCellAttrs(dom,extraAttrs)}],toDOM:node=>["td",setCellAttrs(node,extraAttrs),0]},table_header:{content:options.cellContent,attrs:cellAttrs,tableRole:"header_cell",isolating:!0,parseDOM:[{tag:"th",getAttrs:dom=>getCellAttrs(dom,extraAttrs)}],toDOM:node=>["th",setCellAttrs(node,extraAttrs),0]}}},exports.toggleHeader=toggleHeader,exports.toggleHeaderCell=toggleHeaderCell,exports.toggleHeaderColumn=toggleHeaderColumn,exports.toggleHeaderRow=toggleHeaderRow,exports.updateColumnsOnResize=updateColumnsOnResize},"./node_modules/prosemirror-transform/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";function _wrapNativeSuper(Class){var _cache="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function _wrapNativeSuper(Class){if(null===Class||!function _isNativeFunction(fn){try{return-1!==Function.toString.call(fn).indexOf("[native code]")}catch(e){return"function"==typeof fn}}(Class))return Class;if("function"!=typeof Class)throw new TypeError("Super expression must either be null or a function");if(void 0!==_cache){if(_cache.has(Class))return _cache.get(Class);_cache.set(Class,Wrapper)}function Wrapper(){return _construct(Class,arguments,_getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(Class.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(Wrapper,Class)},_wrapNativeSuper(Class)}function _construct(Parent,args,Class){return _construct=_isNativeReflectConstruct()?Reflect.construct.bind():function _construct(Parent,args,Class){var a=[null];a.push.apply(a,args);var instance=new(Function.bind.apply(Parent,a));return Class&&_setPrototypeOf(instance,Class.prototype),instance},_construct.apply(null,arguments)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return function _possibleConstructorReturn(self,call){if(call&&("object"===_typeof(call)||"function"==typeof call))return call;if(void 0!==call)throw new TypeError("Derived constructors may only return object or undefined");return function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}(self)}(this,result)}}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===_typeof(key)?key:String(key)}var prosemirrorModel=__webpack_require__("./node_modules/prosemirror-model/dist/index.cjs"),factor16=Math.pow(2,16);function makeRecover(index,offset){return index+offset*factor16}function recoverIndex(value){return 65535&value}var MapResult=function(){function MapResult(pos,delInfo,recover){_classCallCheck(this,MapResult),this.pos=pos,this.delInfo=delInfo,this.recover=recover}return _createClass(MapResult,[{key:"deleted",get:function get(){return(8&this.delInfo)>0}},{key:"deletedBefore",get:function get(){return(5&this.delInfo)>0}},{key:"deletedAfter",get:function get(){return(6&this.delInfo)>0}},{key:"deletedAcross",get:function get(){return(4&this.delInfo)>0}}]),MapResult}(),StepMap=function(){function StepMap(ranges){var inverted=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(_classCallCheck(this,StepMap),this.ranges=ranges,this.inverted=inverted,!ranges.length&&StepMap.empty)return StepMap.empty}return _createClass(StepMap,[{key:"recover",value:function recover(value){var diff=0,index=recoverIndex(value);if(!this.inverted)for(var i=0;i<index;i++)diff+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*index]+diff+function recoverOffset(value){return(value-(65535&value))/factor16}(value)}},{key:"mapResult",value:function mapResult(pos){var assoc=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(pos,assoc,!1)}},{key:"map",value:function map(pos){var assoc=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(pos,assoc,!0)}},{key:"_map",value:function _map(pos,assoc,simple){for(var diff=0,oldIndex=this.inverted?2:1,newIndex=this.inverted?1:2,i=0;i<this.ranges.length;i+=3){var start=this.ranges[i]-(this.inverted?diff:0);if(start>pos)break;var oldSize=this.ranges[i+oldIndex],newSize=this.ranges[i+newIndex],end=start+oldSize;if(pos<=end){var result=start+diff+((oldSize?pos==start?-1:pos==end?1:assoc:assoc)<0?0:newSize);if(simple)return result;var recover=pos==(assoc<0?start:end)?null:makeRecover(i/3,pos-start),del=pos==start?2:pos==end?1:4;return(assoc<0?pos!=start:pos!=end)&&(del|=8),new MapResult(result,del,recover)}diff+=newSize-oldSize}return simple?pos+diff:new MapResult(pos+diff,0,null)}},{key:"touches",value:function touches(pos,recover){for(var diff=0,index=recoverIndex(recover),oldIndex=this.inverted?2:1,newIndex=this.inverted?1:2,i=0;i<this.ranges.length;i+=3){var start=this.ranges[i]-(this.inverted?diff:0);if(start>pos)break;var oldSize=this.ranges[i+oldIndex];if(pos<=start+oldSize&&i==3*index)return!0;diff+=this.ranges[i+newIndex]-oldSize}return!1}},{key:"forEach",value:function forEach(f){for(var oldIndex=this.inverted?2:1,newIndex=this.inverted?1:2,i=0,diff=0;i<this.ranges.length;i+=3){var start=this.ranges[i],oldStart=start-(this.inverted?diff:0),newStart=start+(this.inverted?0:diff),oldSize=this.ranges[i+oldIndex],newSize=this.ranges[i+newIndex];f(oldStart,oldStart+oldSize,newStart,newStart+newSize),diff+=newSize-oldSize}}},{key:"invert",value:function invert(){return new StepMap(this.ranges,!this.inverted)}},{key:"toString",value:function toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}}],[{key:"offset",value:function offset(n){return 0==n?StepMap.empty:new StepMap(n<0?[0,-n,0]:[0,0,n])}}]),StepMap}();StepMap.empty=new StepMap([]);var Mapping=function(){function Mapping(maps,mirror){var from=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,to=arguments.length>3&&void 0!==arguments[3]?arguments[3]:maps?maps.length:0;_classCallCheck(this,Mapping),this.mirror=mirror,this.from=from,this.to=to,this._maps=maps||[],this.ownData=!(maps||mirror)}return _createClass(Mapping,[{key:"maps",get:function get(){return this._maps}},{key:"slice",value:function slice(){var from=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,to=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maps.length;return new Mapping(this._maps,this.mirror,from,to)}},{key:"appendMap",value:function appendMap(map,mirrors){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(map),null!=mirrors&&this.setMirror(this._maps.length-1,mirrors)}},{key:"appendMapping",value:function appendMapping(mapping){for(var i=0,startSize=this._maps.length;i<mapping._maps.length;i++){var mirr=mapping.getMirror(i);this.appendMap(mapping._maps[i],null!=mirr&&mirr<i?startSize+mirr:void 0)}}},{key:"getMirror",value:function getMirror(n){if(this.mirror)for(var i=0;i<this.mirror.length;i++)if(this.mirror[i]==n)return this.mirror[i+(i%2?-1:1)]}},{key:"setMirror",value:function setMirror(n,m){this.mirror||(this.mirror=[]),this.mirror.push(n,m)}},{key:"appendMappingInverted",value:function appendMappingInverted(mapping){for(var i=mapping.maps.length-1,totalSize=this._maps.length+mapping._maps.length;i>=0;i--){var mirr=mapping.getMirror(i);this.appendMap(mapping._maps[i].invert(),null!=mirr&&mirr>i?totalSize-mirr-1:void 0)}}},{key:"invert",value:function invert(){var inverse=new Mapping;return inverse.appendMappingInverted(this),inverse}},{key:"map",value:function map(pos){var assoc=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.mirror)return this._map(pos,assoc,!0);for(var i=this.from;i<this.to;i++)pos=this._maps[i].map(pos,assoc);return pos}},{key:"mapResult",value:function mapResult(pos){var assoc=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(pos,assoc,!1)}},{key:"_map",value:function _map(pos,assoc,simple){for(var delInfo=0,i=this.from;i<this.to;i++){var result=this._maps[i].mapResult(pos,assoc);if(null!=result.recover){var corr=this.getMirror(i);if(null!=corr&&corr>i&&corr<this.to){i=corr,pos=this._maps[corr].recover(result.recover);continue}}delInfo|=result.delInfo,pos=result.pos}return simple?pos:new MapResult(pos,delInfo,null)}}]),Mapping}(),stepsByID=Object.create(null),Step=function(){function Step(){_classCallCheck(this,Step)}return _createClass(Step,[{key:"getMap",value:function getMap(){return StepMap.empty}},{key:"merge",value:function merge(other){return null}}],[{key:"fromJSON",value:function fromJSON(schema,json){if(!json||!json.stepType)throw new RangeError("Invalid input for Step.fromJSON");var type=stepsByID[json.stepType];if(!type)throw new RangeError("No step type ".concat(json.stepType," defined"));return type.fromJSON(schema,json)}},{key:"jsonID",value:function jsonID(id,stepClass){if(id in stepsByID)throw new RangeError("Duplicate use of step JSON ID "+id);return stepsByID[id]=stepClass,stepClass.prototype.jsonID=id,stepClass}}]),Step}(),StepResult=function(){function StepResult(doc,failed){_classCallCheck(this,StepResult),this.doc=doc,this.failed=failed}return _createClass(StepResult,null,[{key:"ok",value:function ok(doc){return new StepResult(doc,null)}},{key:"fail",value:function fail(message){return new StepResult(null,message)}},{key:"fromReplace",value:function fromReplace(doc,from,to,slice){try{return StepResult.ok(doc.replace(from,to,slice))}catch(e){if(e instanceof prosemirrorModel.ReplaceError)return StepResult.fail(e.message);throw e}}}]),StepResult}();function mapFragment(fragment,f,parent){for(var mapped=[],i=0;i<fragment.childCount;i++){var child=fragment.child(i);child.content.size&&(child=child.copy(mapFragment(child.content,f,child))),child.isInline&&(child=f(child,parent,i)),mapped.push(child)}return prosemirrorModel.Fragment.fromArray(mapped)}var AddMarkStep=function(_Step){_inherits(AddMarkStep,_Step);var _super=_createSuper(AddMarkStep);function AddMarkStep(from,to,mark){var _this;return _classCallCheck(this,AddMarkStep),(_this=_super.call(this)).from=from,_this.to=to,_this.mark=mark,_this}return _createClass(AddMarkStep,[{key:"apply",value:function apply(doc){var _this2=this,oldSlice=doc.slice(this.from,this.to),$from=doc.resolve(this.from),parent=$from.node($from.sharedDepth(this.to)),slice=new prosemirrorModel.Slice(mapFragment(oldSlice.content,function(node,parent){return node.isAtom&&parent.type.allowsMarkType(_this2.mark.type)?node.mark(_this2.mark.addToSet(node.marks)):node},parent),oldSlice.openStart,oldSlice.openEnd);return StepResult.fromReplace(doc,this.from,this.to,slice)}},{key:"invert",value:function invert(){return new RemoveMarkStep(this.from,this.to,this.mark)}},{key:"map",value:function map(mapping){var from=mapping.mapResult(this.from,1),to=mapping.mapResult(this.to,-1);return from.deleted&&to.deleted||from.pos>=to.pos?null:new AddMarkStep(from.pos,to.pos,this.mark)}},{key:"merge",value:function merge(other){return other instanceof AddMarkStep&&other.mark.eq(this.mark)&&this.from<=other.to&&this.to>=other.from?new AddMarkStep(Math.min(this.from,other.from),Math.max(this.to,other.to),this.mark):null}},{key:"toJSON",value:function toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function fromJSON(schema,json){if("number"!=typeof json.from||"number"!=typeof json.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new AddMarkStep(json.from,json.to,schema.markFromJSON(json.mark))}}]),AddMarkStep}(Step);Step.jsonID("addMark",AddMarkStep);var RemoveMarkStep=function(_Step2){_inherits(RemoveMarkStep,_Step2);var _super2=_createSuper(RemoveMarkStep);function RemoveMarkStep(from,to,mark){var _this3;return _classCallCheck(this,RemoveMarkStep),(_this3=_super2.call(this)).from=from,_this3.to=to,_this3.mark=mark,_this3}return _createClass(RemoveMarkStep,[{key:"apply",value:function apply(doc){var _this4=this,oldSlice=doc.slice(this.from,this.to),slice=new prosemirrorModel.Slice(mapFragment(oldSlice.content,function(node){return node.mark(_this4.mark.removeFromSet(node.marks))},doc),oldSlice.openStart,oldSlice.openEnd);return StepResult.fromReplace(doc,this.from,this.to,slice)}},{key:"invert",value:function invert(){return new AddMarkStep(this.from,this.to,this.mark)}},{key:"map",value:function map(mapping){var from=mapping.mapResult(this.from,1),to=mapping.mapResult(this.to,-1);return from.deleted&&to.deleted||from.pos>=to.pos?null:new RemoveMarkStep(from.pos,to.pos,this.mark)}},{key:"merge",value:function merge(other){return other instanceof RemoveMarkStep&&other.mark.eq(this.mark)&&this.from<=other.to&&this.to>=other.from?new RemoveMarkStep(Math.min(this.from,other.from),Math.max(this.to,other.to),this.mark):null}},{key:"toJSON",value:function toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function fromJSON(schema,json){if("number"!=typeof json.from||"number"!=typeof json.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new RemoveMarkStep(json.from,json.to,schema.markFromJSON(json.mark))}}]),RemoveMarkStep}(Step);Step.jsonID("removeMark",RemoveMarkStep);var AddNodeMarkStep=function(_Step3){_inherits(AddNodeMarkStep,_Step3);var _super3=_createSuper(AddNodeMarkStep);function AddNodeMarkStep(pos,mark){var _this5;return _classCallCheck(this,AddNodeMarkStep),(_this5=_super3.call(this)).pos=pos,_this5.mark=mark,_this5}return _createClass(AddNodeMarkStep,[{key:"apply",value:function apply(doc){var node=doc.nodeAt(this.pos);if(!node)return StepResult.fail("No node at mark step's position");var updated=node.type.create(node.attrs,null,this.mark.addToSet(node.marks));return StepResult.fromReplace(doc,this.pos,this.pos+1,new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated),0,node.isLeaf?0:1))}},{key:"invert",value:function invert(doc){var node=doc.nodeAt(this.pos);if(node){var newSet=this.mark.addToSet(node.marks);if(newSet.length==node.marks.length){for(var i=0;i<node.marks.length;i++)if(!node.marks[i].isInSet(newSet))return new AddNodeMarkStep(this.pos,node.marks[i]);return new AddNodeMarkStep(this.pos,this.mark)}}return new RemoveNodeMarkStep(this.pos,this.mark)}},{key:"map",value:function map(mapping){var pos=mapping.mapResult(this.pos,1);return pos.deletedAfter?null:new AddNodeMarkStep(pos.pos,this.mark)}},{key:"toJSON",value:function toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function fromJSON(schema,json){if("number"!=typeof json.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new AddNodeMarkStep(json.pos,schema.markFromJSON(json.mark))}}]),AddNodeMarkStep}(Step);Step.jsonID("addNodeMark",AddNodeMarkStep);var RemoveNodeMarkStep=function(_Step4){_inherits(RemoveNodeMarkStep,_Step4);var _super4=_createSuper(RemoveNodeMarkStep);function RemoveNodeMarkStep(pos,mark){var _this6;return _classCallCheck(this,RemoveNodeMarkStep),(_this6=_super4.call(this)).pos=pos,_this6.mark=mark,_this6}return _createClass(RemoveNodeMarkStep,[{key:"apply",value:function apply(doc){var node=doc.nodeAt(this.pos);if(!node)return StepResult.fail("No node at mark step's position");var updated=node.type.create(node.attrs,null,this.mark.removeFromSet(node.marks));return StepResult.fromReplace(doc,this.pos,this.pos+1,new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated),0,node.isLeaf?0:1))}},{key:"invert",value:function invert(doc){var node=doc.nodeAt(this.pos);return node&&this.mark.isInSet(node.marks)?new AddNodeMarkStep(this.pos,this.mark):this}},{key:"map",value:function map(mapping){var pos=mapping.mapResult(this.pos,1);return pos.deletedAfter?null:new RemoveNodeMarkStep(pos.pos,this.mark)}},{key:"toJSON",value:function toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function fromJSON(schema,json){if("number"!=typeof json.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new RemoveNodeMarkStep(json.pos,schema.markFromJSON(json.mark))}}]),RemoveNodeMarkStep}(Step);Step.jsonID("removeNodeMark",RemoveNodeMarkStep);var ReplaceStep=function(_Step5){_inherits(ReplaceStep,_Step5);var _super5=_createSuper(ReplaceStep);function ReplaceStep(from,to,slice){var _this7,structure=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return _classCallCheck(this,ReplaceStep),(_this7=_super5.call(this)).from=from,_this7.to=to,_this7.slice=slice,_this7.structure=structure,_this7}return _createClass(ReplaceStep,[{key:"apply",value:function apply(doc){return this.structure&&contentBetween(doc,this.from,this.to)?StepResult.fail("Structure replace would overwrite content"):StepResult.fromReplace(doc,this.from,this.to,this.slice)}},{key:"getMap",value:function getMap(){return new StepMap([this.from,this.to-this.from,this.slice.size])}},{key:"invert",value:function invert(doc){return new ReplaceStep(this.from,this.from+this.slice.size,doc.slice(this.from,this.to))}},{key:"map",value:function map(mapping){var to=mapping.mapResult(this.to,-1),from=this.from==this.to&&ReplaceStep.MAP_BIAS<0?to:mapping.mapResult(this.from,1);return from.deletedAcross&&to.deletedAcross?null:new ReplaceStep(from.pos,Math.max(from.pos,to.pos),this.slice,this.structure)}},{key:"merge",value:function merge(other){if(!(other instanceof ReplaceStep)||other.structure||this.structure)return null;if(this.from+this.slice.size!=other.from||this.slice.openEnd||other.slice.openStart){if(other.to!=this.from||this.slice.openStart||other.slice.openEnd)return null;var _slice=this.slice.size+other.slice.size==0?prosemirrorModel.Slice.empty:new prosemirrorModel.Slice(other.slice.content.append(this.slice.content),other.slice.openStart,this.slice.openEnd);return new ReplaceStep(other.from,this.to,_slice,this.structure)}var slice=this.slice.size+other.slice.size==0?prosemirrorModel.Slice.empty:new prosemirrorModel.Slice(this.slice.content.append(other.slice.content),this.slice.openStart,other.slice.openEnd);return new ReplaceStep(this.from,this.to+(other.to-other.from),slice,this.structure)}},{key:"toJSON",value:function toJSON(){var json={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(json.slice=this.slice.toJSON()),this.structure&&(json.structure=!0),json}}],[{key:"fromJSON",value:function fromJSON(schema,json){if("number"!=typeof json.from||"number"!=typeof json.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ReplaceStep(json.from,json.to,prosemirrorModel.Slice.fromJSON(schema,json.slice),!!json.structure)}}]),ReplaceStep}(Step);ReplaceStep.MAP_BIAS=1,Step.jsonID("replace",ReplaceStep);var ReplaceAroundStep=function(_Step6){_inherits(ReplaceAroundStep,_Step6);var _super6=_createSuper(ReplaceAroundStep);function ReplaceAroundStep(from,to,gapFrom,gapTo,slice,insert){var _this8,structure=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return _classCallCheck(this,ReplaceAroundStep),(_this8=_super6.call(this)).from=from,_this8.to=to,_this8.gapFrom=gapFrom,_this8.gapTo=gapTo,_this8.slice=slice,_this8.insert=insert,_this8.structure=structure,_this8}return _createClass(ReplaceAroundStep,[{key:"apply",value:function apply(doc){if(this.structure&&(contentBetween(doc,this.from,this.gapFrom)||contentBetween(doc,this.gapTo,this.to)))return StepResult.fail("Structure gap-replace would overwrite content");var gap=doc.slice(this.gapFrom,this.gapTo);if(gap.openStart||gap.openEnd)return StepResult.fail("Gap is not a flat range");var inserted=this.slice.insertAt(this.insert,gap.content);return inserted?StepResult.fromReplace(doc,this.from,this.to,inserted):StepResult.fail("Content does not fit in gap")}},{key:"getMap",value:function getMap(){return new StepMap([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}},{key:"invert",value:function invert(doc){var gap=this.gapTo-this.gapFrom;return new ReplaceAroundStep(this.from,this.from+this.slice.size+gap,this.from+this.insert,this.from+this.insert+gap,doc.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}},{key:"map",value:function map(mapping){var from=mapping.mapResult(this.from,1),to=mapping.mapResult(this.to,-1),gapFrom=this.from==this.gapFrom?from.pos:mapping.map(this.gapFrom,-1),gapTo=this.to==this.gapTo?to.pos:mapping.map(this.gapTo,1);return from.deletedAcross&&to.deletedAcross||gapFrom<from.pos||gapTo>to.pos?null:new ReplaceAroundStep(from.pos,to.pos,gapFrom,gapTo,this.slice,this.insert,this.structure)}},{key:"toJSON",value:function toJSON(){var json={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(json.slice=this.slice.toJSON()),this.structure&&(json.structure=!0),json}}],[{key:"fromJSON",value:function fromJSON(schema,json){if("number"!=typeof json.from||"number"!=typeof json.to||"number"!=typeof json.gapFrom||"number"!=typeof json.gapTo||"number"!=typeof json.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ReplaceAroundStep(json.from,json.to,json.gapFrom,json.gapTo,prosemirrorModel.Slice.fromJSON(schema,json.slice),json.insert,!!json.structure)}}]),ReplaceAroundStep}(Step);function contentBetween(doc,from,to){for(var $from=doc.resolve(from),dist=to-from,depth=$from.depth;dist>0&&depth>0&&$from.indexAfter(depth)==$from.node(depth).childCount;)depth--,dist--;if(dist>0)for(var next=$from.node(depth).maybeChild($from.indexAfter(depth));dist>0;){if(!next||next.isLeaf)return!0;next=next.firstChild,dist--}return!1}function _clearIncompatible(tr,pos,parentType){for(var match=arguments.length>3&&void 0!==arguments[3]?arguments[3]:parentType.contentMatch,clearNewlines=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],node=tr.doc.nodeAt(pos),replSteps=[],cur=pos+1,i=0;i<node.childCount;i++){var child=node.child(i),end=cur+child.nodeSize,allowed=match.matchType(child.type);if(allowed){match=allowed;for(var j=0;j<child.marks.length;j++)parentType.allowsMarkType(child.marks[j].type)||tr.step(new RemoveMarkStep(cur,end,child.marks[j]));if(clearNewlines&&child.isText&&"pre"!=parentType.whitespace)for(var m=void 0,newline=/\r?\n|\r/g,slice=void 0;m=newline.exec(child.text);)slice||(slice=new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(parentType.schema.text(" ",parentType.allowedMarks(child.marks))),0,0)),replSteps.push(new ReplaceStep(cur+m.index,cur+m.index+m[0].length,slice))}else replSteps.push(new ReplaceStep(cur,end,prosemirrorModel.Slice.empty));cur=end}if(!match.validEnd){var fill=match.fillBefore(prosemirrorModel.Fragment.empty,!0);tr.replace(cur,cur,new prosemirrorModel.Slice(fill,0,0))}for(var _i=replSteps.length-1;_i>=0;_i--)tr.step(replSteps[_i])}function canCut(node,start,end){return(0==start||node.canReplace(start,node.childCount))&&(end==node.childCount||node.canReplace(0,end))}function withAttrs(type){return{type,attrs:null}}function replaceNewlines(tr,node,pos,mapFrom){node.forEach(function(child,offset){if(child.isText)for(var m,newline=/\r?\n|\r/g;m=newline.exec(child.text);){var start=tr.mapping.slice(mapFrom).map(pos+1+offset+m.index);tr.replaceWith(start,start+1,node.type.schema.linebreakReplacement.create())}})}function replaceLinebreaks(tr,node,pos,mapFrom){node.forEach(function(child,offset){if(child.type==child.type.schema.linebreakReplacement){var start=tr.mapping.slice(mapFrom).map(pos+1+offset);tr.replaceWith(start,start+1,node.type.schema.text("\n"))}})}function joinable(a,b){return!(!a||!b||a.isLeaf||!function canAppendWithSubstitutedLinebreaks(a,b){b.content.size||a.type.compatibleContent(b.type);for(var match=a.contentMatchAt(a.childCount),linebreakReplacement=a.type.schema.linebreakReplacement,i=0;i<b.childCount;i++){var child=b.child(i),type=child.type==linebreakReplacement?a.type.schema.nodes.text:child.type;if(!(match=match.matchType(type)))return!1;if(!a.type.allowsMarks(child.marks))return!1}return match.validEnd}(a,b))}function insertPoint(doc,pos,nodeType){var $pos=doc.resolve(pos);if($pos.parent.canReplaceWith($pos.index(),$pos.index(),nodeType))return pos;if(0==$pos.parentOffset)for(var d=$pos.depth-1;d>=0;d--){var index=$pos.index(d);if($pos.node(d).canReplaceWith(index,index,nodeType))return $pos.before(d+1);if(index>0)return null}if($pos.parentOffset==$pos.parent.content.size)for(var _d2=$pos.depth-1;_d2>=0;_d2--){var _index2=$pos.indexAfter(_d2);if($pos.node(_d2).canReplaceWith(_index2,_index2,nodeType))return $pos.after(_d2+1);if(_index2<$pos.node(_d2).childCount)return null}return null}function replaceStep(doc,from){var to=arguments.length>2&&void 0!==arguments[2]?arguments[2]:from,slice=arguments.length>3&&void 0!==arguments[3]?arguments[3]:prosemirrorModel.Slice.empty;if(from==to&&!slice.size)return null;var $from=doc.resolve(from),$to=doc.resolve(to);return fitsTrivially($from,$to,slice)?new ReplaceStep(from,to,slice):new Fitter($from,$to,slice).fit()}function fitsTrivially($from,$to,slice){return!slice.openStart&&!slice.openEnd&&$from.start()==$to.start()&&$from.parent.canReplace($from.index(),$to.index(),slice.content)}Step.jsonID("replaceAround",ReplaceAroundStep);var Fitter=function(){function Fitter($from,$to,unplaced){_classCallCheck(this,Fitter),this.$from=$from,this.$to=$to,this.unplaced=unplaced,this.frontier=[],this.placed=prosemirrorModel.Fragment.empty;for(var i=0;i<=$from.depth;i++){var node=$from.node(i);this.frontier.push({type:node.type,match:node.contentMatchAt($from.indexAfter(i))})}for(var _i2=$from.depth;_i2>0;_i2--)this.placed=prosemirrorModel.Fragment.from($from.node(_i2).copy(this.placed))}return _createClass(Fitter,[{key:"depth",get:function get(){return this.frontier.length-1}},{key:"fit",value:function fit(){for(;this.unplaced.size;){var fit=this.findFittable();fit?this.placeNodes(fit):this.openMore()||this.dropNode()}var moveInline=this.mustMoveInline(),placedSize=this.placed.size-this.depth-this.$from.depth,$from=this.$from,$to=this.close(moveInline<0?this.$to:$from.doc.resolve(moveInline));if(!$to)return null;for(var content=this.placed,openStart=$from.depth,openEnd=$to.depth;openStart&&openEnd&&1==content.childCount;)content=content.firstChild.content,openStart--,openEnd--;var slice=new prosemirrorModel.Slice(content,openStart,openEnd);return moveInline>-1?new ReplaceAroundStep($from.pos,moveInline,this.$to.pos,this.$to.end(),slice,placedSize):slice.size||$from.pos!=this.$to.pos?new ReplaceStep($from.pos,$to.pos,slice):null}},{key:"findFittable",value:function findFittable(){for(var startDepth=this.unplaced.openStart,cur=this.unplaced.content,d=0,openEnd=this.unplaced.openEnd;d<startDepth;d++){var node=cur.firstChild;if(cur.childCount>1&&(openEnd=0),node.type.spec.isolating&&openEnd<=d){startDepth=d;break}cur=node.content}for(var pass=1;pass<=2;pass++)for(var sliceDepth=1==pass?startDepth:this.unplaced.openStart;sliceDepth>=0;sliceDepth--)for(var parent=null,first=(sliceDepth?(parent=contentAt(this.unplaced.content,sliceDepth-1).firstChild).content:this.unplaced.content).firstChild,frontierDepth=this.depth;frontierDepth>=0;frontierDepth--){var _this$frontier$fronti=this.frontier[frontierDepth],type=_this$frontier$fronti.type,match=_this$frontier$fronti.match,_wrap=void 0,inject=null;if(1==pass&&(first?match.matchType(first.type)||(inject=match.fillBefore(prosemirrorModel.Fragment.from(first),!1)):parent&&type.compatibleContent(parent.type)))return{sliceDepth,frontierDepth,parent,inject};if(2==pass&&first&&(_wrap=match.findWrapping(first.type)))return{sliceDepth,frontierDepth,parent,wrap:_wrap};if(parent&&match.matchType(parent.type))break}}},{key:"openMore",value:function openMore(){var _this$unplaced=this.unplaced,content=_this$unplaced.content,openStart=_this$unplaced.openStart,openEnd=_this$unplaced.openEnd;return!(maxOpen(content,-1)<=openStart)&&(this.unplaced.size>1&&maxOpen(content,1)>openEnd&&openEnd++,this.unplaced=new prosemirrorModel.Slice(content,openStart+1,openEnd),!0)}},{key:"dropNode",value:function dropNode(){var _this$unplaced2=this.unplaced,content=_this$unplaced2.content,openStart=_this$unplaced2.openStart,openEnd=_this$unplaced2.openEnd,inner=contentAt(content,openStart);if(inner.childCount<=1&&openStart>0){var openAtEnd=content.size-openStart<=openStart+inner.size;this.unplaced=new prosemirrorModel.Slice(dropFromFragment(content,openStart-1,1),openStart-1,openAtEnd?openStart-1:openEnd)}else this.unplaced=new prosemirrorModel.Slice(dropFromFragment(content,openStart,1),openStart,openEnd)}},{key:"placeNodes",value:function placeNodes(_ref){for(var sliceDepth=_ref.sliceDepth,frontierDepth=_ref.frontierDepth,parent=_ref.parent,inject=_ref.inject,wrap=_ref.wrap;this.depth>frontierDepth;)this.closeFrontierNode();if(wrap)for(var i=0;i<wrap.length;i++)this.openFrontierNode(wrap[i]);var slice=this.unplaced,fragment=parent?parent.content:slice.content,openStart=slice.openStart-sliceDepth,taken=0,add=[],_this$frontier$fronti2=this.frontier[frontierDepth],match=_this$frontier$fronti2.match,type=_this$frontier$fronti2.type;if(inject){for(var _i3=0;_i3<inject.childCount;_i3++)add.push(inject.child(_i3));match=match.matchFragment(inject)}for(var openEndCount=fragment.size+sliceDepth-(slice.content.size-slice.openEnd);taken<fragment.childCount;){var next=fragment.child(taken),matches=match.matchType(next.type);if(!matches)break;(++taken>1||0==openStart||next.content.size)&&(match=matches,add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)),1==taken?openStart:0,taken==fragment.childCount?openEndCount:-1)))}var toEnd=taken==fragment.childCount;toEnd||(openEndCount=-1),this.placed=addToFragment(this.placed,frontierDepth,prosemirrorModel.Fragment.from(add)),this.frontier[frontierDepth].match=match,toEnd&&openEndCount<0&&parent&&parent.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var _i4=0,cur=fragment;_i4<openEndCount;_i4++){var node=cur.lastChild;this.frontier.push({type:node.type,match:node.contentMatchAt(node.childCount)}),cur=node.content}this.unplaced=toEnd?0==sliceDepth?prosemirrorModel.Slice.empty:new prosemirrorModel.Slice(dropFromFragment(slice.content,sliceDepth-1,1),sliceDepth-1,openEndCount<0?slice.openEnd:sliceDepth-1):new prosemirrorModel.Slice(dropFromFragment(slice.content,sliceDepth,taken),slice.openStart,slice.openEnd)}},{key:"mustMoveInline",value:function mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;var level,top=this.frontier[this.depth];if(!top.type.isTextblock||!contentAfterFits(this.$to,this.$to.depth,top.type,top.match,!1)||this.$to.depth==this.depth&&(level=this.findCloseLevel(this.$to))&&level.depth==this.depth)return-1;for(var depth=this.$to.depth,after=this.$to.after(depth);depth>1&&after==this.$to.end(--depth);)++after;return after}},{key:"findCloseLevel",value:function findCloseLevel($to){scan:for(var i=Math.min(this.depth,$to.depth);i>=0;i--){var _this$frontier$i=this.frontier[i],match=_this$frontier$i.match,type=_this$frontier$i.type,dropInner=i<$to.depth&&$to.end(i+1)==$to.pos+($to.depth-(i+1)),fit=contentAfterFits($to,i,type,match,dropInner);if(fit){for(var d=i-1;d>=0;d--){var _this$frontier$d=this.frontier[d],_match=_this$frontier$d.match,matches=contentAfterFits($to,d,_this$frontier$d.type,_match,!0);if(!matches||matches.childCount)continue scan}return{depth:i,fit,move:dropInner?$to.doc.resolve($to.after(i+1)):$to}}}}},{key:"close",value:function close($to){var close=this.findCloseLevel($to);if(!close)return null;for(;this.depth>close.depth;)this.closeFrontierNode();close.fit.childCount&&(this.placed=addToFragment(this.placed,close.depth,close.fit)),$to=close.move;for(var d=close.depth+1;d<=$to.depth;d++){var node=$to.node(d),add=node.type.contentMatch.fillBefore(node.content,!0,$to.index(d));this.openFrontierNode(node.type,node.attrs,add)}return $to}},{key:"openFrontierNode",value:function openFrontierNode(type){var attrs=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,content=arguments.length>2?arguments[2]:void 0,top=this.frontier[this.depth];top.match=top.match.matchType(type),this.placed=addToFragment(this.placed,this.depth,prosemirrorModel.Fragment.from(type.create(attrs,content))),this.frontier.push({type,match:type.contentMatch})}},{key:"closeFrontierNode",value:function closeFrontierNode(){var add=this.frontier.pop().match.fillBefore(prosemirrorModel.Fragment.empty,!0);add.childCount&&(this.placed=addToFragment(this.placed,this.frontier.length,add))}}]),Fitter}();function dropFromFragment(fragment,depth,count){return 0==depth?fragment.cutByIndex(count,fragment.childCount):fragment.replaceChild(0,fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content,depth-1,count)))}function addToFragment(fragment,depth,content){return 0==depth?fragment.append(content):fragment.replaceChild(fragment.childCount-1,fragment.lastChild.copy(addToFragment(fragment.lastChild.content,depth-1,content)))}function contentAt(fragment,depth){for(var i=0;i<depth;i++)fragment=fragment.firstChild.content;return fragment}function closeNodeStart(node,openStart,openEnd){if(openStart<=0)return node;var frag=node.content;return openStart>1&&(frag=frag.replaceChild(0,closeNodeStart(frag.firstChild,openStart-1,1==frag.childCount?openEnd-1:0))),openStart>0&&(frag=node.type.contentMatch.fillBefore(frag).append(frag),openEnd<=0&&(frag=frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(prosemirrorModel.Fragment.empty,!0)))),node.copy(frag)}function contentAfterFits($to,depth,type,match,open){var node=$to.node(depth),index=open?$to.indexAfter(depth):$to.index(depth);if(index==node.childCount&&!type.compatibleContent(node.type))return null;var fit=match.fillBefore(node.content,!0,index);return fit&&!function invalidMarks(type,fragment,start){for(var i=start;i<fragment.childCount;i++)if(!type.allowsMarks(fragment.child(i).marks))return!0;return!1}(type,node.content,index)?fit:null}function definesContent(type){return type.spec.defining||type.spec.definingForContent}function maxOpen(frag,side){for(var count=0;;count++){var ch=side<0?frag.firstChild:frag.lastChild;if(!ch||ch.isAtom)return count;frag=ch.content}}function closeFragment(fragment,depth,oldOpen,newOpen,parent){if(depth<oldOpen){var first=fragment.firstChild;fragment=fragment.replaceChild(0,first.copy(closeFragment(first.content,depth+1,oldOpen,newOpen,first)))}if(depth>newOpen){var match=parent.contentMatchAt(0),start=match.fillBefore(fragment).append(fragment);fragment=start.append(match.matchFragment(start).fillBefore(prosemirrorModel.Fragment.empty,!0))}return fragment}function coveredDepths($from,$to){for(var result=[],d=Math.min($from.depth,$to.depth);d>=0;d--){var start=$from.start(d);if(start<$from.pos-($from.depth-d)||$to.end(d)>$to.pos+($to.depth-d)||$from.node(d).type.spec.isolating||$to.node(d).type.spec.isolating)break;(start==$to.start(d)||d==$from.depth&&d==$to.depth&&$from.parent.inlineContent&&$to.parent.inlineContent&&d&&$to.start(d-1)==start-1)&&result.push(d)}return result}var AttrStep=function(_Step7){_inherits(AttrStep,_Step7);var _super7=_createSuper(AttrStep);function AttrStep(pos,attr,value){var _this9;return _classCallCheck(this,AttrStep),(_this9=_super7.call(this)).pos=pos,_this9.attr=attr,_this9.value=value,_this9}return _createClass(AttrStep,[{key:"apply",value:function apply(doc){var node=doc.nodeAt(this.pos);if(!node)return StepResult.fail("No node at attribute step's position");var attrs=Object.create(null);for(var name in node.attrs)attrs[name]=node.attrs[name];attrs[this.attr]=this.value;var updated=node.type.create(attrs,null,node.marks);return StepResult.fromReplace(doc,this.pos,this.pos+1,new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated),0,node.isLeaf?0:1))}},{key:"getMap",value:function getMap(){return StepMap.empty}},{key:"invert",value:function invert(doc){return new AttrStep(this.pos,this.attr,doc.nodeAt(this.pos).attrs[this.attr])}},{key:"map",value:function map(mapping){var pos=mapping.mapResult(this.pos,1);return pos.deletedAfter?null:new AttrStep(pos.pos,this.attr,this.value)}},{key:"toJSON",value:function toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function fromJSON(schema,json){if("number"!=typeof json.pos||"string"!=typeof json.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new AttrStep(json.pos,json.attr,json.value)}}]),AttrStep}(Step);Step.jsonID("attr",AttrStep);var DocAttrStep=function(_Step8){_inherits(DocAttrStep,_Step8);var _super8=_createSuper(DocAttrStep);function DocAttrStep(attr,value){var _this10;return _classCallCheck(this,DocAttrStep),(_this10=_super8.call(this)).attr=attr,_this10.value=value,_this10}return _createClass(DocAttrStep,[{key:"apply",value:function apply(doc){var attrs=Object.create(null);for(var name in doc.attrs)attrs[name]=doc.attrs[name];attrs[this.attr]=this.value;var updated=doc.type.create(attrs,doc.content,doc.marks);return StepResult.ok(updated)}},{key:"getMap",value:function getMap(){return StepMap.empty}},{key:"invert",value:function invert(doc){return new DocAttrStep(this.attr,doc.attrs[this.attr])}},{key:"map",value:function map(mapping){return this}},{key:"toJSON",value:function toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function fromJSON(schema,json){if("string"!=typeof json.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new DocAttrStep(json.attr,json.value)}}]),DocAttrStep}(Step);Step.jsonID("docAttr",DocAttrStep),exports.TransformError=function(_Error){_inherits(TransformError,_Error);var _super9=_createSuper(TransformError);function TransformError(){return _classCallCheck(this,TransformError),_super9.apply(this,arguments)}return _createClass(TransformError)}(_wrapNativeSuper(Error)),exports.TransformError=function TransformError(message){var err=Error.call(this,message);return err.__proto__=TransformError.prototype,err},exports.TransformError.prototype=Object.create(Error.prototype),exports.TransformError.prototype.constructor=exports.TransformError,exports.TransformError.prototype.name="TransformError";var Transform=function(){function Transform(doc){_classCallCheck(this,Transform),this.doc=doc,this.steps=[],this.docs=[],this.mapping=new Mapping}return _createClass(Transform,[{key:"before",get:function get(){return this.docs.length?this.docs[0]:this.doc}},{key:"step",value:function step(_step){var result=this.maybeStep(_step);if(result.failed)throw new exports.TransformError(result.failed);return this}},{key:"maybeStep",value:function maybeStep(step){var result=step.apply(this.doc);return result.failed||this.addStep(step,result.doc),result}},{key:"docChanged",get:function get(){return this.steps.length>0}},{key:"changedRange",value:function changedRange(){for(var from=1e9,to=-1e9,i=0;i<this.mapping.maps.length;i++){var map=this.mapping.maps[i];i&&(from=map.map(from,1),to=map.map(to,-1)),map.forEach(function(_f,_t,fromB,toB){from=Math.min(from,fromB),to=Math.max(to,toB)})}return 1e9==from?null:{from,to}}},{key:"addStep",value:function addStep(step,doc){this.docs.push(this.doc),this.steps.push(step),this.mapping.appendMap(step.getMap()),this.doc=doc}},{key:"replace",value:function replace(from){var to=arguments.length>1&&void 0!==arguments[1]?arguments[1]:from,slice=arguments.length>2&&void 0!==arguments[2]?arguments[2]:prosemirrorModel.Slice.empty,step=replaceStep(this.doc,from,to,slice);return step&&this.step(step),this}},{key:"replaceWith",value:function replaceWith(from,to,content){return this.replace(from,to,new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(content),0,0))}},{key:"delete",value:function _delete(from,to){return this.replace(from,to,prosemirrorModel.Slice.empty)}},{key:"insert",value:function insert(pos,content){return this.replaceWith(pos,pos,content)}},{key:"replaceRange",value:function replaceRange(from,to,slice){return function _replaceRange(tr,from,to,slice){if(!slice.size)return tr.deleteRange(from,to);var $from=tr.doc.resolve(from),$to=tr.doc.resolve(to);if(fitsTrivially($from,$to,slice))return tr.step(new ReplaceStep(from,to,slice));var targetDepths=coveredDepths($from,$to);0==targetDepths[targetDepths.length-1]&&targetDepths.pop();var preferredTarget=-($from.depth+1);targetDepths.unshift(preferredTarget);for(var d=$from.depth,pos=$from.pos-1;d>0;d--,pos--){var spec=$from.node(d).type.spec;if(spec.defining||spec.definingAsContext||spec.isolating)break;targetDepths.indexOf(d)>-1?preferredTarget=d:$from.before(d)==pos&&targetDepths.splice(1,0,-d)}for(var preferredTargetIndex=targetDepths.indexOf(preferredTarget),leftNodes=[],preferredDepth=slice.openStart,content=slice.content,i=0;;i++){var node=content.firstChild;if(leftNodes.push(node),i==slice.openStart)break;content=node.content}for(var _d3=preferredDepth-1;_d3>=0;_d3--){var leftNode=leftNodes[_d3],def=definesContent(leftNode.type);if(def&&!leftNode.sameMarkup($from.node(Math.abs(preferredTarget)-1)))preferredDepth=_d3;else if(def||!leftNode.type.isTextblock)break}for(var j=slice.openStart;j>=0;j--){var openDepth=(j+preferredDepth+1)%(slice.openStart+1),insert=leftNodes[openDepth];if(insert)for(var _i5=0;_i5<targetDepths.length;_i5++){var targetDepth=targetDepths[(_i5+preferredTargetIndex)%targetDepths.length],expand=!0;targetDepth<0&&(expand=!1,targetDepth=-targetDepth);var parent=$from.node(targetDepth-1),index=$from.index(targetDepth-1);if(parent.canReplaceWith(index,index,insert.type,insert.marks))return tr.replace($from.before(targetDepth),expand?$to.after(targetDepth):to,new prosemirrorModel.Slice(closeFragment(slice.content,0,slice.openStart,openDepth),openDepth,slice.openEnd))}}for(var startSteps=tr.steps.length,_i6=targetDepths.length-1;_i6>=0&&(tr.replace(from,to,slice),!(tr.steps.length>startSteps));_i6--){var depth=targetDepths[_i6];depth<0||(from=$from.before(depth),to=$to.after(depth))}}(this,from,to,slice),this}},{key:"replaceRangeWith",value:function replaceRangeWith(from,to,node){return function _replaceRangeWith(tr,from,to,node){if(!node.isInline&&from==to&&tr.doc.resolve(from).parent.content.size){var point=insertPoint(tr.doc,from,node.type);null!=point&&(from=to=point)}tr.replaceRange(from,to,new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(node),0,0))}(this,from,to,node),this}},{key:"deleteRange",value:function deleteRange(from,to){return function _deleteRange(tr,from,to){var $from=tr.doc.resolve(from),$to=tr.doc.resolve(to);if($from.parent.isTextblock&&$to.parent.isTextblock&&$from.start()!=$to.start()&&0==$from.parentOffset&&0==$to.parentOffset){for(var shared=$from.sharedDepth(to),isolated=!1,d=$from.depth;d>shared;d--)$from.node(d).type.spec.isolating&&(isolated=!0);for(var _d4=$to.depth;_d4>shared;_d4--)$to.node(_d4).type.spec.isolating&&(isolated=!0);if(!isolated){for(var _d5=$from.depth;_d5>0&&from==$from.start(_d5);_d5--)from=$from.before(_d5);for(var _d6=$to.depth;_d6>0&&to==$to.start(_d6);_d6--)to=$to.before(_d6);$from=tr.doc.resolve(from),$to=tr.doc.resolve(to)}}for(var covered=coveredDepths($from,$to),i=0;i<covered.length;i++){var depth=covered[i],last=i==covered.length-1;if(last&&0==depth||$from.node(depth).type.contentMatch.validEnd)return tr.delete($from.start(depth),$to.end(depth));if(depth>0&&(last||$from.node(depth-1).canReplace($from.index(depth-1),$to.indexAfter(depth-1))))return tr.delete($from.before(depth),$to.after(depth))}for(var _d7=1;_d7<=$from.depth&&_d7<=$to.depth;_d7++)if(from-$from.start(_d7)==$from.depth-_d7&&to>$from.end(_d7)&&$to.end(_d7)-to!=$to.depth-_d7&&$from.start(_d7-1)==$to.start(_d7-1)&&$from.node(_d7-1).canReplace($from.index(_d7-1),$to.index(_d7-1)))return tr.delete($from.before(_d7),to);tr.delete(from,to)}(this,from,to),this}},{key:"lift",value:function lift(range,target){return function _lift(tr,range,target){for(var $from=range.$from,$to=range.$to,depth=range.depth,gapStart=$from.before(depth+1),gapEnd=$to.after(depth+1),start=gapStart,end=gapEnd,before=prosemirrorModel.Fragment.empty,openStart=0,d=depth,splitting=!1;d>target;d--)splitting||$from.index(d)>0?(splitting=!0,before=prosemirrorModel.Fragment.from($from.node(d).copy(before)),openStart++):start--;for(var after=prosemirrorModel.Fragment.empty,openEnd=0,_d=depth,_splitting=!1;_d>target;_d--)_splitting||$to.after(_d+1)<$to.end(_d)?(_splitting=!0,after=prosemirrorModel.Fragment.from($to.node(_d).copy(after)),openEnd++):end++;tr.step(new ReplaceAroundStep(start,end,gapStart,gapEnd,new prosemirrorModel.Slice(before.append(after),openStart,openEnd),before.size-openStart,!0))}(this,range,target),this}},{key:"join",value:function join(pos){return function _join(tr,pos,depth){var convertNewlines=null,linebreakReplacement=tr.doc.type.schema.linebreakReplacement,$before=tr.doc.resolve(pos-depth),beforeType=$before.node().type;if(linebreakReplacement&&beforeType.inlineContent){var pre="pre"==beforeType.whitespace,supportLinebreak=!!beforeType.contentMatch.matchType(linebreakReplacement);pre&&!supportLinebreak?convertNewlines=!1:!pre&&supportLinebreak&&(convertNewlines=!0)}var mapFrom=tr.steps.length;if(!1===convertNewlines){var $after=tr.doc.resolve(pos+depth);replaceLinebreaks(tr,$after.node(),$after.before(),mapFrom)}beforeType.inlineContent&&_clearIncompatible(tr,pos+depth-1,beforeType,$before.node().contentMatchAt($before.index()),null==convertNewlines);var mapping=tr.mapping.slice(mapFrom),start=mapping.map(pos-depth);if(tr.step(new ReplaceStep(start,mapping.map(pos+depth,-1),prosemirrorModel.Slice.empty,!0)),!0===convertNewlines){var $full=tr.doc.resolve(start);replaceNewlines(tr,$full.node(),$full.before(),tr.steps.length)}return tr}(this,pos,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),this}},{key:"wrap",value:function wrap(range,wrappers){return function _wrap2(tr,range,wrappers){for(var content=prosemirrorModel.Fragment.empty,i=wrappers.length-1;i>=0;i--){if(content.size){var match=wrappers[i].type.contentMatch.matchFragment(content);if(!match||!match.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}content=prosemirrorModel.Fragment.from(wrappers[i].type.create(wrappers[i].attrs,content))}var start=range.start,end=range.end;tr.step(new ReplaceAroundStep(start,end,start,end,new prosemirrorModel.Slice(content,0,0),wrappers.length,!0))}(this,range,wrappers),this}},{key:"setBlockType",value:function setBlockType(from){return function _setBlockType(tr,from,to,type,attrs){if(!type.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var mapFrom=tr.steps.length;tr.doc.nodesBetween(from,to,function(node,pos){var attrsHere="function"==typeof attrs?attrs(node):attrs;if(node.isTextblock&&!node.hasMarkup(type,attrsHere)&&function canChangeType(doc,pos,type){var $pos=doc.resolve(pos),index=$pos.index();return $pos.parent.canReplaceWith(index,index+1,type)}(tr.doc,tr.mapping.slice(mapFrom).map(pos),type)){var convertNewlines=null;if(type.schema.linebreakReplacement){var pre="pre"==type.whitespace,supportLinebreak=!!type.contentMatch.matchType(type.schema.linebreakReplacement);pre&&!supportLinebreak?convertNewlines=!1:!pre&&supportLinebreak&&(convertNewlines=!0)}!1===convertNewlines&&replaceLinebreaks(tr,node,pos,mapFrom),_clearIncompatible(tr,tr.mapping.slice(mapFrom).map(pos,1),type,void 0,null===convertNewlines);var mapping=tr.mapping.slice(mapFrom),startM=mapping.map(pos,1),endM=mapping.map(pos+node.nodeSize,1);return tr.step(new ReplaceAroundStep(startM,endM,startM+1,endM-1,new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(type.create(attrsHere,null,node.marks)),0,0),1,!0)),!0===convertNewlines&&replaceNewlines(tr,node,pos,mapFrom),!1}})}(this,from,arguments.length>1&&void 0!==arguments[1]?arguments[1]:from,arguments.length>2?arguments[2]:void 0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null),this}},{key:"setNodeMarkup",value:function setNodeMarkup(pos,type){return function _setNodeMarkup(tr,pos,type,attrs,marks){var node=tr.doc.nodeAt(pos);if(!node)throw new RangeError("No node at given position");type||(type=node.type);var newNode=type.create(attrs,null,marks||node.marks);if(node.isLeaf)return tr.replaceWith(pos,pos+node.nodeSize,newNode);if(!type.validContent(node.content))throw new RangeError("Invalid content for node type "+type.name);tr.step(new ReplaceAroundStep(pos,pos+node.nodeSize,pos+1,pos+node.nodeSize-1,new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(newNode),0,0),1,!0))}(this,pos,type,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0),this}},{key:"setNodeAttribute",value:function setNodeAttribute(pos,attr,value){return this.step(new AttrStep(pos,attr,value)),this}},{key:"setDocAttribute",value:function setDocAttribute(attr,value){return this.step(new DocAttrStep(attr,value)),this}},{key:"addNodeMark",value:function addNodeMark(pos,mark){return this.step(new AddNodeMarkStep(pos,mark)),this}},{key:"removeNodeMark",value:function removeNodeMark(pos,mark){var node=this.doc.nodeAt(pos);if(!node)throw new RangeError("No node at position "+pos);if(mark instanceof prosemirrorModel.Mark)mark.isInSet(node.marks)&&this.step(new RemoveNodeMarkStep(pos,mark));else{for(var found,set=node.marks,steps=[];found=mark.isInSet(set);)steps.push(new RemoveNodeMarkStep(pos,found)),set=found.removeFromSet(set);for(var i=steps.length-1;i>=0;i--)this.step(steps[i])}return this}},{key:"split",value:function split(pos){return function _split(tr,pos){for(var depth=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,typesAfter=arguments.length>3?arguments[3]:void 0,$pos=tr.doc.resolve(pos),before=prosemirrorModel.Fragment.empty,after=prosemirrorModel.Fragment.empty,d=$pos.depth,e=$pos.depth-depth,i=depth-1;d>e;d--,i--){before=prosemirrorModel.Fragment.from($pos.node(d).copy(before));var typeAfter=typesAfter&&typesAfter[i];after=prosemirrorModel.Fragment.from(typeAfter?typeAfter.type.create(typeAfter.attrs,after):$pos.node(d).copy(after))}tr.step(new ReplaceStep(pos,pos,new prosemirrorModel.Slice(before.append(after),depth,depth),!0))}(this,pos,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2?arguments[2]:void 0),this}},{key:"addMark",value:function addMark(from,to,mark){return function _addMark(tr,from,to,mark){var removing,adding,removed=[],added=[];tr.doc.nodesBetween(from,to,function(node,pos,parent){if(node.isInline){var marks=node.marks;if(!mark.isInSet(marks)&&parent.type.allowsMarkType(mark.type)){for(var start=Math.max(pos,from),end=Math.min(pos+node.nodeSize,to),newSet=mark.addToSet(marks),i=0;i<marks.length;i++)marks[i].isInSet(newSet)||(removing&&removing.to==start&&removing.mark.eq(marks[i])?removing.to=end:removed.push(removing=new RemoveMarkStep(start,end,marks[i])));adding&&adding.to==start?adding.to=end:added.push(adding=new AddMarkStep(start,end,mark))}}}),removed.forEach(function(s){return tr.step(s)}),added.forEach(function(s){return tr.step(s)})}(this,from,to,mark),this}},{key:"removeMark",value:function removeMark(from,to,mark){return function _removeMark(tr,from,to,mark){var matched=[],step=0;tr.doc.nodesBetween(from,to,function(node,pos){if(node.isInline){step++;var toRemove=null;if(mark instanceof prosemirrorModel.MarkType)for(var found,set=node.marks;found=mark.isInSet(set);)(toRemove||(toRemove=[])).push(found),set=found.removeFromSet(set);else mark?mark.isInSet(node.marks)&&(toRemove=[mark]):toRemove=node.marks;if(toRemove&&toRemove.length)for(var end=Math.min(pos+node.nodeSize,to),i=0;i<toRemove.length;i++){for(var style=toRemove[i],_found=void 0,j=0;j<matched.length;j++){var m=matched[j];m.step==step-1&&style.eq(matched[j].style)&&(_found=m)}_found?(_found.to=end,_found.step=step):matched.push({style,from:Math.max(pos,from),to:end,step})}}}),matched.forEach(function(m){return tr.step(new RemoveMarkStep(m.from,m.to,m.style))})}(this,from,to,mark),this}},{key:"clearIncompatible",value:function clearIncompatible(pos,parentType,match){return _clearIncompatible(this,pos,parentType,match),this}}]),Transform}();exports.AddMarkStep=AddMarkStep,exports.AddNodeMarkStep=AddNodeMarkStep,exports.AttrStep=AttrStep,exports.DocAttrStep=DocAttrStep,exports.MapResult=MapResult,exports.Mapping=Mapping,exports.RemoveMarkStep=RemoveMarkStep,exports.RemoveNodeMarkStep=RemoveNodeMarkStep,exports.ReplaceAroundStep=ReplaceAroundStep,exports.ReplaceStep=ReplaceStep,exports.Step=Step,exports.StepMap=StepMap,exports.StepResult=StepResult,exports.Transform=Transform,exports.canJoin=function canJoin(doc,pos){var $pos=doc.resolve(pos),index=$pos.index();return joinable($pos.nodeBefore,$pos.nodeAfter)&&$pos.parent.canReplace(index,index+1)},exports.canSplit=function canSplit(doc,pos){var depth=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,typesAfter=arguments.length>3?arguments[3]:void 0,$pos=doc.resolve(pos),base=$pos.depth-depth,innerType=typesAfter&&typesAfter[typesAfter.length-1]||$pos.parent;if(base<0||$pos.parent.type.spec.isolating||!$pos.parent.canReplace($pos.index(),$pos.parent.childCount)||!innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(),$pos.parent.childCount)))return!1;for(var d=$pos.depth-1,i=depth-2;d>base;d--,i--){var node=$pos.node(d),_index=$pos.index(d);if(node.type.spec.isolating)return!1;var rest=node.content.cutByIndex(_index,node.childCount),overrideChild=typesAfter&&typesAfter[i+1];overrideChild&&(rest=rest.replaceChild(0,overrideChild.type.create(overrideChild.attrs)));var after=typesAfter&&typesAfter[i]||node;if(!node.canReplace(_index+1,node.childCount)||!after.type.validContent(rest))return!1}var index=$pos.indexAfter(base),baseType=typesAfter&&typesAfter[0];return $pos.node(base).canReplaceWith(index,index,baseType?baseType.type:$pos.node(base+1).type)},exports.dropPoint=function dropPoint(doc,pos,slice){var $pos=doc.resolve(pos);if(!slice.content.size)return pos;for(var content=slice.content,i=0;i<slice.openStart;i++)content=content.firstChild.content;for(var pass=1;pass<=(0==slice.openStart&&slice.size?2:1);pass++)for(var d=$pos.depth;d>=0;d--){var bias=d==$pos.depth?0:$pos.pos<=($pos.start(d+1)+$pos.end(d+1))/2?-1:1,insertPos=$pos.index(d)+(bias>0?1:0),parent=$pos.node(d),fits=!1;if(1==pass)fits=parent.canReplace(insertPos,insertPos,content);else{var wrapping=parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);fits=wrapping&&parent.canReplaceWith(insertPos,insertPos,wrapping[0])}if(fits)return 0==bias?$pos.pos:bias<0?$pos.before(d+1):$pos.after(d+1)}return null},exports.findWrapping=function findWrapping(range,nodeType){var attrs=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,innerRange=arguments.length>3&&void 0!==arguments[3]?arguments[3]:range,around=function findWrappingOutside(range,type){var parent=range.parent,startIndex=range.startIndex,endIndex=range.endIndex,around=parent.contentMatchAt(startIndex).findWrapping(type);if(!around)return null;var outer=around.length?around[0]:type;return parent.canReplaceWith(startIndex,endIndex,outer)?around:null}(range,nodeType),inner=around&&function findWrappingInside(range,type){var parent=range.parent,startIndex=range.startIndex,endIndex=range.endIndex,inner=parent.child(startIndex),inside=type.contentMatch.findWrapping(inner.type);if(!inside)return null;for(var innerMatch=(inside.length?inside[inside.length-1]:type).contentMatch,i=startIndex;innerMatch&&i<endIndex;i++)innerMatch=innerMatch.matchType(parent.child(i).type);return innerMatch&&innerMatch.validEnd?inside:null}(innerRange,nodeType);return inner?around.map(withAttrs).concat({type:nodeType,attrs}).concat(inner.map(withAttrs)):null},exports.insertPoint=insertPoint,exports.joinPoint=function joinPoint(doc,pos){for(var dir=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,$pos=doc.resolve(pos),d=$pos.depth;;d--){var before=void 0,after=void 0,index=$pos.index(d);if(d==$pos.depth?(before=$pos.nodeBefore,after=$pos.nodeAfter):dir>0?(before=$pos.node(d+1),index++,after=$pos.node(d).maybeChild(index)):(before=$pos.node(d).maybeChild(index-1),after=$pos.node(d+1)),before&&!before.isTextblock&&joinable(before,after)&&$pos.node(d).canReplace(index,index+1))return pos;if(0==d)break;pos=dir<0?$pos.before(d):$pos.after(d)}},exports.liftTarget=function liftTarget(range){for(var content=range.parent.content.cutByIndex(range.startIndex,range.endIndex),depth=range.depth,contentBefore=0,contentAfter=0;;--depth){var node=range.$from.node(depth),index=range.$from.index(depth)+contentBefore,endIndex=range.$to.indexAfter(depth)-contentAfter;if(depth<range.depth&&node.canReplace(index,endIndex,content))return depth;if(0==depth||node.type.spec.isolating||!canCut(node,index,endIndex))break;index&&(contentBefore=1),endIndex<node.childCount&&(contentAfter=1)}return null},exports.replaceStep=replaceStep},"./node_modules/prosemirror-view/dist/index.cjs"(__unused_webpack_module,exports,__webpack_require__){"use strict";function _slicedToArray(arr,i){return function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}(arr)||function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r}finally{try{if(!f&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(o)throw n}}return a}}(arr,i)||_unsupportedIterableToArray(arr,i)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _createForOfIteratorHelper(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&"number"==typeof o.length){it&&(o=it);var i=0,F=function F(){};return{s:F,n:function n(){return i>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var err,normalCompletion=!0,didErr=!1;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();return normalCompletion=step.done,step},e:function e(_e2){didErr=!0,err=_e2},f:function f(){try{normalCompletion||null==it.return||it.return()}finally{if(didErr)throw err}}}}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function _get(target,property,receiver){var base=function _superPropBase(object,property){for(;!Object.prototype.hasOwnProperty.call(object,property)&&null!==(object=_getPrototypeOf(object)););return object}(target,property);if(base){var desc=Object.getOwnPropertyDescriptor(base,property);return desc.get?desc.get.call(arguments.length<3?target:receiver):desc.value}},_get.apply(this,arguments)}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}function _createSuper(Derived){var hasNativeReflectConstruct=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function _createSuperInternal(){var result,Super=_getPrototypeOf(Derived);if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return function _possibleConstructorReturn(self,call){if(call&&("object"===_typeof(call)||"function"==typeof call))return call;if(void 0!==call)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(self)}(this,result)}}function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===_typeof(key)?key:String(key)}var prosemirrorState=__webpack_require__("./node_modules/prosemirror-state/dist/index.cjs"),prosemirrorModel=__webpack_require__("./node_modules/prosemirror-model/dist/index.cjs"),prosemirrorTransform=__webpack_require__("./node_modules/prosemirror-transform/dist/index.cjs"),domIndex=function domIndex(node){for(var index=0;;index++)if(!(node=node.previousSibling))return index},parentNode=function parentNode(node){var parent=node.assignedSlot||node.parentNode;return parent&&11==parent.nodeType?parent.host:parent},reusedRange=null,textRange=function textRange(node,from,to){var range=reusedRange||(reusedRange=document.createRange());return range.setEnd(node,to??node.nodeValue.length),range.setStart(node,from||0),range},isEquivalentPosition=function isEquivalentPosition(node,off,targetNode,targetOff){return targetNode&&(scanFor(node,off,targetNode,targetOff,-1)||scanFor(node,off,targetNode,targetOff,1))},atomElements=/^(img|br|input|textarea|hr)$/i;function scanFor(node,off,targetNode,targetOff,dir){for(var _a;;){if(node==targetNode&&off==targetOff)return!0;if(off==(dir<0?0:nodeSize(node))){var parent=node.parentNode;if(!parent||1!=parent.nodeType||hasBlockDesc(node)||atomElements.test(node.nodeName)||"false"==node.contentEditable)return!1;off=domIndex(node)+(dir<0?0:1),node=parent}else{if(1!=node.nodeType)return!1;var child=node.childNodes[off+(dir<0?-1:0)];if(1==child.nodeType&&"false"==child.contentEditable){if(!(null===(_a=child.pmViewDesc)||void 0===_a?void 0:_a.ignoreForSelection))return!1;off+=dir}else node=child,off=dir<0?nodeSize(node):0}}}function nodeSize(node){return 3==node.nodeType?node.nodeValue.length:node.childNodes.length}function hasBlockDesc(dom){for(var desc,cur=dom;cur&&!(desc=cur.pmViewDesc);cur=cur.parentNode);return desc&&desc.node&&desc.node.isBlock&&(desc.dom==dom||desc.contentDOM==dom)}var selectionCollapsed=function selectionCollapsed(domSel){return domSel.focusNode&&isEquivalentPosition(domSel.focusNode,domSel.focusOffset,domSel.anchorNode,domSel.anchorOffset)};function keyEvent(keyCode,key){var event=document.createEvent("Event");return event.initEvent("keydown",!0,!0),event.keyCode=keyCode,event.key=event.code=key,event}var nav="undefined"!=typeof navigator?navigator:null,doc="undefined"!=typeof document?document:null,agent=nav&&nav.userAgent||"",ie_edge=/Edge\/(\d+)/.exec(agent),ie_upto10=/MSIE \d/.exec(agent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent),ie=!!(ie_upto10||ie_11up||ie_edge),ie_version=ie_upto10?document.documentMode:ie_11up?+ie_11up[1]:ie_edge?+ie_edge[1]:0,gecko=!ie&&/gecko\/(\d+)/i.test(agent);gecko&&(/Firefox\/(\d+)/.exec(agent)||[0,0])[1];var _chrome=!ie&&/Chrome\/(\d+)/.exec(agent),chrome=!!_chrome,chrome_version=_chrome?+_chrome[1]:0,safari=!ie&&!!nav&&/Apple Computer/.test(nav.vendor),ios=safari&&(/Mobile\/\w+/.test(agent)||!!nav&&nav.maxTouchPoints>2),mac=ios||!!nav&&/Mac/.test(nav.platform),windows=!!nav&&/Win/.test(nav.platform),android=/Android \d/.test(agent),webkit=!!doc&&"webkitFontSmoothing"in doc.documentElement.style,webkit_version=webkit?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function windowRect(doc){var vp=doc.defaultView&&doc.defaultView.visualViewport;return vp?{left:0,right:vp.width,top:0,bottom:vp.height}:{left:0,right:doc.documentElement.clientWidth,top:0,bottom:doc.documentElement.clientHeight}}function getSide(value,side){return"number"==typeof value?value:value[side]}function clientRect(node){var rect=node.getBoundingClientRect(),scaleX=rect.width/node.offsetWidth||1,scaleY=rect.height/node.offsetHeight||1;return{left:rect.left,right:rect.left+node.clientWidth*scaleX,top:rect.top,bottom:rect.top+node.clientHeight*scaleY}}function scrollRectIntoView(view,rect,startDOM){if(nonZero(rect)||0!=rect.left)for(var scrollThreshold=view.someProp("scrollThreshold")||0,scrollMargin=view.someProp("scrollMargin")||5,doc=view.dom.ownerDocument,parent=startDOM||view.dom;parent;)if(1==parent.nodeType){var elt=parent,atTop=elt==doc.body,bounding=atTop?windowRect(doc):clientRect(elt),moveX=0,moveY=0;if(rect.top<bounding.top+getSide(scrollThreshold,"top")?moveY=-(bounding.top-rect.top+getSide(scrollMargin,"top")):rect.bottom>bounding.bottom-getSide(scrollThreshold,"bottom")&&(moveY=rect.bottom-rect.top>bounding.bottom-bounding.top?rect.top+getSide(scrollMargin,"top")-bounding.top:rect.bottom-bounding.bottom+getSide(scrollMargin,"bottom")),rect.left<bounding.left+getSide(scrollThreshold,"left")?moveX=-(bounding.left-rect.left+getSide(scrollMargin,"left")):rect.right>bounding.right-getSide(scrollThreshold,"right")&&(moveX=rect.right-bounding.right+getSide(scrollMargin,"right")),moveX||moveY)if(atTop)doc.defaultView.scrollBy(moveX,moveY);else{var startX=elt.scrollLeft,startY=elt.scrollTop;moveY&&(elt.scrollTop+=moveY),moveX&&(elt.scrollLeft+=moveX);var dX=elt.scrollLeft-startX,dY=elt.scrollTop-startY;rect={left:rect.left-dX,top:rect.top-dY,right:rect.right-dX,bottom:rect.bottom-dY}}var pos=atTop?"fixed":getComputedStyle(parent).position;if(/^(fixed|sticky)$/.test(pos))break;parent="absolute"==pos?parent.offsetParent:parentNode(parent)}else parent=parentNode(parent)}function scrollStack(dom){for(var stack=[],doc=dom.ownerDocument,cur=dom;cur&&(stack.push({dom:cur,top:cur.scrollTop,left:cur.scrollLeft}),dom!=doc);cur=parentNode(cur));return stack}function restoreScrollStack(stack,dTop){for(var i=0;i<stack.length;i++){var _stack$i=stack[i],dom=_stack$i.dom,top=_stack$i.top,left=_stack$i.left;dom.scrollTop!=top+dTop&&(dom.scrollTop=top+dTop),dom.scrollLeft!=left&&(dom.scrollLeft=left)}}var preventScrollSupported=null;function findOffsetInNode(node,coords){for(var closest,coordsClosest,firstBelow,coordsBelow,dxClosest=2e8,offset=0,rowBot=coords.top,rowTop=coords.top,child=node.firstChild,childIndex=0;child;child=child.nextSibling,childIndex++){var rects=void 0;if(1==child.nodeType)rects=child.getClientRects();else{if(3!=child.nodeType)continue;rects=textRange(child).getClientRects()}for(var i=0;i<rects.length;i++){var rect=rects[i];if(rect.top<=rowBot&&rect.bottom>=rowTop){rowBot=Math.max(rect.bottom,rowBot),rowTop=Math.min(rect.top,rowTop);var dx=rect.left>coords.left?rect.left-coords.left:rect.right<coords.left?coords.left-rect.right:0;if(dx<dxClosest){closest=child,dxClosest=dx,coordsClosest=dx&&3==closest.nodeType?{left:rect.right<coords.left?rect.right:rect.left,top:coords.top}:coords,1==child.nodeType&&dx&&(offset=childIndex+(coords.left>=(rect.left+rect.right)/2?1:0));continue}}else rect.top>coords.top&&!firstBelow&&rect.left<=coords.left&&rect.right>=coords.left&&(firstBelow=child,coordsBelow={left:Math.max(rect.left,Math.min(rect.right,coords.left)),top:rect.top});!closest&&(coords.left>=rect.right&&coords.top>=rect.top||coords.left>=rect.left&&coords.top>=rect.bottom)&&(offset=childIndex+1)}}return!closest&&firstBelow&&(closest=firstBelow,coordsClosest=coordsBelow,dxClosest=0),closest&&3==closest.nodeType?function findOffsetInText(node,coords){for(var result,len=node.nodeValue.length,range=document.createRange(),i=0;i<len;i++){range.setEnd(node,i+1),range.setStart(node,i);var rect=singleRect(range,1);if(rect.top!=rect.bottom&&inRect(coords,rect)){result={node,offset:i+(coords.left>=(rect.left+rect.right)/2?1:0)};break}}return range.detach(),result||{node,offset:0}}(closest,coordsClosest):!closest||dxClosest&&1==closest.nodeType?{node,offset}:findOffsetInNode(closest,coordsClosest)}function inRect(coords,rect){return coords.left>=rect.left-1&&coords.left<=rect.right+1&&coords.top>=rect.top-1&&coords.top<=rect.bottom+1}function elementFromPoint(element,coords,box){var len=element.childNodes.length;if(len&&box.top<box.bottom)for(var startI=Math.max(0,Math.min(len-1,Math.floor(len*(coords.top-box.top)/(box.bottom-box.top))-2)),i=startI;;){var child=element.childNodes[i];if(1==child.nodeType)for(var rects=child.getClientRects(),j=0;j<rects.length;j++){var rect=rects[j];if(inRect(coords,rect))return elementFromPoint(child,coords,rect)}if((i=(i+1)%len)==startI)break}return element}function _posAtCoords(view,coords){var node,doc=view.dom.ownerDocument,offset=0,caret=function caretFromPoint(doc,x,y){if(doc.caretPositionFromPoint)try{var pos=doc.caretPositionFromPoint(x,y);if(pos)return{node:pos.offsetNode,offset:Math.min(nodeSize(pos.offsetNode),pos.offset)}}catch(_){}if(doc.caretRangeFromPoint){var range=doc.caretRangeFromPoint(x,y);if(range)return{node:range.startContainer,offset:Math.min(nodeSize(range.startContainer),range.startOffset)}}}(doc,coords.left,coords.top);caret&&(node=caret.node,offset=caret.offset);var pos,elt=(view.root.elementFromPoint?view.root:doc).elementFromPoint(coords.left,coords.top);if(!elt||!view.dom.contains(1!=elt.nodeType?elt.parentNode:elt)){var box=view.dom.getBoundingClientRect();if(!inRect(coords,box))return null;if(!(elt=elementFromPoint(view.dom,coords,box)))return null}if(safari)for(var p=elt;node&&p;p=parentNode(p))p.draggable&&(node=void 0);if(elt=function targetKludge(dom,coords){var parent=dom.parentNode;return parent&&/^li$/i.test(parent.nodeName)&&coords.left<dom.getBoundingClientRect().left?parent:dom}(elt,coords),node){if(gecko&&1==node.nodeType&&(offset=Math.min(offset,node.childNodes.length))<node.childNodes.length){var _box,next=node.childNodes[offset];"IMG"==next.nodeName&&(_box=next.getBoundingClientRect()).right<=coords.left&&_box.bottom>coords.top&&offset++}var prev;webkit&&offset&&1==node.nodeType&&1==(prev=node.childNodes[offset-1]).nodeType&&"false"==prev.contentEditable&&prev.getBoundingClientRect().top>=coords.top&&offset--,node==view.dom&&offset==node.childNodes.length-1&&1==node.lastChild.nodeType&&coords.top>node.lastChild.getBoundingClientRect().bottom?pos=view.state.doc.content.size:0!=offset&&1==node.nodeType&&"BR"==node.childNodes[offset-1].nodeName||(pos=function posFromCaret(view,node,offset,coords){for(var outsideBlock=-1,cur=node,sawBlock=!1;cur!=view.dom;){var desc=view.docView.nearestDesc(cur,!0),rect=void 0;if(!desc)return null;if(1==desc.dom.nodeType&&(desc.node.isBlock&&desc.parent||!desc.contentDOM)&&((rect=desc.dom.getBoundingClientRect()).width||rect.height)&&(desc.node.isBlock&&desc.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)&&(!sawBlock&&rect.left>coords.left||rect.top>coords.top?outsideBlock=desc.posBefore:(!sawBlock&&rect.right<coords.left||rect.bottom<coords.top)&&(outsideBlock=desc.posAfter),sawBlock=!0),!desc.contentDOM&&outsideBlock<0&&!desc.node.isText))return(desc.node.isBlock?coords.top<(rect.top+rect.bottom)/2:coords.left<(rect.left+rect.right)/2)?desc.posBefore:desc.posAfter;cur=desc.dom.parentNode}return outsideBlock>-1?outsideBlock:view.docView.posFromDOM(node,offset,-1)}(view,node,offset,coords))}null==pos&&(pos=function posFromElement(view,elt,coords){var _findOffsetInNode=findOffsetInNode(elt,coords),node=_findOffsetInNode.node,offset=_findOffsetInNode.offset,bias=-1;if(1==node.nodeType&&!node.firstChild){var rect=node.getBoundingClientRect();bias=rect.left!=rect.right&&coords.left>(rect.left+rect.right)/2?1:-1}return view.docView.posFromDOM(node,offset,bias)}(view,elt,coords));var desc=view.docView.nearestDesc(elt,!0);return{pos,inside:desc?desc.posAtStart-desc.border:-1}}function nonZero(rect){return rect.top<rect.bottom||rect.left<rect.right}function singleRect(target,bias){var rects=target.getClientRects();if(rects.length){var first=rects[bias<0?0:rects.length-1];if(nonZero(first))return first}return Array.prototype.find.call(rects,nonZero)||target.getBoundingClientRect()}var BIDI=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _coordsAtPos(view,pos,side){var _view$docView$domFrom=view.docView.domFromPos(pos,side<0?-1:1),node=_view$docView$domFrom.node,offset=_view$docView$domFrom.offset,atom=_view$docView$domFrom.atom,supportEmptyRange=webkit||gecko;if(3==node.nodeType){if(!supportEmptyRange||!BIDI.test(node.nodeValue)&&(side<0?offset:offset!=node.nodeValue.length)){var from=offset,to=offset,takeSide=side<0?1:-1;return side<0&&!offset?(to++,takeSide=-1):side>=0&&offset==node.nodeValue.length?(from--,takeSide=1):side<0?from--:to++,flattenV(singleRect(textRange(node,from,to),takeSide),takeSide<0)}var rect=singleRect(textRange(node,offset,offset),side);if(gecko&&offset&&/\s/.test(node.nodeValue[offset-1])&&offset<node.nodeValue.length){var rectBefore=singleRect(textRange(node,offset-1,offset-1),-1);if(rectBefore.top==rect.top){var rectAfter=singleRect(textRange(node,offset,offset+1),-1);if(rectAfter.top!=rect.top)return flattenV(rectAfter,rectAfter.left<rectBefore.left)}}return rect}if(!view.state.doc.resolve(pos-(atom||0)).parent.inlineContent){if(null==atom&&offset&&(side<0||offset==nodeSize(node))){var before=node.childNodes[offset-1];if(1==before.nodeType)return flattenH(before.getBoundingClientRect(),!1)}if(null==atom&&offset<nodeSize(node)){var after=node.childNodes[offset];if(1==after.nodeType)return flattenH(after.getBoundingClientRect(),!0)}return flattenH(node.getBoundingClientRect(),side>=0)}if(null==atom&&offset&&(side<0||offset==nodeSize(node))){var _before=node.childNodes[offset-1],target=3==_before.nodeType?textRange(_before,nodeSize(_before)-(supportEmptyRange?0:1)):1!=_before.nodeType||"BR"==_before.nodeName&&_before.nextSibling?null:_before;if(target)return flattenV(singleRect(target,1),!1)}if(null==atom&&offset<nodeSize(node)){for(var _after=node.childNodes[offset];_after.pmViewDesc&&_after.pmViewDesc.ignoreForCoords;)_after=_after.nextSibling;var _target=_after?3==_after.nodeType?textRange(_after,0,supportEmptyRange?0:1):1==_after.nodeType?_after:null:null;if(_target)return flattenV(singleRect(_target,-1),!0)}return flattenV(singleRect(3==node.nodeType?textRange(node):node,-side),side>=0)}function flattenV(rect,left){if(0==rect.width)return rect;var x=left?rect.left:rect.right;return{top:rect.top,bottom:rect.bottom,left:x,right:x}}function flattenH(rect,top){if(0==rect.height)return rect;var y=top?rect.top:rect.bottom;return{top:y,bottom:y,left:rect.left,right:rect.right}}function withFlushedState(view,state,f){var viewState=view.state,active=view.root.activeElement;viewState!=state&&view.updateState(state),active!=view.dom&&view.focus();try{return f()}finally{viewState!=state&&view.updateState(viewState),active!=view.dom&&active&&active.focus()}}var maybeRTL=/[\u0590-\u08ac]/;var cachedState=null,cachedDir=null,cachedResult=!1;function _endOfTextblock(view,state,dir){return cachedState==state&&cachedDir==dir?cachedResult:(cachedState=state,cachedDir=dir,cachedResult="up"==dir||"down"==dir?function endOfTextblockVertical(view,state,dir){var sel=state.selection,$pos="up"==dir?sel.$from:sel.$to;return withFlushedState(view,state,function(){for(var dom=view.docView.domFromPos($pos.pos,"up"==dir?-1:1).node;;){var nearest=view.docView.nearestDesc(dom,!0);if(!nearest)break;if(nearest.node.isBlock){dom=nearest.contentDOM||nearest.dom;break}dom=nearest.dom.parentNode}for(var coords=_coordsAtPos(view,$pos.pos,1),child=dom.firstChild;child;child=child.nextSibling){var boxes=void 0;if(1==child.nodeType)boxes=child.getClientRects();else{if(3!=child.nodeType)continue;boxes=textRange(child,0,child.nodeValue.length).getClientRects()}for(var i=0;i<boxes.length;i++){var box=boxes[i];if(box.bottom>box.top+1&&("up"==dir?coords.top-box.top>2*(box.bottom-coords.top):box.bottom-coords.bottom>2*(coords.bottom-box.top)))return!1}}return!0})}(view,state,dir):function endOfTextblockHorizontal(view,state,dir){var $head=state.selection.$head;if(!$head.parent.isTextblock)return!1;var offset=$head.parentOffset,atStart=!offset,atEnd=offset==$head.parent.content.size,sel=view.domSelection();return sel?maybeRTL.test($head.parent.textContent)&&sel.modify?withFlushedState(view,state,function(){var _view$domSelectionRan=view.domSelectionRange(),oldNode=_view$domSelectionRan.focusNode,oldOff=_view$domSelectionRan.focusOffset,anchorNode=_view$domSelectionRan.anchorNode,anchorOffset=_view$domSelectionRan.anchorOffset,oldBidiLevel=sel.caretBidiLevel;sel.modify("move",dir,"character");var parentDOM=$head.depth?view.docView.domAfterPos($head.before()):view.dom,_view$domSelectionRan2=view.domSelectionRange(),newNode=_view$domSelectionRan2.focusNode,newOff=_view$domSelectionRan2.focusOffset,result=newNode&&!parentDOM.contains(1==newNode.nodeType?newNode:newNode.parentNode)||oldNode==newNode&&oldOff==newOff;try{sel.collapse(anchorNode,anchorOffset),oldNode&&(oldNode!=anchorNode||oldOff!=anchorOffset)&&sel.extend&&sel.extend(oldNode,oldOff)}catch(_){}return null!=oldBidiLevel&&(sel.caretBidiLevel=oldBidiLevel),result}):"left"==dir||"backward"==dir?atStart:atEnd:$head.pos==$head.start()||$head.pos==$head.end()}(view,state,dir))}var ViewDesc=function(){function ViewDesc(parent,children,dom,contentDOM){_classCallCheck(this,ViewDesc),this.parent=parent,this.children=children,this.dom=dom,this.contentDOM=contentDOM,this.dirty=0,dom.pmViewDesc=this}return _createClass(ViewDesc,[{key:"matchesWidget",value:function matchesWidget(widget){return!1}},{key:"matchesMark",value:function matchesMark(mark){return!1}},{key:"matchesNode",value:function matchesNode(node,outerDeco,innerDeco){return!1}},{key:"matchesHack",value:function matchesHack(nodeName){return!1}},{key:"parseRule",value:function parseRule(addedNodes){return null}},{key:"stopEvent",value:function stopEvent(event){return!1}},{key:"size",get:function get(){for(var size=0,i=0;i<this.children.length;i++)size+=this.children[i].size;return size}},{key:"border",get:function get(){return 0}},{key:"destroy",value:function destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(var i=0;i<this.children.length;i++)this.children[i].destroy()}},{key:"posBeforeChild",value:function posBeforeChild(child){for(var i=0,pos=this.posAtStart;;i++){var cur=this.children[i];if(cur==child)return pos;pos+=cur.size}}},{key:"posBefore",get:function get(){return this.parent.posBeforeChild(this)}},{key:"posAtStart",get:function get(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}},{key:"posAfter",get:function get(){return this.posBefore+this.size}},{key:"posAtEnd",get:function get(){return this.posAtStart+this.size-2*this.border}},{key:"localPosFromDOM",value:function localPosFromDOM(dom,offset,bias){if(this.contentDOM&&this.contentDOM.contains(1==dom.nodeType?dom:dom.parentNode)){if(bias<0){var domBefore,desc;if(dom==this.contentDOM)domBefore=dom.childNodes[offset-1];else{for(;dom.parentNode!=this.contentDOM;)dom=dom.parentNode;domBefore=dom.previousSibling}for(;domBefore&&(!(desc=domBefore.pmViewDesc)||desc.parent!=this);)domBefore=domBefore.previousSibling;return domBefore?this.posBeforeChild(desc)+desc.size:this.posAtStart}var domAfter,_desc;if(dom==this.contentDOM)domAfter=dom.childNodes[offset];else{for(;dom.parentNode!=this.contentDOM;)dom=dom.parentNode;domAfter=dom.nextSibling}for(;domAfter&&(!(_desc=domAfter.pmViewDesc)||_desc.parent!=this);)domAfter=domAfter.nextSibling;return domAfter?this.posBeforeChild(_desc):this.posAtEnd}var atEnd;if(dom==this.dom&&this.contentDOM)atEnd=offset>domIndex(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))atEnd=2&dom.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==offset)for(var search=dom;;search=search.parentNode){if(search==this.dom){atEnd=!1;break}if(search.previousSibling)break}if(null==atEnd&&offset==dom.childNodes.length)for(var _search=dom;;_search=_search.parentNode){if(_search==this.dom){atEnd=!0;break}if(_search.nextSibling)break}}return atEnd??bias>0?this.posAtEnd:this.posAtStart}},{key:"nearestDesc",value:function nearestDesc(dom){for(var onlyNodes=arguments.length>1&&void 0!==arguments[1]&&arguments[1],first=!0,cur=dom;cur;cur=cur.parentNode){var desc=this.getDesc(cur),nodeDOM=void 0;if(desc&&(!onlyNodes||desc.node)){if(!first||!(nodeDOM=desc.nodeDOM)||(1==nodeDOM.nodeType?nodeDOM.contains(1==dom.nodeType?dom:dom.parentNode):nodeDOM==dom))return desc;first=!1}}}},{key:"getDesc",value:function getDesc(dom){for(var desc=dom.pmViewDesc,cur=desc;cur;cur=cur.parent)if(cur==this)return desc}},{key:"posFromDOM",value:function posFromDOM(dom,offset,bias){for(var scan=dom;scan;scan=scan.parentNode){var desc=this.getDesc(scan);if(desc)return desc.localPosFromDOM(dom,offset,bias)}return-1}},{key:"descAt",value:function descAt(pos){for(var i=0,offset=0;i<this.children.length;i++){var child=this.children[i],end=offset+child.size;if(offset==pos&&end!=offset){for(;!child.border&&child.children.length;)for(var _i=0;_i<child.children.length;_i++){var inner=child.children[_i];if(inner.size){child=inner;break}}return child}if(pos<end)return child.descAt(pos-offset-child.border);offset=end}}},{key:"domFromPos",value:function domFromPos(pos,side){if(!this.contentDOM)return{node:this.dom,offset:0,atom:pos+1};for(var prev,i=0,offset=0,curPos=0;i<this.children.length;i++){var child=this.children[i],end=curPos+child.size;if(end>pos||child instanceof TrailingHackViewDesc){offset=pos-curPos;break}curPos=end}if(offset)return this.children[i].domFromPos(offset-this.children[i].border,side);for(;i&&!(prev=this.children[i-1]).size&&prev instanceof WidgetViewDesc&&prev.side>=0;i--);if(side<=0){for(var _prev,enter=!0;(_prev=i?this.children[i-1]:null)&&_prev.dom.parentNode!=this.contentDOM;i--,enter=!1);return _prev&&side&&enter&&!_prev.border&&!_prev.domAtom?_prev.domFromPos(_prev.size,side):{node:this.contentDOM,offset:_prev?domIndex(_prev.dom)+1:0}}for(var next,_enter=!0;(next=i<this.children.length?this.children[i]:null)&&next.dom.parentNode!=this.contentDOM;i++,_enter=!1);return next&&_enter&&!next.border&&!next.domAtom?next.domFromPos(0,side):{node:this.contentDOM,offset:next?domIndex(next.dom):this.contentDOM.childNodes.length}}},{key:"parseRange",value:function parseRange(from,to){var base=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from,to,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var fromOffset=-1,toOffset=-1,offset=base,i=0;;i++){var child=this.children[i],end=offset+child.size;if(-1==fromOffset&&from<=end){var childBase=offset+child.border;if(from>=childBase&&to<=end-child.border&&child.node&&child.contentDOM&&this.contentDOM.contains(child.contentDOM))return child.parseRange(from,to,childBase);from=offset;for(var j=i;j>0;j--){var prev=this.children[j-1];if(prev.size&&prev.dom.parentNode==this.contentDOM&&!prev.emptyChildAt(1)){fromOffset=domIndex(prev.dom)+1;break}from-=prev.size}-1==fromOffset&&(fromOffset=0)}if(fromOffset>-1&&(end>to||i==this.children.length-1)){to=end;for(var _j=i+1;_j<this.children.length;_j++){var next=this.children[_j];if(next.size&&next.dom.parentNode==this.contentDOM&&!next.emptyChildAt(-1)){toOffset=domIndex(next.dom);break}to+=next.size}-1==toOffset&&(toOffset=this.contentDOM.childNodes.length);break}offset=end}return{node:this.contentDOM,from,to,fromOffset,toOffset}}},{key:"emptyChildAt",value:function emptyChildAt(side){if(this.border||!this.contentDOM||!this.children.length)return!1;var child=this.children[side<0?0:this.children.length-1];return 0==child.size||child.emptyChildAt(side)}},{key:"domAfterPos",value:function domAfterPos(pos){var _this$domFromPos=this.domFromPos(pos,0),node=_this$domFromPos.node,offset=_this$domFromPos.offset;if(1!=node.nodeType||offset==node.childNodes.length)throw new RangeError("No node after pos "+pos);return node.childNodes[offset]}},{key:"setSelection",value:function setSelection(anchor,head,view){for(var force=arguments.length>3&&void 0!==arguments[3]&&arguments[3],from=Math.min(anchor,head),to=Math.max(anchor,head),i=0,offset=0;i<this.children.length;i++){var child=this.children[i],end=offset+child.size;if(from>offset&&to<end)return child.setSelection(anchor-offset-child.border,head-offset-child.border,view,force);offset=end}var anchorDOM=this.domFromPos(anchor,anchor?-1:1),headDOM=head==anchor?anchorDOM:this.domFromPos(head,head?-1:1),domSel=view.root.getSelection(),selRange=view.domSelectionRange(),brKludge=!1;if((gecko||safari)&&anchor==head){var _anchorDOM=anchorDOM,node=_anchorDOM.node,_offset=_anchorDOM.offset;if(3==node.nodeType){if((brKludge=!(!_offset||"\n"!=node.nodeValue[_offset-1]))&&_offset==node.nodeValue.length)for(var after,scan=node;scan;scan=scan.parentNode){if(after=scan.nextSibling){"BR"==after.nodeName&&(anchorDOM=headDOM={node:after.parentNode,offset:domIndex(after)+1});break}var desc=scan.pmViewDesc;if(desc&&desc.node&&desc.node.isBlock)break}}else{var prev=node.childNodes[_offset-1];brKludge=prev&&("BR"==prev.nodeName||"false"==prev.contentEditable)}}if(gecko&&selRange.focusNode&&selRange.focusNode!=headDOM.node&&1==selRange.focusNode.nodeType){var _after2=selRange.focusNode.childNodes[selRange.focusOffset];_after2&&"false"==_after2.contentEditable&&(force=!0)}if(force||brKludge&&safari||!isEquivalentPosition(anchorDOM.node,anchorDOM.offset,selRange.anchorNode,selRange.anchorOffset)||!isEquivalentPosition(headDOM.node,headDOM.offset,selRange.focusNode,selRange.focusOffset)){var domSelExtended=!1;if((domSel.extend||anchor==head)&&(!brKludge||!gecko)){domSel.collapse(anchorDOM.node,anchorDOM.offset);try{anchor!=head&&domSel.extend(headDOM.node,headDOM.offset),domSelExtended=!0}catch(_){}}if(!domSelExtended){if(anchor>head){var tmp=anchorDOM;anchorDOM=headDOM,headDOM=tmp}var range=document.createRange();range.setEnd(headDOM.node,headDOM.offset),range.setStart(anchorDOM.node,anchorDOM.offset),domSel.removeAllRanges(),domSel.addRange(range)}}}},{key:"ignoreMutation",value:function ignoreMutation(mutation){return!this.contentDOM&&"selection"!=mutation.type}},{key:"contentLost",get:function get(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}},{key:"markDirty",value:function markDirty(from,to){for(var offset=0,i=0;i<this.children.length;i++){var child=this.children[i],end=offset+child.size;if(offset==end?from<=end&&to>=offset:from<end&&to>offset){var startInside=offset+child.border,endInside=end-child.border;if(from>=startInside&&to<=endInside)return this.dirty=from==offset||to==end?2:1,void(from!=startInside||to!=endInside||!child.contentLost&&child.dom.parentNode==this.contentDOM?child.markDirty(from-startInside,to-startInside):child.dirty=3);child.dirty=child.dom!=child.contentDOM||child.dom.parentNode!=this.contentDOM||child.children.length?3:2}offset=end}this.dirty=2}},{key:"markParentsDirty",value:function markParentsDirty(){for(var level=1,node=this.parent;node;node=node.parent,level++){var dirty=1==level?2:1;node.dirty<dirty&&(node.dirty=dirty)}}},{key:"domAtom",get:function get(){return!1}},{key:"ignoreForCoords",get:function get(){return!1}},{key:"ignoreForSelection",get:function get(){return!1}},{key:"isText",value:function isText(text){return!1}}]),ViewDesc}(),WidgetViewDesc=function(_ViewDesc){_inherits(WidgetViewDesc,_ViewDesc);var _super=_createSuper(WidgetViewDesc);function WidgetViewDesc(parent,widget,view,pos){var _this;_classCallCheck(this,WidgetViewDesc);var self,dom=widget.type.toDOM;if("function"==typeof dom&&(dom=dom(view,function(){return self?self.parent?self.parent.posBeforeChild(self):void 0:pos})),!widget.type.spec.raw){if(1!=dom.nodeType){var wrap=document.createElement("span");wrap.appendChild(dom),dom=wrap}dom.hasAttribute("contenteditable")||(dom.contentEditable="false"),dom.classList.add("ProseMirror-widget")}return(_this=_super.call(this,parent,[],dom,null)).widget=widget,_this.widget=widget,self=_assertThisInitialized(_this),_this}return _createClass(WidgetViewDesc,[{key:"matchesWidget",value:function matchesWidget(widget){return 0==this.dirty&&widget.type.eq(this.widget.type)}},{key:"parseRule",value:function parseRule(){return{ignore:!0}}},{key:"stopEvent",value:function stopEvent(event){var stop=this.widget.spec.stopEvent;return!!stop&&stop(event)}},{key:"ignoreMutation",value:function ignoreMutation(mutation){return"selection"!=mutation.type||this.widget.spec.ignoreSelection}},{key:"destroy",value:function destroy(){this.widget.type.destroy(this.dom),_get(_getPrototypeOf(WidgetViewDesc.prototype),"destroy",this).call(this)}},{key:"domAtom",get:function get(){return!0}},{key:"ignoreForSelection",get:function get(){return!!this.widget.type.spec.relaxedSide}},{key:"side",get:function get(){return this.widget.type.side}}]),WidgetViewDesc}(ViewDesc),CompositionViewDesc=function(_ViewDesc2){_inherits(CompositionViewDesc,_ViewDesc2);var _super2=_createSuper(CompositionViewDesc);function CompositionViewDesc(parent,dom,textDOM,text){var _this2;return _classCallCheck(this,CompositionViewDesc),(_this2=_super2.call(this,parent,[],dom,null)).textDOM=textDOM,_this2.text=text,_this2}return _createClass(CompositionViewDesc,[{key:"size",get:function get(){return this.text.length}},{key:"localPosFromDOM",value:function localPosFromDOM(dom,offset){return dom!=this.textDOM?this.posAtStart+(offset?this.size:0):this.posAtStart+offset}},{key:"domFromPos",value:function domFromPos(pos){return{node:this.textDOM,offset:pos}}},{key:"ignoreMutation",value:function ignoreMutation(mut){return"characterData"===mut.type&&mut.target.nodeValue==mut.oldValue}}]),CompositionViewDesc}(ViewDesc),MarkViewDesc=function(_ViewDesc3){_inherits(MarkViewDesc,_ViewDesc3);var _super3=_createSuper(MarkViewDesc);function MarkViewDesc(parent,mark,dom,contentDOM,spec){var _this3;return _classCallCheck(this,MarkViewDesc),(_this3=_super3.call(this,parent,[],dom,contentDOM)).mark=mark,_this3.spec=spec,_this3}return _createClass(MarkViewDesc,[{key:"parseRule",value:function parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}},{key:"matchesMark",value:function matchesMark(mark){return 3!=this.dirty&&this.mark.eq(mark)}},{key:"markDirty",value:function markDirty(from,to){if(_get(_getPrototypeOf(MarkViewDesc.prototype),"markDirty",this).call(this,from,to),0!=this.dirty){for(var parent=this.parent;!parent.node;)parent=parent.parent;parent.dirty<this.dirty&&(parent.dirty=this.dirty),this.dirty=0}}},{key:"slice",value:function slice(from,to,view){var copy=MarkViewDesc.create(this.parent,this.mark,!0,view),nodes=this.children,size=this.size;to<size&&(nodes=replaceNodes(nodes,to,size,view)),from>0&&(nodes=replaceNodes(nodes,0,from,view));for(var i=0;i<nodes.length;i++)nodes[i].parent=copy;return copy.children=nodes,copy}},{key:"ignoreMutation",value:function ignoreMutation(mutation){return this.spec.ignoreMutation?this.spec.ignoreMutation(mutation):_get(_getPrototypeOf(MarkViewDesc.prototype),"ignoreMutation",this).call(this,mutation)}},{key:"destroy",value:function destroy(){this.spec.destroy&&this.spec.destroy(),_get(_getPrototypeOf(MarkViewDesc.prototype),"destroy",this).call(this)}}],[{key:"create",value:function create(parent,mark,inline,view){var custom=view.nodeViews[mark.type.name],spec=custom&&custom(mark,view,inline);return spec&&spec.dom||(spec=prosemirrorModel.DOMSerializer.renderSpec(document,mark.type.spec.toDOM(mark,inline),null,mark.attrs)),new MarkViewDesc(parent,mark,spec.dom,spec.contentDOM||spec.dom,spec)}}]),MarkViewDesc}(ViewDesc),NodeViewDesc=function(_ViewDesc4){_inherits(NodeViewDesc,_ViewDesc4);var _super4=_createSuper(NodeViewDesc);function NodeViewDesc(parent,node,outerDeco,innerDeco,dom,contentDOM,nodeDOM){var _this4;return _classCallCheck(this,NodeViewDesc),(_this4=_super4.call(this,parent,[],dom,contentDOM)).node=node,_this4.outerDeco=outerDeco,_this4.innerDeco=innerDeco,_this4.nodeDOM=nodeDOM,_this4}return _createClass(NodeViewDesc,[{key:"parseRule",value:function parseRule(addedNodes){var _this5=this;if(this.node.type.spec.reparseInView)return null;var rule={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(rule.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(var i=this.children.length-1;i>=0;i--){var child=this.children[i];if(this.dom.contains(child.dom.parentNode)){rule.contentElement=child.dom.parentNode;break}}if(!rule.contentElement){var found=addedNodes&&addedNodes.find(function(n){return 1==n.nodeType&&addedNodes.indexOf(n.parentNode)<0&&_this5.dom.contains(n)});found?rule.contentElement=found:rule.getContent=function(){return prosemirrorModel.Fragment.empty}}}else rule.contentElement=this.contentDOM;else rule.getContent=function(){return _this5.node.content};return rule}},{key:"matchesNode",value:function matchesNode(node,outerDeco,innerDeco){return 0==this.dirty&&node.eq(this.node)&&sameOuterDeco(outerDeco,this.outerDeco)&&innerDeco.eq(this.innerDeco)}},{key:"size",get:function get(){return this.node.nodeSize}},{key:"border",get:function get(){return this.node.isLeaf?0:1}},{key:"updateChildren",value:function updateChildren(view,pos){var _this6=this,inline=this.node.inlineContent,off=pos,composition=view.composing?this.localCompositionInfo(view,pos):null,localComposition=composition&&composition.pos>-1?composition:null,compositionInChild=composition&&composition.pos<0,updater=new ViewTreeUpdater(this,localComposition&&localComposition.node,view);!function iterDeco(parent,deco,onWidget,onNode){var locals=deco.locals(parent),offset=0;if(0==locals.length){for(var i=0;i<parent.childCount;i++){var child=parent.child(i);onNode(child,locals,deco.forChild(offset,child),i),offset+=child.nodeSize}return}for(var decoIndex=0,active=[],restNode=null,parentIndex=0;;){for(var widget=void 0,widgets=void 0;decoIndex<locals.length&&locals[decoIndex].to==offset;){var next=locals[decoIndex++];next.widget&&(widget?(widgets||(widgets=[widget])).push(next):widget=next)}if(widget)if(widgets){widgets.sort(compareSide);for(var _i3=0;_i3<widgets.length;_i3++)onWidget(widgets[_i3],parentIndex,!!restNode)}else onWidget(widget,parentIndex,!!restNode);var _child=void 0,index=void 0;if(restNode)index=-1,_child=restNode,restNode=null;else{if(!(parentIndex<parent.childCount))break;index=parentIndex,_child=parent.child(parentIndex++)}for(var _i4=0;_i4<active.length;_i4++)active[_i4].to<=offset&&active.splice(_i4--,1);for(;decoIndex<locals.length&&locals[decoIndex].from<=offset&&locals[decoIndex].to>offset;)active.push(locals[decoIndex++]);var end=offset+_child.nodeSize;if(_child.isText){var cutAt=end;decoIndex<locals.length&&locals[decoIndex].from<cutAt&&(cutAt=locals[decoIndex].from);for(var _i5=0;_i5<active.length;_i5++)active[_i5].to<cutAt&&(cutAt=active[_i5].to);cutAt<end&&(restNode=_child.cut(cutAt-offset),_child=_child.cut(0,cutAt-offset),end=cutAt,index=-1)}else for(;decoIndex<locals.length&&locals[decoIndex].to<end;)decoIndex++;onNode(_child,_child.isInline&&!_child.isLeaf?active.filter(function(d){return!d.inline}):active.slice(),deco.forChild(offset,_child),index),offset=end}}(this.node,this.innerDeco,function(widget,i,insideNode){widget.spec.marks?updater.syncToMarks(widget.spec.marks,inline,view,i):widget.type.side>=0&&!insideNode&&updater.syncToMarks(i==_this6.node.childCount?prosemirrorModel.Mark.none:_this6.node.child(i).marks,inline,view,i),updater.placeWidget(widget,view,off)},function(child,outerDeco,innerDeco,i){var compIndex;updater.syncToMarks(child.marks,inline,view,i),updater.findNodeMatch(child,outerDeco,innerDeco,i)||compositionInChild&&view.state.selection.from>off&&view.state.selection.to<off+child.nodeSize&&(compIndex=updater.findIndexWithChild(composition.node))>-1&&updater.updateNodeAt(child,outerDeco,innerDeco,compIndex,view)||updater.updateNextNode(child,outerDeco,innerDeco,view,i,off)||updater.addNode(child,outerDeco,innerDeco,view,off),off+=child.nodeSize}),updater.syncToMarks([],inline,view,0),this.node.isTextblock&&updater.addTextblockHacks(),updater.destroyRest(),(updater.changed||2==this.dirty)&&(localComposition&&this.protectLocalComposition(view,localComposition),renderDescs(this.contentDOM,this.children,view),ios&&function iosHacks(dom){if("UL"==dom.nodeName||"OL"==dom.nodeName){var oldCSS=dom.style.cssText;dom.style.cssText=oldCSS+"; list-style: square !important",window.getComputedStyle(dom).listStyle,dom.style.cssText=oldCSS}}(this.dom))}},{key:"localCompositionInfo",value:function localCompositionInfo(view,pos){var _view$state$selection=view.state.selection,from=_view$state$selection.from,to=_view$state$selection.to;if(!(view.state.selection instanceof prosemirrorState.TextSelection)||from<pos||to>pos+this.node.content.size)return null;var textNode=view.input.compositionNode;if(!textNode||!this.dom.contains(textNode.parentNode))return null;if(this.node.inlineContent){var text=textNode.nodeValue,textPos=function findTextInFragment(frag,text,from,to){for(var i=0,pos=0;i<frag.childCount&&pos<=to;){var child=frag.child(i++),childStart=pos;if(pos+=child.nodeSize,child.isText){for(var str=child.text;i<frag.childCount;){var next=frag.child(i++);if(pos+=next.nodeSize,!next.isText)break;str+=next.text}if(pos>=from){if(pos>=to&&str.slice(to-text.length-childStart,to-childStart)==text)return to-text.length;var found=childStart<to?str.lastIndexOf(text,to-childStart-1):-1;if(found>=0&&found+text.length+childStart>=from)return childStart+found;if(from==to&&str.length>=to+text.length-childStart&&str.slice(to-childStart,to-childStart+text.length)==text)return to}}}return-1}(this.node.content,text,from-pos,to-pos);return textPos<0?null:{node:textNode,pos:textPos,text}}return{node:textNode,pos:-1,text:""}}},{key:"protectLocalComposition",value:function protectLocalComposition(view,_ref2){var node=_ref2.node,pos=_ref2.pos,text=_ref2.text;if(!this.getDesc(node)){for(var topNode=node;topNode.parentNode!=this.contentDOM;topNode=topNode.parentNode){for(;topNode.previousSibling;)topNode.parentNode.removeChild(topNode.previousSibling);for(;topNode.nextSibling;)topNode.parentNode.removeChild(topNode.nextSibling);topNode.pmViewDesc&&(topNode.pmViewDesc=void 0)}var desc=new CompositionViewDesc(this,topNode,node,text);view.input.compositionNodes.push(desc),this.children=replaceNodes(this.children,pos,pos+text.length,view,desc)}}},{key:"update",value:function update(node,outerDeco,innerDeco,view){return!(3==this.dirty||!node.sameMarkup(this.node))&&(this.updateInner(node,outerDeco,innerDeco,view),!0)}},{key:"updateInner",value:function updateInner(node,outerDeco,innerDeco,view){this.updateOuterDeco(outerDeco),this.node=node,this.innerDeco=innerDeco,this.contentDOM&&this.updateChildren(view,this.posAtStart),this.dirty=0}},{key:"updateOuterDeco",value:function updateOuterDeco(outerDeco){if(!sameOuterDeco(outerDeco,this.outerDeco)){var needsWrap=1!=this.nodeDOM.nodeType,oldDOM=this.dom;this.dom=patchOuterDeco(this.dom,this.nodeDOM,computeOuterDeco(this.outerDeco,this.node,needsWrap),computeOuterDeco(outerDeco,this.node,needsWrap)),this.dom!=oldDOM&&(oldDOM.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=outerDeco}}},{key:"selectNode",value:function selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}},{key:"deselectNode",value:function deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}},{key:"domAtom",get:function get(){return this.node.isAtom}}],[{key:"create",value:function create(parent,node,outerDeco,innerDeco,view,pos){var descObj,custom=view.nodeViews[node.type.name],spec=custom&&custom(node,view,function(){return descObj?descObj.parent?descObj.parent.posBeforeChild(descObj):void 0:pos},outerDeco,innerDeco),dom=spec&&spec.dom,contentDOM=spec&&spec.contentDOM;if(node.isText)if(dom){if(3!=dom.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else dom=document.createTextNode(node.text);else if(!dom){var _spec=prosemirrorModel.DOMSerializer.renderSpec(document,node.type.spec.toDOM(node),null,node.attrs);dom=_spec.dom,contentDOM=_spec.contentDOM}contentDOM||node.isText||"BR"==dom.nodeName||(dom.hasAttribute("contenteditable")||(dom.contentEditable="false"),node.type.spec.draggable&&(dom.draggable=!0));var nodeDOM=dom;return dom=applyOuterDeco(dom,outerDeco,node),spec?descObj=new CustomNodeViewDesc(parent,node,outerDeco,innerDeco,dom,contentDOM||null,nodeDOM,spec):node.isText?new TextViewDesc(parent,node,outerDeco,innerDeco,dom,nodeDOM):new NodeViewDesc(parent,node,outerDeco,innerDeco,dom,contentDOM||null,nodeDOM)}}]),NodeViewDesc}(ViewDesc);function docViewDesc(doc,outerDeco,innerDeco,dom,view){applyOuterDeco(dom,outerDeco,doc);var docView=new NodeViewDesc(void 0,doc,outerDeco,innerDeco,dom,dom,dom);return docView.contentDOM&&docView.updateChildren(view,0),docView}var TextViewDesc=function(_NodeViewDesc){_inherits(TextViewDesc,_NodeViewDesc);var _super5=_createSuper(TextViewDesc);function TextViewDesc(parent,node,outerDeco,innerDeco,dom,nodeDOM){return _classCallCheck(this,TextViewDesc),_super5.call(this,parent,node,outerDeco,innerDeco,dom,null,nodeDOM)}return _createClass(TextViewDesc,[{key:"parseRule",value:function parseRule(){for(var skip=this.nodeDOM.parentNode;skip&&skip!=this.dom&&!skip.pmIsDeco;)skip=skip.parentNode;return{skip:skip||!0}}},{key:"update",value:function update(node,outerDeco,innerDeco,view){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!node.sameMarkup(this.node))&&(this.updateOuterDeco(outerDeco),0==this.dirty&&node.text==this.node.text||node.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=node.text,view.trackWrites==this.nodeDOM&&(view.trackWrites=null)),this.node=node,this.dirty=0,!0)}},{key:"inParent",value:function inParent(){for(var parentDOM=this.parent.contentDOM,n=this.nodeDOM;n;n=n.parentNode)if(n==parentDOM)return!0;return!1}},{key:"domFromPos",value:function domFromPos(pos){return{node:this.nodeDOM,offset:pos}}},{key:"localPosFromDOM",value:function localPosFromDOM(dom,offset,bias){return dom==this.nodeDOM?this.posAtStart+Math.min(offset,this.node.text.length):_get(_getPrototypeOf(TextViewDesc.prototype),"localPosFromDOM",this).call(this,dom,offset,bias)}},{key:"ignoreMutation",value:function ignoreMutation(mutation){return"characterData"!=mutation.type&&"selection"!=mutation.type}},{key:"slice",value:function slice(from,to,_view){var node=this.node.cut(from,to),dom=document.createTextNode(node.text);return new TextViewDesc(this.parent,node,this.outerDeco,this.innerDeco,dom,dom)}},{key:"markDirty",value:function markDirty(from,to){_get(_getPrototypeOf(TextViewDesc.prototype),"markDirty",this).call(this,from,to),this.dom==this.nodeDOM||0!=from&&to!=this.nodeDOM.nodeValue.length||(this.dirty=3)}},{key:"domAtom",get:function get(){return!1}},{key:"isText",value:function isText(text){return this.node.text==text}}]),TextViewDesc}(NodeViewDesc),TrailingHackViewDesc=function(_ViewDesc5){_inherits(TrailingHackViewDesc,_ViewDesc5);var _super6=_createSuper(TrailingHackViewDesc);function TrailingHackViewDesc(){return _classCallCheck(this,TrailingHackViewDesc),_super6.apply(this,arguments)}return _createClass(TrailingHackViewDesc,[{key:"parseRule",value:function parseRule(){return{ignore:!0}}},{key:"matchesHack",value:function matchesHack(nodeName){return 0==this.dirty&&this.dom.nodeName==nodeName}},{key:"domAtom",get:function get(){return!0}},{key:"ignoreForCoords",get:function get(){return"IMG"==this.dom.nodeName}}]),TrailingHackViewDesc}(ViewDesc),CustomNodeViewDesc=function(_NodeViewDesc2){_inherits(CustomNodeViewDesc,_NodeViewDesc2);var _super7=_createSuper(CustomNodeViewDesc);function CustomNodeViewDesc(parent,node,outerDeco,innerDeco,dom,contentDOM,nodeDOM,spec){var _this7;return _classCallCheck(this,CustomNodeViewDesc),(_this7=_super7.call(this,parent,node,outerDeco,innerDeco,dom,contentDOM,nodeDOM)).spec=spec,_this7}return _createClass(CustomNodeViewDesc,[{key:"update",value:function update(node,outerDeco,innerDeco,view){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==node.type||this.spec.multiType)){var result=this.spec.update(node,outerDeco,innerDeco);return result&&this.updateInner(node,outerDeco,innerDeco,view),result}return!(!this.contentDOM&&!node.isLeaf)&&_get(_getPrototypeOf(CustomNodeViewDesc.prototype),"update",this).call(this,node,outerDeco,innerDeco,view)}},{key:"selectNode",value:function selectNode(){this.spec.selectNode?this.spec.selectNode():_get(_getPrototypeOf(CustomNodeViewDesc.prototype),"selectNode",this).call(this)}},{key:"deselectNode",value:function deselectNode(){this.spec.deselectNode?this.spec.deselectNode():_get(_getPrototypeOf(CustomNodeViewDesc.prototype),"deselectNode",this).call(this)}},{key:"setSelection",value:function setSelection(anchor,head,view,force){this.spec.setSelection?this.spec.setSelection(anchor,head,view.root):_get(_getPrototypeOf(CustomNodeViewDesc.prototype),"setSelection",this).call(this,anchor,head,view,force)}},{key:"destroy",value:function destroy(){this.spec.destroy&&this.spec.destroy(),_get(_getPrototypeOf(CustomNodeViewDesc.prototype),"destroy",this).call(this)}},{key:"stopEvent",value:function stopEvent(event){return!!this.spec.stopEvent&&this.spec.stopEvent(event)}},{key:"ignoreMutation",value:function ignoreMutation(mutation){return this.spec.ignoreMutation?this.spec.ignoreMutation(mutation):_get(_getPrototypeOf(CustomNodeViewDesc.prototype),"ignoreMutation",this).call(this,mutation)}}]),CustomNodeViewDesc}(NodeViewDesc);function renderDescs(parentDOM,descs,view){for(var dom=parentDOM.firstChild,written=!1,i=0;i<descs.length;i++){var desc=descs[i],childDOM=desc.dom;if(childDOM.parentNode==parentDOM){for(;childDOM!=dom;)dom=rm(dom),written=!0;dom=dom.nextSibling}else written=!0,parentDOM.insertBefore(childDOM,dom);if(desc instanceof MarkViewDesc){var pos=dom?dom.previousSibling:parentDOM.lastChild;renderDescs(desc.contentDOM,desc.children,view),dom=pos?pos.nextSibling:parentDOM.firstChild}}for(;dom;)dom=rm(dom),written=!0;written&&view.trackWrites==parentDOM&&(view.trackWrites=null)}var OuterDecoLevel=function OuterDecoLevel(nodeName){nodeName&&(this.nodeName=nodeName)};OuterDecoLevel.prototype=Object.create(null);var noDeco=[new OuterDecoLevel];function computeOuterDeco(outerDeco,node,needsWrap){if(0==outerDeco.length)return noDeco;for(var top=needsWrap?noDeco[0]:new OuterDecoLevel,result=[top],i=0;i<outerDeco.length;i++){var attrs=outerDeco[i].type.attrs;if(attrs)for(var name in attrs.nodeName&&result.push(top=new OuterDecoLevel(attrs.nodeName)),attrs){var val=attrs[name];null!=val&&(needsWrap&&1==result.length&&result.push(top=new OuterDecoLevel(node.isInline?"span":"div")),"class"==name?top.class=(top.class?top.class+" ":"")+val:"style"==name?top.style=(top.style?top.style+";":"")+val:"nodeName"!=name&&(top[name]=val))}}return result}function patchOuterDeco(outerDOM,nodeDOM,prevComputed,curComputed){if(prevComputed==noDeco&&curComputed==noDeco)return nodeDOM;for(var curDOM=nodeDOM,i=0;i<curComputed.length;i++){var deco=curComputed[i],prev=prevComputed[i];if(i){var parent=void 0;prev&&prev.nodeName==deco.nodeName&&curDOM!=outerDOM&&(parent=curDOM.parentNode)&&parent.nodeName.toLowerCase()==deco.nodeName||((parent=document.createElement(deco.nodeName)).pmIsDeco=!0,parent.appendChild(curDOM),prev=noDeco[0]),curDOM=parent}patchAttributes(curDOM,prev||noDeco[0],deco)}return curDOM}function patchAttributes(dom,prev,cur){for(var name in prev)"class"==name||"style"==name||"nodeName"==name||name in cur||dom.removeAttribute(name);for(var _name in cur)"class"!=_name&&"style"!=_name&&"nodeName"!=_name&&cur[_name]!=prev[_name]&&dom.setAttribute(_name,cur[_name]);if(prev.class!=cur.class){for(var prevList=prev.class?prev.class.split(" ").filter(Boolean):[],curList=cur.class?cur.class.split(" ").filter(Boolean):[],i=0;i<prevList.length;i++)-1==curList.indexOf(prevList[i])&&dom.classList.remove(prevList[i]);for(var _i2=0;_i2<curList.length;_i2++)-1==prevList.indexOf(curList[_i2])&&dom.classList.add(curList[_i2]);0==dom.classList.length&&dom.removeAttribute("class")}if(prev.style!=cur.style){if(prev.style)for(var m,prop=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;m=prop.exec(prev.style);)dom.style.removeProperty(m[1]);cur.style&&(dom.style.cssText+=cur.style)}}function applyOuterDeco(dom,deco,node){return patchOuterDeco(dom,dom,noDeco,computeOuterDeco(deco,node,1!=dom.nodeType))}function sameOuterDeco(a,b){if(a.length!=b.length)return!1;for(var i=0;i<a.length;i++)if(!a[i].type.eq(b[i].type))return!1;return!0}function rm(dom){var next=dom.nextSibling;return dom.parentNode.removeChild(dom),next}var ViewTreeUpdater=function(){function ViewTreeUpdater(top,lock,view){_classCallCheck(this,ViewTreeUpdater),this.lock=lock,this.view=view,this.index=0,this.stack=[],this.changed=!1,this.top=top,this.preMatch=function preMatch(frag,parentDesc){var curDesc=parentDesc,descI=curDesc.children.length,fI=frag.childCount,matched=new Map,matches=[];outer:for(;fI>0;){for(var desc=void 0;;)if(descI){var next=curDesc.children[descI-1];if(!(next instanceof MarkViewDesc)){desc=next,descI--;break}curDesc=next,descI=next.children.length}else{if(curDesc==parentDesc)break outer;descI=curDesc.parent.children.indexOf(curDesc),curDesc=curDesc.parent}var node=desc.node;if(node){if(node!=frag.child(fI-1))break;--fI,matched.set(desc,fI),matches.push(desc)}}return{index:fI,matched,matches:matches.reverse()}}(top.node.content,top)}return _createClass(ViewTreeUpdater,[{key:"destroyBetween",value:function destroyBetween(start,end){if(start!=end){for(var i=start;i<end;i++)this.top.children[i].destroy();this.top.children.splice(start,end-start),this.changed=!0}}},{key:"destroyRest",value:function destroyRest(){this.destroyBetween(this.index,this.top.children.length)}},{key:"syncToMarks",value:function syncToMarks(marks,inline,view,parentIndex){for(var keep=0,depth=this.stack.length>>1,maxKeep=Math.min(depth,marks.length);keep<maxKeep&&(keep==depth-1?this.top:this.stack[keep+1<<1]).matchesMark(marks[keep])&&!1!==marks[keep].type.spec.spanning;)keep++;for(;keep<depth;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),depth--;for(;depth<marks.length;){this.stack.push(this.top,this.index+1);var found=-1,scanTo=this.top.children.length;parentIndex<this.preMatch.index&&(scanTo=Math.min(this.index+3,scanTo));for(var i=this.index;i<scanTo;i++){var next=this.top.children[i];if(next.matchesMark(marks[depth])&&!this.isLocked(next.dom)){found=i;break}}if(found<0&&this.index<this.top.children.length){var cur=this.top.children[this.index];cur instanceof MarkViewDesc&&3!=cur.dirty&&cur.mark.type==marks[depth].type&&cur.spec.update&&!this.isLocked(cur.dom)&&cur.spec.update(marks[depth])&&(cur.mark=marks[depth],found=this.index,this.changed=!0)}if(found>-1)found>this.index&&(this.changed=!0,this.destroyBetween(this.index,found)),this.top=this.top.children[this.index];else{var markDesc=MarkViewDesc.create(this.top,marks[depth],inline,view);this.top.children.splice(this.index,0,markDesc),this.top=markDesc,this.changed=!0}this.index=0,depth++}}},{key:"findNodeMatch",value:function findNodeMatch(node,outerDeco,innerDeco,index){var targetDesc,found=-1;if(index>=this.preMatch.index&&(targetDesc=this.preMatch.matches[index-this.preMatch.index]).parent==this.top&&targetDesc.matchesNode(node,outerDeco,innerDeco))found=this.top.children.indexOf(targetDesc,this.index);else for(var i=this.index,e=Math.min(this.top.children.length,i+5);i<e;i++){var child=this.top.children[i];if(child.matchesNode(node,outerDeco,innerDeco)&&!this.preMatch.matched.has(child)){found=i;break}}return!(found<0)&&(this.destroyBetween(this.index,found),this.index++,!0)}},{key:"updateNodeAt",value:function updateNodeAt(node,outerDeco,innerDeco,index,view){var child=this.top.children[index];return 3==child.dirty&&child.dom==child.contentDOM&&(child.dirty=2),!!child.update(node,outerDeco,innerDeco,view)&&(this.destroyBetween(this.index,index),this.index++,!0)}},{key:"findIndexWithChild",value:function findIndexWithChild(domNode){for(;;){var parent=domNode.parentNode;if(!parent)return-1;if(parent==this.top.contentDOM){var desc=domNode.pmViewDesc;if(desc)for(var i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==desc)return i;return-1}domNode=parent}}},{key:"updateNextNode",value:function updateNextNode(node,outerDeco,innerDeco,view,index,pos){for(var i=this.index;i<this.top.children.length;i++){var next=this.top.children[i];if(next instanceof NodeViewDesc){var _preMatch=this.preMatch.matched.get(next);if(null!=_preMatch&&_preMatch!=index)return!1;var nextDOM=next.dom,updated=void 0,locked=this.isLocked(nextDOM)&&!(node.isText&&next.node&&next.node.isText&&next.nodeDOM.nodeValue==node.text&&3!=next.dirty&&sameOuterDeco(outerDeco,next.outerDeco));if(!locked&&next.update(node,outerDeco,innerDeco,view))return this.destroyBetween(this.index,i),next.dom!=nextDOM&&(this.changed=!0),this.index++,!0;if(!locked&&(updated=this.recreateWrapper(next,node,outerDeco,innerDeco,view,pos)))return this.destroyBetween(this.index,i),this.top.children[this.index]=updated,updated.contentDOM&&(updated.dirty=2,updated.updateChildren(view,pos+1),updated.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}},{key:"recreateWrapper",value:function recreateWrapper(next,node,outerDeco,innerDeco,view,pos){if(next.dirty||node.isAtom||!next.children.length||!next.node.content.eq(node.content)||!sameOuterDeco(outerDeco,next.outerDeco)||!innerDeco.eq(next.innerDeco))return null;var wrapper=NodeViewDesc.create(this.top,node,outerDeco,innerDeco,view,pos);if(wrapper.contentDOM){wrapper.children=next.children,next.children=[];var _step,_iterator=_createForOfIteratorHelper(wrapper.children);try{for(_iterator.s();!(_step=_iterator.n()).done;){_step.value.parent=wrapper}}catch(err){_iterator.e(err)}finally{_iterator.f()}}return next.destroy(),wrapper}},{key:"addNode",value:function addNode(node,outerDeco,innerDeco,view,pos){var desc=NodeViewDesc.create(this.top,node,outerDeco,innerDeco,view,pos);desc.contentDOM&&desc.updateChildren(view,pos+1),this.top.children.splice(this.index++,0,desc),this.changed=!0}},{key:"placeWidget",value:function placeWidget(widget,view,pos){var next=this.index<this.top.children.length?this.top.children[this.index]:null;if(!next||!next.matchesWidget(widget)||widget!=next.widget&&next.widget.type.toDOM.parentNode){var desc=new WidgetViewDesc(this.top,widget,view,pos);this.top.children.splice(this.index++,0,desc),this.changed=!0}else this.index++}},{key:"addTextblockHacks",value:function addTextblockHacks(){for(var lastChild=this.top.children[this.index-1],parent=this.top;lastChild instanceof MarkViewDesc;)lastChild=(parent=lastChild).children[parent.children.length-1];(!lastChild||!(lastChild instanceof TextViewDesc)||/\n$/.test(lastChild.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(lastChild.node.text))&&((safari||chrome)&&lastChild&&"false"==lastChild.dom.contentEditable&&this.addHackNode("IMG",parent),this.addHackNode("BR",this.top))}},{key:"addHackNode",value:function addHackNode(nodeName,parent){if(parent==this.top&&this.index<parent.children.length&&parent.children[this.index].matchesHack(nodeName))this.index++;else{var dom=document.createElement(nodeName);"IMG"==nodeName&&(dom.className="ProseMirror-separator",dom.alt=""),"BR"==nodeName&&(dom.className="ProseMirror-trailingBreak");var hack=new TrailingHackViewDesc(this.top,[],dom,null);parent!=this.top?parent.children.push(hack):parent.children.splice(this.index++,0,hack),this.changed=!0}}},{key:"isLocked",value:function isLocked(node){return this.lock&&(node==this.lock||1==node.nodeType&&node.contains(this.lock.parentNode))}}]),ViewTreeUpdater}();function compareSide(a,b){return a.type.side-b.type.side}function replaceNodes(nodes,from,to,view,replacement){for(var result=[],i=0,off=0;i<nodes.length;i++){var child=nodes[i],start=off,end=off+=child.size;start>=to||end<=from?result.push(child):(start<from&&result.push(child.slice(0,from-start,view)),replacement&&(result.push(replacement),replacement=void 0),end>to&&result.push(child.slice(to-start,child.size,view)))}return result}function selectionFromDOM(view){var origin=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,domSel=view.domSelectionRange(),doc=view.state.doc;if(!domSel.focusNode)return null;var nearestDesc=view.docView.nearestDesc(domSel.focusNode),inWidget=nearestDesc&&0==nearestDesc.size,head=view.docView.posFromDOM(domSel.focusNode,domSel.focusOffset,1);if(head<0)return null;var anchor,selection,$head=doc.resolve(head);if(selectionCollapsed(domSel)){for(anchor=head;nearestDesc&&!nearestDesc.node;)nearestDesc=nearestDesc.parent;var nearestDescNode=nearestDesc.node;if(nearestDesc&&nearestDescNode.isAtom&&prosemirrorState.NodeSelection.isSelectable(nearestDescNode)&&nearestDesc.parent&&(!nearestDescNode.isInline||!function isOnEdge(node,offset,parent){for(var atStart=0==offset,atEnd=offset==nodeSize(node);atStart||atEnd;){if(node==parent)return!0;var index=domIndex(node);if(!(node=node.parentNode))return!1;atStart=atStart&&0==index,atEnd=atEnd&&index==nodeSize(node)}}(domSel.focusNode,domSel.focusOffset,nearestDesc.dom))){var pos=nearestDesc.posBefore;selection=new prosemirrorState.NodeSelection(head==pos?$head:doc.resolve(pos))}}else{if(domSel instanceof view.dom.ownerDocument.defaultView.Selection&&domSel.rangeCount>1){for(var min=head,max=head,i=0;i<domSel.rangeCount;i++){var range=domSel.getRangeAt(i);min=Math.min(min,view.docView.posFromDOM(range.startContainer,range.startOffset,1)),max=Math.max(max,view.docView.posFromDOM(range.endContainer,range.endOffset,-1))}if(min<0)return null;var _ref4=_slicedToArray(max==view.state.selection.anchor?[max,min]:[min,max],2);anchor=_ref4[0],head=_ref4[1],$head=doc.resolve(head)}else anchor=view.docView.posFromDOM(domSel.anchorNode,domSel.anchorOffset,1);if(anchor<0)return null}var $anchor=doc.resolve(anchor);selection||(selection=selectionBetween(view,$anchor,$head,"pointer"==origin||view.state.selection.head<$head.pos&&!inWidget?1:-1));return selection}function editorOwnsSelection(view){return view.editable?view.hasFocus():hasSelection(view)&&document.activeElement&&document.activeElement.contains(view.dom)}function selectionToDOM(view){var force=arguments.length>1&&void 0!==arguments[1]&&arguments[1],sel=view.state.selection;if(syncNodeSelection(view,sel),editorOwnsSelection(view)){var mouseDown=view.input.mouseDown;if(!force&&chrome&&mouseDown){var domSel=view.domSelectionRange(),curSel=view.domObserver.currentSelection;if(domSel.anchorNode&&curSel.anchorNode&&isEquivalentPosition(domSel.anchorNode,domSel.anchorOffset,curSel.anchorNode,curSel.anchorOffset)&&mouseDown.delaySelUpdate())return void view.domObserver.setCurSelection()}if(view.domObserver.disconnectSelection(),view.cursorWrapper)!function selectCursorWrapper(view){var domSel=view.domSelection();if(!domSel)return;var node=view.cursorWrapper.dom,img="IMG"==node.nodeName;img?domSel.collapse(node.parentNode,domIndex(node)+1):domSel.collapse(node,0);!img&&!view.state.selection.visible&&ie&&ie_version<=11&&(node.disabled=!0,node.disabled=!1)}(view);else{var resetEditableFrom,resetEditableTo,anchor=sel.anchor,head=sel.head;!brokenSelectBetweenUneditable||sel instanceof prosemirrorState.TextSelection||(sel.$from.parent.inlineContent||(resetEditableFrom=temporarilyEditableNear(view,sel.from)),sel.empty||sel.$from.parent.inlineContent||(resetEditableTo=temporarilyEditableNear(view,sel.to))),view.docView.setSelection(anchor,head,view,force),brokenSelectBetweenUneditable&&(resetEditableFrom&&resetEditable(resetEditableFrom),resetEditableTo&&resetEditable(resetEditableTo)),sel.visible?view.dom.classList.remove("ProseMirror-hideselection"):(view.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function removeClassOnSelectionChange(view){var doc=view.dom.ownerDocument;doc.removeEventListener("selectionchange",view.input.hideSelectionGuard);var domSel=view.domSelectionRange(),node=domSel.anchorNode,offset=domSel.anchorOffset;doc.addEventListener("selectionchange",view.input.hideSelectionGuard=function(){domSel.anchorNode==node&&domSel.anchorOffset==offset||(doc.removeEventListener("selectionchange",view.input.hideSelectionGuard),setTimeout(function(){editorOwnsSelection(view)&&!view.state.selection.visible||view.dom.classList.remove("ProseMirror-hideselection")},20))})}(view))}view.domObserver.setCurSelection(),view.domObserver.connectSelection()}}var brokenSelectBetweenUneditable=safari||chrome&&chrome_version<63;function temporarilyEditableNear(view,pos){var _view$docView$domFrom3=view.docView.domFromPos(pos,0),node=_view$docView$domFrom3.node,offset=_view$docView$domFrom3.offset,after=offset<node.childNodes.length?node.childNodes[offset]:null,before=offset?node.childNodes[offset-1]:null;if(safari&&after&&"false"==after.contentEditable)return setEditable(after);if(!(after&&"false"!=after.contentEditable||before&&"false"!=before.contentEditable)){if(after)return setEditable(after);if(before)return setEditable(before)}}function setEditable(element){return element.contentEditable="true",safari&&element.draggable&&(element.draggable=!1,element.wasDraggable=!0),element}function resetEditable(element){element.contentEditable="false",element.wasDraggable&&(element.draggable=!0,element.wasDraggable=null)}function syncNodeSelection(view,sel){if(sel instanceof prosemirrorState.NodeSelection){var desc=view.docView.descAt(sel.from);desc!=view.lastSelectedViewDesc&&(clearNodeSelection(view),desc&&desc.selectNode(),view.lastSelectedViewDesc=desc)}else clearNodeSelection(view)}function clearNodeSelection(view){view.lastSelectedViewDesc&&(view.lastSelectedViewDesc.parent&&view.lastSelectedViewDesc.deselectNode(),view.lastSelectedViewDesc=void 0)}function selectionBetween(view,$anchor,$head,bias){return view.someProp("createSelectionBetween",function(f){return f(view,$anchor,$head)})||prosemirrorState.TextSelection.between($anchor,$head,bias)}function hasFocusAndSelection(view){return!(view.editable&&!view.hasFocus())&&hasSelection(view)}function hasSelection(view){var sel=view.domSelectionRange();if(!sel.anchorNode)return!1;try{return view.dom.contains(3==sel.anchorNode.nodeType?sel.anchorNode.parentNode:sel.anchorNode)&&(view.editable||view.dom.contains(3==sel.focusNode.nodeType?sel.focusNode.parentNode:sel.focusNode))}catch(_){return!1}}function moveSelectionBlock(state,dir){var _state$selection=state.selection,$anchor=_state$selection.$anchor,$head=_state$selection.$head,$side=dir>0?$anchor.max($head):$anchor.min($head),$start=$side.parent.inlineContent?$side.depth?state.doc.resolve(dir>0?$side.after():$side.before()):null:$side;return $start&&prosemirrorState.Selection.findFrom($start,dir)}function apply(view,sel){return view.dispatch(view.state.tr.setSelection(sel).scrollIntoView()),!0}function selectHorizontally(view,dir,mods){var sel=view.state.selection;if(!(sel instanceof prosemirrorState.TextSelection)){if(sel instanceof prosemirrorState.NodeSelection&&sel.node.isInline)return apply(view,new prosemirrorState.TextSelection(dir>0?sel.$to:sel.$from));var _next=moveSelectionBlock(view.state,dir);return!!_next&&apply(view,_next)}if(mods.indexOf("s")>-1){var $head=sel.$head,node=$head.textOffset?null:dir<0?$head.nodeBefore:$head.nodeAfter;if(!node||node.isText||!node.isLeaf)return!1;var $newHead=view.state.doc.resolve($head.pos+node.nodeSize*(dir<0?-1:1));return apply(view,new prosemirrorState.TextSelection(sel.$anchor,$newHead))}if(!sel.empty)return!1;if(view.endOfTextblock(dir>0?"forward":"backward")){var next=moveSelectionBlock(view.state,dir);return!!(next&&next instanceof prosemirrorState.NodeSelection)&&apply(view,next)}if(!(mac&&mods.indexOf("m")>-1)){var desc,_$head=sel.$head,_node=_$head.textOffset?null:dir<0?_$head.nodeBefore:_$head.nodeAfter;if(!_node||_node.isText)return!1;var nodePos=dir<0?_$head.pos-_node.nodeSize:_$head.pos;return!!(_node.isAtom||(desc=view.docView.descAt(nodePos))&&!desc.contentDOM)&&(prosemirrorState.NodeSelection.isSelectable(_node)?apply(view,new prosemirrorState.NodeSelection(dir<0?view.state.doc.resolve(_$head.pos-_node.nodeSize):_$head)):!!webkit&&apply(view,new prosemirrorState.TextSelection(view.state.doc.resolve(dir<0?nodePos:nodePos+_node.nodeSize))))}}function nodeLen(node){return 3==node.nodeType?node.nodeValue.length:node.childNodes.length}function isIgnorable(dom,dir){var desc=dom.pmViewDesc;return desc&&0==desc.size&&(dir<0||dom.nextSibling||"BR"!=dom.nodeName)}function skipIgnoredNodes(view,dir){return dir<0?function skipIgnoredNodesBefore(view){var sel=view.domSelectionRange(),node=sel.focusNode,offset=sel.focusOffset;if(!node)return;var moveNode,moveOffset,force=!1;gecko&&1==node.nodeType&&offset<nodeLen(node)&&isIgnorable(node.childNodes[offset],-1)&&(force=!0);for(;;)if(offset>0){if(1!=node.nodeType)break;var before=node.childNodes[offset-1];if(isIgnorable(before,-1))moveNode=node,moveOffset=--offset;else{if(3!=before.nodeType)break;offset=(node=before).nodeValue.length}}else{if(isBlockNode(node))break;for(var prev=node.previousSibling;prev&&isIgnorable(prev,-1);)moveNode=node.parentNode,moveOffset=domIndex(prev),prev=prev.previousSibling;if(prev)offset=nodeLen(node=prev);else{if((node=node.parentNode)==view.dom)break;offset=0}}force?setSelFocus(view,node,offset):moveNode&&setSelFocus(view,moveNode,moveOffset)}(view):function skipIgnoredNodesAfter(view){var sel=view.domSelectionRange(),node=sel.focusNode,offset=sel.focusOffset;if(!node)return;for(var moveNode,moveOffset,len=nodeLen(node);;)if(offset<len){if(1!=node.nodeType)break;if(!isIgnorable(node.childNodes[offset],1))break;moveNode=node,moveOffset=++offset}else{if(isBlockNode(node))break;for(var next=node.nextSibling;next&&isIgnorable(next,1);)moveNode=next.parentNode,moveOffset=domIndex(next)+1,next=next.nextSibling;if(next)offset=0,len=nodeLen(node=next);else{if((node=node.parentNode)==view.dom)break;offset=len=0}}moveNode&&setSelFocus(view,moveNode,moveOffset)}(view)}function isBlockNode(dom){var desc=dom.pmViewDesc;return desc&&desc.node&&desc.node.isBlock}function setSelFocus(view,node,offset){var before,after;3!=node.nodeType&&((after=function textNodeAfter(node,offset){for(;node&&offset==node.childNodes.length&&!hasBlockDesc(node);)offset=domIndex(node)+1,node=node.parentNode;for(;node&&offset<node.childNodes.length;){var next=node.childNodes[offset];if(3==next.nodeType)return next;if(1==next.nodeType&&"false"==next.contentEditable)break;node=next,offset=0}}(node,offset))?(node=after,offset=0):(before=function textNodeBefore(node,offset){for(;node&&!offset&&!hasBlockDesc(node);)offset=domIndex(node),node=node.parentNode;for(;node&&offset;){var next=node.childNodes[offset-1];if(3==next.nodeType)return next;if(1==next.nodeType&&"false"==next.contentEditable)break;offset=(node=next).childNodes.length}}(node,offset))&&(node=before,offset=before.nodeValue.length));var sel=view.domSelection();if(sel){if(selectionCollapsed(sel)){var range=document.createRange();range.setEnd(node,offset),range.setStart(node,offset),sel.removeAllRanges(),sel.addRange(range)}else sel.extend&&sel.extend(node,offset);view.domObserver.setCurSelection();var state=view.state;setTimeout(function(){view.state==state&&selectionToDOM(view)},50)}}function findDirection(view,pos){var $pos=view.state.doc.resolve(pos);if(!chrome&&!windows&&$pos.parent.inlineContent){var coords=view.coordsAtPos(pos);if(pos>$pos.start()){var before=view.coordsAtPos(pos-1),mid=(before.top+before.bottom)/2;if(mid>coords.top&&mid<coords.bottom&&Math.abs(before.left-coords.left)>1)return before.left<coords.left?"ltr":"rtl"}if(pos<$pos.end()){var after=view.coordsAtPos(pos+1),_mid=(after.top+after.bottom)/2;if(_mid>coords.top&&_mid<coords.bottom&&Math.abs(after.left-coords.left)>1)return after.left>coords.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(view.dom).direction?"rtl":"ltr"}function selectVertically(view,dir,mods){var sel=view.state.selection;if(sel instanceof prosemirrorState.TextSelection&&!sel.empty||mods.indexOf("s")>-1)return!1;if(mac&&mods.indexOf("m")>-1)return!1;var $from=sel.$from,$to=sel.$to;if(!$from.parent.inlineContent||view.endOfTextblock(dir<0?"up":"down")){var next=moveSelectionBlock(view.state,dir);if(next&&next instanceof prosemirrorState.NodeSelection)return apply(view,next)}if(!$from.parent.inlineContent){var side=dir<0?$from:$to,beyond=sel instanceof prosemirrorState.AllSelection?prosemirrorState.Selection.near(side,dir):prosemirrorState.Selection.findFrom(side,dir);return!!beyond&&apply(view,beyond)}return!1}function stopNativeHorizontalDelete(view,dir){if(!(view.state.selection instanceof prosemirrorState.TextSelection))return!0;var _view$state$selection2=view.state.selection,$head=_view$state$selection2.$head,$anchor=_view$state$selection2.$anchor,empty=_view$state$selection2.empty;if(!$head.sameParent($anchor))return!0;if(!empty)return!1;if(view.endOfTextblock(dir>0?"forward":"backward"))return!0;var nextNode=!$head.textOffset&&(dir<0?$head.nodeBefore:$head.nodeAfter);if(nextNode&&!nextNode.isText){var tr=view.state.tr;return dir<0?tr.delete($head.pos-nextNode.nodeSize,$head.pos):tr.delete($head.pos,$head.pos+nextNode.nodeSize),view.dispatch(tr),!0}return!1}function switchEditable(view,node,state){view.domObserver.stop(),node.contentEditable=state,view.domObserver.start()}function captureKeyDown(view,event){var code=event.keyCode,mods=function getMods(event){var result="";return event.ctrlKey&&(result+="c"),event.metaKey&&(result+="m"),event.altKey&&(result+="a"),event.shiftKey&&(result+="s"),result}(event);if(8==code||mac&&72==code&&"c"==mods)return stopNativeHorizontalDelete(view,-1)||skipIgnoredNodes(view,-1);if(46==code&&!event.shiftKey||mac&&68==code&&"c"==mods)return stopNativeHorizontalDelete(view,1)||skipIgnoredNodes(view,1);if(13==code||27==code)return!0;if(37==code||mac&&66==code&&"c"==mods){var dir=37==code?"ltr"==findDirection(view,view.state.selection.from)?-1:1:-1;return selectHorizontally(view,dir,mods)||skipIgnoredNodes(view,dir)}if(39==code||mac&&70==code&&"c"==mods){var _dir=39==code?"ltr"==findDirection(view,view.state.selection.from)?1:-1:1;return selectHorizontally(view,_dir,mods)||skipIgnoredNodes(view,_dir)}return 38==code||mac&&80==code&&"c"==mods?selectVertically(view,-1,mods)||skipIgnoredNodes(view,-1):40==code||mac&&78==code&&"c"==mods?function safariDownArrowBug(view){if(!safari||view.state.selection.$head.parentOffset>0)return!1;var _view$domSelectionRan3=view.domSelectionRange(),focusNode=_view$domSelectionRan3.focusNode,focusOffset=_view$domSelectionRan3.focusOffset;if(focusNode&&1==focusNode.nodeType&&0==focusOffset&&focusNode.firstChild&&"false"==focusNode.firstChild.contentEditable){var child=focusNode.firstChild;switchEditable(view,child,"true"),setTimeout(function(){return switchEditable(view,child,"false")},20)}return!1}(view)||selectVertically(view,1,mods)||skipIgnoredNodes(view,1):mods==(mac?"m":"c")&&(66==code||73==code||89==code||90==code)}function _serializeForClipboard(view,slice){view.someProp("transformCopied",function(f){slice=f(slice,view)});for(var context=[],_slice=slice,content=_slice.content,openStart=_slice.openStart,openEnd=_slice.openEnd;openStart>1&&openEnd>1&&1==content.childCount&&1==content.firstChild.childCount;){openStart--,openEnd--;var node=content.firstChild;context.push(node.type.name,node.attrs!=node.type.defaultAttrs?node.attrs:null),content=node.content}var serializer=view.someProp("clipboardSerializer")||prosemirrorModel.DOMSerializer.fromSchema(view.state.schema),doc=detachedDoc(),wrap=doc.createElement("div");wrap.appendChild(serializer.serializeFragment(content,{document:doc}));for(var needsWrap,firstChild=wrap.firstChild,wrappers=0;firstChild&&1==firstChild.nodeType&&(needsWrap=wrapMap[firstChild.nodeName.toLowerCase()]);){for(var i=needsWrap.length-1;i>=0;i--){for(var wrapper=doc.createElement(needsWrap[i]);wrap.firstChild;)wrapper.appendChild(wrap.firstChild);wrap.appendChild(wrapper),wrappers++}firstChild=wrap.firstChild}return firstChild&&1==firstChild.nodeType&&firstChild.setAttribute("data-pm-slice","".concat(openStart," ").concat(openEnd).concat(wrappers?" -".concat(wrappers):""," ").concat(JSON.stringify(context))),{dom:wrap,text:view.someProp("clipboardTextSerializer",function(f){return f(slice,view)})||slice.content.textBetween(0,slice.content.size,"\n\n"),slice}}function parseFromClipboard(view,text,html,plainText,$context){var dom,slice,inCode=$context.parent.type.spec.code;if(!html&&!text)return null;var asText=!!text&&(plainText||inCode||!html);if(asText){if(view.someProp("transformPastedText",function(f){text=f(text,inCode||plainText,view)}),inCode)return slice=new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(view.state.schema.text(text.replace(/\r\n?/g,"\n"))),0,0),view.someProp("transformPasted",function(f){slice=f(slice,view,!0)}),slice;var parsed=view.someProp("clipboardTextParser",function(f){return f(text,$context,plainText,view)});if(parsed)slice=parsed;else{var marks=$context.marks(),schema=view.state.schema,serializer=prosemirrorModel.DOMSerializer.fromSchema(schema);dom=document.createElement("div"),text.split(/(?:\r\n?|\n)+/).forEach(function(block){var p=dom.appendChild(document.createElement("p"));block&&p.appendChild(serializer.serializeNode(schema.text(block,marks)))})}}else view.someProp("transformPastedHTML",function(f){html=f(html,view)}),dom=function readHTML(html){var metas=/^(\s*<meta [^>]*>)*/.exec(html);metas&&(html=html.slice(metas[0].length));var wrap,doc=detachedDoc(),elt=doc.body,firstTag=/<([a-z][^>\s]+)/i.exec(html);(wrap=firstTag&&wrapMap[firstTag[1].toLowerCase()])&&(html=wrap.map(function(n){return"<"+n+">"}).join("")+html+wrap.map(function(n){return"</"+n+">"}).reverse().join(""));if(elt.innerHTML=function maybeWrapTrusted(html){var trustedTypes=window.trustedTypes;if(!trustedTypes)return html;if(!_policy){if(_policy=trustedTypes.defaultPolicy)try{return _policy.createHTML(html)}catch(_a){}_policy=trustedTypes.createPolicy("ProseMirrorClipboard",{createHTML:function createHTML(s){return s}})}return _policy.createHTML(html)}(html),wrap)for(var i=0;i<wrap.length;i++)elt=elt.querySelector(wrap[i])||elt;for(var _i6=0;_i6<doc.styleSheets.length;_i6++)for(var style=doc.styleSheets[_i6],j=0;j<style.rules.length;j++){var rule=style.rules[j];if(rule instanceof CSSStyleRule)for(var matches=elt.querySelectorAll(rule.selectorText),k=0;k<matches.length;k++)matches[k].style.cssText+=rule.style.cssText}return elt}(html),webkit&&function restoreReplacedSpaces(dom){for(var nodes=dom.querySelectorAll(chrome?"span:not([class]):not([style])":"span.Apple-converted-space"),i=0;i<nodes.length;i++){var node=nodes[i];1==node.childNodes.length&&" "==node.textContent&&node.parentNode&&node.parentNode.replaceChild(dom.ownerDocument.createTextNode(" "),node)}}(dom);var contextNode=dom&&dom.querySelector("[data-pm-slice]"),sliceData=contextNode&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice")||"");if(sliceData&&sliceData[3])for(var i=+sliceData[3];i>0;i--){for(var child=dom.firstChild;child&&1!=child.nodeType;)child=child.nextSibling;if(!child)break;dom=child}if(!slice){var parser=view.someProp("clipboardParser")||view.someProp("domParser")||prosemirrorModel.DOMParser.fromSchema(view.state.schema);slice=parser.parseSlice(dom,{preserveWhitespace:!(!asText&&!sliceData),context:$context,ruleFromNode:function ruleFromNode(dom){return"BR"!=dom.nodeName||dom.nextSibling||!dom.parentNode||inlineParents.test(dom.parentNode.nodeName)?null:{ignore:!0}}})}if(sliceData)slice=function addContext(slice,context){if(!slice.size)return slice;var array,schema=slice.content.firstChild.type.schema;try{array=JSON.parse(context)}catch(e){return slice}for(var content=slice.content,openStart=slice.openStart,openEnd=slice.openEnd,i=array.length-2;i>=0;i-=2){var type=schema.nodes[array[i]];if(!type||type.hasRequiredAttrs())break;try{type.checkAttrs(array[i+1])}catch(e){break}content=prosemirrorModel.Fragment.from(type.create(array[i+1],content)),openStart++,openEnd++}return new prosemirrorModel.Slice(content,openStart,openEnd)}(closeSlice(slice,+sliceData[1],+sliceData[2]),sliceData[4]);else if(slice=prosemirrorModel.Slice.maxOpen(function normalizeSiblings(fragment,$context){if(fragment.childCount<2)return fragment;for(var _ret,_loop=function _loop(){var lastWrap,match=$context.node(d).contentMatchAt($context.index(d)),result=[];if(fragment.forEach(function(node){if(result){var inLast,wrap=match.findWrapping(node.type);if(!wrap)return result=null;if(inLast=result.length&&lastWrap.length&&addToSibling(wrap,lastWrap,node,result[result.length-1],0))result[result.length-1]=inLast;else{result.length&&(result[result.length-1]=closeRight(result[result.length-1],lastWrap.length));var wrapped=withWrappers(node,wrap);result.push(wrapped),match=match.matchType(wrapped.type),lastWrap=wrap}}}),result)return{v:prosemirrorModel.Fragment.from(result)}},d=$context.depth;d>=0;d--)if(_ret=_loop())return _ret.v;return fragment}(slice.content,$context),!0),slice.openStart||slice.openEnd){for(var openStart=0,openEnd=0,node=slice.content.firstChild;openStart<slice.openStart&&!node.type.spec.isolating;openStart++,node=node.firstChild);for(var _node2=slice.content.lastChild;openEnd<slice.openEnd&&!_node2.type.spec.isolating;openEnd++,_node2=_node2.lastChild);slice=closeSlice(slice,openStart,openEnd)}return view.someProp("transformPasted",function(f){slice=f(slice,view,asText)}),slice}var inlineParents=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function withWrappers(node,wrap){for(var from=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=wrap.length-1;i>=from;i--)node=wrap[i].create(null,prosemirrorModel.Fragment.from(node));return node}function addToSibling(wrap,lastWrap,node,sibling,depth){if(depth<wrap.length&&depth<lastWrap.length&&wrap[depth]==lastWrap[depth]){var inner=addToSibling(wrap,lastWrap,node,sibling.lastChild,depth+1);if(inner)return sibling.copy(sibling.content.replaceChild(sibling.childCount-1,inner));if(sibling.contentMatchAt(sibling.childCount).matchType(depth==wrap.length-1?node.type:wrap[depth+1]))return sibling.copy(sibling.content.append(prosemirrorModel.Fragment.from(withWrappers(node,wrap,depth+1))))}}function closeRight(node,depth){if(0==depth)return node;var fragment=node.content.replaceChild(node.childCount-1,closeRight(node.lastChild,depth-1)),fill=node.contentMatchAt(node.childCount).fillBefore(prosemirrorModel.Fragment.empty,!0);return node.copy(fragment.append(fill))}function closeRange(fragment,side,from,to,depth,openEnd){var node=side<0?fragment.firstChild:fragment.lastChild,inner=node.content;return fragment.childCount>1&&(openEnd=0),depth<to-1&&(inner=closeRange(inner,side,from,to,depth+1,openEnd)),depth>=from&&(inner=side<0?node.contentMatchAt(0).fillBefore(inner,openEnd<=depth).append(inner):inner.append(node.contentMatchAt(node.childCount).fillBefore(prosemirrorModel.Fragment.empty,!0))),fragment.replaceChild(side<0?0:fragment.childCount-1,node.copy(inner))}function closeSlice(slice,openStart,openEnd){return openStart<slice.openStart&&(slice=new prosemirrorModel.Slice(closeRange(slice.content,-1,openStart,slice.openStart,0,slice.openEnd),openStart,slice.openEnd)),openEnd<slice.openEnd&&(slice=new prosemirrorModel.Slice(closeRange(slice.content,1,openEnd,slice.openEnd,0,0),slice.openStart,openEnd)),slice}var wrapMap={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function detachedDoc(){return document.implementation.createHTMLDocument("title")}var _policy=null;var handlers={},editHandlers={},passiveHandlers={touchstart:!0,touchmove:!0},InputState=_createClass(function InputState(){_classCallCheck(this,InputState),this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null});function setSelectionOrigin(view,origin){view.input.lastSelectionOrigin=origin,view.input.lastSelectionTime=Date.now()}function ensureListeners(view){view.someProp("handleDOMEvents",function(currentHandlers){for(var type in currentHandlers)view.input.eventHandlers[type]||view.dom.addEventListener(type,view.input.eventHandlers[type]=function(event){return runCustomHandler(view,event)})})}function runCustomHandler(view,event){return view.someProp("handleDOMEvents",function(handlers){var handler=handlers[event.type];return!!handler&&(handler(view,event)||event.defaultPrevented)})}function eventCoords(event){return{left:event.clientX,top:event.clientY}}function runHandlerOnContext(view,propName,pos,inside,event){if(-1==inside)return!1;for(var _ret2,$pos=view.state.doc.resolve(inside),_loop3=function _loop3(i){if(view.someProp(propName,function(f){return i>$pos.depth?f(view,pos,$pos.nodeAfter,$pos.before(i),event,!0):f(view,pos,$pos.node(i),$pos.before(i),event,!1)}))return{v:!0}},i=$pos.depth+1;i>0;i--)if(_ret2=_loop3(i))return _ret2.v;return!1}function updateSelection(view,selection,origin){if(view.focused||view.focus(),!view.state.selection.eq(selection)){var tr=view.state.tr.setSelection(selection);"pointer"==origin&&tr.setMeta("pointer",!0),view.dispatch(tr)}}function handleSingleClick(view,pos,inside,event,selectNode){return runHandlerOnContext(view,"handleClickOn",pos,inside,event)||view.someProp("handleClick",function(f){return f(view,pos,event)})||(selectNode?function selectClickedNode(view,inside){if(-1==inside)return!1;var selectedNode,selectAt,sel=view.state.selection;sel instanceof prosemirrorState.NodeSelection&&(selectedNode=sel.node);for(var $pos=view.state.doc.resolve(inside),i=$pos.depth+1;i>0;i--){var node=i>$pos.depth?$pos.nodeAfter:$pos.node(i);if(prosemirrorState.NodeSelection.isSelectable(node)){selectAt=selectedNode&&sel.$from.depth>0&&i>=sel.$from.depth&&$pos.before(sel.$from.depth+1)==sel.$from.pos?$pos.before(sel.$from.depth):$pos.before(i);break}}return null!=selectAt&&(updateSelection(view,prosemirrorState.NodeSelection.create(view.state.doc,selectAt),"pointer"),!0)}(view,inside):function selectClickedLeaf(view,inside){if(-1==inside)return!1;var $pos=view.state.doc.resolve(inside),node=$pos.nodeAfter;return!!(node&&node.isAtom&&prosemirrorState.NodeSelection.isSelectable(node))&&(updateSelection(view,new prosemirrorState.NodeSelection($pos),"pointer"),!0)}(view,inside))}function handleDoubleClick(view,pos,inside,event){return runHandlerOnContext(view,"handleDoubleClickOn",pos,inside,event)||view.someProp("handleDoubleClick",function(f){return f(view,pos,event)})}function handleTripleClick(view,pos,inside,event){return runHandlerOnContext(view,"handleTripleClickOn",pos,inside,event)||view.someProp("handleTripleClick",function(f){return f(view,pos,event)})||function defaultTripleClick(view,inside,event){if(0!=event.button)return!1;var selection=selectionForTripleClick(view,inside,!0),doc=view.state.doc;if(!selection)return!1;updateSelection(view,selection,"pointer"),selection instanceof prosemirrorState.TextSelection&&doc.eq(view.state.doc)&&(view.input.mouseDown=new TripleClickDrag(view,selection));return!0}(view,inside,event)}function selectionForTripleClick(view,inside,selectNodes){var doc=view.state.doc;if(-1==inside)return doc.inlineContent?prosemirrorState.TextSelection.create(doc,0,doc.content.size):null;for(var $pos=doc.resolve(inside),i=$pos.depth+1;i>0;i--){var node=i>$pos.depth?$pos.nodeAfter:$pos.node(i),nodePos=$pos.before(i);if(node.inlineContent)return prosemirrorState.TextSelection.create(doc,nodePos+1,nodePos+1+node.content.size);if(selectNodes&&prosemirrorState.NodeSelection.isSelectable(node))return prosemirrorState.NodeSelection.create(doc,nodePos)}return null}function forceDOMFlush(view){return endComposition(view)}editHandlers.keydown=function(view,_event){var event=_event;if(view.input.shiftKey=16==event.keyCode||event.shiftKey,!inOrNearComposition(view)&&(view.input.lastKeyCode=event.keyCode,view.input.lastKeyCodeTime=Date.now(),!android||!chrome||13!=event.keyCode))if(229!=event.keyCode&&view.domObserver.forceFlush(),!ios||13!=event.keyCode||event.ctrlKey||event.altKey||event.metaKey)view.someProp("handleKeyDown",function(f){return f(view,event)})||captureKeyDown(view,event)?event.preventDefault():setSelectionOrigin(view,"key");else{var now=Date.now();view.input.lastIOSEnter=now,view.input.lastIOSEnterFallbackTimeout=setTimeout(function(){view.input.lastIOSEnter==now&&(view.someProp("handleKeyDown",function(f){return f(view,keyEvent(13,"Enter"))}),view.input.lastIOSEnter=0)},200)}},editHandlers.keyup=function(view,event){16==event.keyCode&&(view.input.shiftKey=!1)},editHandlers.keypress=function(view,_event){var event=_event;if(!(inOrNearComposition(view)||!event.charCode||event.ctrlKey&&!event.altKey||mac&&event.metaKey))if(view.someProp("handleKeyPress",function(f){return f(view,event)}))event.preventDefault();else{var sel=view.state.selection;if(!(sel instanceof prosemirrorState.TextSelection&&sel.$from.sameParent(sel.$to))){var text=String.fromCharCode(event.charCode),deflt=function deflt(){return view.state.tr.insertText(text).scrollIntoView()};/[\r\n]/.test(text)||view.someProp("handleTextInput",function(f){return f(view,sel.$from.pos,sel.$to.pos,text,deflt)})||view.dispatch(deflt()),event.preventDefault()}}};var selectNodeModifier=mac?"metaKey":"ctrlKey";handlers.mousedown=function(view,_event){var event=_event;view.input.shiftKey=event.shiftKey;var flushed=forceDOMFlush(view),now=Date.now(),type="singleClick";now-view.input.lastClick.time<500&&function isNear(event,click){var dx=click.x-event.clientX,dy=click.y-event.clientY;return dx*dx+dy*dy<100}(event,view.input.lastClick)&&!event[selectNodeModifier]&&view.input.lastClick.button==event.button&&("singleClick"==view.input.lastClick.type?type="doubleClick":"doubleClick"==view.input.lastClick.type&&(type="tripleClick")),view.input.lastClick={time:now,x:event.clientX,y:event.clientY,type,button:event.button},view.input.mouseDown&&view.input.mouseDown.done();var pos=view.posAtCoords(eventCoords(event));pos&&("singleClick"==type?view.input.mouseDown=new LeftMouseDown(view,pos,event,!!flushed):("doubleClick"==type?handleDoubleClick:handleTripleClick)(view,pos.pos,pos.inside,event)?event.preventDefault():setSelectionOrigin(view,"pointer"))};var MouseDown=function(){function MouseDown(view){_classCallCheck(this,MouseDown),this.view=view,this.mightDrag=null,view.root.addEventListener("mouseup",this.up=this.up.bind(this)),view.root.addEventListener("mousemove",this.move=this.move.bind(this))}return _createClass(MouseDown,[{key:"up",value:function up(event){this.done()}},{key:"move",value:function move(event){0==event.buttons&&this.done()}},{key:"done",value:function done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}},{key:"delaySelUpdate",value:function delaySelUpdate(){return!1}}]),MouseDown}(),LeftMouseDown=function(_MouseDown){_inherits(LeftMouseDown,_MouseDown);var _super8=_createSuper(LeftMouseDown);function LeftMouseDown(view,pos,event,flushed){var _this8,targetNode,targetPos;if(_classCallCheck(this,LeftMouseDown),(_this8=_super8.call(this,view)).pos=pos,_this8.event=event,_this8.flushed=flushed,_this8.delayedSelectionSync=!1,_this8.startDoc=view.state.doc,_this8.selectNode=!!event[selectNodeModifier],_this8.allowDefault=event.shiftKey,pos.inside>-1)targetNode=view.state.doc.nodeAt(pos.inside),targetPos=pos.inside;else{var $pos=view.state.doc.resolve(pos.pos);targetNode=$pos.parent,targetPos=$pos.depth?$pos.before():0}var target=flushed?null:event.target,targetDesc=target?view.docView.nearestDesc(target,!0):null;_this8.target=targetDesc&&1==targetDesc.nodeDOM.nodeType?targetDesc.nodeDOM:null;var selection=view.state.selection;return 0==event.button&&(targetNode.type.spec.draggable&&!1!==targetNode.type.spec.selectable||selection instanceof prosemirrorState.NodeSelection&&selection.from<=targetPos&&selection.to>targetPos)&&(_this8.mightDrag={node:targetNode,pos:targetPos,addAttr:!(!_this8.target||_this8.target.draggable),setUneditable:!(!_this8.target||!gecko||_this8.target.hasAttribute("contentEditable"))}),_this8.target&&_this8.mightDrag&&(_this8.mightDrag.addAttr||_this8.mightDrag.setUneditable)&&(_this8.view.domObserver.stop(),_this8.mightDrag.addAttr&&(_this8.target.draggable=!0),_this8.mightDrag.setUneditable&&setTimeout(function(){_this8.view.input.mouseDown==_assertThisInitialized(_this8)&&_this8.target.setAttribute("contentEditable","false")},20),_this8.view.domObserver.start()),setSelectionOrigin(view,"pointer"),_this8}return _createClass(LeftMouseDown,[{key:"done",value:function done(){var _this9=this;_get(_getPrototypeOf(LeftMouseDown.prototype),"done",this).call(this),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(function(){_this9.view.isDestroyed||selectionToDOM(_this9.view)})}},{key:"up",value:function up(event){if(this.done(),this.view.dom.contains(event.target)){var pos=this.pos;this.view.state.doc!=this.startDoc&&(pos=this.view.posAtCoords(eventCoords(event))),this.updateAllowDefault(event),this.allowDefault||!pos?setSelectionOrigin(this.view,"pointer"):handleSingleClick(this.view,pos.pos,pos.inside,event,this.selectNode)?event.preventDefault():0==event.button&&(this.flushed||safari&&this.mightDrag&&!this.mightDrag.node.isAtom||chrome&&!this.view.state.selection.visible&&Math.min(Math.abs(pos.pos-this.view.state.selection.from),Math.abs(pos.pos-this.view.state.selection.to))<=2)?(updateSelection(this.view,prosemirrorState.Selection.near(this.view.state.doc.resolve(pos.pos)),"pointer"),event.preventDefault()):setSelectionOrigin(this.view,"pointer")}}},{key:"move",value:function move(event){this.updateAllowDefault(event),setSelectionOrigin(this.view,"pointer"),_get(_getPrototypeOf(LeftMouseDown.prototype),"move",this).call(this,event)}},{key:"updateAllowDefault",value:function updateAllowDefault(event){!this.allowDefault&&(Math.abs(this.event.x-event.clientX)>4||Math.abs(this.event.y-event.clientY)>4)&&(this.allowDefault=!0)}},{key:"delaySelUpdate",value:function delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}]),LeftMouseDown}(MouseDown),TripleClickDrag=function(_MouseDown2){_inherits(TripleClickDrag,_MouseDown2);var _super9=_createSuper(TripleClickDrag);function TripleClickDrag(view,startSelection){var _this10;return _classCallCheck(this,TripleClickDrag),(_this10=_super9.call(this,view)).startSelection=startSelection,_this10.startDoc=view.state.doc,_this10}return _createClass(TripleClickDrag,[{key:"move",value:function move(event){if(0!=event.buttons&&!this.view.isDestroyed&&this.view.state.doc.eq(this.startDoc)){event.preventDefault(),setSelectionOrigin(this.view,"pointer");var pos=this.view.posAtCoords(eventCoords(event)),target=pos&&selectionForTripleClick(this.view,pos.inside,!1);if(target){var doc=this.view.state.doc,start=this.startSelection,_ref6=_slicedToArray(target.from<start.from?[start.to,target.from]:[start.from,target.to],2),anchor=_ref6[0],head=_ref6[1];updateSelection(this.view,prosemirrorState.TextSelection.create(doc,anchor,head),"pointer")}}else this.done()}}]),TripleClickDrag}(MouseDown);function inOrNearComposition(view,event){return!!view.composing||!!(safari&&Math.abs(Date.now()-view.input.compositionEndedAt)<500)&&(view.input.compositionEndedAt=-2e8,!0)}handlers.touchstart=function(view){view.input.lastTouch=Date.now(),forceDOMFlush(view),setSelectionOrigin(view,"pointer")},handlers.touchmove=function(view){view.input.lastTouch=Date.now(),setSelectionOrigin(view,"pointer")},handlers.contextmenu=function(view){return forceDOMFlush(view)};var timeoutComposition=android?5e3:-1;function scheduleComposeEnd(view,delay){clearTimeout(view.input.composingTimeout),delay>-1&&(view.input.composingTimeout=setTimeout(function(){return endComposition(view)},delay))}function clearComposition(view){for(view.composing&&(view.input.composing=!1,view.input.compositionEndedAt=Date.now());view.input.compositionNodes.length>0;)view.input.compositionNodes.pop().markParentsDirty()}function findCompositionNode(view){var sel=view.domSelectionRange();if(!sel.focusNode)return null;var textBefore=function textNodeBefore$1(node,offset){for(;;){if(3==node.nodeType&&offset)return node;if(1==node.nodeType&&offset>0){if("false"==node.contentEditable)return null;offset=nodeSize(node=node.childNodes[offset-1])}else{if(!node.parentNode||hasBlockDesc(node))return null;offset=domIndex(node),node=node.parentNode}}}(sel.focusNode,sel.focusOffset),textAfter=function textNodeAfter$1(node,offset){for(;;){if(3==node.nodeType&&offset<node.nodeValue.length)return node;if(1==node.nodeType&&offset<node.childNodes.length){if("false"==node.contentEditable)return null;node=node.childNodes[offset],offset=0}else{if(!node.parentNode||hasBlockDesc(node))return null;offset=domIndex(node)+1,node=node.parentNode}}}(sel.focusNode,sel.focusOffset);if(textBefore&&textAfter&&textBefore!=textAfter){var descAfter=textAfter.pmViewDesc,lastChanged=view.domObserver.lastChangedTextNode;if(textBefore==lastChanged||textAfter==lastChanged)return lastChanged;if(!descAfter||!descAfter.isText(textAfter.nodeValue))return textAfter;if(view.input.compositionNode==textAfter){var descBefore=textBefore.pmViewDesc;if(descBefore&&descBefore.isText(textBefore.nodeValue))return textAfter}}return textBefore||textAfter}function endComposition(view){var restarting=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(android&&view.domObserver.flushingSoon>=0)){if(view.domObserver.forceFlush(),clearComposition(view),restarting||view.docView&&view.docView.dirty){var sel=selectionFromDOM(view),cur=view.state.selection;return sel&&!sel.eq(cur)?view.dispatch(view.state.tr.setSelection(sel)):!view.markCursor&&!restarting||cur.$from.node(cur.$from.sharedDepth(cur.to)).inlineContent?view.updateState(view.state):view.dispatch(view.state.tr.deleteSelection()),!0}return!1}}editHandlers.compositionstart=editHandlers.compositionupdate=function(view){if(!view.composing){view.domObserver.flush();var state=view.state,$pos=state.selection.$to;if(state.selection instanceof prosemirrorState.TextSelection&&(state.storedMarks||!$pos.textOffset&&$pos.parentOffset&&$pos.nodeBefore.marks.some(function(m){return!1===m.type.spec.inclusive})||chrome&&windows&&function selectionBeforeUneditable(view){var _view$domSelectionRan4=view.domSelectionRange(),focusNode=_view$domSelectionRan4.focusNode,focusOffset=_view$domSelectionRan4.focusOffset;if(!focusNode||1!=focusNode.nodeType||focusOffset>=focusNode.childNodes.length)return!1;var next=focusNode.childNodes[focusOffset];return 1==next.nodeType&&"false"==next.contentEditable}(view)))view.markCursor=view.state.storedMarks||$pos.marks(),endComposition(view,!0),view.markCursor=null;else if(endComposition(view,!state.selection.empty),gecko&&state.selection.empty&&$pos.parentOffset&&!$pos.textOffset&&$pos.nodeBefore.marks.length)for(var sel=view.domSelectionRange(),node=sel.focusNode,offset=sel.focusOffset;node&&1==node.nodeType&&0!=offset;){var before=offset<0?node.lastChild:node.childNodes[offset-1];if(!before)break;if(3==before.nodeType){var _sel=view.domSelection();_sel&&_sel.collapse(before,before.nodeValue.length);break}node=before,offset=-1}view.input.composing=!0}scheduleComposeEnd(view,timeoutComposition)},editHandlers.compositionend=function(view,event){view.composing&&(view.input.composing=!1,view.input.compositionEndedAt=Date.now(),view.input.compositionPendingChanges=view.domObserver.pendingRecords().length?view.input.compositionID:0,view.input.compositionNode=null,view.input.badSafariComposition?view.domObserver.forceFlush():view.input.compositionPendingChanges&&Promise.resolve().then(function(){return view.domObserver.flush()}),view.input.compositionID++,scheduleComposeEnd(view,20))};var brokenClipboardAPI=ie&&ie_version<15||ios&&webkit_version<604;function doPaste(view,text,html,preferPlain,event){var slice=parseFromClipboard(view,text,html,preferPlain,view.state.selection.$from);if(view.someProp("handlePaste",function(f){return f(view,event,slice||prosemirrorModel.Slice.empty)}))return!0;if(!slice)return!1;var singleNode=function sliceSingleNode(slice){return 0==slice.openStart&&0==slice.openEnd&&1==slice.content.childCount?slice.content.firstChild:null}(slice),tr=singleNode?view.state.tr.replaceSelectionWith(singleNode,preferPlain):view.state.tr.replaceSelection(slice);return view.dispatch(tr.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function getText(clipboardData){var text=clipboardData.getData("text/plain")||clipboardData.getData("Text");if(text)return text;var uris=clipboardData.getData("text/uri-list");return uris?uris.replace(/\r?\n/g," "):""}handlers.copy=editHandlers.cut=function(view,_event){var event=_event,sel=view.state.selection,cut="cut"==event.type;if(!sel.empty){var data=brokenClipboardAPI?null:event.clipboardData,_serializeForClipboar=_serializeForClipboard(view,sel.content()),dom=_serializeForClipboar.dom,text=_serializeForClipboar.text;data?(event.preventDefault(),data.clearData(),data.setData("text/html",dom.innerHTML),data.setData("text/plain",text)):function captureCopy(view,dom){if(view.dom.parentNode){var wrap=view.dom.parentNode.appendChild(document.createElement("div"));wrap.appendChild(dom),wrap.style.cssText="position: fixed; left: -10000px; top: 10px";var sel=getSelection(),range=document.createRange();range.selectNodeContents(dom),view.dom.blur(),sel.removeAllRanges(),sel.addRange(range),setTimeout(function(){wrap.parentNode&&wrap.parentNode.removeChild(wrap),view.focus()},50)}}(view,dom),cut&&view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},editHandlers.paste=function(view,_event){var event=_event;if(!view.composing||android){var data=brokenClipboardAPI?null:event.clipboardData,plain=view.input.shiftKey&&45!=view.input.lastKeyCode;data&&doPaste(view,getText(data),data.getData("text/html"),plain,event)?event.preventDefault():function capturePaste(view,event){if(view.dom.parentNode){var plainText=view.input.shiftKey||view.state.selection.$from.parent.type.spec.code,target=view.dom.parentNode.appendChild(document.createElement(plainText?"textarea":"div"));plainText||(target.contentEditable="true"),target.style.cssText="position: fixed; left: -10000px; top: 10px",target.focus();var plain=view.input.shiftKey&&45!=view.input.lastKeyCode;setTimeout(function(){view.focus(),target.parentNode&&target.parentNode.removeChild(target),plainText?doPaste(view,target.value,null,plain,event):doPaste(view,target.textContent,target.innerHTML,plain,event)},50)}}(view,event)}};var Dragging=_createClass(function Dragging(slice,move,node){_classCallCheck(this,Dragging),this.slice=slice,this.move=move,this.node=node}),dragCopyModifier=mac?"altKey":"ctrlKey";function dragMoves(view,event){var copy;return view.someProp("dragCopies",function(test){copy=copy||test(event)}),null!=copy?!copy:!event[dragCopyModifier]}for(var prop in handlers.dragstart=function(view,_event){var event=_event,mouseDown=view.input.mouseDown;if(mouseDown&&mouseDown.done(),event.dataTransfer){var node,sel=view.state.selection,pos=sel.empty?null:view.posAtCoords(eventCoords(event));if(pos&&pos.pos>=sel.from&&pos.pos<=(sel instanceof prosemirrorState.NodeSelection?sel.to-1:sel.to));else if(mouseDown&&mouseDown.mightDrag)node=prosemirrorState.NodeSelection.create(view.state.doc,mouseDown.mightDrag.pos);else if(event.target&&1==event.target.nodeType){var desc=view.docView.nearestDesc(event.target,!0);desc&&desc.node.type.spec.draggable&&desc!=view.docView&&(node=prosemirrorState.NodeSelection.create(view.state.doc,desc.posBefore))}var _serializeForClipboar2=_serializeForClipboard(view,(node||view.state.selection).content()),dom=_serializeForClipboar2.dom,text=_serializeForClipboar2.text,slice=_serializeForClipboar2.slice;(!event.dataTransfer.files.length||!chrome||chrome_version>120)&&event.dataTransfer.clearData(),event.dataTransfer.setData(brokenClipboardAPI?"Text":"text/html",dom.innerHTML),event.dataTransfer.effectAllowed="copyMove",brokenClipboardAPI||event.dataTransfer.setData("text/plain",text),view.dragging=new Dragging(slice,dragMoves(view,event),node)}},handlers.dragend=function(view){var dragging=view.dragging;window.setTimeout(function(){view.dragging==dragging&&(view.dragging=null)},50)},editHandlers.dragover=editHandlers.dragenter=function(_,e){return e.preventDefault()},editHandlers.drop=function(view,event){try{!function handleDrop(view,event,dragging){if(!event.dataTransfer)return;var eventPos=view.posAtCoords(eventCoords(event));if(!eventPos)return;var $mouse=view.state.doc.resolve(eventPos.pos),slice=dragging&&dragging.slice;slice?view.someProp("transformPasted",function(f){slice=f(slice,view,!1)}):slice=parseFromClipboard(view,getText(event.dataTransfer),brokenClipboardAPI?null:event.dataTransfer.getData("text/html"),!1,$mouse);var move=!(!dragging||!dragMoves(view,event));if(view.someProp("handleDrop",function(f){return f(view,event,slice||prosemirrorModel.Slice.empty,move)}))return void event.preventDefault();if(!slice)return;event.preventDefault();var insertPos=slice?prosemirrorTransform.dropPoint(view.state.doc,$mouse.pos,slice):$mouse.pos;null==insertPos&&(insertPos=$mouse.pos);var tr=view.state.tr;if(move){var node=dragging.node;node?node.replace(tr):tr.deleteSelection()}var pos=tr.mapping.map(insertPos),isNode=0==slice.openStart&&0==slice.openEnd&&1==slice.content.childCount,beforeInsert=tr.doc;isNode?tr.replaceRangeWith(pos,pos,slice.content.firstChild):tr.replaceRange(pos,pos,slice);if(tr.doc.eq(beforeInsert))return;var $pos=tr.doc.resolve(pos);if(isNode&&prosemirrorState.NodeSelection.isSelectable(slice.content.firstChild)&&$pos.nodeAfter&&$pos.nodeAfter.sameMarkup(slice.content.firstChild))tr.setSelection(new prosemirrorState.NodeSelection($pos));else{var end=tr.mapping.map(insertPos);tr.mapping.maps[tr.mapping.maps.length-1].forEach(function(_from,_to,_newFrom,newTo){return end=newTo}),tr.setSelection(selectionBetween(view,$pos,tr.doc.resolve(end)))}view.focus(),view.dispatch(tr.setMeta("uiEvent","drop"))}(view,event,view.dragging)}finally{view.dragging=null}},handlers.focus=function(view){view.input.lastFocus=Date.now(),view.focused||(view.domObserver.stop(),view.dom.classList.add("ProseMirror-focused"),view.domObserver.start(),view.focused=!0,setTimeout(function(){view.docView&&view.hasFocus()&&!view.domObserver.currentSelection.eq(view.domSelectionRange())&&selectionToDOM(view)},20))},handlers.blur=function(view,_event){var event=_event;view.focused&&(view.domObserver.stop(),view.dom.classList.remove("ProseMirror-focused"),view.domObserver.start(),event.relatedTarget&&view.dom.contains(event.relatedTarget)&&view.domObserver.currentSelection.clear(),view.focused=!1)},handlers.beforeinput=function(view,_event){if(android&&"deleteContentBackward"==_event.inputType){view.domObserver.flushSoon();var domChangeCount=view.input.domChangeCount;setTimeout(function(){if(view.input.domChangeCount==domChangeCount&&(view.dom.blur(),view.focus(),!view.someProp("handleKeyDown",function(f){return f(view,keyEvent(8,"Backspace"))}))){var $cursor=view.state.selection.$cursor;$cursor&&$cursor.pos>0&&view.dispatch(view.state.tr.delete($cursor.pos-1,$cursor.pos).scrollIntoView())}},50)}},editHandlers)handlers[prop]=editHandlers[prop];function compareObjs(a,b){if(a==b)return!0;for(var p in a)if(a[p]!==b[p])return!1;for(var _p in b)if(!(_p in a))return!1;return!0}var WidgetType=function(){function WidgetType(toDOM,spec){_classCallCheck(this,WidgetType),this.toDOM=toDOM,this.spec=spec||noSpec,this.side=this.spec.side||0}return _createClass(WidgetType,[{key:"map",value:function map(mapping,span,offset,oldOffset){var _mapping$mapResult=mapping.mapResult(span.from+oldOffset,this.side<0?-1:1),pos=_mapping$mapResult.pos;return _mapping$mapResult.deleted?null:new Decoration(pos-offset,pos-offset,this)}},{key:"valid",value:function valid(){return!0}},{key:"eq",value:function eq(other){return this==other||other instanceof WidgetType&&(this.spec.key&&this.spec.key==other.spec.key||this.toDOM==other.toDOM&&compareObjs(this.spec,other.spec))}},{key:"destroy",value:function destroy(node){this.spec.destroy&&this.spec.destroy(node)}}]),WidgetType}(),InlineType=function(){function InlineType(attrs,spec){_classCallCheck(this,InlineType),this.attrs=attrs,this.spec=spec||noSpec}return _createClass(InlineType,[{key:"map",value:function map(mapping,span,offset,oldOffset){var from=mapping.map(span.from+oldOffset,this.spec.inclusiveStart?-1:1)-offset,to=mapping.map(span.to+oldOffset,this.spec.inclusiveEnd?1:-1)-offset;return from>=to?null:new Decoration(from,to,this)}},{key:"valid",value:function valid(_,span){return span.from<span.to}},{key:"eq",value:function eq(other){return this==other||other instanceof InlineType&&compareObjs(this.attrs,other.attrs)&&compareObjs(this.spec,other.spec)}},{key:"destroy",value:function destroy(){}}],[{key:"is",value:function is(span){return span.type instanceof InlineType}}]),InlineType}(),NodeType=function(){function NodeType(attrs,spec){_classCallCheck(this,NodeType),this.attrs=attrs,this.spec=spec||noSpec}return _createClass(NodeType,[{key:"map",value:function map(mapping,span,offset,oldOffset){var from=mapping.mapResult(span.from+oldOffset,1);if(from.deleted)return null;var to=mapping.mapResult(span.to+oldOffset,-1);return to.deleted||to.pos<=from.pos?null:new Decoration(from.pos-offset,to.pos-offset,this)}},{key:"valid",value:function valid(node,span){var child,_node$content$findInd=node.content.findIndex(span.from),index=_node$content$findInd.index,offset=_node$content$findInd.offset;return offset==span.from&&!(child=node.child(index)).isText&&offset+child.nodeSize==span.to}},{key:"eq",value:function eq(other){return this==other||other instanceof NodeType&&compareObjs(this.attrs,other.attrs)&&compareObjs(this.spec,other.spec)}},{key:"destroy",value:function destroy(){}}]),NodeType}(),Decoration=function(){function Decoration(from,to,type){_classCallCheck(this,Decoration),this.from=from,this.to=to,this.type=type}return _createClass(Decoration,[{key:"copy",value:function copy(from,to){return new Decoration(from,to,this.type)}},{key:"eq",value:function eq(other){var offset=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.type.eq(other.type)&&this.from+offset==other.from&&this.to+offset==other.to}},{key:"map",value:function map(mapping,offset,oldOffset){return this.type.map(mapping,this,offset,oldOffset)}},{key:"spec",get:function get(){return this.type.spec}},{key:"inline",get:function get(){return this.type instanceof InlineType}},{key:"widget",get:function get(){return this.type instanceof WidgetType}}],[{key:"widget",value:function widget(pos,toDOM,spec){return new Decoration(pos,pos,new WidgetType(toDOM,spec))}},{key:"inline",value:function inline(from,to,attrs,spec){return new Decoration(from,to,new InlineType(attrs,spec))}},{key:"node",value:function node(from,to,attrs,spec){return new Decoration(from,to,new NodeType(attrs,spec))}}]),Decoration}(),none=[],noSpec={},DecorationSet=function(){function DecorationSet(local,children){_classCallCheck(this,DecorationSet),this.local=local.length?local:none,this.children=children.length?children:none}return _createClass(DecorationSet,[{key:"find",value:function find(start,end,predicate){var result=[];return this.findInner(start??0,end??1e9,result,0,predicate),result}},{key:"findInner",value:function findInner(start,end,result,offset,predicate){for(var i=0;i<this.local.length;i++){var span=this.local[i];span.from<=end&&span.to>=start&&(!predicate||predicate(span.spec))&&result.push(span.copy(span.from+offset,span.to+offset))}for(var _i7=0;_i7<this.children.length;_i7+=3)if(this.children[_i7]<end&&this.children[_i7+1]>start){var childOff=this.children[_i7]+1;this.children[_i7+2].findInner(start-childOff,end-childOff,result,offset+childOff,predicate)}}},{key:"map",value:function map(mapping,doc,options){return this==empty||0==mapping.maps.length?this:this.mapInner(mapping,doc,0,0,options||noSpec)}},{key:"mapInner",value:function mapInner(mapping,node,offset,oldOffset,options){for(var newLocal,i=0;i<this.local.length;i++){var mapped=this.local[i].map(mapping,offset,oldOffset);mapped&&mapped.type.valid(node,mapped)?(newLocal||(newLocal=[])).push(mapped):options.onRemove&&options.onRemove(this.local[i].spec)}return this.children.length?mapChildren(this.children,newLocal||[],mapping,node,offset,oldOffset,options):newLocal?new DecorationSet(newLocal.sort(byPos),none):empty}},{key:"add",value:function add(doc,decorations){return decorations.length?this==empty?DecorationSet.create(doc,decorations):this.addInner(doc,decorations,0):this}},{key:"addInner",value:function addInner(doc,decorations,offset){var children,_this11=this,childIndex=0;doc.forEach(function(childNode,childOffset){var found,baseOffset=childOffset+offset;if(found=takeSpansForNode(decorations,childNode,baseOffset)){for(children||(children=_this11.children.slice());childIndex<children.length&&children[childIndex]<childOffset;)childIndex+=3;children[childIndex]==childOffset?children[childIndex+2]=children[childIndex+2].addInner(childNode,found,baseOffset+1):children.splice(childIndex,0,childOffset,childOffset+childNode.nodeSize,buildTree(found,childNode,baseOffset+1,noSpec)),childIndex+=3}});for(var local=moveSpans(childIndex?withoutNulls(decorations):decorations,-offset),i=0;i<local.length;i++)local[i].type.valid(doc,local[i])||local.splice(i--,1);return new DecorationSet(local.length?this.local.concat(local).sort(byPos):this.local,children||this.children)}},{key:"remove",value:function remove(decorations){return 0==decorations.length||this==empty?this:this.removeInner(decorations,0)}},{key:"removeInner",value:function removeInner(decorations,offset){for(var children=this.children,local=this.local,i=0;i<children.length;i+=3){for(var span,found=void 0,from=children[i]+offset,to=children[i+1]+offset,j=0;j<decorations.length;j++)(span=decorations[j])&&span.from>from&&span.to<to&&(decorations[j]=null,(found||(found=[])).push(span));if(found){children==this.children&&(children=this.children.slice());var removed=children[i+2].removeInner(found,from+1);removed!=empty?children[i+2]=removed:(children.splice(i,3),i-=3)}}if(local.length)for(var _span,_i8=0;_i8<decorations.length;_i8++)if(_span=decorations[_i8])for(var _j2=0;_j2<local.length;_j2++)local[_j2].eq(_span,offset)&&(local==this.local&&(local=this.local.slice()),local.splice(_j2--,1));return children==this.children&&local==this.local?this:local.length||children.length?new DecorationSet(local,children):empty}},{key:"forChild",value:function forChild(offset,node){if(this==empty)return this;if(node.isLeaf)return DecorationSet.empty;for(var child,local,i=0;i<this.children.length;i+=3)if(this.children[i]>=offset){this.children[i]==offset&&(child=this.children[i+2]);break}for(var start=offset+1,end=start+node.content.size,_i9=0;_i9<this.local.length;_i9++){var dec=this.local[_i9];if(dec.from<end&&dec.to>start&&dec.type instanceof InlineType){var from=Math.max(start,dec.from)-start,to=Math.min(end,dec.to)-start;from<to&&(local||(local=[])).push(dec.copy(from,to))}}if(local){var localSet=new DecorationSet(local.sort(byPos),none);return child?new DecorationGroup([localSet,child]):localSet}return child||empty}},{key:"eq",value:function eq(other){if(this==other)return!0;if(!(other instanceof DecorationSet)||this.local.length!=other.local.length||this.children.length!=other.children.length)return!1;for(var i=0;i<this.local.length;i++)if(!this.local[i].eq(other.local[i]))return!1;for(var _i10=0;_i10<this.children.length;_i10+=3)if(this.children[_i10]!=other.children[_i10]||this.children[_i10+1]!=other.children[_i10+1]||!this.children[_i10+2].eq(other.children[_i10+2]))return!1;return!0}},{key:"locals",value:function locals(node){return removeOverlap(this.localsInner(node))}},{key:"localsInner",value:function localsInner(node){if(this==empty)return none;if(node.inlineContent||!this.local.some(InlineType.is))return this.local;for(var result=[],i=0;i<this.local.length;i++)this.local[i].type instanceof InlineType||result.push(this.local[i]);return result}},{key:"forEachSet",value:function forEachSet(f){f(this)}}],[{key:"create",value:function create(doc,decorations){return decorations.length?buildTree(decorations,doc,0,noSpec):empty}}]),DecorationSet}();DecorationSet.empty=new DecorationSet([],[]),DecorationSet.removeOverlap=removeOverlap;var empty=DecorationSet.empty,DecorationGroup=function(){function DecorationGroup(members){_classCallCheck(this,DecorationGroup),this.members=members}return _createClass(DecorationGroup,[{key:"map",value:function map(mapping,doc){var mappedDecos=this.members.map(function(member){return member.map(mapping,doc,noSpec)});return DecorationGroup.from(mappedDecos)}},{key:"forChild",value:function forChild(offset,child){if(child.isLeaf)return DecorationSet.empty;for(var found=[],i=0;i<this.members.length;i++){var result=this.members[i].forChild(offset,child);result!=empty&&(result instanceof DecorationGroup?found=found.concat(result.members):found.push(result))}return DecorationGroup.from(found)}},{key:"eq",value:function eq(other){if(!(other instanceof DecorationGroup)||other.members.length!=this.members.length)return!1;for(var i=0;i<this.members.length;i++)if(!this.members[i].eq(other.members[i]))return!1;return!0}},{key:"locals",value:function locals(node){for(var result,sorted=!0,i=0;i<this.members.length;i++){var locals=this.members[i].localsInner(node);if(locals.length)if(result){sorted&&(result=result.slice(),sorted=!1);for(var j=0;j<locals.length;j++)result.push(locals[j])}else result=locals}return result?removeOverlap(sorted?result:result.sort(byPos)):none}},{key:"forEachSet",value:function forEachSet(f){for(var i=0;i<this.members.length;i++)this.members[i].forEachSet(f)}}],[{key:"from",value:function from(members){switch(members.length){case 0:return empty;case 1:return members[0];default:return new DecorationGroup(members.every(function(m){return m instanceof DecorationSet})?members:members.reduce(function(r,m){return r.concat(m instanceof DecorationSet?m:m.members)},[]))}}}]),DecorationGroup}();function mapChildren(oldChildren,newLocal,mapping,node,offset,oldOffset,options){for(var children=oldChildren.slice(),_loop4=function _loop4(_baseOffset){var moved=0;mapping.maps[i].forEach(function(oldStart,oldEnd,newStart,newEnd){for(var dSize=newEnd-newStart-(oldEnd-oldStart),_i14=0;_i14<children.length;_i14+=3){var end=children[_i14+1];if(!(end<0||oldStart>end+_baseOffset-moved)){var start=children[_i14]+_baseOffset-moved;oldEnd>=start?children[_i14+1]=oldStart<=start?-2:-1:oldStart>=_baseOffset&&dSize&&(children[_i14]+=dSize,children[_i14+1]+=dSize)}}moved+=dSize}),_baseOffset=mapping.maps[i].map(_baseOffset,-1),baseOffset=_baseOffset},i=0,baseOffset=oldOffset;i<mapping.maps.length;i++)_loop4(baseOffset);for(var mustRebuild=!1,_i11=0;_i11<children.length;_i11+=3)if(children[_i11+1]<0){if(-2==children[_i11+1]){mustRebuild=!0,children[_i11+1]=-1;continue}var from=mapping.map(oldChildren[_i11]+oldOffset),fromLocal=from-offset;if(fromLocal<0||fromLocal>=node.content.size){mustRebuild=!0;continue}var toLocal=mapping.map(oldChildren[_i11+1]+oldOffset,-1)-offset,_node$content$findInd2=node.content.findIndex(fromLocal),index=_node$content$findInd2.index,childOffset=_node$content$findInd2.offset,childNode=node.maybeChild(index);if(childNode&&childOffset==fromLocal&&childOffset+childNode.nodeSize==toLocal){var mapped=children[_i11+2].mapInner(mapping,childNode,from+1,oldChildren[_i11]+oldOffset+1,options);mapped!=empty?(children[_i11]=fromLocal,children[_i11+1]=toLocal,children[_i11+2]=mapped):(children[_i11+1]=-2,mustRebuild=!0)}else mustRebuild=!0}if(mustRebuild){var decorations=function mapAndGatherRemainingDecorations(children,oldChildren,decorations,mapping,offset,oldOffset,options){function gather(set,oldOffset){for(var i=0;i<set.local.length;i++){var mapped=set.local[i].map(mapping,offset,oldOffset);mapped?decorations.push(mapped):options.onRemove&&options.onRemove(set.local[i].spec)}for(var _i15=0;_i15<set.children.length;_i15+=3)gather(set.children[_i15+2],set.children[_i15]+oldOffset+1)}for(var i=0;i<children.length;i+=3)-1==children[i+1]&&gather(children[i+2],oldChildren[i]+oldOffset+1);return decorations}(children,oldChildren,newLocal,mapping,offset,oldOffset,options),built=buildTree(decorations,node,0,options);newLocal=built.local;for(var _i12=0;_i12<children.length;_i12+=3)children[_i12+1]<0&&(children.splice(_i12,3),_i12-=3);for(var _i13=0,j=0;_i13<built.children.length;_i13+=3){for(var _from2=built.children[_i13];j<children.length&&children[j]<_from2;)j+=3;children.splice(j,0,built.children[_i13],built.children[_i13+1],built.children[_i13+2])}}return new DecorationSet(newLocal.sort(byPos),children)}function moveSpans(spans,offset){if(!offset||!spans.length)return spans;for(var result=[],i=0;i<spans.length;i++){var span=spans[i];result.push(new Decoration(span.from+offset,span.to+offset,span.type))}return result}function takeSpansForNode(spans,node,offset){if(node.isLeaf)return null;for(var span,end=offset+node.nodeSize,found=null,i=0;i<spans.length;i++)(span=spans[i])&&span.from>offset&&span.to<end&&((found||(found=[])).push(span),spans[i]=null);return found}function withoutNulls(array){for(var result=[],i=0;i<array.length;i++)null!=array[i]&&result.push(array[i]);return result}function buildTree(spans,node,offset,options){var children=[],hasNulls=!1;node.forEach(function(childNode,localStart){var found=takeSpansForNode(spans,childNode,localStart+offset);if(found){hasNulls=!0;var subtree=buildTree(found,childNode,offset+localStart+1,options);subtree!=empty&&children.push(localStart,localStart+childNode.nodeSize,subtree)}});for(var locals=moveSpans(hasNulls?withoutNulls(spans):spans,-offset).sort(byPos),i=0;i<locals.length;i++)locals[i].type.valid(node,locals[i])||(options.onRemove&&options.onRemove(locals[i].spec),locals.splice(i--,1));return locals.length||children.length?new DecorationSet(locals,children):empty}function byPos(a,b){return a.from-b.from||a.to-b.to}function removeOverlap(spans){for(var working=spans,i=0;i<working.length-1;i++){var span=working[i];if(span.from!=span.to)for(var j=i+1;j<working.length;j++){var next=working[j];if(next.from!=span.from){next.from<span.to&&(working==spans&&(working=spans.slice()),working[i]=span.copy(span.from,next.from),insertAhead(working,j,span.copy(next.from,span.to)));break}next.to!=span.to&&(working==spans&&(working=spans.slice()),working[j]=next.copy(next.from,span.to),insertAhead(working,j+1,next.copy(span.to,next.to)))}}return working}function insertAhead(array,i,deco){for(;i<array.length&&byPos(deco,array[i])>0;)i++;array.splice(i,0,deco)}function viewDecorations(view){var found=[];return view.someProp("decorations",function(f){var result=f(view.state);result&&result!=empty&&found.push(result)}),view.cursorWrapper&&found.push(DecorationSet.create(view.state.doc,[view.cursorWrapper.deco])),DecorationGroup.from(found)}var observeOptions={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},useCharData=ie&&ie_version<=11,SelectionState=function(){function SelectionState(){_classCallCheck(this,SelectionState),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return _createClass(SelectionState,[{key:"set",value:function set(sel){this.anchorNode=sel.anchorNode,this.anchorOffset=sel.anchorOffset,this.focusNode=sel.focusNode,this.focusOffset=sel.focusOffset}},{key:"clear",value:function clear(){this.anchorNode=this.focusNode=null}},{key:"eq",value:function eq(sel){return sel.anchorNode==this.anchorNode&&sel.anchorOffset==this.anchorOffset&&sel.focusNode==this.focusNode&&sel.focusOffset==this.focusOffset}}]),SelectionState}(),DOMObserver=function(){function DOMObserver(view,handleDOMChange){var _this12=this;_classCallCheck(this,DOMObserver),this.view=view,this.handleDOMChange=handleDOMChange,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new SelectionState,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(function(mutations){for(var i=0;i<mutations.length;i++)_this12.queue.push(mutations[i]);ie&&ie_version<=11&&mutations.some(function(m){return"childList"==m.type&&m.removedNodes.length||"characterData"==m.type&&m.oldValue.length>m.target.nodeValue.length})?_this12.flushSoon():safari&&view.composing&&mutations.some(function(m){return"childList"==m.type&&"TR"==m.target.nodeName})?(view.input.badSafariComposition=!0,_this12.flushSoon()):_this12.flush()}),useCharData&&(this.onCharData=function(e){_this12.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),_this12.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}return _createClass(DOMObserver,[{key:"flushSoon",value:function flushSoon(){var _this13=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){_this13.flushingSoon=-1,_this13.flush()},20))}},{key:"forceFlush",value:function forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}},{key:"start",value:function start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,observeOptions)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}},{key:"stop",value:function stop(){var _this14=this;if(this.observer){var take=this.observer.takeRecords();if(take.length){for(var i=0;i<take.length;i++)this.queue.push(take[i]);window.setTimeout(function(){return _this14.flush()},20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}},{key:"connectSelection",value:function connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}},{key:"disconnectSelection",value:function disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"suppressSelectionUpdates",value:function suppressSelectionUpdates(){var _this15=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return _this15.suppressingSelectionUpdates=!1},50)}},{key:"onSelectionChange",value:function onSelectionChange(){if(hasFocusAndSelection(this.view)){if(this.suppressingSelectionUpdates)return selectionToDOM(this.view);if(ie&&ie_version<=11&&!this.view.state.selection.empty){var sel=this.view.domSelectionRange();if(sel.focusNode&&isEquivalentPosition(sel.focusNode,sel.focusOffset,sel.anchorNode,sel.anchorOffset))return this.flushSoon()}this.flush()}}},{key:"setCurSelection",value:function setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}},{key:"ignoreSelectionChange",value:function ignoreSelectionChange(sel){if(!sel.focusNode)return!0;for(var container,ancestors=new Set,scan=sel.focusNode;scan;scan=parentNode(scan))ancestors.add(scan);for(var _scan=sel.anchorNode;_scan;_scan=parentNode(_scan))if(ancestors.has(_scan)){container=_scan;break}var desc=container&&this.view.docView.nearestDesc(container);return desc&&desc.ignoreMutation({type:"selection",target:3==container.nodeType?container.parentNode:container})?(this.setCurSelection(),!0):void 0}},{key:"pendingRecords",value:function pendingRecords(){if(this.observer){var _step2,_iterator2=_createForOfIteratorHelper(this.observer.takeRecords());try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var mut=_step2.value;this.queue.push(mut)}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}}return this.queue}},{key:"flush",value:function flush(){var view=this.view;if(view.docView&&!(this.flushingSoon>-1)){var mutations=this.pendingRecords();mutations.length&&(this.queue=[]);var sel=view.domSelectionRange(),newSel=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(sel)&&hasFocusAndSelection(view)&&!this.ignoreSelectionChange(sel),from=-1,to=-1,typeOver=!1,added=[];if(view.editable)for(var i=0;i<mutations.length;i++){var result=this.registerMutation(mutations[i],added);result&&(from=from<0?result.from:Math.min(result.from,from),to=to<0?result.to:Math.max(result.to,to),result.typeOver&&(typeOver=!0))}if(added.some(function(n){return"BR"==n.nodeName})&&(8==view.input.lastKeyCode||46==view.input.lastKeyCode||chrome&&(view.composing||view.input.compositionEndedAt>Date.now()-50)&&mutations.some(function(m){return"childList"==m.type&&m.removedNodes.length}))){var _step3,_iterator3=_createForOfIteratorHelper(added);try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var node=_step3.value;if("BR"==node.nodeName&&node.parentNode)for(var after=node.nextSibling;after&&1==after.nodeType;){if("false"==after.contentEditable){node.parentNode.removeChild(node);break}after=after.firstChild}}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}else if(gecko&&added.length){var brs=added.filter(function(n){return"BR"==n.nodeName});if(2==brs.length){var _brs=_slicedToArray(brs,2),a=_brs[0],b=_brs[1];a.parentNode&&a.parentNode.parentNode==b.parentNode?b.remove():a.remove()}else{var _step4,focusNode=this.currentSelection.focusNode,_iterator4=_createForOfIteratorHelper(brs);try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var br=_step4.value,parent=br.parentNode;!parent||"LI"!=parent.nodeName||focusNode&&blockParent(view,focusNode)==parent||br.remove()}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}}}var readSel=null;from<0&&newSel&&view.input.lastFocus>Date.now()-200&&Math.max(view.input.lastTouch,view.input.lastClick.time)<Date.now()-300&&selectionCollapsed(sel)&&(readSel=selectionFromDOM(view))&&readSel.eq(prosemirrorState.Selection.near(view.state.doc.resolve(0),1))?(view.input.lastFocus=0,selectionToDOM(view),this.currentSelection.set(sel),view.scrollToSelection()):(from>-1||newSel)&&(from>-1&&(view.docView.markDirty(from,to),function checkCSS(view){if(cssChecked.has(view))return;if(cssChecked.set(view,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(view.dom).whiteSpace)){if(view.requiresGeckoHackNode=gecko,cssCheckWarned)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),cssCheckWarned=!0}}(view)),view.input.badSafariComposition&&(view.input.badSafariComposition=!1,function fixUpBadSafariComposition(view,addedNodes){var _a,_step5,_view$domSelectionRan5=view.domSelectionRange(),focusNode=_view$domSelectionRan5.focusNode,focusOffset=_view$domSelectionRan5.focusOffset,_iterator5=_createForOfIteratorHelper(addedNodes);try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var node=_step5.value;if("TR"==(null===(_a=node.parentNode)||void 0===_a?void 0:_a.nodeName)){for(var nextCell=node.nextSibling;nextCell&&"TD"!=nextCell.nodeName&&"TH"!=nextCell.nodeName;)nextCell=nextCell.nextSibling;if(nextCell){for(var parent=nextCell;;){var first=parent.firstChild;if(!first||1!=first.nodeType||"false"==first.contentEditable||/^(BR|IMG)$/.test(first.nodeName))break;parent=first}parent.insertBefore(node,parent.firstChild),focusNode==node&&view.domSelection().collapse(node,focusOffset)}else node.parentNode.removeChild(node)}}}catch(err){_iterator5.e(err)}finally{_iterator5.f()}}(view,added)),this.handleDOMChange(from,to,typeOver,added),view.docView&&view.docView.dirty?view.updateState(view.state):this.currentSelection.eq(sel)||selectionToDOM(view),this.currentSelection.set(sel))}}},{key:"registerMutation",value:function registerMutation(mut,added){if(added.indexOf(mut.target)>-1)return null;var desc=this.view.docView.nearestDesc(mut.target);if("attributes"==mut.type&&(desc==this.view.docView||"contenteditable"==mut.attributeName||"style"==mut.attributeName&&!mut.oldValue&&!mut.target.getAttribute("style")))return null;if(!desc||desc.ignoreMutation(mut))return null;if("childList"==mut.type){for(var i=0;i<mut.addedNodes.length;i++){var node=mut.addedNodes[i];added.push(node),3==node.nodeType&&(this.lastChangedTextNode=node)}if(desc.contentDOM&&desc.contentDOM!=desc.dom&&!desc.contentDOM.contains(mut.target))return{from:desc.posBefore,to:desc.posAfter};var prev=mut.previousSibling,next=mut.nextSibling;if(ie&&ie_version<=11&&mut.addedNodes.length)for(var _i16=0;_i16<mut.addedNodes.length;_i16++){var _mut$addedNodes$_i=mut.addedNodes[_i16],previousSibling=_mut$addedNodes$_i.previousSibling,nextSibling=_mut$addedNodes$_i.nextSibling;(!previousSibling||Array.prototype.indexOf.call(mut.addedNodes,previousSibling)<0)&&(prev=previousSibling),(!nextSibling||Array.prototype.indexOf.call(mut.addedNodes,nextSibling)<0)&&(next=nextSibling)}var fromOffset=prev&&prev.parentNode==mut.target?domIndex(prev)+1:0,from=desc.localPosFromDOM(mut.target,fromOffset,-1),toOffset=next&&next.parentNode==mut.target?domIndex(next):mut.target.childNodes.length;return{from,to:desc.localPosFromDOM(mut.target,toOffset,1)}}return"attributes"==mut.type?{from:desc.posAtStart-desc.border,to:desc.posAtEnd+desc.border}:(this.lastChangedTextNode=mut.target,{from:desc.posAtStart,to:desc.posAtEnd,typeOver:mut.target.nodeValue==mut.oldValue})}}]),DOMObserver}(),cssChecked=new WeakMap,cssCheckWarned=!1;function rangeToSelectionRange(view,range){var anchorNode=range.startContainer,anchorOffset=range.startOffset,focusNode=range.endContainer,focusOffset=range.endOffset,currentAnchor=view.domAtPos(view.state.selection.anchor);if(isEquivalentPosition(currentAnchor.node,currentAnchor.offset,focusNode,focusOffset)){var _ref7=[focusNode,focusOffset,anchorNode,anchorOffset];anchorNode=_ref7[0],anchorOffset=_ref7[1],focusNode=_ref7[2],focusOffset=_ref7[3]}return{anchorNode,anchorOffset,focusNode,focusOffset}}function blockParent(view,node){for(var p=node.parentNode;p&&p!=view.dom;p=p.parentNode){var desc=view.docView.nearestDesc(p,!0);if(desc&&desc.node.isBlock)return p}return null}var ruleFromNode=function ruleFromNode(added){return function(dom){var desc=dom.pmViewDesc;if(desc)return desc.parseRule(added);if("BR"==dom.nodeName&&dom.parentNode){if(safari&&/^(ul|ol)$/i.test(dom.parentNode.nodeName)){var skip=document.createElement("div");return skip.appendChild(document.createElement("li")),{skip}}if(dom.parentNode.lastChild==dom||safari&&/^(tr|table)$/i.test(dom.parentNode.nodeName))return{ignore:!0}}else if("IMG"==dom.nodeName&&dom.getAttribute("mark-placeholder"))return{ignore:!0};return null}},isInline=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function readDOMChange(view,from,to,typeOver,addedNodes){var compositionID=view.input.compositionPendingChanges||(view.composing?view.input.compositionID:0);if(view.input.compositionPendingChanges=0,from<0){var origin=view.input.lastSelectionTime>Date.now()-50?view.input.lastSelectionOrigin:null,newSel=selectionFromDOM(view,origin);if(newSel&&!view.state.selection.eq(newSel)){if(chrome&&android&&13===view.input.lastKeyCode&&Date.now()-100<view.input.lastKeyCodeTime&&view.someProp("handleKeyDown",function(f){return f(view,keyEvent(13,"Enter"))}))return;var tr=view.state.tr.setSelection(newSel);"pointer"==origin?tr.setMeta("pointer",!0):"key"==origin&&tr.scrollIntoView(),compositionID&&tr.setMeta("composition",compositionID),view.dispatch(tr)}}else{var $before=view.state.doc.resolve(from),shared=$before.sharedDepth(to);from=$before.before(shared+1),to=view.state.doc.resolve(to).after(shared+1);var preferredPos,preferredSide,sel=view.state.selection,parse=function parseBetween(view,from_,to_,addedNodes){var find,_view$docView$parseRa=view.docView.parseRange(from_,to_),parent=_view$docView$parseRa.node,fromOffset=_view$docView$parseRa.fromOffset,toOffset=_view$docView$parseRa.toOffset,from=_view$docView$parseRa.from,to=_view$docView$parseRa.to,domSel=view.domSelectionRange(),anchor=domSel.anchorNode;if(anchor&&view.dom.contains(1==anchor.nodeType?anchor:anchor.parentNode)&&(find=[{node:anchor,offset:domSel.anchorOffset}],selectionCollapsed(domSel)||find.push({node:domSel.focusNode,offset:domSel.focusOffset})),chrome&&8===view.input.lastKeyCode)for(var off=toOffset;off>fromOffset;off--){var node=parent.childNodes[off-1],desc=node.pmViewDesc;if("BR"==node.nodeName&&!desc){toOffset=off;break}if(!desc||desc.size)break}var startDoc=view.state.doc,parser=view.someProp("domParser")||prosemirrorModel.DOMParser.fromSchema(view.state.schema),$from=startDoc.resolve(from),sel=null,doc=parser.parse(parent,{topNode:$from.parent,topMatch:$from.parent.contentMatchAt($from.index()),topOpen:!0,from:fromOffset,to:toOffset,preserveWhitespace:"pre"!=$from.parent.type.whitespace||"full",findPositions:find,ruleFromNode:ruleFromNode(addedNodes),context:$from});if(find&&null!=find[0].pos){var _anchor=find[0].pos,head=find[1]&&find[1].pos;null==head&&(head=_anchor),sel={anchor:_anchor+from,head:head+from}}return{doc,sel,from,to}}(view,from,to,addedNodes),doc=view.state.doc,compare=doc.slice(parse.from,parse.to);8===view.input.lastKeyCode&&Date.now()-100<view.input.lastKeyCodeTime?(preferredPos=view.state.selection.to,preferredSide="end"):(preferredPos=view.state.selection.from,preferredSide="start"),view.input.lastKeyCode=null;var change=function findDiff(a,b,pos,preferredPos,preferredSide){var start=a.findDiffStart(b,pos),lenA=pos+a.size,lenB=pos+b.size;if(null==start)return null;var _a$findDiffEnd=a.findDiffEnd(b,lenA,lenB),endA=_a$findDiffEnd.a,endB=_a$findDiffEnd.b;if("end"==preferredSide){preferredPos-=endA+Math.max(0,start-Math.min(endA,endB))-start}if(endA<start&&lenA<lenB){endB=(start-=preferredPos<=start&&preferredPos>=endA?start-preferredPos:0)+(endB-endA),endA=start}else if(endB<start){endA=(start-=preferredPos<=start&&preferredPos>=endB?start-preferredPos:0)+(endA-endB),endB=start}return{start,endA,endB}}(compare.content,parse.doc.content,parse.from,preferredPos,preferredSide);if(change&&view.input.domChangeCount++,(ios&&view.input.lastIOSEnter>Date.now()-225||android)&&addedNodes.some(function(n){return 1==n.nodeType&&!isInline.test(n.nodeName)})&&(!change||change.endA>=change.endB)&&view.someProp("handleKeyDown",function(f){return f(view,keyEvent(13,"Enter"))}))view.input.lastIOSEnter=0;else{if(!change){if(!(typeOver&&sel instanceof prosemirrorState.TextSelection&&!sel.empty&&sel.$head.sameParent(sel.$anchor))||view.composing||parse.sel&&parse.sel.anchor!=parse.sel.head){if(parse.sel){var _sel2=resolveSelection(view,view.state.doc,parse.sel);if(_sel2&&!_sel2.eq(view.state.selection)){var _tr=view.state.tr.setSelection(_sel2);compositionID&&_tr.setMeta("composition",compositionID),view.dispatch(_tr)}}return}change={start:sel.from,endA:sel.to,endB:sel.to}}view.state.selection.from<view.state.selection.to&&change.start==change.endB&&view.state.selection instanceof prosemirrorState.TextSelection&&(change.start>view.state.selection.from&&change.start<=view.state.selection.from+2&&view.state.selection.from>=parse.from?change.start=view.state.selection.from:change.endA<view.state.selection.to&&change.endA>=view.state.selection.to-2&&view.state.selection.to<=parse.to&&(change.endB+=view.state.selection.to-change.endA,change.endA=view.state.selection.to)),ie&&ie_version<=11&&change.endB==change.start+1&&change.endA==change.start&&change.start>parse.from&&"  "==parse.doc.textBetween(change.start-parse.from-1,change.start-parse.from+1)&&(change.start--,change.endA--,change.endB--);var $from=parse.doc.resolveNoCache(change.start-parse.from),$to=parse.doc.resolveNoCache(change.endB-parse.from),$fromA=doc.resolve(change.start),inlineChange=$from.sameParent($to)&&$from.parent.inlineContent&&$fromA.end()>=change.endA;if((ios&&view.input.lastIOSEnter>Date.now()-225&&(!inlineChange||addedNodes.some(function(n){return"DIV"==n.nodeName||"P"==n.nodeName}))||!inlineChange&&$from.pos<parse.doc.content.size&&(!$from.sameParent($to)||!$from.parent.inlineContent)&&$from.pos<$to.pos&&!/\S/.test(parse.doc.textBetween($from.pos,$to.pos,"","")))&&view.someProp("handleKeyDown",function(f){return f(view,keyEvent(13,"Enter"))}))view.input.lastIOSEnter=0;else if(view.state.selection.anchor>change.start&&function looksLikeBackspace(old,start,end,$newStart,$newEnd){if(end-start<=$newEnd.pos-$newStart.pos||skipClosingAndOpening($newStart,!0,!1)<$newEnd.pos)return!1;var $start=old.resolve(start);if(!$newStart.parent.isTextblock){var after=$start.nodeAfter;return null!=after&&end==start+after.nodeSize}if($start.parentOffset<$start.parent.content.size||!$start.parent.isTextblock)return!1;var $next=old.resolve(skipClosingAndOpening($start,!0,!0));return!(!$next.parent.isTextblock||$next.pos>end||skipClosingAndOpening($next,!0,!1)<end)&&$newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content)}(doc,change.start,change.endA,$from,$to)&&view.someProp("handleKeyDown",function(f){return f(view,keyEvent(8,"Backspace"))}))android&&chrome&&view.domObserver.suppressSelectionUpdates();else{chrome&&change.endB==change.start&&(view.input.lastChromeDelete=Date.now()),android&&!inlineChange&&$from.start()!=$to.start()&&0==$to.parentOffset&&$from.depth==$to.depth&&parse.sel&&parse.sel.anchor==parse.sel.head&&parse.sel.head==change.endA&&(change.endB-=2,$to=parse.doc.resolveNoCache(change.endB-parse.from),setTimeout(function(){view.someProp("handleKeyDown",function(f){return f(view,keyEvent(13,"Enter"))})},20));var markChange,chFrom=change.start,chTo=change.endA,mkTr=function mkTr(base){var tr=base||view.state.tr.replace(chFrom,chTo,parse.doc.slice(change.start-parse.from,change.endB-parse.from));if(parse.sel){var _sel3=resolveSelection(view,tr.doc,parse.sel);_sel3&&!(chrome&&view.composing&&_sel3.empty&&(change.start!=change.endB||view.input.lastChromeDelete<Date.now()-100)&&(_sel3.head==chFrom||_sel3.head==tr.mapping.map(chTo)-1)||ie&&_sel3.empty&&_sel3.head==chFrom)&&tr.setSelection(_sel3)}return compositionID&&tr.setMeta("composition",compositionID),tr.scrollIntoView()};if(inlineChange)if($from.pos==$to.pos){ie&&ie_version<=11&&0==$from.parentOffset&&(view.domObserver.suppressSelectionUpdates(),setTimeout(function(){return selectionToDOM(view)},20));var _tr2=mkTr(view.state.tr.delete(chFrom,chTo)),marks=doc.resolve(change.start).marksAcross(doc.resolve(change.endA));marks&&_tr2.ensureMarks(marks),view.dispatch(_tr2)}else if(change.endA==change.endB&&(markChange=function isMarkChange(cur,prev){for(var type,mark,update,curMarks=cur.firstChild.marks,prevMarks=prev.firstChild.marks,added=curMarks,removed=prevMarks,i=0;i<prevMarks.length;i++)added=prevMarks[i].removeFromSet(added);for(var _i17=0;_i17<curMarks.length;_i17++)removed=curMarks[_i17].removeFromSet(removed);if(1==added.length&&0==removed.length)mark=added[0],type="add",update=function update(node){return node.mark(mark.addToSet(node.marks))};else{if(0!=added.length||1!=removed.length)return null;mark=removed[0],type="remove",update=function update(node){return node.mark(mark.removeFromSet(node.marks))}}for(var updated=[],_i18=0;_i18<prev.childCount;_i18++)updated.push(update(prev.child(_i18)));if(prosemirrorModel.Fragment.from(updated).eq(cur))return{mark,type}}($from.parent.content.cut($from.parentOffset,$to.parentOffset),$fromA.parent.content.cut($fromA.parentOffset,change.endA-$fromA.start())))){var _tr3=mkTr(view.state.tr);"add"==markChange.type?_tr3.addMark(chFrom,chTo,markChange.mark):_tr3.removeMark(chFrom,chTo,markChange.mark),view.dispatch(_tr3)}else if($from.parent.child($from.index()).isText&&$from.index()==$to.index()-($to.textOffset?0:1)){var text=$from.parent.textBetween($from.parentOffset,$to.parentOffset),deflt=function deflt(){return mkTr(view.state.tr.insertText(text,chFrom,chTo))};view.someProp("handleTextInput",function(f){return f(view,chFrom,chTo,text,deflt)})||view.dispatch(deflt())}else view.dispatch(mkTr());else view.dispatch(mkTr())}}}}function resolveSelection(view,doc,parsedSel){return Math.max(parsedSel.anchor,parsedSel.head)>doc.content.size?null:selectionBetween(view,doc.resolve(parsedSel.anchor),doc.resolve(parsedSel.head))}function skipClosingAndOpening($pos,fromEnd,mayOpen){for(var depth=$pos.depth,end=fromEnd?$pos.end():$pos.pos;depth>0&&(fromEnd||$pos.indexAfter(depth)==$pos.node(depth).childCount);)depth--,end++,fromEnd=!1;if(mayOpen)for(var next=$pos.node(depth).maybeChild($pos.indexAfter(depth));next&&!next.isLeaf;)next=next.firstChild,end++;return end}var __parseFromClipboard=parseFromClipboard,__endComposition=endComposition,EditorView=function(){function EditorView(place,props){var _this16=this;_classCallCheck(this,EditorView),this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new InputState,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=props,this.state=props.state,this.directPlugins=props.plugins||[],this.directPlugins.forEach(checkStateComponent),this.dispatch=this.dispatch.bind(this),this.dom=place&&place.mount||document.createElement("div"),place&&(place.appendChild?place.appendChild(this.dom):"function"==typeof place?place(this.dom):place.mount&&(this.mounted=!0)),this.editable=getEditable(this),updateCursorWrapper(this),this.nodeViews=buildNodeViews(this),this.docView=docViewDesc(this.state.doc,computeDocDeco(this),viewDecorations(this),this.dom,this),this.domObserver=new DOMObserver(this,function(from,to,typeOver,added){return readDOMChange(_this16,from,to,typeOver,added)}),this.domObserver.start(),function initInput(view){var _loop2=function _loop2(){var handler=handlers[event];view.dom.addEventListener(event,view.input.eventHandlers[event]=function(event){!function eventBelongsToView(view,event){if(!event.bubbles)return!0;if(event.defaultPrevented)return!1;for(var node=event.target;node!=view.dom;node=node.parentNode)if(!node||11==node.nodeType||node.pmViewDesc&&node.pmViewDesc.stopEvent(event))return!1;return!0}(view,event)||runCustomHandler(view,event)||!view.editable&&event.type in editHandlers||handler(view,event)},passiveHandlers[event]?{passive:!0}:void 0)};for(var event in handlers)_loop2();safari&&view.dom.addEventListener("input",function(){return null}),ensureListeners(view)}(this),this.updatePluginViews()}return _createClass(EditorView,[{key:"composing",get:function get(){return this.input.composing}},{key:"props",get:function get(){if(this._props.state!=this.state){var prev=this._props;for(var name in this._props={},prev)this._props[name]=prev[name];this._props.state=this.state}return this._props}},{key:"update",value:function update(props){props.handleDOMEvents!=this._props.handleDOMEvents&&ensureListeners(this);var prevProps=this._props;this._props=props,props.plugins&&(props.plugins.forEach(checkStateComponent),this.directPlugins=props.plugins),this.updateStateInner(props.state,prevProps)}},{key:"setProps",value:function setProps(props){var updated={};for(var name in this._props)updated[name]=this._props[name];for(var _name2 in updated.state=this.state,props)updated[_name2]=props[_name2];this.update(updated)}},{key:"updateState",value:function updateState(state){this.updateStateInner(state,this._props)}},{key:"updateStateInner",value:function updateStateInner(state,prevProps){var _a,prev=this.state,redraw=!1,updateSel=!1;state.storedMarks&&this.composing&&(clearComposition(this),updateSel=!0),this.state=state;var pluginsChanged=prev.plugins!=state.plugins||this._props.plugins!=prevProps.plugins;if(pluginsChanged||this._props.plugins!=prevProps.plugins||this._props.nodeViews!=prevProps.nodeViews){var nodeViews=buildNodeViews(this);(function changedNodeViews(a,b){var nA=0,nB=0;for(var _prop4 in a){if(a[_prop4]!=b[_prop4])return!0;nA++}for(var _ in b)nB++;return nA!=nB})(nodeViews,this.nodeViews)&&(this.nodeViews=nodeViews,redraw=!0)}(pluginsChanged||prevProps.handleDOMEvents!=this._props.handleDOMEvents)&&ensureListeners(this),this.editable=getEditable(this),updateCursorWrapper(this);var innerDeco=viewDecorations(this),outerDeco=computeDocDeco(this),scroll=prev.plugins==state.plugins||prev.doc.eq(state.doc)?state.scrollToSelection>prev.scrollToSelection?"to selection":"preserve":"reset",updateDoc=redraw||!this.docView.matchesNode(state.doc,outerDeco,innerDeco);!updateDoc&&state.selection.eq(prev.selection)||(updateSel=!0);var oldScrollPos="preserve"==scroll&&updateSel&&null==this.dom.style.overflowAnchor&&function storeScrollPos(view){for(var refDOM,refTop,rect=view.dom.getBoundingClientRect(),startY=Math.max(0,rect.top),x=(rect.left+rect.right)/2,y=startY+1;y<Math.min(innerHeight,rect.bottom);y+=5){var dom=view.root.elementFromPoint(x,y);if(dom&&dom!=view.dom&&view.dom.contains(dom)){var localRect=dom.getBoundingClientRect();if(localRect.top>=startY-20){refDOM=dom,refTop=localRect.top;break}}}return{refDOM,refTop,stack:scrollStack(view.dom)}}(this);if(updateSel){this.domObserver.stop();var forceSelUpdate=updateDoc&&(ie||chrome)&&!this.composing&&!prev.selection.empty&&!state.selection.empty&&function selectionContextChanged(sel1,sel2){var depth=Math.min(sel1.$anchor.sharedDepth(sel1.head),sel2.$anchor.sharedDepth(sel2.head));return sel1.$anchor.start(depth)!=sel2.$anchor.start(depth)}(prev.selection,state.selection);if(updateDoc){var chromeKludge=chrome?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=findCompositionNode(this)),!redraw&&this.docView.update(state.doc,outerDeco,innerDeco,this)||(this.docView.updateOuterDeco(outerDeco),this.docView.destroy(),this.docView=docViewDesc(state.doc,outerDeco,innerDeco,this.dom,this)),!chromeKludge||this.trackWrites&&this.dom.contains(this.trackWrites)||(forceSelUpdate=!0)}var mouseDown=this.input.mouseDown;forceSelUpdate||!(mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function anchorInRightPlace(view){var anchorDOM=view.docView.domFromPos(view.state.selection.anchor,0),domSel=view.domSelectionRange();return isEquivalentPosition(anchorDOM.node,anchorDOM.offset,domSel.anchorNode,domSel.anchorOffset)}(this)&&mouseDown.delaySelUpdate())?selectionToDOM(this,forceSelUpdate):(syncNodeSelection(this,state.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(prev),(null===(_a=this.dragging)||void 0===_a?void 0:_a.node)&&!prev.doc.eq(state.doc)&&this.updateDraggedNode(this.dragging,prev),"reset"==scroll?this.dom.scrollTop=0:"to selection"==scroll?this.scrollToSelection():oldScrollPos&&function resetScrollPos(_ref){var refDOM=_ref.refDOM,refTop=_ref.refTop,stack=_ref.stack,newRefTop=refDOM?refDOM.getBoundingClientRect().top:0;restoreScrollStack(stack,0==newRefTop?0:newRefTop-refTop)}(oldScrollPos)}},{key:"scrollToSelection",value:function scrollToSelection(){var _this17=this,startDOM=this.domSelectionRange().focusNode;if(startDOM&&this.dom.contains(1==startDOM.nodeType?startDOM:startDOM.parentNode))if(this.someProp("handleScrollToSelection",function(f){return f(_this17)}));else if(this.state.selection instanceof prosemirrorState.NodeSelection){var target=this.docView.domAfterPos(this.state.selection.from);1==target.nodeType&&scrollRectIntoView(this,target.getBoundingClientRect(),startDOM)}else scrollRectIntoView(this,this.coordsAtPos(this.state.selection.head,1),startDOM);else;}},{key:"destroyPluginViews",value:function destroyPluginViews(){for(var view;view=this.pluginViews.pop();)view.destroy&&view.destroy()}},{key:"updatePluginViews",value:function updatePluginViews(prevState){if(prevState&&prevState.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var _i20=0;_i20<this.pluginViews.length;_i20++){var pluginView=this.pluginViews[_i20];pluginView.update&&pluginView.update(this,prevState)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var i=0;i<this.directPlugins.length;i++){var plugin=this.directPlugins[i];plugin.spec.view&&this.pluginViews.push(plugin.spec.view(this))}for(var _i19=0;_i19<this.state.plugins.length;_i19++){var _plugin=this.state.plugins[_i19];_plugin.spec.view&&this.pluginViews.push(_plugin.spec.view(this))}}}},{key:"updateDraggedNode",value:function updateDraggedNode(dragging,prev){var sel=dragging.node,found=-1;if(sel.from<this.state.doc.content.size&&this.state.doc.nodeAt(sel.from)==sel.node)found=sel.from;else{var movedPos=sel.from+(this.state.doc.content.size-prev.doc.content.size);(movedPos>0&&movedPos<this.state.doc.content.size&&this.state.doc.nodeAt(movedPos))==sel.node&&(found=movedPos)}this.dragging=new Dragging(dragging.slice,dragging.move,found<0?void 0:prosemirrorState.NodeSelection.create(this.state.doc,found))}},{key:"someProp",value:function someProp(propName,f){var value,prop=this._props&&this._props[propName];if(null!=prop&&(value=f?f(prop):prop))return value;for(var i=0;i<this.directPlugins.length;i++){var _prop=this.directPlugins[i].props[propName];if(null!=_prop&&(value=f?f(_prop):_prop))return value}var plugins=this.state.plugins;if(plugins)for(var _i21=0;_i21<plugins.length;_i21++){var _prop2=plugins[_i21].props[propName];if(null!=_prop2&&(value=f?f(_prop2):_prop2))return value}}},{key:"hasFocus",value:function hasFocus(){if(ie){var node=this.root.activeElement;if(node==this.dom)return!0;if(!node||!this.dom.contains(node))return!1;for(;node&&this.dom!=node&&this.dom.contains(node);){if("false"==node.contentEditable)return!1;node=node.parentElement}return!0}return this.root.activeElement==this.dom}},{key:"focus",value:function focus(){this.domObserver.stop(),this.editable&&function focusPreventScroll(dom){if(dom.setActive)return dom.setActive();if(preventScrollSupported)return dom.focus(preventScrollSupported);var stored=scrollStack(dom);dom.focus(null==preventScrollSupported?{get preventScroll(){return preventScrollSupported={preventScroll:!0},!0}}:void 0),preventScrollSupported||(preventScrollSupported=!1,restoreScrollStack(stored,0))}(this.dom),selectionToDOM(this),this.domObserver.start()}},{key:"root",get:function get(){var _this18=this,cached=this._root;if(null==cached)for(var _ret3,_loop5=function _loop5(search){if(9==search.nodeType||11==search.nodeType&&search.host)return search.getSelection||(Object.getPrototypeOf(search).getSelection=function(){return search.ownerDocument.getSelection()}),{v:_this18._root=search}},search=this.dom.parentNode;search;search=search.parentNode)if(_ret3=_loop5(search))return _ret3.v;return cached||document}},{key:"updateRoot",value:function updateRoot(){this._root=null}},{key:"posAtCoords",value:function posAtCoords(coords){return _posAtCoords(this,coords)}},{key:"coordsAtPos",value:function coordsAtPos(pos){return _coordsAtPos(this,pos,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)}},{key:"domAtPos",value:function domAtPos(pos){var side=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.domFromPos(pos,side)}},{key:"nodeDOM",value:function nodeDOM(pos){var desc=this.docView.descAt(pos);return desc?desc.nodeDOM:null}},{key:"posAtDOM",value:function posAtDOM(node,offset){var bias=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,pos=this.docView.posFromDOM(node,offset,bias);if(null==pos)throw new RangeError("DOM position not inside the editor");return pos}},{key:"endOfTextblock",value:function endOfTextblock(dir,state){return _endOfTextblock(this,state||this.state,dir)}},{key:"pasteHTML",value:function pasteHTML(html,event){return doPaste(this,"",html,!1,event||new ClipboardEvent("paste"))}},{key:"pasteText",value:function pasteText(text,event){return doPaste(this,text,null,!0,event||new ClipboardEvent("paste"))}},{key:"serializeForClipboard",value:function serializeForClipboard(slice){return _serializeForClipboard(this,slice)}},{key:"destroy",value:function destroy(){this.docView&&(function destroyInput(view){for(var type in view.input.mouseDown&&view.input.mouseDown.done(),view.domObserver.stop(),view.input.eventHandlers)view.dom.removeEventListener(type,view.input.eventHandlers[type]);clearTimeout(view.input.composingTimeout),clearTimeout(view.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],viewDecorations(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,function clearReusedRange(){reusedRange=null}())}},{key:"isDestroyed",get:function get(){return null==this.docView}},{key:"dispatchEvent",value:function dispatchEvent(event){return function _dispatchEvent(view,event){runCustomHandler(view,event)||!handlers[event.type]||!view.editable&&event.type in editHandlers||handlers[event.type](view,event)}(this,event)}},{key:"domSelectionRange",value:function domSelectionRange(){var sel=this.domSelection();return sel?safari&&11===this.root.nodeType&&function deepActiveElement(doc){for(var elt=doc.activeElement;elt&&elt.shadowRoot;)elt=elt.shadowRoot.activeElement;return elt}(this.dom.ownerDocument)==this.dom&&function safariShadowSelectionRange(view,selection){if(selection.getComposedRanges){var range=selection.getComposedRanges(view.root)[0];if(range)return rangeToSelectionRange(view,range)}var found;function read(event){event.preventDefault(),event.stopImmediatePropagation(),found=event.getTargetRanges()[0]}return view.dom.addEventListener("beforeinput",read,!0),document.execCommand("indent"),view.dom.removeEventListener("beforeinput",read,!0),found?rangeToSelectionRange(view,found):null}(this,sel)||sel:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}},{key:"domSelection",value:function domSelection(){return this.root.getSelection()}}]),EditorView}();function computeDocDeco(view){var attrs=Object.create(null);return attrs.class="ProseMirror",attrs.contenteditable=String(view.editable),view.someProp("attributes",function(value){if("function"==typeof value&&(value=value(view.state)),value)for(var attr in value)"class"==attr?attrs.class+=" "+value[attr]:"style"==attr?attrs.style=(attrs.style?attrs.style+";":"")+value[attr]:attrs[attr]||"contenteditable"==attr||"nodeName"==attr||(attrs[attr]=String(value[attr]))}),attrs.translate||(attrs.translate="no"),[Decoration.node(0,view.state.doc.content.size,attrs)]}function updateCursorWrapper(view){if(view.markCursor){var dom=document.createElement("img");dom.className="ProseMirror-separator",dom.setAttribute("mark-placeholder","true"),dom.setAttribute("alt",""),view.cursorWrapper={dom,deco:Decoration.widget(view.state.selection.from,dom,{raw:!0,marks:view.markCursor})}}else view.cursorWrapper=null}function getEditable(view){return!view.someProp("editable",function(value){return!1===value(view.state)})}function buildNodeViews(view){var result=Object.create(null);function add(obj){for(var _prop3 in obj)Object.prototype.hasOwnProperty.call(result,_prop3)||(result[_prop3]=obj[_prop3])}return view.someProp("nodeViews",add),view.someProp("markViews",add),result}function checkStateComponent(plugin){if(plugin.spec.state||plugin.spec.filterTransaction||plugin.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}EditorView.prototype.dispatch=function(tr){var dispatchTransaction=this._props.dispatchTransaction;dispatchTransaction?dispatchTransaction.call(this,tr):this.updateState(this.state.apply(tr))},exports.Decoration=Decoration,exports.DecorationSet=DecorationSet,exports.EditorView=EditorView,exports.__endComposition=__endComposition,exports.__parseFromClipboard=__parseFromClipboard},"./node_modules/rope-sequence/dist/index.cjs"(module){"use strict";var RopeSequence=function RopeSequence(){};RopeSequence.prototype.append=function append(other){return other.length?(other=RopeSequence.from(other),!this.length&&other||other.length<200&&this.leafAppend(other)||this.length<200&&other.leafPrepend(this)||this.appendInner(other)):this},RopeSequence.prototype.prepend=function prepend(other){return other.length?RopeSequence.from(other).append(this):this},RopeSequence.prototype.appendInner=function appendInner(other){return new Append(this,other)},RopeSequence.prototype.slice=function slice(from,to){return void 0===from&&(from=0),void 0===to&&(to=this.length),from>=to?RopeSequence.empty:this.sliceInner(Math.max(0,from),Math.min(this.length,to))},RopeSequence.prototype.get=function get(i){if(!(i<0||i>=this.length))return this.getInner(i)},RopeSequence.prototype.forEach=function forEach(f,from,to){void 0===from&&(from=0),void 0===to&&(to=this.length),from<=to?this.forEachInner(f,from,to,0):this.forEachInvertedInner(f,from,to,0)},RopeSequence.prototype.map=function map(f,from,to){void 0===from&&(from=0),void 0===to&&(to=this.length);var result=[];return this.forEach(function(elt,i){return result.push(f(elt,i))},from,to),result},RopeSequence.from=function from(values){return values instanceof RopeSequence?values:values&&values.length?new Leaf(values):RopeSequence.empty};var Leaf=function(RopeSequence){function Leaf(values){RopeSequence.call(this),this.values=values}RopeSequence&&(Leaf.__proto__=RopeSequence),Leaf.prototype=Object.create(RopeSequence&&RopeSequence.prototype),Leaf.prototype.constructor=Leaf;var prototypeAccessors={length:{configurable:!0},depth:{configurable:!0}};return Leaf.prototype.flatten=function flatten(){return this.values},Leaf.prototype.sliceInner=function sliceInner(from,to){return 0==from&&to==this.length?this:new Leaf(this.values.slice(from,to))},Leaf.prototype.getInner=function getInner(i){return this.values[i]},Leaf.prototype.forEachInner=function forEachInner(f,from,to,start){for(var i=from;i<to;i++)if(!1===f(this.values[i],start+i))return!1},Leaf.prototype.forEachInvertedInner=function forEachInvertedInner(f,from,to,start){for(var i=from-1;i>=to;i--)if(!1===f(this.values[i],start+i))return!1},Leaf.prototype.leafAppend=function leafAppend(other){if(this.length+other.length<=200)return new Leaf(this.values.concat(other.flatten()))},Leaf.prototype.leafPrepend=function leafPrepend(other){if(this.length+other.length<=200)return new Leaf(other.flatten().concat(this.values))},prototypeAccessors.length.get=function(){return this.values.length},prototypeAccessors.depth.get=function(){return 0},Object.defineProperties(Leaf.prototype,prototypeAccessors),Leaf}(RopeSequence);RopeSequence.empty=new Leaf([]);var Append=function(RopeSequence){function Append(left,right){RopeSequence.call(this),this.left=left,this.right=right,this.length=left.length+right.length,this.depth=Math.max(left.depth,right.depth)+1}return RopeSequence&&(Append.__proto__=RopeSequence),Append.prototype=Object.create(RopeSequence&&RopeSequence.prototype),Append.prototype.constructor=Append,Append.prototype.flatten=function flatten(){return this.left.flatten().concat(this.right.flatten())},Append.prototype.getInner=function getInner(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},Append.prototype.forEachInner=function forEachInner(f,from,to,start){var leftLen=this.left.length;return!(from<leftLen&&!1===this.left.forEachInner(f,from,Math.min(to,leftLen),start))&&(!(to>leftLen&&!1===this.right.forEachInner(f,Math.max(from-leftLen,0),Math.min(this.length,to)-leftLen,start+leftLen))&&void 0)},Append.prototype.forEachInvertedInner=function forEachInvertedInner(f,from,to,start){var leftLen=this.left.length;return!(from>leftLen&&!1===this.right.forEachInvertedInner(f,from-leftLen,Math.max(to,leftLen)-leftLen,start+leftLen))&&(!(to<leftLen&&!1===this.left.forEachInvertedInner(f,Math.min(from,leftLen),to,start))&&void 0)},Append.prototype.sliceInner=function sliceInner(from,to){if(0==from&&to==this.length)return this;var leftLen=this.left.length;return to<=leftLen?this.left.slice(from,to):from>=leftLen?this.right.slice(from-leftLen,to-leftLen):this.left.slice(from,leftLen).append(this.right.slice(0,to-leftLen))},Append.prototype.leafAppend=function leafAppend(other){var inner=this.right.leafAppend(other);if(inner)return new Append(this.left,inner)},Append.prototype.leafPrepend=function leafPrepend(other){var inner=this.left.leafPrepend(other);if(inner)return new Append(inner,this.right)},Append.prototype.appendInner=function appendInner(other){return this.left.depth>=Math.max(this.right.depth,other.depth)+1?new Append(this.left,new Append(this.right,other)):new Append(this,other)},Append}(RopeSequence);module.exports=RopeSequence},"./node_modules/w3c-keyname/index.cjs"(__unused_webpack_module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});for(var base={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shift={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mac="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ie="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),i=0;i<10;i++)base[48+i]=base[96+i]=String(i);for(i=1;i<=24;i++)base[i+111]="F"+i;for(i=65;i<=90;i++)base[i]=String.fromCharCode(i+32),shift[i]=String.fromCharCode(i);for(var code in base)shift.hasOwnProperty(code)||(shift[code]=base[code]);exports.base=base,exports.keyName=function keyName(event){var name=!(mac&&event.metaKey&&event.shiftKey&&!event.ctrlKey&&!event.altKey||ie&&event.shiftKey&&event.key&&1==event.key.length||"Unidentified"==event.key)&&event.key||(event.shiftKey?shift:base)[event.keyCode]||event.key||"Unidentified";return"Esc"==name&&(name="Escape"),"Del"==name&&(name="Delete"),"Left"==name&&(name="ArrowLeft"),"Up"==name&&(name="ArrowUp"),"Right"==name&&(name="ArrowRight"),"Down"==name&&(name="ArrowDown"),name},exports.shift=shift}}]);
3
+ //# sourceMappingURL=7674.58735d56.iframe.bundle.js.map