@aquera/nile-elements 2.0.16 → 2.0.18

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 (383) hide show
  1. package/README.md +6 -0
  2. package/dist/{index-f6944844.cjs.js → index-0c0c869d.cjs.js} +2 -2
  3. package/dist/{index-f6944844.cjs.js.map → index-0c0c869d.cjs.js.map} +1 -1
  4. package/dist/{index-403841c7.cjs.js → index-129ef6fb.cjs.js} +3 -3
  5. package/dist/{index-403841c7.cjs.js.map → index-129ef6fb.cjs.js.map} +1 -1
  6. package/dist/{index-1faa963c.esm.js → index-36f2a6b5.esm.js} +1 -1
  7. package/dist/index-4df50481.esm.js +1 -0
  8. package/dist/index-5d34cff1.esm.js +1 -0
  9. package/dist/index-7ae95edd.cjs.js +2 -0
  10. package/dist/{index-3ca67627.cjs.js.map → index-7ae95edd.cjs.js.map} +1 -1
  11. package/dist/index-7ca72b78.esm.js +1 -0
  12. package/dist/index-bbe23ad8.cjs.js +2 -0
  13. package/dist/index-bbe23ad8.cjs.js.map +1 -0
  14. package/dist/index-ccc6a799.cjs.js +5 -0
  15. package/dist/index-ccc6a799.cjs.js.map +1 -0
  16. package/dist/index.cjs.js +1 -1
  17. package/dist/index.esm.js +1 -1
  18. package/dist/index.js +686 -464
  19. package/dist/nile-auto-complete/index.cjs.js +1 -1
  20. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  21. package/dist/nile-auto-complete/portal-manager.cjs.js +1 -1
  22. package/dist/nile-auto-complete/portal-utils.cjs.js +1 -1
  23. package/dist/nile-code-editor/extensionSetup.cjs.js +2 -2
  24. package/dist/nile-code-editor/index.cjs.js +1 -1
  25. package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
  26. package/dist/nile-code-editor/theme.cjs.js +1 -1
  27. package/dist/nile-color-picker/index.cjs.js +1 -1
  28. package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
  29. package/dist/nile-combobox/index.cjs.js +1 -1
  30. package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
  31. package/dist/nile-combobox/portal-manager.cjs.js +1 -1
  32. package/dist/nile-context-menu/index.cjs.js +1 -1
  33. package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
  34. package/dist/nile-context-submenu/index.cjs.js +1 -1
  35. package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
  36. package/dist/nile-detail/index.cjs.js +1 -1
  37. package/dist/nile-detail/nile-detail.cjs.js +1 -1
  38. package/dist/nile-dropdown/index.cjs.js +1 -1
  39. package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
  40. package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
  41. package/dist/nile-file-upload/index.cjs.js +1 -1
  42. package/dist/nile-file-upload/nile-file-upload.cjs.js +1 -1
  43. package/dist/nile-file-upload/nile-file-upload.template.cjs.js +1 -1
  44. package/dist/nile-floating-panel/index.cjs.js +1 -1
  45. package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
  46. package/dist/nile-lite-tooltip/index.cjs.js +1 -1
  47. package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
  48. package/dist/nile-markdown-editor/index.cjs.js +1 -1
  49. package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
  50. package/dist/nile-minimap/index.cjs.js +2 -0
  51. package/dist/nile-minimap/index.cjs.js.map +1 -0
  52. package/dist/nile-minimap/index.esm.js +1 -0
  53. package/dist/nile-minimap/nile-minimap.cjs.js +2 -0
  54. package/dist/nile-minimap/nile-minimap.cjs.js.map +1 -0
  55. package/dist/nile-minimap/nile-minimap.css.cjs.js +2 -0
  56. package/dist/nile-minimap/nile-minimap.css.cjs.js.map +1 -0
  57. package/dist/nile-minimap/nile-minimap.css.esm.js +150 -0
  58. package/dist/nile-minimap/nile-minimap.esm.js +22 -0
  59. package/dist/nile-popover/index.cjs.js +1 -1
  60. package/dist/nile-popover/nile-popover.cjs.js +1 -1
  61. package/dist/nile-popover/portal-manager.cjs.js +1 -1
  62. package/dist/nile-popup/index.cjs.js +1 -1
  63. package/dist/nile-popup/nile-popup.cjs.js +1 -1
  64. package/dist/nile-segmented-progress-bar/index.cjs.js +1 -1
  65. package/dist/nile-segmented-progress-bar/nile-segmented-progress-bar.cjs.js +1 -1
  66. package/dist/nile-select/index.cjs.js +1 -1
  67. package/dist/nile-select/nile-select.cjs.js +1 -1
  68. package/dist/nile-select/portal-manager.cjs.js +1 -1
  69. package/dist/nile-side-bar-action/index.cjs.js +1 -1
  70. package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
  71. package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
  72. package/dist/nile-tooltip/index.cjs.js +1 -1
  73. package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
  74. package/dist/nile-virtual-select/index.cjs.js +1 -1
  75. package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
  76. package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
  77. package/dist/nile-virtual-select/renderer.cjs.js +1 -1
  78. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
  79. package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -1
  80. package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -1
  81. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
  82. package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -1
  83. package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -1
  84. package/dist/nile-wysiwyg-editor/engine/email-css.cjs.js +2 -0
  85. package/dist/nile-wysiwyg-editor/engine/email-css.cjs.js.map +1 -0
  86. package/dist/nile-wysiwyg-editor/engine/email-css.esm.js +1 -0
  87. package/dist/nile-wysiwyg-editor/engine/email-render.cjs.js +2 -0
  88. package/dist/nile-wysiwyg-editor/engine/email-render.cjs.js.map +1 -0
  89. package/dist/nile-wysiwyg-editor/engine/email-render.esm.js +1 -0
  90. package/dist/nile-wysiwyg-editor/engine/html-detect.cjs.js +2 -0
  91. package/dist/nile-wysiwyg-editor/engine/html-detect.cjs.js.map +1 -0
  92. package/dist/nile-wysiwyg-editor/engine/html-detect.esm.js +1 -0
  93. package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
  94. package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -1
  95. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
  96. package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js.map +1 -1
  97. package/dist/nile-wysiwyg-editor/engine/inputrules.esm.js +1 -1
  98. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
  99. package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js.map +1 -1
  100. package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -1
  101. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
  102. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -1
  103. package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -1
  104. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
  105. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -1
  106. package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -1
  107. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
  108. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -1
  109. package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -1
  110. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +1 -1
  111. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js.map +1 -1
  112. package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.esm.js +1 -1
  113. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +1 -1
  114. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js.map +1 -1
  115. package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -1
  116. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +1 -1
  117. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js.map +1 -1
  118. package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -1
  119. package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +1 -1
  120. package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js.map +1 -1
  121. package/dist/nile-wysiwyg-editor/engine/plugins/image.esm.js +1 -1
  122. package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +1 -1
  123. package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js.map +1 -1
  124. package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -1
  125. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +1 -1
  126. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js.map +1 -1
  127. package/dist/nile-wysiwyg-editor/engine/plugins/max-length.esm.js +1 -1
  128. package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +1 -1
  129. package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -1
  130. package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -1
  131. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +1 -1
  132. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js.map +1 -1
  133. package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.esm.js +1 -1
  134. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +1 -1
  135. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js.map +1 -1
  136. package/dist/nile-wysiwyg-editor/engine/plugins/single-line.esm.js +1 -1
  137. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +1 -1
  138. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js.map +1 -1
  139. package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.esm.js +1 -1
  140. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
  141. package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -1
  142. package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -1
  143. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +2 -1
  144. package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -1
  145. package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -1
  146. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
  147. package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -1
  148. package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -1
  149. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
  150. package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -1
  151. package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -1
  152. package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +1 -1
  153. package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js.map +1 -1
  154. package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -1
  155. package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
  156. package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
  157. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
  158. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
  159. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
  160. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
  161. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +45 -4
  162. package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +2 -2
  163. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
  164. package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
  165. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +1 -1
  166. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -1
  167. package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +2 -2
  168. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
  169. package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
  170. package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +5 -5
  171. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
  172. package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -1
  173. package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +1 -1
  174. package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +1 -1
  175. package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -1
  176. package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +1 -1
  177. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
  178. package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -1
  179. package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +2 -2
  180. package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +1 -1
  181. package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -1
  182. package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +1 -1
  183. package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +1 -1
  184. package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -1
  185. package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +3 -3
  186. package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +1 -1
  187. package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -1
  188. package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +3 -3
  189. package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +1 -1
  190. package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -1
  191. package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +1 -1
  192. package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +1 -1
  193. package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -1
  194. package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +1 -1
  195. package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +1 -1
  196. package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -1
  197. package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +9 -9
  198. package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +1 -1
  199. package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -1
  200. package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +1 -1
  201. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +1 -1
  202. package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -1
  203. package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +1 -1
  204. package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +1 -1
  205. package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -1
  206. package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +1 -1
  207. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
  208. package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -1
  209. package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +4 -4
  210. package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +1 -1
  211. package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -1
  212. package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +1 -1
  213. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +1 -1
  214. package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -1
  215. package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +23 -12
  216. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +1 -1
  217. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -1
  218. package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +7 -7
  219. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
  220. package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
  221. package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +1 -1
  222. package/dist/src/index.d.ts +1 -0
  223. package/dist/src/index.js +1 -0
  224. package/dist/src/index.js.map +1 -1
  225. package/dist/src/nile-minimap/index.d.ts +1 -0
  226. package/dist/src/nile-minimap/index.js +2 -0
  227. package/dist/src/nile-minimap/index.js.map +1 -0
  228. package/dist/src/nile-minimap/nile-minimap.css.d.ts +12 -0
  229. package/dist/src/nile-minimap/nile-minimap.css.js +162 -0
  230. package/dist/src/nile-minimap/nile-minimap.css.js.map +1 -0
  231. package/dist/src/nile-minimap/nile-minimap.d.ts +131 -0
  232. package/dist/src/nile-minimap/nile-minimap.js +704 -0
  233. package/dist/src/nile-minimap/nile-minimap.js.map +1 -0
  234. package/dist/src/nile-minimap/nile-minimap.test.d.ts +1 -0
  235. package/dist/src/nile-minimap/nile-minimap.test.js +785 -0
  236. package/dist/src/nile-minimap/nile-minimap.test.js.map +1 -0
  237. package/dist/src/nile-wysiwyg-editor/engine/create-state.d.ts +5 -0
  238. package/dist/src/nile-wysiwyg-editor/engine/create-state.js +2 -0
  239. package/dist/src/nile-wysiwyg-editor/engine/create-state.js.map +1 -1
  240. package/dist/src/nile-wysiwyg-editor/engine/email-css.d.ts +14 -0
  241. package/dist/src/nile-wysiwyg-editor/engine/email-css.js +140 -0
  242. package/dist/src/nile-wysiwyg-editor/engine/email-css.js.map +1 -0
  243. package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.d.ts +1 -0
  244. package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.js +1045 -0
  245. package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.js.map +1 -0
  246. package/dist/src/nile-wysiwyg-editor/engine/email-render.d.ts +11 -0
  247. package/dist/src/nile-wysiwyg-editor/engine/email-render.js +93 -0
  248. package/dist/src/nile-wysiwyg-editor/engine/email-render.js.map +1 -0
  249. package/dist/src/nile-wysiwyg-editor/engine/html-detect.d.ts +2 -0
  250. package/dist/src/nile-wysiwyg-editor/engine/html-detect.js +24 -0
  251. package/dist/src/nile-wysiwyg-editor/engine/html-detect.js.map +1 -0
  252. package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +4 -1
  253. package/dist/src/nile-wysiwyg-editor/engine/index.js +3 -1
  254. package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
  255. package/dist/src/nile-wysiwyg-editor/engine/inputrules.d.ts +0 -5
  256. package/dist/src/nile-wysiwyg-editor/engine/inputrules.js +19 -0
  257. package/dist/src/nile-wysiwyg-editor/engine/inputrules.js.map +1 -1
  258. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js +3 -2
  259. package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js.map +1 -1
  260. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.d.ts +4 -0
  261. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js +56 -1
  262. package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js.map +1 -1
  263. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.d.ts +5 -0
  264. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js +27 -6
  265. package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js.map +1 -1
  266. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +30 -7
  267. package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
  268. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +46 -0
  269. package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
  270. package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +9 -1
  271. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +730 -7
  272. package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
  273. package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +3 -0
  274. package/dist/src/nile-wysiwyg-editor/engine/schema.js +215 -34
  275. package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
  276. package/dist/src/nile-wysiwyg-editor/engine/selection-state.js +3 -1
  277. package/dist/src/nile-wysiwyg-editor/engine/selection-state.js.map +1 -1
  278. package/dist/src/nile-wysiwyg-editor/engine/serializer.d.ts +12 -4
  279. package/dist/src/nile-wysiwyg-editor/engine/serializer.js +18 -8
  280. package/dist/src/nile-wysiwyg-editor/engine/serializer.js.map +1 -1
  281. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.d.ts +1 -0
  282. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.js +287 -0
  283. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.js.map +1 -0
  284. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +45 -4
  285. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
  286. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +23 -0
  287. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +113 -15
  288. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
  289. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +213 -0
  290. package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
  291. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +2 -2
  292. package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -1
  293. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +1 -1
  294. package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
  295. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +1 -1
  296. package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -1
  297. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +1 -1
  298. package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
  299. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +1 -1
  300. package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -1
  301. package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +1 -1
  302. package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -1
  303. package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +1 -1
  304. package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -1
  305. package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +1 -1
  306. package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -1
  307. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +1 -1
  308. package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -1
  309. package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +2 -2
  310. package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -1
  311. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +1 -1
  312. package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -1
  313. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +1 -1
  314. package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
  315. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +1 -1
  316. package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -1
  317. package/dist/src/nile-wysiwyg-editor/ui/source-view.js +2 -2
  318. package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
  319. package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +1 -1
  320. package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -1
  321. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +14 -3
  322. package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
  323. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +2 -2
  324. package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
  325. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +1 -1
  326. package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -1
  327. package/dist/src/version.js +1 -1
  328. package/dist/src/version.js.map +1 -1
  329. package/dist/tsconfig.tsbuildinfo +1 -1
  330. package/package.json +2 -1
  331. package/src/index.ts +1 -0
  332. package/src/nile-minimap/index.ts +1 -0
  333. package/src/nile-minimap/nile-minimap.css.ts +164 -0
  334. package/src/nile-minimap/nile-minimap.test.ts +924 -0
  335. package/src/nile-minimap/nile-minimap.ts +796 -0
  336. package/src/nile-wysiwyg-editor/engine/create-state.ts +7 -0
  337. package/src/nile-wysiwyg-editor/engine/email-css.ts +136 -0
  338. package/src/nile-wysiwyg-editor/engine/email-fidelity.test.ts +1347 -0
  339. package/src/nile-wysiwyg-editor/engine/email-render.ts +99 -0
  340. package/src/nile-wysiwyg-editor/engine/html-detect.ts +26 -0
  341. package/src/nile-wysiwyg-editor/engine/index.ts +10 -1
  342. package/src/nile-wysiwyg-editor/engine/inputrules.ts +18 -1
  343. package/src/nile-wysiwyg-editor/engine/plugins/image-view.ts +3 -2
  344. package/src/nile-wysiwyg-editor/engine/plugins/link.ts +58 -2
  345. package/src/nile-wysiwyg-editor/engine/plugins/paste.ts +31 -8
  346. package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +29 -7
  347. package/src/nile-wysiwyg-editor/engine/pm.test.ts +73 -0
  348. package/src/nile-wysiwyg-editor/engine/sanitize.ts +729 -7
  349. package/src/nile-wysiwyg-editor/engine/schema.ts +206 -33
  350. package/src/nile-wysiwyg-editor/engine/selection-state.ts +3 -1
  351. package/src/nile-wysiwyg-editor/engine/serializer.ts +30 -8
  352. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.ts +357 -0
  353. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +45 -4
  354. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +258 -0
  355. package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +119 -12
  356. package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +2 -2
  357. package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +1 -1
  358. package/src/nile-wysiwyg-editor/ui/embed-menu.ts +1 -1
  359. package/src/nile-wysiwyg-editor/ui/embed-panel.ts +1 -1
  360. package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +1 -1
  361. package/src/nile-wysiwyg-editor/ui/find-replace.ts +1 -1
  362. package/src/nile-wysiwyg-editor/ui/image-menu.ts +1 -1
  363. package/src/nile-wysiwyg-editor/ui/image-panel.ts +1 -1
  364. package/src/nile-wysiwyg-editor/ui/insert-menu.ts +1 -1
  365. package/src/nile-wysiwyg-editor/ui/link-editor.ts +2 -2
  366. package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +1 -1
  367. package/src/nile-wysiwyg-editor/ui/math-panel.ts +1 -1
  368. package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +1 -1
  369. package/src/nile-wysiwyg-editor/ui/source-view.ts +2 -2
  370. package/src/nile-wysiwyg-editor/ui/special-chars.ts +1 -1
  371. package/src/nile-wysiwyg-editor/ui/suggest-list.ts +14 -3
  372. package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +2 -2
  373. package/src/nile-wysiwyg-editor/ui/table-menu.ts +1 -1
  374. package/vscode-html-custom-data.json +116 -25
  375. package/web-test-runner.config.mjs +4 -0
  376. package/dist/index-3ca67627.cjs.js +0 -2
  377. package/dist/index-6f3fa4ab.esm.js +0 -1
  378. package/dist/index-7b1c9857.esm.js +0 -1
  379. package/dist/index-89c520e9.cjs.js +0 -5
  380. package/dist/index-89c520e9.cjs.js.map +0 -1
  381. package/dist/index-ba47645d.esm.js +0 -1
  382. package/dist/index-c3210a9c.cjs.js +0 -2
  383. package/dist/index-c3210a9c.cjs.js.map +0 -1
@@ -1,8 +1,10 @@
1
1
  import { puppeteerLauncher } from '@web/test-runner-puppeteer';
2
2
  import { fromRollup } from '@web/dev-server-rollup';
3
3
  import rollupReplace from '@rollup/plugin-replace';
4
+ import rollupCommonjs from '@rollup/plugin-commonjs';
4
5
 
5
6
  const replace = fromRollup(rollupReplace);
7
+ const commonjs = fromRollup(rollupCommonjs);
6
8
 
7
9
  const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode', 'Multiple versions of Lit loaded', 'The main \'lit-element\' module entrypoint is deprecated'];
8
10
 
@@ -56,6 +58,8 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
56
58
  preventAssignment: true,
57
59
  'process.env.NODE_ENV': JSON.stringify('production'),
58
60
  }),
61
+ // highlight.js (used by nile-wysiwyg-editor) ships CommonJS.
62
+ commonjs({ include: ['**/node_modules/highlight.js/**'] }),
59
63
  ],
60
64
 
61
65
  coverage: true,
@@ -1,2 +0,0 @@
1
- System.register(["./index-89c520e9.cjs.js"],function(_export,_context){"use strict";var t,e,i,r,n,s,l,o,h,f,u,c,a,d,p,m,k,y,v,D,x,O,S,T,C,P,E,N,R,A,B,$,I,F,K,L,G,_,nt,st,lt,ot,ft,ut,ct,at,dt,mt,bt,gt,kt,Mt,Tt,At,re,fe,ce,ae,de,pe,me,Ce,Pe,Ee,Ne,Ae,Ke,He,We,_t67,ze,Ge,Ue,Je,Ye,Qe,Xe,Ze,_e,hi,fi,ui,ci,ai,di,bi,gi,yi;function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}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 _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;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function _createForOfIteratorHelper(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var n=0,F=function F(){};return{s:F,n:function(_n36){function n(){return _n36.apply(this,arguments);}n.toString=function(){return _n36.toString();};return n;}(function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]};}),e:function e(r){throw r;},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 o,a=!0,u=!1;return{s:function s(){t=t.call(r);},n:function n(){var r=t.next();return a=r.done,r;},e:function e(r){u=!0,o=r;},f:function f(){try{a||null==t["return"]||t["return"]();}finally{if(u)throw o;}}};}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;}}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 _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function _typeof(o){"@babel/helpers - typeof";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(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function b(t,e,i,r,n){for(var s;;){if(t==i&&e==r)return!0;if(e==(n<0?0:g(t))){var _i=t.parentNode;if(!_i||1!=_i.nodeType||w(t)||m.test(t.nodeName)||"false"==t.contentEditable)return!1;e=u(t)+(n<0?0:1),t=_i;}else{if(1!=t.nodeType)return!1;{var _i2=t.childNodes[e+(n<0?-1:0)];if(1==_i2.nodeType&&"false"==_i2.contentEditable){if(!(null===(s=_i2.pmViewDesc)||void 0===s?void 0:s.ignoreForSelection))return!1;e+=n;}else t=_i2,e=n<0?g(t):0;}}}}function g(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length;}function w(t){var e;for(var _i3=t;_i3&&!(e=_i3.pmViewDesc);_i3=_i3.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t);}function M(t,e){var i=document.createEvent("Event");return i.initEvent("keydown",!0,!0),i.keyCode=t,i.key=i.code=e,i;}function q(t){var e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight};}function H(t,e){return"number"==typeof t?t:t[e];}function W(t){var e=t.getBoundingClientRect(),i=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*i,top:e.top,bottom:e.top+t.clientHeight*r};}function j(t,e,i){if(!X(e)&&0==e.left)return;var r=t.someProp("scrollThreshold")||0,n=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(var _l=i||t.dom;_l;){if(1!=_l.nodeType){_l=c(_l);continue;}var _t2=_l,_i4=_t2==s.body,_o=_i4?q(s):W(_t2),_h=0,_f=0;if(e.top<_o.top+H(r,"top")?_f=-(_o.top-e.top+H(n,"top")):e.bottom>_o.bottom-H(r,"bottom")&&(_f=e.bottom-e.top>_o.bottom-_o.top?e.top+H(n,"top")-_o.top:e.bottom-_o.bottom+H(n,"bottom")),e.left<_o.left+H(r,"left")?_h=-(_o.left-e.left+H(n,"left")):e.right>_o.right-H(r,"right")&&(_h=e.right-_o.right+H(n,"right")),_h||_f)if(_i4)s.defaultView.scrollBy(_h,_f);else{var _i5=_t2.scrollLeft,_r=_t2.scrollTop;_f&&(_t2.scrollTop+=_f),_h&&(_t2.scrollLeft+=_h);var _n=_t2.scrollLeft-_i5,_s=_t2.scrollTop-_r;e={left:e.left-_n,top:e.top-_s,right:e.right-_n,bottom:e.bottom-_s};}var _u=_i4?"fixed":getComputedStyle(_l).position;if(/^(fixed|sticky)$/.test(_u))break;_l="absolute"==_u?_l.offsetParent:c(_l);}}function V(t){var e=[],i=t.ownerDocument;for(var _r2=t;_r2&&(e.push({dom:_r2,top:_r2.scrollTop,left:_r2.scrollLeft}),t!=i);_r2=c(_r2));return e;}function z(t,e){for(var _i6=0;_i6<t.length;_i6++){var _t$_i=t[_i6],_r3=_t$_i.dom,_n2=_t$_i.top,_s2=_t$_i.left;_r3.scrollTop!=_n2+e&&(_r3.scrollTop=_n2+e),_r3.scrollLeft!=_s2&&(_r3.scrollLeft=_s2);}}function U(t,e){var i,r,n,s,l=2e8,o=0,h=e.top,f=e.top;for(var _u2=t.firstChild,_c=0;_u2;_u2=_u2.nextSibling,_c++){var _t3=void 0;if(1==_u2.nodeType)_t3=_u2.getClientRects();else{if(3!=_u2.nodeType)continue;_t3=d(_u2).getClientRects();}for(var _a=0;_a<_t3.length;_a++){var _d=_t3[_a];if(_d.top<=h&&_d.bottom>=f){h=Math.max(_d.bottom,h),f=Math.min(_d.top,f);var _t4=_d.left>e.left?_d.left-e.left:_d.right<e.left?e.left-_d.right:0;if(_t4<l){i=_u2,l=_t4,r=_t4&&3==i.nodeType?{left:_d.right<e.left?_d.right:_d.left,top:e.top}:e,1==_u2.nodeType&&_t4&&(o=_c+(e.left>=(_d.left+_d.right)/2?1:0));continue;}}else _d.top>e.top&&!n&&_d.left<=e.left&&_d.right>=e.left&&(n=_u2,s={left:Math.max(_d.left,Math.min(_d.right,e.left)),top:_d.top});!i&&(e.left>=_d.right&&e.top>=_d.top||e.left>=_d.left&&e.top>=_d.bottom)&&(o=_c+1);}}return!i&&n&&(i=n,r=s,l=0),i&&3==i.nodeType?function(t,e){var i,r=t.nodeValue.length,n=document.createRange();for(var _s3=0;_s3<r;_s3++){n.setEnd(t,_s3+1),n.setStart(t,_s3);var _r4=Z(n,1);if(_r4.top!=_r4.bottom&&J(e,_r4)){i={node:t,offset:_s3+(e.left>=(_r4.left+_r4.right)/2?1:0)};break;}}return n.detach(),i||{node:t,offset:0};}(i,r):!i||l&&1==i.nodeType?{node:t,offset:o}:U(i,r);}function J(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1;}function Y(t,e,i){var r=t.childNodes.length;if(r&&i.top<i.bottom)for(var _n3=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-i.top)/(i.bottom-i.top))-2)),_s4=_n3;;){var _i7=t.childNodes[_s4];if(1==_i7.nodeType){var _t5=_i7.getClientRects();for(var _r5=0;_r5<_t5.length;_r5++){var _n4=_t5[_r5];if(J(e,_n4))return Y(_i7,e,_n4);}}if((_s4=(_s4+1)%r)==_n3)break;}return t;}function Q(t,e){var _s5;var i,r=t.dom.ownerDocument,n=0,s=function(t,e,i){if(t.caretPositionFromPoint)try{var _r6=t.caretPositionFromPoint(e,i);if(_r6)return{node:_r6.offsetNode,offset:Math.min(g(_r6.offsetNode),_r6.offset)};}catch(t){}if(t.caretRangeFromPoint){var _r7=t.caretRangeFromPoint(e,i);if(_r7)return{node:_r7.startContainer,offset:Math.min(g(_r7.startContainer),_r7.startOffset)};}}(r,e.left,e.top);s&&(_s5=s,i=_s5.node,n=_s5.offset,_s5);var l,o=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top);if(!o||!t.dom.contains(1!=o.nodeType?o.parentNode:o)){var _i8=t.dom.getBoundingClientRect();if(!J(e,_i8))return null;if(o=Y(t.dom,e,_i8),!o)return null;}if(A)for(var _t6=o;i&&_t6;_t6=c(_t6))_t6.draggable&&(i=void 0);if(o=function(t,e){var i=t.parentNode;return i&&/^li$/i.test(i.nodeName)&&e.left<t.getBoundingClientRect().left?i:t;}(o,e),i){if(P&&1==i.nodeType&&(n=Math.min(n,i.childNodes.length),n<i.childNodes.length)){var _t7,_r8=i.childNodes[n];"IMG"==_r8.nodeName&&(_t7=_r8.getBoundingClientRect()).right<=e.left&&_t7.bottom>e.top&&n++;}var _r9;K&&n&&1==i.nodeType&&1==(_r9=i.childNodes[n-1]).nodeType&&"false"==_r9.contentEditable&&_r9.getBoundingClientRect().top>=e.top&&n--,i==t.dom&&n==i.childNodes.length-1&&1==i.lastChild.nodeType&&e.top>i.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=n&&1==i.nodeType&&"BR"==i.childNodes[n-1].nodeName||(l=function(t,e,i,r){var n=-1;for(var _i9=e,_s6=!1;_i9!=t.dom;){var _e2=void 0,_l2=t.docView.nearestDesc(_i9,!0);if(!_l2)return null;if(1==_l2.dom.nodeType&&(_l2.node.isBlock&&_l2.parent||!_l2.contentDOM)&&((_e2=_l2.dom.getBoundingClientRect()).width||_e2.height)&&(_l2.node.isBlock&&_l2.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(_l2.dom.nodeName)&&(!_s6&&_e2.left>r.left||_e2.top>r.top?n=_l2.posBefore:(!_s6&&_e2.right<r.left||_e2.bottom<r.top)&&(n=_l2.posAfter),_s6=!0),!_l2.contentDOM&&n<0&&!_l2.node.isText))return(_l2.node.isBlock?r.top<(_e2.top+_e2.bottom)/2:r.left<(_e2.left+_e2.right)/2)?_l2.posBefore:_l2.posAfter;_i9=_l2.dom.parentNode;}return n>-1?n:t.docView.posFromDOM(e,i,-1);}(t,i,n,e));}null==l&&(l=function(t,e,i){var _U=U(e,i),r=_U.node,n=_U.offset,s=-1;if(1==r.nodeType&&!r.firstChild){var _t8=r.getBoundingClientRect();s=_t8.left!=_t8.right&&i.left>(_t8.left+_t8.right)/2?1:-1;}return t.docView.posFromDOM(r,n,s);}(t,o,e));var h=t.docView.nearestDesc(o,!0);return{pos:l,inside:h?h.posAtStart-h.border:-1};}function X(t){return t.top<t.bottom||t.left<t.right;}function Z(t,e){var i=t.getClientRects();if(i.length){var _t9=i[e<0?0:i.length-1];if(X(_t9))return _t9;}return Array.prototype.find.call(i,X)||t.getBoundingClientRect();}function tt(t,e,i){var _t$docView$domFromPos=t.docView.domFromPos(e,i<0?-1:1),r=_t$docView$domFromPos.node,n=_t$docView$domFromPos.offset,s=_t$docView$domFromPos.atom,l=K||P;if(3==r.nodeType){if(!l||!_.test(r.nodeValue)&&(i<0?n:n!=r.nodeValue.length)){var _t10=n,_e3=n,_s7=i<0?1:-1;return i<0&&!n?(_e3++,_s7=-1):i>=0&&n==r.nodeValue.length?(_t10--,_s7=1):i<0?_t10--:_e3++,et(Z(d(r,_t10,_e3),_s7),_s7<0);}{var _t11=Z(d(r,n,n),i);if(P&&n&&/\s/.test(r.nodeValue[n-1])&&n<r.nodeValue.length){var _e4=Z(d(r,n-1,n-1),-1);if(_e4.top==_t11.top){var _i10=Z(d(r,n,n+1),-1);if(_i10.top!=_t11.top)return et(_i10,_i10.left<_e4.left);}}return _t11;}}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(null==s&&n&&(i<0||n==g(r))){var _t12=r.childNodes[n-1];if(1==_t12.nodeType)return it(_t12.getBoundingClientRect(),!1);}if(null==s&&n<g(r)){var _t13=r.childNodes[n];if(1==_t13.nodeType)return it(_t13.getBoundingClientRect(),!0);}return it(r.getBoundingClientRect(),i>=0);}if(null==s&&n&&(i<0||n==g(r))){var _t14=r.childNodes[n-1],_e5=3==_t14.nodeType?d(_t14,g(_t14)-(l?0:1)):1!=_t14.nodeType||"BR"==_t14.nodeName&&_t14.nextSibling?null:_t14;if(_e5)return et(Z(_e5,1),!1);}if(null==s&&n<g(r)){var _t15=r.childNodes[n];for(;_t15.pmViewDesc&&_t15.pmViewDesc.ignoreForCoords;)_t15=_t15.nextSibling;var _e6=_t15?3==_t15.nodeType?d(_t15,0,l?0:1):1==_t15.nodeType?_t15:null:null;if(_e6)return et(Z(_e6,-1),!0);}return et(Z(3==r.nodeType?d(r):r,-i),i>=0);}function et(t,e){if(0==t.width)return t;var i=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:i,right:i};}function it(t,e){if(0==t.height)return t;var i=e?t.top:t.bottom;return{top:i,bottom:i,left:t.left,right:t.right};}function rt(t,e,i){var r=t.state,n=t.root.activeElement;r!=e&&t.updateState(e),n!=t.dom&&t.focus();try{return i();}finally{r!=e&&t.updateState(r),n!=t.dom&&n&&n.focus();}}function ht(t,e,i){return st==e&&lt==i?ot:(st=e,lt=i,ot="up"==i||"down"==i?function(t,e,i){var r=e.selection,n="up"==i?r.$from:r.$to;return rt(t,e,function(){var _t$docView$domFromPos2=t.docView.domFromPos(n.pos,"up"==i?-1:1),e=_t$docView$domFromPos2.node;for(;;){var _i11=t.docView.nearestDesc(e,!0);if(!_i11)break;if(_i11.node.isBlock){e=_i11.contentDOM||_i11.dom;break;}e=_i11.dom.parentNode;}var r=tt(t,n.pos,1);for(var _t16=e.firstChild;_t16;_t16=_t16.nextSibling){var _e7=void 0;if(1==_t16.nodeType)_e7=_t16.getClientRects();else{if(3!=_t16.nodeType)continue;_e7=d(_t16,0,_t16.nodeValue.length).getClientRects();}for(var _t17=0;_t17<_e7.length;_t17++){var _n5=_e7[_t17];if(_n5.bottom>_n5.top+1&&("up"==i?r.top-_n5.top>2*(_n5.bottom-r.top):_n5.bottom-r.bottom>2*(r.bottom-_n5.top)))return!1;}}return!0;});}(t,e,i):function(t,e,i){var r=e.selection.$head;if(!r.parent.isTextblock)return!1;var n=r.parentOffset,s=!n,l=n==r.parent.content.size,o=t.domSelection();return o?nt.test(r.parent.textContent)&&o.modify?rt(t,e,function(){var _t$domSelectionRange=t.domSelectionRange(),e=_t$domSelectionRange.focusNode,n=_t$domSelectionRange.focusOffset,s=_t$domSelectionRange.anchorNode,l=_t$domSelectionRange.anchorOffset,h=o.caretBidiLevel;o.modify("move",i,"character");var f=r.depth?t.docView.domAfterPos(r.before()):t.dom,_t$domSelectionRange2=t.domSelectionRange(),u=_t$domSelectionRange2.focusNode,c=_t$domSelectionRange2.focusOffset,a=u&&!f.contains(1==u.nodeType?u:u.parentNode)||e==u&&n==c;try{o.collapse(s,l),e&&(e!=s||n!=l)&&o.extend&&o.extend(e,n);}catch(t){}return null!=h&&(o.caretBidiLevel=h),a;}):"left"==i||"backward"==i?s:l:r.pos==r.start()||r.pos==r.end();}(t,e,i));}function pt(t,e,i,r,n){xt(r,e,t);var s=new dt(void 0,t,e,i,r,r,r);return s.contentDOM&&s.updateChildren(n,0),s;}function wt(t,e,i){var r=t.firstChild,n=!1;for(var _s13=0;_s13<e.length;_s13++){var _l9=e[_s13],_o5=_l9.dom;if(_o5.parentNode==t){for(;_o5!=r;)r=St(r),n=!0;r=r.nextSibling;}else n=!0,t.insertBefore(_o5,r);if(_l9 instanceof at){var _e24=r?r.previousSibling:t.lastChild;wt(_l9.contentDOM,_l9.children,i),r=_e24?_e24.nextSibling:t.firstChild;}}for(;r;)r=St(r),n=!0;n&&i.trackWrites==t&&(i.trackWrites=null);}function yt(t,e,i){if(0==t.length)return Mt;var r=i?Mt[0]:new kt(),n=[r];for(var _s14=0;_s14<t.length;_s14++){var _l10=t[_s14].type.attrs;if(_l10){_l10.nodeName&&n.push(r=new kt(_l10.nodeName));for(var _t40 in _l10){var _s15=_l10[_t40];null!=_s15&&(i&&1==n.length&&n.push(r=new kt(e.isInline?"span":"div")),"class"==_t40?r["class"]=(r["class"]?r["class"]+" ":"")+_s15:"style"==_t40?r.style=(r.style?r.style+";":"")+_s15:"nodeName"!=_t40&&(r[_t40]=_s15));}}}return n;}function vt(t,e,i,r){if(i==Mt&&r==Mt)return e;var n=e;for(var _e25=0;_e25<r.length;_e25++){var _s16=r[_e25],_l11=i[_e25];if(_e25){var _e26=void 0;_l11&&_l11.nodeName==_s16.nodeName&&n!=t&&(_e26=n.parentNode)&&_e26.nodeName.toLowerCase()==_s16.nodeName||(_e26=document.createElement(_s16.nodeName),_e26.pmIsDeco=!0,_e26.appendChild(n),_l11=Mt[0]),n=_e26;}Dt(n,_l11||Mt[0],_s16);}return n;}function Dt(t,e,i){for(var _r20 in e)"class"==_r20||"style"==_r20||"nodeName"==_r20||_r20 in i||t.removeAttribute(_r20);for(var _r21 in i)"class"!=_r21&&"style"!=_r21&&"nodeName"!=_r21&&i[_r21]!=e[_r21]&&t.setAttribute(_r21,i[_r21]);if(e["class"]!=i["class"]){var _r22=e["class"]?e["class"].split(" ").filter(Boolean):[],_n14=i["class"]?i["class"].split(" ").filter(Boolean):[];for(var _e27=0;_e27<_r22.length;_e27++)-1==_n14.indexOf(_r22[_e27])&&t.classList.remove(_r22[_e27]);for(var _e28=0;_e28<_n14.length;_e28++)-1==_r22.indexOf(_n14[_e28])&&t.classList.add(_n14[_e28]);0==t.classList.length&&t.removeAttribute("class");}if(e.style!=i.style){if(e.style){var _i28,_r23=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;_i28=_r23.exec(e.style);)t.style.removeProperty(_i28[1]);}i.style&&(t.style.cssText+=i.style);}}function xt(t,e,i){return vt(t,t,Mt,yt(e,i,1!=t.nodeType));}function Ot(t,e){if(t.length!=e.length)return!1;for(var _i29=0;_i29<t.length;_i29++)if(!t[_i29].type.eq(e[_i29].type))return!1;return!0;}function St(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e;}function Ct(t,e){return t.type.side-e.type.side;}function Pt(t,e,i,r,n){var s=[];for(var _l14=0,_o8=0;_l14<t.length;_l14++){var _h6=t[_l14],_f5=_o8,_u5=_o8+=_h6.size;_f5>=i||_u5<=e?s.push(_h6):(_f5<e&&s.push(_h6.slice(0,e-_f5,r)),n&&(s.push(n),n=void 0),_u5>i&&s.push(_h6.slice(i-_f5,_h6.size,r)));}return s;}function Et(e){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;var s=e.docView.nearestDesc(r.focusNode),l=s&&0==s.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;var h,f,c=n.resolve(o);if(k(r)){for(h=o;s&&!s.node;)s=s.parent;var _e33=s.node;if(s&&_e33.isAtom&&t.isSelectable(_e33)&&s.parent&&(!_e33.isInline||!function(t,e,i){for(var _r28=0==e,_n18=e==g(t);_r28||_n18;){if(t==i)return!0;var _e34=u(t);if(!(t=t.parentNode))return!1;_r28=_r28&&0==_e34,_n18=_n18&&_e34==g(t);}}(r.focusNode,r.focusOffset,s.dom))){var _e35=s.posBefore;f=new t(o==_e35?c:n.resolve(_e35));}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){var _ref2,_ref3;var _t44=o,_i33=o;for(var _n19=0;_n19<r.rangeCount;_n19++){var _s17=r.getRangeAt(_n19);_t44=Math.min(_t44,e.docView.posFromDOM(_s17.startContainer,_s17.startOffset,1)),_i33=Math.max(_i33,e.docView.posFromDOM(_s17.endContainer,_s17.endOffset,-1));}if(_t44<0)return null;_ref2=_i33==e.state.selection.anchor?[_i33,_t44]:[_t44,_i33],_ref3=_slicedToArray(_ref2,2),h=_ref3[0],o=_ref3[1],c=n.resolve(o);}else h=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(h<0)return null;}var a=n.resolve(h);if(!f){f=Lt(e,a,c,"pointer"==i||e.state.selection.head<c.pos&&!l?1:-1);}return f;}function Nt(t){return t.editable?t.hasFocus():Ht(t)&&document.activeElement&&document.activeElement.contains(t.dom);}function Rt(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;var r=t.state.selection;if(Ft(t,r),!Nt(t))return;var n=t.input.mouseDown;if(!i&&N&&n){var _e36=t.domSelectionRange(),_i34=t.domObserver.currentSelection;if(_e36.anchorNode&&_i34.anchorNode&&p(_e36.anchorNode,_e36.anchorOffset,_i34.anchorNode,_i34.anchorOffset)&&n.delaySelUpdate())return void t.domObserver.setCurSelection();}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){var e=t.domSelection();if(!e)return;var i=t.cursorWrapper.dom,r="IMG"==i.nodeName;r?e.collapse(i.parentNode,u(i)+1):e.collapse(i,0);!r&&!t.state.selection.visible&&T&&C<=11&&(i.disabled=!0,i.disabled=!1);}(t);else{var _n20,_s18,_l15=r.anchor,_o9=r.head;!At||r instanceof e||(r.$from.parent.inlineContent||(_n20=Bt(t,r.from)),r.empty||r.$from.parent.inlineContent||(_s18=Bt(t,r.to))),t.docView.setSelection(_l15,_o9,t,i),At&&(_n20&&It(_n20),_s18&&It(_s18)),r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){var e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);var i=t.domSelectionRange(),r=i.anchorNode,n=i.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=function(){i.anchorNode==r&&i.anchorOffset==n||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(function(){Nt(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection");},20));});}(t));}t.domObserver.setCurSelection(),t.domObserver.connectSelection();}function Bt(t,e){var _t$docView$domFromPos3=t.docView.domFromPos(e,0),i=_t$docView$domFromPos3.node,r=_t$docView$domFromPos3.offset,n=r<i.childNodes.length?i.childNodes[r]:null,s=r?i.childNodes[r-1]:null;if(A&&n&&"false"==n.contentEditable)return $t(n);if(!(n&&"false"!=n.contentEditable||s&&"false"!=s.contentEditable)){if(n)return $t(n);if(s)return $t(s);}}function $t(t){return t.contentEditable="true",A&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t;}function It(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null);}function Ft(e,i){if(i instanceof t){var _t45=e.docView.descAt(i.from);_t45!=e.lastSelectedViewDesc&&(Kt(e),_t45&&_t45.selectNode(),e.lastSelectedViewDesc=_t45);}else Kt(e);}function Kt(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0);}function Lt(t,i,r,n){return t.someProp("createSelectionBetween",function(e){return e(t,i,r);})||e.between(i,r,n);}function qt(t){return!(t.editable&&!t.hasFocus())&&Ht(t);}function Ht(t){var e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode));}catch(t){return!1;}}function Wt(t,e){var _t$selection=t.selection,i=_t$selection.$anchor,n=_t$selection.$head,s=e>0?i.max(n):i.min(n),l=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return l&&r.findFrom(l,e);}function jt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0;}function Vt(i,r,n){var s=i.state.selection;if(!(s instanceof e)){if(s instanceof t&&s.node.isInline)return jt(i,new e(r>0?s.$to:s.$from));{var _t46=Wt(i.state,r);return!!_t46&&jt(i,_t46);}}if(n.indexOf("s")>-1){var _t47=s.$head,_n21=_t47.textOffset?null:r<0?_t47.nodeBefore:_t47.nodeAfter;if(!_n21||_n21.isText||!_n21.isLeaf)return!1;var _l16=i.state.doc.resolve(_t47.pos+_n21.nodeSize*(r<0?-1:1));return jt(i,new e(s.$anchor,_l16));}if(!s.empty)return!1;if(i.endOfTextblock(r>0?"forward":"backward")){var _e37=Wt(i.state,r);return!!(_e37&&_e37 instanceof t)&&jt(i,_e37);}if(!($&&n.indexOf("m")>-1)){var _n22,_l17=s.$head,_o10=_l17.textOffset?null:r<0?_l17.nodeBefore:_l17.nodeAfter;if(!_o10||_o10.isText)return!1;var _h7=r<0?_l17.pos-_o10.nodeSize:_l17.pos;return!!(_o10.isAtom||(_n22=i.docView.descAt(_h7))&&!_n22.contentDOM)&&(t.isSelectable(_o10)?jt(i,new t(r<0?i.state.doc.resolve(_l17.pos-_o10.nodeSize):_l17)):!!K&&jt(i,new e(i.state.doc.resolve(r<0?_h7:_h7+_o10.nodeSize))));}}function zt(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length;}function Gt(t,e){var i=t.pmViewDesc;return i&&0==i.size&&(e<0||t.nextSibling||"BR"!=t.nodeName);}function Ut(t,e){return e<0?function(t){var e=t.domSelectionRange(),i=e.focusNode,r=e.focusOffset;if(!i)return;var n,s,l=!1;P&&1==i.nodeType&&r<zt(i)&&Gt(i.childNodes[r],-1)&&(l=!0);for(;;)if(r>0){if(1!=i.nodeType)break;{var _t48=i.childNodes[r-1];if(Gt(_t48,-1))n=i,s=--r;else{if(3!=_t48.nodeType)break;i=_t48,r=i.nodeValue.length;}}}else{if(Jt(i))break;{var _e38=i.previousSibling;for(;_e38&&Gt(_e38,-1);)n=i.parentNode,s=u(_e38),_e38=_e38.previousSibling;if(_e38)i=_e38,r=zt(i);else{if(i=i.parentNode,i==t.dom)break;r=0;}}}l?Yt(t,i,r):n&&Yt(t,n,s);}(t):function(t){var e=t.domSelectionRange(),i=e.focusNode,r=e.focusOffset;if(!i)return;var n,s,l=zt(i);for(;;)if(r<l){if(1!=i.nodeType)break;if(!Gt(i.childNodes[r],1))break;n=i,s=++r;}else{if(Jt(i))break;{var _e39=i.nextSibling;for(;_e39&&Gt(_e39,1);)n=_e39.parentNode,s=u(_e39)+1,_e39=_e39.nextSibling;if(_e39)i=_e39,r=0,l=zt(i);else{if(i=i.parentNode,i==t.dom)break;r=l=0;}}}n&&Yt(t,n,s);}(t);}function Jt(t){var e=t.pmViewDesc;return e&&e.node&&e.node.isBlock;}function Yt(t,e,i){if(3!=e.nodeType){var _t49,_r29;(_r29=function(t,e){for(;t&&e==t.childNodes.length&&!w(t);)e=u(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){var _i35=t.childNodes[e];if(3==_i35.nodeType)return _i35;if(1==_i35.nodeType&&"false"==_i35.contentEditable)break;t=_i35,e=0;}}(e,i))?(e=_r29,i=0):(_t49=function(t,e){for(;t&&!e&&!w(t);)e=u(t),t=t.parentNode;for(;t&&e;){var _i36=t.childNodes[e-1];if(3==_i36.nodeType)return _i36;if(1==_i36.nodeType&&"false"==_i36.contentEditable)break;e=(t=_i36).childNodes.length;}}(e,i))&&(e=_t49,i=_t49.nodeValue.length);}var r=t.domSelection();if(!r)return;if(k(r)){var _t50=document.createRange();_t50.setEnd(e,i),_t50.setStart(e,i),r.removeAllRanges(),r.addRange(_t50);}else r.extend&&r.extend(e,i);t.domObserver.setCurSelection();var n=t.state;setTimeout(function(){t.state==n&&Rt(t);},50);}function Qt(t,e){var i=t.state.doc.resolve(e);if(!N&&!I&&i.parent.inlineContent){var _r30=t.coordsAtPos(e);if(e>i.start()){var _i37=t.coordsAtPos(e-1),_n23=(_i37.top+_i37.bottom)/2;if(_n23>_r30.top&&_n23<_r30.bottom&&Math.abs(_i37.left-_r30.left)>1)return _i37.left<_r30.left?"ltr":"rtl";}if(e<i.end()){var _i38=t.coordsAtPos(e+1),_n24=(_i38.top+_i38.bottom)/2;if(_n24>_r30.top&&_n24<_r30.bottom&&Math.abs(_i38.left-_r30.left)>1)return _i38.left>_r30.left?"ltr":"rtl";}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr";}function Xt(i,n,s){var l=i.state.selection;if(l instanceof e&&!l.empty||s.indexOf("s")>-1)return!1;if($&&s.indexOf("m")>-1)return!1;var o=l.$from,h=l.$to;if(!o.parent.inlineContent||i.endOfTextblock(n<0?"up":"down")){var _e40=Wt(i.state,n);if(_e40&&_e40 instanceof t)return jt(i,_e40);}if(!o.parent.inlineContent){var _t51=n<0?o:h,_e41=l instanceof f?r.near(_t51,n):r.findFrom(_t51,n);return!!_e41&&jt(i,_e41);}return!1;}function Zt(t,i){if(!(t.state.selection instanceof e))return!0;var _t$state$selection2=t.state.selection,r=_t$state$selection2.$head,n=_t$state$selection2.$anchor,s=_t$state$selection2.empty;if(!r.sameParent(n))return!0;if(!s)return!1;if(t.endOfTextblock(i>0?"forward":"backward"))return!0;var l=!r.textOffset&&(i<0?r.nodeBefore:r.nodeAfter);if(l&&!l.isText){var _e42=t.state.tr;return i<0?_e42["delete"](r.pos-l.nodeSize,r.pos):_e42["delete"](r.pos,r.pos+l.nodeSize),t.dispatch(_e42),!0;}return!1;}function _t(t,e,i){t.domObserver.stop(),e.contentEditable=i,t.domObserver.start();}function te(t,e){var i=e.keyCode,r=function(t){var e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e;}(e);if(8==i||$&&72==i&&"c"==r)return Zt(t,-1)||Ut(t,-1);if(46==i&&!e.shiftKey||$&&68==i&&"c"==r)return Zt(t,1)||Ut(t,1);if(13==i||27==i)return!0;if(37==i||$&&66==i&&"c"==r){var _e43=37==i?"ltr"==Qt(t,t.state.selection.from)?-1:1:-1;return Vt(t,_e43,r)||Ut(t,_e43);}if(39==i||$&&70==i&&"c"==r){var _e44=39==i?"ltr"==Qt(t,t.state.selection.from)?1:-1:1;return Vt(t,_e44,r)||Ut(t,_e44);}return 38==i||$&&80==i&&"c"==r?Xt(t,-1,r)||Ut(t,-1):40==i||$&&78==i&&"c"==r?function(t){if(!A||t.state.selection.$head.parentOffset>0)return!1;var _t$domSelectionRange3=t.domSelectionRange(),e=_t$domSelectionRange3.focusNode,i=_t$domSelectionRange3.focusOffset;if(e&&1==e.nodeType&&0==i&&e.firstChild&&"false"==e.firstChild.contentEditable){var _i39=e.firstChild;_t(t,_i39,"true"),setTimeout(function(){return _t(t,_i39,"false");},20);}return!1;}(t)||Xt(t,1,r)||Ut(t,1):r==($?"m":"c")&&(66==i||73==i||89==i||90==i);}function ee(t,e){t.someProp("transformCopied",function(i){e=i(e,t);});var r=[],_e45=e,n=_e45.content,s=_e45.openStart,l=_e45.openEnd;for(;s>1&&l>1&&1==n.childCount&&1==n.firstChild.childCount;){s--,l--;var _t52=n.firstChild;r.push(_t52.type.name,_t52.attrs!=_t52.type.defaultAttrs?_t52.attrs:null),n=_t52.content;}var o=t.someProp("clipboardSerializer")||i.fromSchema(t.state.schema),h=ue(),f=h.createElement("div");f.appendChild(o.serializeFragment(n,{document:h}));var u,c=f.firstChild,a=0;for(;c&&1==c.nodeType&&(u=fe[c.nodeName.toLowerCase()]);){for(var _t53=u.length-1;_t53>=0;_t53--){var _e46=h.createElement(u[_t53]);for(;f.firstChild;)_e46.appendChild(f.firstChild);f.appendChild(_e46),a++;}c=f.firstChild;}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice","".concat(s," ").concat(l).concat(a?" -".concat(a):""," ").concat(JSON.stringify(r))),{dom:f,text:t.someProp("clipboardTextSerializer",function(i){return i(e,t);})||e.content.textBetween(0,e.content.size,"\n\n"),slice:e};}function ie(t,e,r,s,h){var f,u,c=h.parent.type.spec.code;if(!r&&!e)return null;var a=!!e&&(s||c||!r);if(a){if(t.someProp("transformPastedText",function(i){e=i(e,c||s,t);}),c)return u=new n(l.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0),t.someProp("transformPasted",function(e){u=e(u,t,!0);}),u;var _r31=t.someProp("clipboardTextParser",function(i){return i(e,h,s,t);});if(_r31)u=_r31;else{var _r32=h.marks(),_n25=t.state.schema,_s19=i.fromSchema(_n25);f=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(function(t){var e=f.appendChild(document.createElement("p"));t&&e.appendChild(_s19.serializeNode(_n25.text(t,_r32)));});}}else t.someProp("transformPastedHTML",function(e){r=e(r,t);}),f=function(t){var e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));var i,r=ue(),n=r.body,s=/<([a-z][^>\s]+)/i.exec(t);(i=s&&fe[s[1].toLowerCase()])&&(t=i.map(function(t){return"<"+t+">";}).join("")+t+i.map(function(t){return"</"+t+">";}).reverse().join(""));if(n.innerHTML=function(t){var e=window.trustedTypes;if(!e)return t;ce||(ce=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:function createHTML(t){return t;}}));return ce.createHTML(t);}(t),i)for(var _t54=0;_t54<i.length;_t54++)n=n.querySelector(i[_t54])||n;for(var _t55=0;_t55<r.styleSheets.length;_t55++){var _e47=r.styleSheets[_t55];for(var _t56=0;_t56<_e47.rules.length;_t56++){var _i40=_e47.rules[_t56];if(_i40 instanceof CSSStyleRule){var _t57=n.querySelectorAll(_i40.selectorText);for(var _e48=0;_e48<_t57.length;_e48++)_t57[_e48].style.cssText+=_i40.style.cssText;}}}return n;}(r),K&&function(t){var e=t.querySelectorAll(N?"span:not([class]):not([style])":"span.Apple-converted-space");for(var _i41=0;_i41<e.length;_i41++){var _r33=e[_i41];1==_r33.childNodes.length&&" "==_r33.textContent&&_r33.parentNode&&_r33.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),_r33);}}(f);var d=f&&f.querySelector("[data-pm-slice]"),p=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(p&&p[3])for(var _t58=+p[3];_t58>0;_t58--){var _t59=f.firstChild;for(;_t59&&1!=_t59.nodeType;)_t59=_t59.nextSibling;if(!_t59)break;f=_t59;}if(!u){var _e49=t.someProp("clipboardParser")||t.someProp("domParser")||o.fromSchema(t.state.schema);u=_e49.parseSlice(f,{preserveWhitespace:!(!a&&!p),context:h,ruleFromNode:function ruleFromNode(t){return"BR"!=t.nodeName||t.nextSibling||!t.parentNode||re.test(t.parentNode.nodeName)?null:{ignore:!0};}});}if(p)u=function(t,e){if(!t.size)return t;var i,r=t.content.firstChild.type.schema;try{i=JSON.parse(e);}catch(e){return t;}var s=t.content,o=t.openStart,h=t.openEnd;for(var _t60=i.length-2;_t60>=0;_t60-=2){var _e50=r.nodes[i[_t60]];if(!_e50||_e50.hasRequiredAttrs())break;s=l.from(_e50.create(i[_t60+1],s)),o++,h++;}return new n(s,o,h);}(he(u,+p[1],+p[2]),p[4]);else if(u=n.maxOpen(function(t,e){if(t.childCount<2)return t;var _loop=function _loop(){var r,n=e.node(_i42).contentMatchAt(e.index(_i42)),s=[];if(t.forEach(function(t){if(!s)return;var e,i=n.findWrapping(t.type);if(!i)return s=null;if(e=s.length&&r.length&&se(i,r,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=le(s[s.length-1],r.length));var _e51=ne(t,i);s.push(_e51),n=n.matchType(_e51.type),r=i;}}),s)return{v:l.from(s)};},_ret;for(var _i42=e.depth;_i42>=0;_i42--){_ret=_loop();if(_ret)return _ret.v;}return t;}(u.content,h),!0),u.openStart||u.openEnd){var _t61=0,_e52=0;for(var _e53=u.content.firstChild;_t61<u.openStart&&!_e53.type.spec.isolating;_t61++,_e53=_e53.firstChild);for(var _t62=u.content.lastChild;_e52<u.openEnd&&!_t62.type.spec.isolating;_e52++,_t62=_t62.lastChild);u=he(u,_t61,_e52);}return t.someProp("transformPasted",function(e){u=e(u,t,a);}),u;}function ne(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;for(var _r34=e.length-1;_r34>=i;_r34--)t=e[_r34].create(null,l.from(t));return t;}function se(t,e,i,r,n){if(n<t.length&&n<e.length&&t[n]==e[n]){var _s20=se(t,e,i,r.lastChild,n+1);if(_s20)return r.copy(r.content.replaceChild(r.childCount-1,_s20));if(r.contentMatchAt(r.childCount).matchType(n==t.length-1?i.type:t[n+1]))return r.copy(r.content.append(l.from(ne(i,t,n+1))));}}function le(t,e){if(0==e)return t;var i=t.content.replaceChild(t.childCount-1,le(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(l.empty,!0);return t.copy(i.append(r));}function oe(t,e,i,r,n,s){var o=e<0?t.firstChild:t.lastChild,h=o.content;return t.childCount>1&&(s=0),n<r-1&&(h=oe(h,e,i,r,n+1,s)),n>=i&&(h=e<0?o.contentMatchAt(0).fillBefore(h,s<=n).append(h):h.append(o.contentMatchAt(o.childCount).fillBefore(l.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(h));}function he(t,e,i){return e<t.openStart&&(t=new n(oe(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),i<t.openEnd&&(t=new n(oe(t.content,1,i,t.openEnd,0,0),t.openStart,i)),t;}function ue(){return document.implementation.createHTMLDocument("title");}function be(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now();}function ge(t){t.someProp("handleDOMEvents",function(e){for(var _i43 in e)t.input.eventHandlers[_i43]||t.dom.addEventListener(_i43,t.input.eventHandlers[_i43]=function(e){return we(t,e);});});}function we(t,e){return t.someProp("handleDOMEvents",function(i){var r=i[e.type];return!!r&&(r(t,e)||e.defaultPrevented);});}function ke(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var _i44=e.target;_i44!=t.dom;_i44=_i44.parentNode)if(!_i44||11==_i44.nodeType||_i44.pmViewDesc&&_i44.pmViewDesc.stopEvent(e))return!1;return!0;}function Me(t){return{left:t.clientX,top:t.clientY};}function ye(t,e,i,r,n){if(-1==r)return!1;var s=t.state.doc.resolve(r);var _loop2=function _loop2(_r35){if(t.someProp(e,function(e){return _r35>s.depth?e(t,i,s.nodeAfter,s.before(_r35),n,!0):e(t,i,s.node(_r35),s.before(_r35),n,!1);}))return{v:!0};},_ret2;for(var _r35=s.depth+1;_r35>0;_r35--){_ret2=_loop2(_r35);if(_ret2)return _ret2.v;}return!1;}function ve(t,e,i){if(t.focused||t.focus(),t.state.selection.eq(e))return;var r=t.state.tr.setSelection(e);"pointer"==i&&r.setMeta("pointer",!0),t.dispatch(r);}function De(e,i,r,n,s){return ye(e,"handleClickOn",i,r,n)||e.someProp("handleClick",function(t){return t(e,i,n);})||(s?function(e,i){if(-1==i)return!1;var r,n,s=e.state.selection;s instanceof t&&(r=s.node);var l=e.state.doc.resolve(i);for(var _e54=l.depth+1;_e54>0;_e54--){var _i45=_e54>l.depth?l.nodeAfter:l.node(_e54);if(t.isSelectable(_i45)){n=r&&s.$from.depth>0&&_e54>=s.$from.depth&&l.before(s.$from.depth+1)==s.$from.pos?l.before(s.$from.depth):l.before(_e54);break;}}return null!=n&&(ve(e,t.create(e.state.doc,n),"pointer"),!0);}(e,r):function(e,i){if(-1==i)return!1;var r=e.state.doc.resolve(i),n=r.nodeAfter;return!!(n&&n.isAtom&&t.isSelectable(n))&&(ve(e,new t(r),"pointer"),!0);}(e,r));}function xe(t,e,i,r){return ye(t,"handleDoubleClickOn",e,i,r)||t.someProp("handleDoubleClick",function(i){return i(t,e,r);});}function Oe(t,i,r,n){return ye(t,"handleTripleClickOn",i,r,n)||t.someProp("handleTripleClick",function(e){return e(t,i,n);})||function(t,i,r){if(0!=r.button)return!1;var n=Se(t,i,!0),s=t.state.doc;if(!n)return!1;ve(t,n,"pointer"),n instanceof e&&s.eq(t.state.doc)&&(t.input.mouseDown=new Ne(t,n));return!0;}(t,r,n);}function Se(i,r,n){var s=i.state.doc;if(-1==r)return s.inlineContent?e.create(s,0,s.content.size):null;var l=s.resolve(r);for(var _i46=l.depth+1;_i46>0;_i46--){var _r36=_i46>l.depth?l.nodeAfter:l.node(_i46),_o11=l.before(_i46);if(_r36.inlineContent)return e.create(s,_o11+1,_o11+1+_r36.content.size);if(n&&t.isSelectable(_r36))return t.create(s,_o11);}return null;}function Te(t){return Fe(t);}function Re(t,e){return!!t.composing||!!(A&&Math.abs(Date.now()-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0);}function Be(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(function(){return Fe(t);},e));}function $e(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty();}function Ie(t){var e=t.domSelectionRange();if(!e.focusNode)return null;var i=function(t,e){for(;;){if(3==t.nodeType&&e)return t;if(1==t.nodeType&&e>0){if("false"==t.contentEditable)return null;e=g(t=t.childNodes[e-1]);}else{if(!t.parentNode||w(t))return null;e=u(t),t=t.parentNode;}}}(e.focusNode,e.focusOffset),r=function(t,e){for(;;){if(3==t.nodeType&&e<t.nodeValue.length)return t;if(1==t.nodeType&&e<t.childNodes.length){if("false"==t.contentEditable)return null;t=t.childNodes[e],e=0;}else{if(!t.parentNode||w(t))return null;e=u(t)+1,t=t.parentNode;}}}(e.focusNode,e.focusOffset);if(i&&r&&i!=r){var _e57=r.pmViewDesc,_n26=t.domObserver.lastChangedTextNode;if(i==_n26||r==_n26)return _n26;if(!_e57||!_e57.isText(r.nodeValue))return r;if(t.input.compositionNode==r){var _t64=i.pmViewDesc;if(_t64&&_t64.isText(i.nodeValue))return r;}}return i||r;}function Fe(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;if(!(F&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),$e(t),e||t.docView&&t.docView.dirty){var _i48=Et(t),_r37=t.state.selection;return _i48&&!_i48.eq(_r37)?t.dispatch(t.state.tr.setSelection(_i48)):!t.markCursor&&!e||_r37.$from.node(_r37.$from.sharedDepth(_r37.to)).inlineContent?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),!0;}return!1;}}function Le(t,e,i,r,s){var l=ie(t,e,i,r,t.state.selection.$from);if(t.someProp("handlePaste",function(e){return e(t,s,l||n.empty);}))return!0;if(!l)return!1;var o=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null;}(l),h=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(l);return t.dispatch(h.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0;}function qe(t){var e=t.getData("text/plain")||t.getData("Text");if(e)return e;var i=t.getData("text/uri-list");return i?i.replace(/\r?\n/g," "):"";}function je(t,e){var i;return t.someProp("dragCopies",function(t){i=i||t(e);}),null!=i?!i:!e[We];}function Ve(t,e){if(t==e)return!0;for(var _i53 in t)if(t[_i53]!==e[_i53])return!1;for(var _i54 in e)if(!(_i54 in t))return!1;return!0;}function ti(t,e){if(!e||!t.length)return t;var i=[];for(var _r44=0;_r44<t.length;_r44++){var _n32=t[_r44];i.push(new Je(_n32.from+e,_n32.to+e,_n32.type));}return i;}function ei(t,e,i){if(e.isLeaf)return null;var r=i+e.nodeSize,n=null;for(var _e73,_s26=0;_s26<t.length;_s26++)(_e73=t[_s26])&&_e73.from>i&&_e73.to<r&&((n||(n=[])).push(_e73),t[_s26]=null);return n;}function ii(t){var e=[];for(var _i61=0;_i61<t.length;_i61++)null!=t[_i61]&&e.push(t[_i61]);return e;}function ri(t,e,i,r){var n=[],s=!1;e.forEach(function(e,l){var o=ei(t,e,l+i);if(o){s=!0;var _t77=ri(o,e,i+l+1,r);_t77!=Ze&&n.push(l,l+e.nodeSize,_t77);}});var l=ti(s?ii(t):t,-i).sort(ni);for(var _t78=0;_t78<l.length;_t78++)l[_t78].type.valid(e,l[_t78])||(r.onRemove&&r.onRemove(l[_t78].spec),l.splice(_t78--,1));return l.length||n.length?new Xe(l,n):Ze;}function ni(t,e){return t.from-e.from||t.to-e.to;}function si(t){var e=t;for(var _i62=0;_i62<e.length-1;_i62++){var _r45=e[_i62];if(_r45.from!=_r45.to)for(var _n33=_i62+1;_n33<e.length;_n33++){var _s27=e[_n33];if(_s27.from!=_r45.from){_s27.from<_r45.to&&(e==t&&(e=t.slice()),e[_i62]=_r45.copy(_r45.from,_s27.from),li(e,_n33,_r45.copy(_s27.from,_r45.to)));break;}_s27.to!=_r45.to&&(e==t&&(e=t.slice()),e[_n33]=_s27.copy(_s27.from,_r45.to),li(e,_n33+1,_s27.copy(_r45.to,_s27.to)));}}return e;}function li(t,e,i){for(;e<t.length&&ni(i,t[e])>0;)e++;t.splice(e,0,i);}function oi(t){var e=[];return t.someProp("decorations",function(i){var r=i(t.state);r&&r!=Ze&&e.push(r);}),t.cursorWrapper&&e.push(Xe.create(t.state.doc,[t.cursorWrapper.deco])),_e.from(e);}function pi(t,e){var _ref6;var i=e.startContainer,r=e.startOffset,n=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return p(l.node,l.offset,n,s)&&(_ref6=[n,s,i,r],i=_ref6[0],r=_ref6[1],n=_ref6[2],s=_ref6[3],_ref6),{anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:s};}function mi(t,e){for(var _i69=e.parentNode;_i69&&_i69!=t.dom;_i69=_i69.parentNode){var _e82=t.docView.nearestDesc(_i69,!0);if(_e82&&_e82.node.isBlock)return _i69;}return null;}function wi(t,i,r,n,s){var h=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,i<0){var _e83=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,_i70=Et(t,_e83);if(_i70&&!t.state.selection.eq(_i70)){if(N&&F&&13===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",function(e){return e(t,M(13,"Enter"));}))return;var _r50=t.state.tr.setSelection(_i70);"pointer"==_e83?_r50.setMeta("pointer",!0):"key"==_e83&&_r50.scrollIntoView(),h&&_r50.setMeta("composition",h),t.dispatch(_r50);}return;}var f=t.state.doc.resolve(i),u=f.sharedDepth(r);i=f.before(u+1),r=t.state.doc.resolve(r).after(u+1);var c,a,d=t.state.selection,p=function(t,e,i,r){var n,_t$docView$parseRange=t.docView.parseRange(e,i),s=_t$docView$parseRange.node,l=_t$docView$parseRange.fromOffset,h=_t$docView$parseRange.toOffset,f=_t$docView$parseRange.from,u=_t$docView$parseRange.to,c=t.domSelectionRange(),a=c.anchorNode;if(a&&t.dom.contains(1==a.nodeType?a:a.parentNode)&&(n=[{node:a,offset:c.anchorOffset}],k(c)||n.push({node:c.focusNode,offset:c.focusOffset})),N&&8===t.input.lastKeyCode)for(var _t88=h;_t88>l;_t88--){var _e84=s.childNodes[_t88-1],_i71=_e84.pmViewDesc;if("BR"==_e84.nodeName&&!_i71){h=_t88;break;}if(!_i71||_i71.size)break;}var d=t.state.doc,p=t.someProp("domParser")||o.fromSchema(t.state.schema),m=d.resolve(f),b=null,g=p.parse(s,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:l,to:h,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:n,ruleFromNode:bi(r),context:m});if(n&&null!=n[0].pos){var _t89=n[0].pos,_e85=n[1]&&n[1].pos;null==_e85&&(_e85=_t89),b={anchor:_t89+f,head:_e85+f};}return{doc:g,sel:b,from:f,to:u};}(t,i,r,s),m=t.state.doc,b=m.slice(p.from,p.to);8===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime?(c=t.state.selection.to,a="end"):(c=t.state.selection.from,a="start"),t.input.lastKeyCode=null;var g=function(t,e,i,r,n){var s=t.findDiffStart(e,i),l=i+t.size,o=i+e.size;if(null==s)return null;var _t$findDiffEnd=t.findDiffEnd(e,l,o),h=_t$findDiffEnd.a,f=_t$findDiffEnd.b;if("end"==n){r-=h+Math.max(0,s-Math.min(h,f))-s;}if(h<s&&l<o){s-=r<=s&&r>=h?s-r:0,f=s+(f-h),h=s;}else if(f<s){s-=r<=s&&r>=f?s-r:0,h=s+(h-f),f=s;}return{start:s,endA:h,endB:f};}(b.content,p.doc.content,p.from,c,a);if(g&&t.input.domChangeCount++,(B&&t.input.lastIOSEnter>Date.now()-225||F)&&s.some(function(t){return 1==t.nodeType&&!gi.test(t.nodeName);})&&(!g||g.endA>=g.endB)&&t.someProp("handleKeyDown",function(e){return e(t,M(13,"Enter"));}))return void(t.input.lastIOSEnter=0);if(!g){if(!(n&&d instanceof e&&!d.empty&&d.$head.sameParent(d.$anchor))||t.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){var _e86=ki(t,t.state.doc,p.sel);if(_e86&&!_e86.eq(t.state.selection)){var _i72=t.state.tr.setSelection(_e86);h&&_i72.setMeta("composition",h),t.dispatch(_i72);}}return;}g={start:d.from,endA:d.to,endB:d.to};}t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof e&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2&&t.state.selection.from>=p.from?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&t.state.selection.to<=p.to&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),T&&C<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&"  "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);var w=p.doc.resolveNoCache(g.start-p.from),y=p.doc.resolveNoCache(g.endB-p.from),v=m.resolve(g.start),D=w.sameParent(y)&&w.parent.inlineContent&&v.end()>=g.endA;if((B&&t.input.lastIOSEnter>Date.now()-225&&(!D||s.some(function(t){return"DIV"==t.nodeName||"P"==t.nodeName;}))||!D&&w.pos<p.doc.content.size&&(!w.sameParent(y)||!w.parent.inlineContent)&&w.pos<y.pos&&!/\S/.test(p.doc.textBetween(w.pos,y.pos,"","")))&&t.someProp("handleKeyDown",function(e){return e(t,M(13,"Enter"));}))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>g.start&&function(t,e,i,r,n){if(i-e<=n.pos-r.pos||Mi(r,!0,!1)<n.pos)return!1;var s=t.resolve(e);if(!r.parent.isTextblock){var _t90=s.nodeAfter;return null!=_t90&&i==e+_t90.nodeSize;}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;var l=t.resolve(Mi(s,!0,!0));return!(!l.parent.isTextblock||l.pos>i||Mi(l,!0,!1)<i)&&r.parent.content.cut(r.parentOffset).eq(l.parent.content);}(m,g.start,g.endA,w,y)&&t.someProp("handleKeyDown",function(e){return e(t,M(8,"Backspace"));}))return void(F&&N&&t.domObserver.suppressSelectionUpdates());N&&g.endB==g.start&&(t.input.lastChromeDelete=Date.now()),F&&!D&&w.start()!=y.start()&&0==y.parentOffset&&w.depth==y.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,y=p.doc.resolveNoCache(g.endB-p.from),setTimeout(function(){t.someProp("handleKeyDown",function(e){return e(t,M(13,"Enter"));});},20));var x,O=g.start,S=g.endA,P=function P(e){var i=e||t.state.tr.replace(O,S,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){var _e87=ki(t,i.doc,p.sel);_e87&&!(N&&t.composing&&_e87.empty&&(g.start!=g.endB||t.input.lastChromeDelete<Date.now()-100)&&(_e87.head==O||_e87.head==i.mapping.map(S)-1)||T&&_e87.empty&&_e87.head==O)&&i.setSelection(_e87);}return h&&i.setMeta("composition",h),i.scrollIntoView();};if(D){if(w.pos==y.pos){T&&C<=11&&0==w.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout(function(){return Rt(t);},20));var _e88=P(t.state.tr["delete"](O,S)),_i73=m.resolve(g.start).marksAcross(m.resolve(g.endA));_i73&&_e88.ensureMarks(_i73),t.dispatch(_e88);}else if(g.endA==g.endB&&(x=function(t,e){var i,r,n,s=t.firstChild.marks,o=e.firstChild.marks,h=s,f=o;for(var _t91=0;_t91<o.length;_t91++)h=o[_t91].removeFromSet(h);for(var _t92=0;_t92<s.length;_t92++)f=s[_t92].removeFromSet(f);if(1==h.length&&0==f.length)r=h[0],i="add",n=function n(t){return t.mark(r.addToSet(t.marks));};else{if(0!=h.length||1!=f.length)return null;r=f[0],i="remove",n=function n(t){return t.mark(r.removeFromSet(t.marks));};}var u=[];for(var _t93=0;_t93<e.childCount;_t93++)u.push(n(e.child(_t93)));if(l.from(u).eq(t))return{mark:r,type:i};}(w.parent.content.cut(w.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,g.endA-v.start())))){var _e89=P(t.state.tr);"add"==x.type?_e89.addMark(O,S,x.mark):_e89.removeMark(O,S,x.mark),t.dispatch(_e89);}else if(w.parent.child(w.index()).isText&&w.index()==y.index()-(y.textOffset?0:1)){var _e90=w.parent.textBetween(w.parentOffset,y.parentOffset),_i74=function _i74(){return P(t.state.tr.insertText(_e90,O,S));};t.someProp("handleTextInput",function(r){return r(t,O,S,_e90,_i74);})||t.dispatch(_i74());}else t.dispatch(P());}else t.dispatch(P());}function ki(t,e,i){return Math.max(i.anchor,i.head)>e.content.size?null:Lt(t,e.resolve(i.anchor),e.resolve(i.head));}function Mi(t,e,i){var r=t.depth,n=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,n++,e=!1;if(i){var _e91=t.node(r).maybeChild(t.indexAfter(r));for(;_e91&&!_e91.isLeaf;)_e91=_e91.firstChild,n++;}return n;}function vi(t){var e=Object.create(null);return e["class"]="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",function(i){if("function"==typeof i&&(i=i(t.state)),i)for(var _t104 in i)"class"==_t104?e["class"]+=" "+i[_t104]:"style"==_t104?e.style=(e.style?e.style+";":"")+i[_t104]:e[_t104]||"contenteditable"==_t104||"nodeName"==_t104||(e[_t104]=String(i[_t104]));}),e.translate||(e.translate="no"),[Je.node(0,t.state.doc.content.size,e)];}function Di(t){if(t.markCursor){var _e99=document.createElement("img");_e99.className="ProseMirror-separator",_e99.setAttribute("mark-placeholder","true"),_e99.setAttribute("alt",""),t.cursorWrapper={dom:_e99,deco:Je.widget(t.state.selection.from,_e99,{raw:!0,marks:t.markCursor})};}else t.cursorWrapper=null;}function xi(t){return!t.someProp("editable",function(e){return!1===e(t.state);});}function Oi(t){var e=Object.create(null);function i(t){for(var _i80 in t)Object.prototype.hasOwnProperty.call(e,_i80)||(e[_i80]=t[_i80]);}return t.someProp("nodeViews",i),t.someProp("markViews",i),e;}function Si(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component");}return{setters:[function(_index00bCjsJs){t=_index00bCjsJs.c;e=_index00bCjsJs.T;i=_index00bCjsJs.a;r=_index00bCjsJs.S;n=_index00bCjsJs.d;s=_index00bCjsJs.e;l=_index00bCjsJs.F;o=_index00bCjsJs.D;h=_index00bCjsJs.M;f=_index00bCjsJs.A;}],execute:function execute(){u=function u(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e;},c=function c(t){var e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e;};a=null;d=function d(t,e,i){var r=a||(a=document.createRange());return r.setEnd(t,null==i?t.nodeValue.length:i),r.setStart(t,e||0),r;},p=function p(t,e,i,r){return i&&(b(t,e,i,r,-1)||b(t,e,i,r,1));},m=/^(img|br|input|textarea|hr)$/i;k=function k(t){return t.focusNode&&p(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset);};y="undefined"!=typeof navigator?navigator:null,v="undefined"!=typeof document?document:null,D=y&&y.userAgent||"",x=/Edge\/(\d+)/.exec(D),O=/MSIE \d/.exec(D),S=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(D),T=!!(O||S||x),C=O?document.documentMode:S?+S[1]:x?+x[1]:0,P=!T&&/gecko\/(\d+)/i.test(D);P&&(/Firefox\/(\d+)/.exec(D)||[0,0])[1];E=!T&&/Chrome\/(\d+)/.exec(D),N=!!E,R=E?+E[1]:0,A=!T&&!!y&&/Apple Computer/.test(y.vendor),B=A&&(/Mobile\/\w+/.test(D)||!!y&&y.maxTouchPoints>2),$=B||!!y&&/Mac/.test(y.platform),I=!!y&&/Win/.test(y.platform),F=/Android \d/.test(D),K=!!v&&"webkitFontSmoothing"in v.documentElement.style,L=K?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;G=null;_=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;nt=/[\u0590-\u08ac]/;st=null,lt=null,ot=!1;ft=/*#__PURE__*/function(){function ft(t,e,i,r){_classCallCheck(this,ft);this.parent=t,this.children=e,this.dom=i,this.contentDOM=r,this.dirty=0,i.pmViewDesc=this;}return _createClass(ft,[{key:"matchesWidget",value:function matchesWidget(t){return!1;}},{key:"matchesMark",value:function matchesMark(t){return!1;}},{key:"matchesNode",value:function matchesNode(t,e,i){return!1;}},{key:"matchesHack",value:function matchesHack(t){return!1;}},{key:"parseRule",value:function parseRule(t){return null;}},{key:"stopEvent",value:function stopEvent(t){return!1;}},{key:"size",get:function get(){var t=0;for(var _e8=0;_e8<this.children.length;_e8++)t+=this.children[_e8].size;return t;}},{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 _t18=0;_t18<this.children.length;_t18++)this.children[_t18].destroy();}},{key:"posBeforeChild",value:function posBeforeChild(t){for(var _e9=0,_i12=this.posAtStart;;_e9++){var _r10=this.children[_e9];if(_r10==t)return _i12;_i12+=_r10.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(t,e,i){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(i<0){var _i13,_r11;if(t==this.contentDOM)_i13=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;_i13=t.previousSibling;}for(;_i13&&(!(_r11=_i13.pmViewDesc)||_r11.parent!=this);)_i13=_i13.previousSibling;return _i13?this.posBeforeChild(_r11)+_r11.size:this.posAtStart;}{var _i14,_r12;if(t==this.contentDOM)_i14=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;_i14=t.nextSibling;}for(;_i14&&(!(_r12=_i14.pmViewDesc)||_r12.parent!=this);)_i14=_i14.nextSibling;return _i14?this.posBeforeChild(_r12):this.posAtEnd;}}var r;if(t==this.dom&&this.contentDOM)r=e>u(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(var _e10=t;;_e10=_e10.parentNode){if(_e10==this.dom){r=!1;break;}if(_e10.previousSibling)break;}if(null==r&&e==t.childNodes.length)for(var _e11=t;;_e11=_e11.parentNode){if(_e11==this.dom){r=!0;break;}if(_e11.nextSibling)break;}}return(null==r?i>0:r)?this.posAtEnd:this.posAtStart;}},{key:"nearestDesc",value:function nearestDesc(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1;for(var _i15=!0,_r13=t;_r13;_r13=_r13.parentNode){var _n6=void 0,_s8=this.getDesc(_r13);if(_s8&&(!e||_s8.node)){if(!_i15||!(_n6=_s8.nodeDOM)||(1==_n6.nodeType?_n6.contains(1==t.nodeType?t:t.parentNode):_n6==t))return _s8;_i15=!1;}}}},{key:"getDesc",value:function getDesc(t){var e=t.pmViewDesc;for(var _t19=e;_t19;_t19=_t19.parent)if(_t19==this)return e;}},{key:"posFromDOM",value:function posFromDOM(t,e,i){for(var _r14=t;_r14;_r14=_r14.parentNode){var _n7=this.getDesc(_r14);if(_n7)return _n7.localPosFromDOM(t,e,i);}return-1;}},{key:"descAt",value:function descAt(t){for(var _e12=0,_i16=0;_e12<this.children.length;_e12++){var _r15=this.children[_e12],_n8=_i16+_r15.size;if(_i16==t&&_n8!=_i16){for(;!_r15.border&&_r15.children.length;)for(var _t20=0;_t20<_r15.children.length;_t20++){var _e13=_r15.children[_t20];if(_e13.size){_r15=_e13;break;}}return _r15;}if(t<_n8)return _r15.descAt(t-_i16-_r15.border);_i16=_n8;}}},{key:"domFromPos",value:function domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};var i=0,r=0;for(var _e14=0;i<this.children.length;i++){var _n9=this.children[i],_s9=_e14+_n9.size;if(_s9>t||_n9 instanceof bt){r=t-_e14;break;}_e14=_s9;}if(r)return this.children[i].domFromPos(r-this.children[i].border,e);for(var _t21;i&&!(_t21=this.children[i-1]).size&&_t21 instanceof ut&&_t21.side>=0;i--);if(e<=0){var _t22,_r16=!0;for(;_t22=i?this.children[i-1]:null,_t22&&_t22.dom.parentNode!=this.contentDOM;i--,_r16=!1);return _t22&&e&&_r16&&!_t22.border&&!_t22.domAtom?_t22.domFromPos(_t22.size,e):{node:this.contentDOM,offset:_t22?u(_t22.dom)+1:0};}{var _t23,_r17=!0;for(;_t23=i<this.children.length?this.children[i]:null,_t23&&_t23.dom.parentNode!=this.contentDOM;i++,_r17=!1);return _t23&&_r17&&!_t23.border&&!_t23.domAtom?_t23.domFromPos(0,e):{node:this.contentDOM,offset:_t23?u(_t23.dom):this.contentDOM.childNodes.length};}}},{key:"parseRange",value:function parseRange(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};var r=-1,n=-1;for(var _s10=i,_l3=0;;_l3++){var _i17=this.children[_l3],_o2=_s10+_i17.size;if(-1==r&&t<=_o2){var _n10=_s10+_i17.border;if(t>=_n10&&e<=_o2-_i17.border&&_i17.node&&_i17.contentDOM&&this.contentDOM.contains(_i17.contentDOM))return _i17.parseRange(t,e,_n10);t=_s10;for(var _e15=_l3;_e15>0;_e15--){var _i18=this.children[_e15-1];if(_i18.size&&_i18.dom.parentNode==this.contentDOM&&!_i18.emptyChildAt(1)){r=u(_i18.dom)+1;break;}t-=_i18.size;}-1==r&&(r=0);}if(r>-1&&(_o2>e||_l3==this.children.length-1)){e=_o2;for(var _t24=_l3+1;_t24<this.children.length;_t24++){var _i19=this.children[_t24];if(_i19.size&&_i19.dom.parentNode==this.contentDOM&&!_i19.emptyChildAt(-1)){n=u(_i19.dom);break;}e+=_i19.size;}-1==n&&(n=this.contentDOM.childNodes.length);break;}_s10=_o2;}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:n};}},{key:"emptyChildAt",value:function emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;var e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t);}},{key:"domAfterPos",value:function domAfterPos(t){var _this$domFromPos=this.domFromPos(t,0),e=_this$domFromPos.node,i=_this$domFromPos.offset;if(1!=e.nodeType||i==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[i];}},{key:"setSelection",value:function setSelection(t,e,i){var r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1;var n=Math.min(t,e),s=Math.max(t,e);for(var _l4=0,_o3=0;_l4<this.children.length;_l4++){var _h2=this.children[_l4],_f2=_o3+_h2.size;if(n>_o3&&s<_f2)return _h2.setSelection(t-_o3-_h2.border,e-_o3-_h2.border,i,r);_o3=_f2;}var l=this.domFromPos(t,t?-1:1),o=e==t?l:this.domFromPos(e,e?-1:1),h=i.root.getSelection(),f=i.domSelectionRange(),c=!1;if((P||A)&&t==e){var _l5=l,_t25=_l5.node,_e16=_l5.offset;if(3==_t25.nodeType){if(c=!(!_e16||"\n"!=_t25.nodeValue[_e16-1]),c&&_e16==_t25.nodeValue.length)for(var _e17,_i20=_t25;_i20;_i20=_i20.parentNode){if(_e17=_i20.nextSibling){"BR"==_e17.nodeName&&(l=o={node:_e17.parentNode,offset:u(_e17)+1});break;}var _t26=_i20.pmViewDesc;if(_t26&&_t26.node&&_t26.node.isBlock)break;}}else{var _i21=_t25.childNodes[_e16-1];c=_i21&&("BR"==_i21.nodeName||"false"==_i21.contentEditable);}}if(P&&f.focusNode&&f.focusNode!=o.node&&1==f.focusNode.nodeType){var _t27=f.focusNode.childNodes[f.focusOffset];_t27&&"false"==_t27.contentEditable&&(r=!0);}if(!(r||c&&A)&&p(l.node,l.offset,f.anchorNode,f.anchorOffset)&&p(o.node,o.offset,f.focusNode,f.focusOffset))return;var a=!1;if((h.extend||t==e)&&(!c||!P)){h.collapse(l.node,l.offset);try{t!=e&&h.extend(o.node,o.offset),a=!0;}catch(t){}}if(!a){if(t>e){var _t28=l;l=o,o=_t28;}var _i22=document.createRange();_i22.setEnd(o.node,o.offset),_i22.setStart(l.node,l.offset),h.removeAllRanges(),h.addRange(_i22);}}},{key:"ignoreMutation",value:function ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type;}},{key:"contentLost",get:function get(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM);}},{key:"markDirty",value:function markDirty(t,e){for(var _i23=0,_r18=0;_r18<this.children.length;_r18++){var _n11=this.children[_r18],_s11=_i23+_n11.size;if(_i23==_s11?t<=_s11&&e>=_i23:t<_s11&&e>_i23){var _r19=_i23+_n11.border,_l6=_s11-_n11.border;if(t>=_r19&&e<=_l6)return this.dirty=t==_i23||e==_s11?2:1,void(t!=_r19||e!=_l6||!_n11.contentLost&&_n11.dom.parentNode==this.contentDOM?_n11.markDirty(t-_r19,e-_r19):_n11.dirty=3);_n11.dirty=_n11.dom!=_n11.contentDOM||_n11.dom.parentNode!=this.contentDOM||_n11.children.length?3:2;}_i23=_s11;}this.dirty=2;}},{key:"markParentsDirty",value:function markParentsDirty(){var t=1;for(var _e18=this.parent;_e18;_e18=_e18.parent,t++){var _i24=1==t?2:1;_e18.dirty<_i24&&(_e18.dirty=_i24);}}},{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(t){return!1;}}]);}();ut=/*#__PURE__*/function(_ft){function ut(t,e,i,r){var _this;_classCallCheck(this,ut);var n,s=e.type.toDOM;if("function"==typeof s&&(s=s(i,function(){return n?n.parent?n.parent.posBeforeChild(n):void 0:r;})),!e.type.spec.raw){if(1!=s.nodeType){var _t29=document.createElement("span");_t29.appendChild(s),s=_t29;}s.contentEditable="false",s.classList.add("ProseMirror-widget");}_this=_callSuper(this,ut,[t,[],s,null]),_this.widget=e,_this.widget=e,n=_assertThisInitialized(_this);return _this;}_inherits(ut,_ft);return _createClass(ut,[{key:"matchesWidget",value:function matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type);}},{key:"parseRule",value:function parseRule(){return{ignore:!0};}},{key:"stopEvent",value:function stopEvent(t){var e=this.widget.spec.stopEvent;return!!e&&e(t);}},{key:"ignoreMutation",value:function ignoreMutation(t){return"selection"!=t.type||this.widget.spec.ignoreSelection;}},{key:"destroy",value:function destroy(){this.widget.type.destroy(this.dom),_superPropGet(ut,"destroy",this,3)([]);}},{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;}}]);}(ft);ct=/*#__PURE__*/function(_ft2){function ct(t,e,i,r){var _this2;_classCallCheck(this,ct);_this2=_callSuper(this,ct,[t,[],e,null]),_this2.textDOM=i,_this2.text=r;return _this2;}_inherits(ct,_ft2);return _createClass(ct,[{key:"size",get:function get(){return this.text.length;}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e;}},{key:"domFromPos",value:function domFromPos(t){return{node:this.textDOM,offset:t};}},{key:"ignoreMutation",value:function ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue;}}]);}(ft);at=/*#__PURE__*/function(_ft3){function at(t,e,i,r,n){var _this3;_classCallCheck(this,at);_this3=_callSuper(this,at,[t,[],i,r]),_this3.mark=e,_this3.spec=n;return _this3;}_inherits(at,_ft3);return _createClass(at,[{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(t){return 3!=this.dirty&&this.mark.eq(t);}},{key:"markDirty",value:function markDirty(t,e){if(_superPropGet(at,"markDirty",this,3)([t,e]),0!=this.dirty){var _t30=this.parent;for(;!_t30.node;)_t30=_t30.parent;_t30.dirty<this.dirty&&(_t30.dirty=this.dirty),this.dirty=0;}}},{key:"slice",value:function slice(t,e,i){var r=at.create(this.parent,this.mark,!0,i),n=this.children,s=this.size;e<s&&(n=Pt(n,e,s,i)),t>0&&(n=Pt(n,0,t,i));for(var _t31=0;_t31<n.length;_t31++)n[_t31].parent=r;return r.children=n,r;}},{key:"ignoreMutation",value:function ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):_superPropGet(at,"ignoreMutation",this,3)([t]);}},{key:"destroy",value:function destroy(){this.spec.destroy&&this.spec.destroy(),_superPropGet(at,"destroy",this,3)([]);}}],[{key:"create",value:function create(t,e,r,n){var s=n.nodeViews[e.type.name],l=s&&s(e,n,r);return l&&l.dom||(l=i.renderSpec(document,e.type.spec.toDOM(e,r),null,e.attrs)),new at(t,e,l.dom,l.contentDOM||l.dom,l);}}]);}(ft);dt=/*#__PURE__*/function(_ft4){function dt(t,e,i,r,n,s,l){var _this4;_classCallCheck(this,dt);_this4=_callSuper(this,dt,[t,[],n,s]),_this4.node=e,_this4.outerDeco=i,_this4.innerDeco=r,_this4.nodeDOM=l;return _this4;}_inherits(dt,_ft4);return _createClass(dt,[{key:"parseRule",value:function parseRule(t){var _this5=this;if(this.node.type.spec.reparseInView)return null;var e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM){if(this.contentLost){for(var _t32=this.children.length-1;_t32>=0;_t32--){var _i25=this.children[_t32];if(this.dom.contains(_i25.dom.parentNode)){e.contentElement=_i25.dom.parentNode;break;}}if(!e.contentElement){var _i26=t&&t.find(function(e){return 1==e.nodeType&&t.indexOf(e.parentNode)<0&&_this5.dom.contains(e);});_i26?e.contentElement=_i26:e.getContent=function(){return l.empty;};}}else e.contentElement=this.contentDOM;}else e.getContent=function(){return _this5.node.content;};return e;}},{key:"matchesNode",value:function matchesNode(t,e,i){return 0==this.dirty&&t.eq(this.node)&&Ot(e,this.outerDeco)&&i.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(t,e){var _this6=this;var i=this.node.inlineContent,r=e,n=t.composing?this.localCompositionInfo(t,e):null,s=n&&n.pos>-1?n:null,l=n&&n.pos<0,o=new Tt(this,s&&s.node,t);!function(t,e,i,r){var n=e.locals(t),s=0;if(0==n.length){for(var _i27=0;_i27<t.childCount;_i27++){var _l7=t.child(_i27);r(_l7,n,e.forChild(s,_l7),_i27),s+=_l7.nodeSize;}return;}var l=0,o=[],h=null;for(var _f3=0;;){var _u3=void 0,_c2=void 0,_a2=void 0,_d2=void 0;for(;l<n.length&&n[l].to==s;){var _t33=n[l++];_t33.widget&&(_u3?(_c2||(_c2=[_u3])).push(_t33):_u3=_t33);}if(_u3)if(_c2){_c2.sort(Ct);for(var _t34=0;_t34<_c2.length;_t34++)i(_c2[_t34],_f3,!!h);}else i(_u3,_f3,!!h);if(h)_d2=-1,_a2=h,h=null;else{if(!(_f3<t.childCount))break;_d2=_f3,_a2=t.child(_f3++);}for(var _t35=0;_t35<o.length;_t35++)o[_t35].to<=s&&o.splice(_t35--,1);for(;l<n.length&&n[l].from<=s&&n[l].to>s;)o.push(n[l++]);var _p=s+_a2.nodeSize;if(_a2.isText){var _t36=_p;l<n.length&&n[l].from<_t36&&(_t36=n[l].from);for(var _e19=0;_e19<o.length;_e19++)o[_e19].to<_t36&&(_t36=o[_e19].to);_t36<_p&&(h=_a2.cut(_t36-s),_a2=_a2.cut(0,_t36-s),_p=_t36,_d2=-1);}else for(;l<n.length&&n[l].to<_p;)l++;r(_a2,_a2.isInline&&!_a2.isLeaf?o.filter(function(t){return!t.inline;}):o.slice(),e.forChild(s,_a2),_d2),s=_p;}}(this.node,this.innerDeco,function(e,n,s){e.spec.marks?o.syncToMarks(e.spec.marks,i,t,n):e.type.side>=0&&!s&&o.syncToMarks(n==_this6.node.childCount?h.none:_this6.node.child(n).marks,i,t,n),o.placeWidget(e,t,r);},function(e,s,h,f){var u;o.syncToMarks(e.marks,i,t,f),o.findNodeMatch(e,s,h,f)||l&&t.state.selection.from>r&&t.state.selection.to<r+e.nodeSize&&(u=o.findIndexWithChild(n.node))>-1&&o.updateNodeAt(e,s,h,u,t)||o.updateNextNode(e,s,h,t,f,r)||o.addNode(e,s,h,t,r),r+=e.nodeSize;}),o.syncToMarks([],i,t,0),this.node.isTextblock&&o.addTextblockHacks(),o.destroyRest(),(o.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),wt(this.contentDOM,this.children,t),B&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){var _e20=t.style.cssText;t.style.cssText=_e20+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=_e20;}}(this.dom));}},{key:"localCompositionInfo",value:function localCompositionInfo(t,i){var _t$state$selection=t.state.selection,r=_t$state$selection.from,n=_t$state$selection.to;if(!(t.state.selection instanceof e)||r<i||n>i+this.node.content.size)return null;var s=t.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){var _t37=s.nodeValue,_e21=function(t,e,i,r){for(var _n12=0,_s12=0;_n12<t.childCount&&_s12<=r;){var _l8=t.child(_n12++),_o4=_s12;if(_s12+=_l8.nodeSize,!_l8.isText)continue;var _h3=_l8.text;for(;_n12<t.childCount;){var _e22=t.child(_n12++);if(_s12+=_e22.nodeSize,!_e22.isText)break;_h3+=_e22.text;}if(_s12>=i){if(_s12>=r&&_h3.slice(r-e.length-_o4,r-_o4)==e)return r-e.length;var _t38=_o4<r?_h3.lastIndexOf(e,r-_o4-1):-1;if(_t38>=0&&_t38+e.length+_o4>=i)return _o4+_t38;if(i==r&&_h3.length>=r+e.length-_o4&&_h3.slice(r-_o4,r-_o4+e.length)==e)return r;}}return-1;}(this.node.content,_t37,r-i,n-i);return _e21<0?null:{node:s,pos:_e21,text:_t37};}return{node:s,pos:-1,text:""};}},{key:"protectLocalComposition",value:function protectLocalComposition(t,_ref){var e=_ref.node,i=_ref.pos,r=_ref.text;if(this.getDesc(e))return;var n=e;for(;n.parentNode!=this.contentDOM;n=n.parentNode){for(;n.previousSibling;)n.parentNode.removeChild(n.previousSibling);for(;n.nextSibling;)n.parentNode.removeChild(n.nextSibling);n.pmViewDesc&&(n.pmViewDesc=void 0);}var s=new ct(this,n,e,r);t.input.compositionNodes.push(s),this.children=Pt(this.children,i,i+r.length,t,s);}},{key:"update",value:function update(t,e,i,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,i,r),!0);}},{key:"updateInner",value:function updateInner(t,e,i,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0;}},{key:"updateOuterDeco",value:function updateOuterDeco(t){if(Ot(t,this.outerDeco))return;var e=1!=this.nodeDOM.nodeType,i=this.dom;this.dom=vt(this.dom,this.nodeDOM,yt(this.outerDeco,this.node,e),yt(t,this.node,e)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t;}},{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(t,e,r,n,s,l){var o,h=s.nodeViews[e.type.name],f=h&&h(e,s,function(){return o?o.parent?o.parent.posBeforeChild(o):void 0:l;},r,n),u=f&&f.dom,c=f&&f.contentDOM;if(e.isText){if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node");}else u=document.createTextNode(e.text);}else if(!u){var _t39=i.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);u=_t39.dom;c=_t39.contentDOM;}c||e.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),e.type.spec.draggable&&(u.draggable=!0));var a=u;return u=xt(u,r,e),f?o=new gt(t,e,r,n,u,c||null,a,f):e.isText?new mt(t,e,r,n,u,a):new dt(t,e,r,n,u,c||null,a);}}]);}(ft);mt=/*#__PURE__*/function(_dt){function mt(t,e,i,r,n,s){_classCallCheck(this,mt);return _callSuper(this,mt,[t,e,i,r,n,null,s]);}_inherits(mt,_dt);return _createClass(mt,[{key:"parseRule",value:function parseRule(){var t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0};}},{key:"update",value:function update(t,e,i,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0);}},{key:"inParent",value:function inParent(){var t=this.parent.contentDOM;for(var _e23=this.nodeDOM;_e23;_e23=_e23.parentNode)if(_e23==t)return!0;return!1;}},{key:"domFromPos",value:function domFromPos(t){return{node:this.nodeDOM,offset:t};}},{key:"localPosFromDOM",value:function localPosFromDOM(t,e,i){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):_superPropGet(mt,"localPosFromDOM",this,3)([t,e,i]);}},{key:"ignoreMutation",value:function ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type;}},{key:"slice",value:function slice(t,e,i){var r=this.node.cut(t,e),n=document.createTextNode(r.text);return new mt(this.parent,r,this.outerDeco,this.innerDeco,n,n);}},{key:"markDirty",value:function markDirty(t,e){_superPropGet(mt,"markDirty",this,3)([t,e]),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3);}},{key:"domAtom",get:function get(){return!1;}},{key:"isText",value:function isText(t){return this.node.text==t;}}]);}(dt);bt=/*#__PURE__*/function(_ft5){function bt(){_classCallCheck(this,bt);return _callSuper(this,bt,arguments);}_inherits(bt,_ft5);return _createClass(bt,[{key:"parseRule",value:function parseRule(){return{ignore:!0};}},{key:"matchesHack",value:function matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t;}},{key:"domAtom",get:function get(){return!0;}},{key:"ignoreForCoords",get:function get(){return"IMG"==this.dom.nodeName;}}]);}(ft);gt=/*#__PURE__*/function(_dt2){function gt(t,e,i,r,n,s,l,o){var _this7;_classCallCheck(this,gt);_this7=_callSuper(this,gt,[t,e,i,r,n,s,l]),_this7.spec=o;return _this7;}_inherits(gt,_dt2);return _createClass(gt,[{key:"update",value:function update(t,e,i,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){var _n13=this.spec.update(t,e,i);return _n13&&this.updateInner(t,e,i,r),_n13;}return!(!this.contentDOM&&!t.isLeaf)&&_superPropGet(gt,"update",this,3)([t,e,i,r]);}},{key:"selectNode",value:function selectNode(){this.spec.selectNode?this.spec.selectNode():_superPropGet(gt,"selectNode",this,3)([]);}},{key:"deselectNode",value:function deselectNode(){this.spec.deselectNode?this.spec.deselectNode():_superPropGet(gt,"deselectNode",this,3)([]);}},{key:"setSelection",value:function setSelection(t,e,i,r){this.spec.setSelection?this.spec.setSelection(t,e,i.root):_superPropGet(gt,"setSelection",this,3)([t,e,i,r]);}},{key:"destroy",value:function destroy(){this.spec.destroy&&this.spec.destroy(),_superPropGet(gt,"destroy",this,3)([]);}},{key:"stopEvent",value:function stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t);}},{key:"ignoreMutation",value:function ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):_superPropGet(gt,"ignoreMutation",this,3)([t]);}}]);}(dt);kt=function kt(t){t&&(this.nodeName=t);};kt.prototype=Object.create(null);Mt=[new kt()];Tt=/*#__PURE__*/function(){function Tt(t,e,i){_classCallCheck(this,Tt);this.lock=e,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(t,e){var i=e,r=i.children.length,n=t.childCount,s=new Map(),l=[];t:for(;n>0;){var _o6=void 0;for(;;)if(r){var _t41=i.children[r-1];if(!(_t41 instanceof at)){_o6=_t41,r--;break;}i=_t41,r=_t41.children.length;}else{if(i==e)break t;r=i.parent.children.indexOf(i),i=i.parent;}var _h4=_o6.node;if(_h4){if(_h4!=t.child(n-1))break;--n,s.set(_o6,n),l.push(_o6);}}return{index:n,matched:s,matches:l.reverse()};}(t.node.content,t);}return _createClass(Tt,[{key:"destroyBetween",value:function destroyBetween(t,e){if(t!=e){for(var _i30=t;_i30<e;_i30++)this.top.children[_i30].destroy();this.top.children.splice(t,e-t),this.changed=!0;}}},{key:"destroyRest",value:function destroyRest(){this.destroyBetween(this.index,this.top.children.length);}},{key:"syncToMarks",value:function syncToMarks(t,e,i,r){var n=0,s=this.stack.length>>1,l=Math.min(s,t.length);for(;n<l&&(n==s-1?this.top:this.stack[n+1<<1]).matchesMark(t[n])&&!1!==t[n].type.spec.spanning;)n++;for(;n<s;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<t.length;){this.stack.push(this.top,this.index+1);var _n15=-1,_l12=this.top.children.length;r<this.preMatch.index&&(_l12=Math.min(this.index+3,_l12));for(var _e29=this.index;_e29<_l12;_e29++){var _i31=this.top.children[_e29];if(_i31.matchesMark(t[s])&&!this.isLocked(_i31.dom)){_n15=_e29;break;}}if(_n15<0&&this.index<this.top.children.length){var _e30=this.top.children[this.index];_e30 instanceof at&&3!=_e30.dirty&&_e30.mark.type==t[s].type&&_e30.spec.update&&!this.isLocked(_e30.dom)&&_e30.spec.update(t[s])&&(_e30.mark=t[s],_n15=this.index,this.changed=!0);}if(_n15>-1)_n15>this.index&&(this.changed=!0,this.destroyBetween(this.index,_n15)),this.top=this.top.children[this.index];else{var _r24=at.create(this.top,t[s],e,i);this.top.children.splice(this.index,0,_r24),this.top=_r24,this.changed=!0;}this.index=0,s++;}}},{key:"findNodeMatch",value:function findNodeMatch(t,e,i,r){var n,s=-1;if(r>=this.preMatch.index&&(n=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&n.matchesNode(t,e,i))s=this.top.children.indexOf(n,this.index);else for(var _r25=this.index,_n16=Math.min(this.top.children.length,_r25+5);_r25<_n16;_r25++){var _n17=this.top.children[_r25];if(_n17.matchesNode(t,e,i)&&!this.preMatch.matched.has(_n17)){s=_r25;break;}}return!(s<0)&&(this.destroyBetween(this.index,s),this.index++,!0);}},{key:"updateNodeAt",value:function updateNodeAt(t,e,i,r,n){var s=this.top.children[r];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(t,e,i,n)&&(this.destroyBetween(this.index,r),this.index++,!0);}},{key:"findIndexWithChild",value:function findIndexWithChild(t){for(;;){var _e31=t.parentNode;if(!_e31)return-1;if(_e31==this.top.contentDOM){var _e32=t.pmViewDesc;if(_e32)for(var _t42=this.index;_t42<this.top.children.length;_t42++)if(this.top.children[_t42]==_e32)return _t42;return-1;}t=_e31;}}},{key:"updateNextNode",value:function updateNextNode(t,e,i,r,n,s){for(var _l13=this.index;_l13<this.top.children.length;_l13++){var _o7=this.top.children[_l13];if(_o7 instanceof dt){var _h5=this.preMatch.matched.get(_o7);if(null!=_h5&&_h5!=n)return!1;var _f4=void 0,_u4=_o7.dom,_c3=this.isLocked(_u4)&&!(t.isText&&_o7.node&&_o7.node.isText&&_o7.nodeDOM.nodeValue==t.text&&3!=_o7.dirty&&Ot(e,_o7.outerDeco));if(!_c3&&_o7.update(t,e,i,r))return this.destroyBetween(this.index,_l13),_o7.dom!=_u4&&(this.changed=!0),this.index++,!0;if(!_c3&&(_f4=this.recreateWrapper(_o7,t,e,i,r,s)))return this.destroyBetween(this.index,_l13),this.top.children[this.index]=_f4,_f4.contentDOM&&(_f4.dirty=2,_f4.updateChildren(r,s+1),_f4.dirty=0),this.changed=!0,this.index++,!0;break;}}return!1;}},{key:"recreateWrapper",value:function recreateWrapper(t,e,i,r,n,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!Ot(i,t.outerDeco)||!r.eq(t.innerDeco))return null;var l=dt.create(this.top,e,i,r,n,s);if(l.contentDOM){l.children=t.children,t.children=[];var _iterator=_createForOfIteratorHelper(l.children),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _t43=_step.value;_t43.parent=l;}}catch(err){_iterator.e(err);}finally{_iterator.f();}}return t.destroy(),l;}},{key:"addNode",value:function addNode(t,e,i,r,n){var s=dt.create(this.top,t,e,i,r,n);s.contentDOM&&s.updateChildren(r,n+1),this.top.children.splice(this.index++,0,s),this.changed=!0;}},{key:"placeWidget",value:function placeWidget(t,e,i){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){var _r26=new ut(this.top,t,e,i);this.top.children.splice(this.index++,0,_r26),this.changed=!0;}else this.index++;}},{key:"addTextblockHacks",value:function addTextblockHacks(){var t=this.top.children[this.index-1],e=this.top;for(;t instanceof at;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof mt)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((A||N)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top));}},{key:"addHackNode",value:function addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{var _i32=document.createElement(t);"IMG"==t&&(_i32.className="ProseMirror-separator",_i32.alt=""),"BR"==t&&(_i32.className="ProseMirror-trailingBreak");var _r27=new bt(this.top,[],_i32,null);e!=this.top?e.children.push(_r27):e.children.splice(this.index++,0,_r27),this.changed=!0;}}},{key:"isLocked",value:function isLocked(t){return this.lock&&(t==this.lock||1==t.nodeType&&t.contains(this.lock.parentNode));}}]);}();At=A||N&&R<63;re=/^(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;fe={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};ce=null;ae={},de={},pe={touchstart:!0,touchmove:!0};me=/*#__PURE__*/_createClass(function me(){_classCallCheck(this,me);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;});de.keydown=function(t,e){var i=e;if(t.input.shiftKey=16==i.keyCode||i.shiftKey,!Re(t)&&(t.input.lastKeyCode=i.keyCode,t.input.lastKeyCodeTime=Date.now(),!F||!N||13!=i.keyCode))if(229!=i.keyCode&&t.domObserver.forceFlush(),!B||13!=i.keyCode||i.ctrlKey||i.altKey||i.metaKey)t.someProp("handleKeyDown",function(e){return e(t,i);})||te(t,i)?i.preventDefault():be(t,"key");else{var _e55=Date.now();t.input.lastIOSEnter=_e55,t.input.lastIOSEnterFallbackTimeout=setTimeout(function(){t.input.lastIOSEnter==_e55&&(t.someProp("handleKeyDown",function(e){return e(t,M(13,"Enter"));}),t.input.lastIOSEnter=0);},200);}},de.keyup=function(t,e){16==e.keyCode&&(t.input.shiftKey=!1);},de.keypress=function(t,i){var r=i;if(Re(t)||!r.charCode||r.ctrlKey&&!r.altKey||$&&r.metaKey)return;if(t.someProp("handleKeyPress",function(e){return e(t,r);}))return void r.preventDefault();var n=t.state.selection;if(!(n instanceof e&&n.$from.sameParent(n.$to))){var _e56=String.fromCharCode(r.charCode),_i47=function _i47(){return t.state.tr.insertText(_e56).scrollIntoView();};/[\r\n]/.test(_e56)||t.someProp("handleTextInput",function(r){return r(t,n.$from.pos,n.$to.pos,_e56,_i47);})||t.dispatch(_i47()),r.preventDefault();}};Ce=$?"metaKey":"ctrlKey";ae.mousedown=function(t,e){var i=e;t.input.shiftKey=i.shiftKey;var r=Te(t),n=Date.now(),s="singleClick";n-t.input.lastClick.time<500&&function(t,e){var i=e.x-t.clientX,r=e.y-t.clientY;return i*i+r*r<100;}(i,t.input.lastClick)&&!i[Ce]&&t.input.lastClick.button==i.button&&("singleClick"==t.input.lastClick.type?s="doubleClick":"doubleClick"==t.input.lastClick.type&&(s="tripleClick")),t.input.lastClick={time:n,x:i.clientX,y:i.clientY,type:s,button:i.button},t.input.mouseDown&&t.input.mouseDown.done();var l=t.posAtCoords(Me(i));l&&("singleClick"==s?t.input.mouseDown=new Ee(t,l,i,!!r):("doubleClick"==s?xe:Oe)(t,l.pos,l.inside,i)?i.preventDefault():be(t,"pointer"));};Pe=/*#__PURE__*/function(){function Pe(t){_classCallCheck(this,Pe);this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this));}return _createClass(Pe,[{key:"up",value:function up(t){this.done();}},{key:"move",value:function move(t){0==t.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;}}]);}();Ee=/*#__PURE__*/function(_Pe){function Ee(e,i,r,n){var _this8;_classCallCheck(this,Ee);var s,l;if(_this8=_callSuper(this,Ee,[e]),_this8.pos=i,_this8.event=r,_this8.flushed=n,_this8.delayedSelectionSync=!1,_this8.startDoc=e.state.doc,_this8.selectNode=!!r[Ce],_this8.allowDefault=r.shiftKey,i.inside>-1)s=e.state.doc.nodeAt(i.inside),l=i.inside;else{var _t63=e.state.doc.resolve(i.pos);s=_t63.parent,l=_t63.depth?_t63.before():0;}var o=n?null:r.target,h=o?e.docView.nearestDesc(o,!0):null;_this8.target=h&&1==h.nodeDOM.nodeType?h.nodeDOM:null;var f=e.state.selection;0==r.button&&(s.type.spec.draggable&&!1!==s.type.spec.selectable||f instanceof t&&f.from<=l&&f.to>l)&&(_this8.mightDrag={node:s,pos:l,addAttr:!(!_this8.target||_this8.target.draggable),setUneditable:!(!_this8.target||!P||_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==_this8&&_this8.target.setAttribute("contentEditable","false");},20),_this8.view.domObserver.start()),be(e,"pointer");return _this8;}_inherits(Ee,_Pe);return _createClass(Ee,[{key:"done",value:function done(){var _this9=this;_superPropGet(Ee,"done",this,3)([]),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||Rt(_this9.view);});}},{key:"up",value:function up(t){if(this.done(),!this.view.dom.contains(t.target))return;var e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Me(t))),this.updateAllowDefault(t),this.allowDefault||!e?be(this.view,"pointer"):De(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||A&&this.mightDrag&&!this.mightDrag.node.isAtom||N&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(ve(this.view,r.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):be(this.view,"pointer");}},{key:"move",value:function move(t){this.updateAllowDefault(t),be(this.view,"pointer"),_superPropGet(Ee,"move",this,3)([t]);}},{key:"updateAllowDefault",value:function updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0);}},{key:"delaySelUpdate",value:function delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0);}}]);}(Pe);Ne=/*#__PURE__*/function(_Pe2){function Ne(t,e){var _this10;_classCallCheck(this,Ne);_this10=_callSuper(this,Ne,[t]),_this10.startSelection=e,_this10.startDoc=t.state.doc;return _this10;}_inherits(Ne,_Pe2);return _createClass(Ne,[{key:"move",value:function move(t){if(0==t.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();t.preventDefault(),be(this.view,"pointer");var i=this.view.posAtCoords(Me(t)),r=i&&Se(this.view,i.inside,!1);if(!r)return;var n=this.view.state.doc,s=this.startSelection,_ref4=r.from<s.from?[s.to,r.from]:[s.from,r.to],_ref5=_slicedToArray(_ref4,2),l=_ref5[0],o=_ref5[1];ve(this.view,e.create(n,l,o),"pointer");}}]);}(Pe);ae.touchstart=function(t){t.input.lastTouch=Date.now(),Te(t),be(t,"pointer");},ae.touchmove=function(t){t.input.lastTouch=Date.now(),be(t,"pointer");},ae.contextmenu=function(t){return Te(t);};Ae=F?5e3:-1;de.compositionstart=de.compositionupdate=function(t){if(!t.composing){t.domObserver.flush();var _i49=t.state,_r38=_i49.selection.$to;if(_i49.selection instanceof e&&(_i49.storedMarks||!_r38.textOffset&&_r38.parentOffset&&_r38.nodeBefore.marks.some(function(t){return!1===t.type.spec.inclusive;})||N&&I&&function(t){var _t$domSelectionRange4=t.domSelectionRange(),e=_t$domSelectionRange4.focusNode,i=_t$domSelectionRange4.focusOffset;if(!e||1!=e.nodeType||i>=e.childNodes.length)return!1;var r=e.childNodes[i];return 1==r.nodeType&&"false"==r.contentEditable;}(t)))t.markCursor=t.state.storedMarks||_r38.marks(),Fe(t,!0),t.markCursor=null;else if(Fe(t,!_i49.selection.empty),P&&_i49.selection.empty&&_r38.parentOffset&&!_r38.textOffset&&_r38.nodeBefore.marks.length){var _e58=t.domSelectionRange();for(var _i50=_e58.focusNode,_r39=_e58.focusOffset;_i50&&1==_i50.nodeType&&0!=_r39;){var _e59=_r39<0?_i50.lastChild:_i50.childNodes[_r39-1];if(!_e59)break;if(3==_e59.nodeType){var _i51=t.domSelection();_i51&&_i51.collapse(_e59,_e59.nodeValue.length);break;}_i50=_e59,_r39=-1;}}t.input.composing=!0;}Be(t,Ae);},de.compositionend=function(t,e){t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(function(){return t.domObserver.flush();}),t.input.compositionID++,Be(t,20));};Ke=T&&C<15||B&&L<604;ae.copy=de.cut=function(t,e){var i=e,r=t.state.selection,n="cut"==i.type;if(r.empty)return;var s=Ke?null:i.clipboardData,l=r.content(),_ee=ee(t,l),o=_ee.dom,h=_ee.text;s?(i.preventDefault(),s.clearData(),s.setData("text/html",o.innerHTML),s.setData("text/plain",h)):function(t,e){if(!t.dom.parentNode)return;var i=t.dom.parentNode.appendChild(document.createElement("div"));i.appendChild(e),i.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),n=document.createRange();n.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(n),setTimeout(function(){i.parentNode&&i.parentNode.removeChild(i),t.focus();},50);}(t,o),n&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"));},de.paste=function(t,e){var i=e;if(t.composing&&!F)return;var r=Ke?null:i.clipboardData,n=t.input.shiftKey&&45!=t.input.lastKeyCode;r&&Le(t,qe(r),r.getData("text/html"),n,i)?i.preventDefault():function(t,e){if(!t.dom.parentNode)return;var i=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(i?"textarea":"div"));i||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();var n=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout(function(){t.focus(),r.parentNode&&r.parentNode.removeChild(r),i?Le(t,r.value,null,n,e):Le(t,r.textContent,r.innerHTML,n,e);},50);}(t,i);};He=/*#__PURE__*/_createClass(function He(t,e,i){_classCallCheck(this,He);this.slice=t,this.move=e,this.node=i;});We=$?"altKey":"ctrlKey";ae.dragstart=function(e,i){var r=i,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;var s,l=e.state.selection,o=l.empty?null:e.posAtCoords(Me(r));if(o&&o.pos>=l.from&&o.pos<=(l instanceof t?l.to-1:l.to));else if(n&&n.mightDrag)s=t.create(e.state.doc,n.mightDrag.pos);else if(r.target&&1==r.target.nodeType){var _i52=e.docView.nearestDesc(r.target,!0);_i52&&_i52.node.type.spec.draggable&&_i52!=e.docView&&(s=t.create(e.state.doc,_i52.posBefore));}var h=(s||e.state.selection).content(),_ee2=ee(e,h),f=_ee2.dom,u=_ee2.text,c=_ee2.slice;(!r.dataTransfer.files.length||!N||R>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(Ke?"Text":"text/html",f.innerHTML),r.dataTransfer.effectAllowed="copyMove",Ke||r.dataTransfer.setData("text/plain",u),e.dragging=new He(c,je(e,r),s);},ae.dragend=function(t){var e=t.dragging;window.setTimeout(function(){t.dragging==e&&(t.dragging=null);},50);},de.dragover=de.dragenter=function(t,e){return e.preventDefault();},de.drop=function(e,i){try{!function(e,i,r){if(!i.dataTransfer)return;var l=e.posAtCoords(Me(i));if(!l)return;var o=e.state.doc.resolve(l.pos),h=r&&r.slice;h?e.someProp("transformPasted",function(t){h=t(h,e,!1);}):h=ie(e,qe(i.dataTransfer),Ke?null:i.dataTransfer.getData("text/html"),!1,o);var f=!(!r||!je(e,i));if(e.someProp("handleDrop",function(t){return t(e,i,h||n.empty,f);}))return void i.preventDefault();if(!h)return;i.preventDefault();var u=h?s(e.state.doc,o.pos,h):o.pos;null==u&&(u=o.pos);var c=e.state.tr;if(f){var _t65=r.node;_t65?_t65.replace(c):c.deleteSelection();}var a=c.mapping.map(u),d=0==h.openStart&&0==h.openEnd&&1==h.content.childCount,p=c.doc;d?c.replaceRangeWith(a,a,h.content.firstChild):c.replaceRange(a,a,h);if(c.doc.eq(p))return;var m=c.doc.resolve(a);if(d&&t.isSelectable(h.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(h.content.firstChild))c.setSelection(new t(m));else{var _t66=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach(function(e,i,r,n){return _t66=n;}),c.setSelection(Lt(e,m,c.doc.resolve(_t66)));}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"));}(e,i,e.dragging);}finally{e.dragging=null;}},ae.focus=function(t){t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(function(){t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Rt(t);},20));},ae.blur=function(t,e){var i=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),i.relatedTarget&&t.dom.contains(i.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1);},ae.beforeinput=function(t,e){if(F&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();var _e60=t.input.domChangeCount;setTimeout(function(){if(t.input.domChangeCount!=_e60)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",function(e){return e(t,M(8,"Backspace"));}))return;var i=t.state.selection.$cursor;i&&i.pos>0&&t.dispatch(t.state.tr["delete"](i.pos-1,i.pos).scrollIntoView());},50);}};for(_t67 in de)ae[_t67]=de[_t67];ze=/*#__PURE__*/function(){function ze(t,e){_classCallCheck(this,ze);this.toDOM=t,this.spec=e||Qe,this.side=this.spec.side||0;}return _createClass(ze,[{key:"map",value:function map(t,e,i,r){var _t$mapResult=t.mapResult(e.from+r,this.side<0?-1:1),n=_t$mapResult.pos,s=_t$mapResult.deleted;return s?null:new Je(n-i,n-i,this);}},{key:"valid",value:function valid(){return!0;}},{key:"eq",value:function eq(t){return this==t||t instanceof ze&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Ve(this.spec,t.spec));}},{key:"destroy",value:function destroy(t){this.spec.destroy&&this.spec.destroy(t);}}]);}();Ge=/*#__PURE__*/function(){function Ge(t,e){_classCallCheck(this,Ge);this.attrs=t,this.spec=e||Qe;}return _createClass(Ge,[{key:"map",value:function map(t,e,i,r){var n=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-i,s=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-i;return n>=s?null:new Je(n,s,this);}},{key:"valid",value:function valid(t,e){return e.from<e.to;}},{key:"eq",value:function eq(t){return this==t||t instanceof Ge&&Ve(this.attrs,t.attrs)&&Ve(this.spec,t.spec);}},{key:"destroy",value:function destroy(){}}],[{key:"is",value:function is(t){return t.type instanceof Ge;}}]);}();Ue=/*#__PURE__*/function(){function Ue(t,e){_classCallCheck(this,Ue);this.attrs=t,this.spec=e||Qe;}return _createClass(Ue,[{key:"map",value:function map(t,e,i,r){var n=t.mapResult(e.from+r,1);if(n.deleted)return null;var s=t.mapResult(e.to+r,-1);return s.deleted||s.pos<=n.pos?null:new Je(n.pos-i,s.pos-i,this);}},{key:"valid",value:function valid(t,e){var i,_t$content$findIndex=t.content.findIndex(e.from),r=_t$content$findIndex.index,n=_t$content$findIndex.offset;return n==e.from&&!(i=t.child(r)).isText&&n+i.nodeSize==e.to;}},{key:"eq",value:function eq(t){return this==t||t instanceof Ue&&Ve(this.attrs,t.attrs)&&Ve(this.spec,t.spec);}},{key:"destroy",value:function destroy(){}}]);}();_export("a",Je=/*#__PURE__*/function(){function Je(t,e,i){_classCallCheck(this,Je);this.from=t,this.to=e,this.type=i;}return _createClass(Je,[{key:"copy",value:function copy(t,e){return new Je(t,e,this.type);}},{key:"eq",value:function eq(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to;}},{key:"map",value:function map(t,e,i){return this.type.map(t,this,e,i);}},{key:"spec",get:function get(){return this.type.spec;}},{key:"inline",get:function get(){return this.type instanceof Ge;}},{key:"widget",get:function get(){return this.type instanceof ze;}}],[{key:"widget",value:function widget(t,e,i){return new Je(t,t,new ze(e,i));}},{key:"inline",value:function inline(t,e,i,r){return new Je(t,e,new Ge(i,r));}},{key:"node",value:function node(t,e,i,r){return new Je(t,e,new Ue(i,r));}}]);}());Ye=[],Qe={};_export("D",Xe=/*#__PURE__*/function(){function Xe(t,e){_classCallCheck(this,Xe);this.local=t.length?t:Ye,this.children=e.length?e:Ye;}return _createClass(Xe,[{key:"find",value:function find(t,e,i){var r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,i),r;}},{key:"findInner",value:function findInner(t,e,i,r,n){for(var _s21=0;_s21<this.local.length;_s21++){var _l18=this.local[_s21];_l18.from<=e&&_l18.to>=t&&(!n||n(_l18.spec))&&i.push(_l18.copy(_l18.from+r,_l18.to+r));}for(var _s22=0;_s22<this.children.length;_s22+=3)if(this.children[_s22]<e&&this.children[_s22+1]>t){var _l19=this.children[_s22]+1;this.children[_s22+2].findInner(t-_l19,e-_l19,i,r+_l19,n);}}},{key:"map",value:function map(t,e,i){return this==Ze||0==t.maps.length?this:this.mapInner(t,e,0,0,i||Qe);}},{key:"mapInner",value:function mapInner(t,e,i,r,n){var s;for(var _l20=0;_l20<this.local.length;_l20++){var _o12=this.local[_l20].map(t,i,r);_o12&&_o12.type.valid(e,_o12)?(s||(s=[])).push(_o12):n.onRemove&&n.onRemove(this.local[_l20].spec);}return this.children.length?function(t,e,i,r,n,s,l){var o=t.slice();var _loop3=function _loop3(_e62){var r=0;i.maps[_t68].forEach(function(t,i,n,s){var l=s-n-(i-t);for(var _n27=0;_n27<o.length;_n27+=3){var _s24=o[_n27+1];if(_s24<0||t>_s24+_e62-r)continue;var _h9=o[_n27]+_e62-r;i>=_h9?o[_n27+1]=t<=_h9?-2:-1:t>=_e62&&l&&(o[_n27]+=l,o[_n27+1]+=l);}r+=l;}),_e62=i.maps[_t68].map(_e62,-1);_e61=_e62;};for(var _t68=0,_e61=s;_t68<i.maps.length;_t68++){_loop3(_e61);}var h=!1;for(var _e63=0;_e63<o.length;_e63+=3)if(o[_e63+1]<0){if(-2==o[_e63+1]){h=!0,o[_e63+1]=-1;continue;}var _f6=i.map(t[_e63]+s),_u6=_f6-n;if(_u6<0||_u6>=r.content.size){h=!0;continue;}var _c4=i.map(t[_e63+1]+s,-1)-n,_r$content$findIndex=r.content.findIndex(_u6),_a3=_r$content$findIndex.index,_d3=_r$content$findIndex.offset,_p2=r.maybeChild(_a3);if(_p2&&_d3==_u6&&_d3+_p2.nodeSize==_c4){var _r40=o[_e63+2].mapInner(i,_p2,_f6+1,t[_e63]+s+1,l);_r40!=Ze?(o[_e63]=_u6,o[_e63+1]=_c4,o[_e63+2]=_r40):(o[_e63+1]=-2,h=!0);}else h=!0;}if(h){var _h8=function(t,e,i,r,n,s,l){function o(t,e){for(var _s23=0;_s23<t.local.length;_s23++){var _o13=t.local[_s23].map(r,n,e);_o13?i.push(_o13):l.onRemove&&l.onRemove(t.local[_s23].spec);}for(var _i55=0;_i55<t.children.length;_i55+=3)o(t.children[_i55+2],t.children[_i55]+e+1);}for(var _i56=0;_i56<t.length;_i56+=3)-1==t[_i56+1]&&o(t[_i56+2],e[_i56]+s+1);return i;}(o,t,e,i,n,s,l),_f7=ri(_h8,r,0,l);e=_f7.local;for(var _t69=0;_t69<o.length;_t69+=3)o[_t69+1]<0&&(o.splice(_t69,3),_t69-=3);for(var _t70=0,_e64=0;_t70<_f7.children.length;_t70+=3){var _i57=_f7.children[_t70];for(;_e64<o.length&&o[_e64]<_i57;)_e64+=3;o.splice(_e64,0,_f7.children[_t70],_f7.children[_t70+1],_f7.children[_t70+2]);}}return new Xe(e.sort(ni),o);}(this.children,s||[],t,e,i,r,n):s?new Xe(s.sort(ni),Ye):Ze;}},{key:"add",value:function add(t,e){return e.length?this==Ze?Xe.create(t,e):this.addInner(t,e,0):this;}},{key:"addInner",value:function addInner(t,e,i){var _this11=this;var r,n=0;t.forEach(function(t,s){var l,o=s+i;if(l=ei(e,t,o)){for(r||(r=_this11.children.slice());n<r.length&&r[n]<s;)n+=3;r[n]==s?r[n+2]=r[n+2].addInner(t,l,o+1):r.splice(n,0,s,s+t.nodeSize,ri(l,t,o+1,Qe)),n+=3;}});var s=ti(n?ii(e):e,-i);for(var _e65=0;_e65<s.length;_e65++)s[_e65].type.valid(t,s[_e65])||s.splice(_e65--,1);return new Xe(s.length?this.local.concat(s).sort(ni):this.local,r||this.children);}},{key:"remove",value:function remove(t){return 0==t.length||this==Ze?this:this.removeInner(t,0);}},{key:"removeInner",value:function removeInner(t,e){var i=this.children,r=this.local;for(var _r41=0;_r41<i.length;_r41+=3){var _n28=void 0,_s25=i[_r41]+e,_l21=i[_r41+1]+e;for(var _e66,_i58=0;_i58<t.length;_i58++)(_e66=t[_i58])&&_e66.from>_s25&&_e66.to<_l21&&(t[_i58]=null,(_n28||(_n28=[])).push(_e66));if(!_n28)continue;i==this.children&&(i=this.children.slice());var _o14=i[_r41+2].removeInner(_n28,_s25+1);_o14!=Ze?i[_r41+2]=_o14:(i.splice(_r41,3),_r41-=3);}if(r.length)for(var _i59,_n29=0;_n29<t.length;_n29++)if(_i59=t[_n29])for(var _t71=0;_t71<r.length;_t71++)r[_t71].eq(_i59,e)&&(r==this.local&&(r=this.local.slice()),r.splice(_t71--,1));return i==this.children&&r==this.local?this:r.length||i.length?new Xe(r,i):Ze;}},{key:"forChild",value:function forChild(t,e){if(this==Ze)return this;if(e.isLeaf)return Xe.empty;var i,r;for(var _e67=0;_e67<this.children.length;_e67+=3)if(this.children[_e67]>=t){this.children[_e67]==t&&(i=this.children[_e67+2]);break;}var n=t+1,s=n+e.content.size;for(var _t72=0;_t72<this.local.length;_t72++){var _e68=this.local[_t72];if(_e68.from<s&&_e68.to>n&&_e68.type instanceof Ge){var _t73=Math.max(n,_e68.from)-n,_i60=Math.min(s,_e68.to)-n;_t73<_i60&&(r||(r=[])).push(_e68.copy(_t73,_i60));}}if(r){var _t74=new Xe(r.sort(ni),Ye);return i?new _e([_t74,i]):_t74;}return i||Ze;}},{key:"eq",value:function eq(t){if(this==t)return!0;if(!(t instanceof Xe)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var _e69=0;_e69<this.local.length;_e69++)if(!this.local[_e69].eq(t.local[_e69]))return!1;for(var _e70=0;_e70<this.children.length;_e70+=3)if(this.children[_e70]!=t.children[_e70]||this.children[_e70+1]!=t.children[_e70+1]||!this.children[_e70+2].eq(t.children[_e70+2]))return!1;return!0;}},{key:"locals",value:function locals(t){return si(this.localsInner(t));}},{key:"localsInner",value:function localsInner(t){if(this==Ze)return Ye;if(t.inlineContent||!this.local.some(Ge.is))return this.local;var e=[];for(var _t75=0;_t75<this.local.length;_t75++)this.local[_t75].type instanceof Ge||e.push(this.local[_t75]);return e;}},{key:"forEachSet",value:function forEachSet(t){t(this);}}],[{key:"create",value:function create(t,e){return e.length?ri(e,t,0,Qe):Ze;}}]);}());Xe.empty=new Xe([],[]),Xe.removeOverlap=si;Ze=Xe.empty;_e=/*#__PURE__*/function(){function _e(t){_classCallCheck(this,_e);this.members=t;}return _createClass(_e,[{key:"map",value:function map(t,e){var i=this.members.map(function(i){return i.map(t,e,Qe);});return _e.from(i);}},{key:"forChild",value:function forChild(t,e){if(e.isLeaf)return Xe.empty;var i=[];for(var _r42=0;_r42<this.members.length;_r42++){var _n30=this.members[_r42].forChild(t,e);_n30!=Ze&&(_n30 instanceof _e?i=i.concat(_n30.members):i.push(_n30));}return _e.from(i);}},{key:"eq",value:function eq(t){if(!(t instanceof _e)||t.members.length!=this.members.length)return!1;for(var _e71=0;_e71<this.members.length;_e71++)if(!this.members[_e71].eq(t.members[_e71]))return!1;return!0;}},{key:"locals",value:function locals(t){var e,i=!0;for(var _r43=0;_r43<this.members.length;_r43++){var _n31=this.members[_r43].localsInner(t);if(_n31.length)if(e){i&&(e=e.slice(),i=!1);for(var _t76=0;_t76<_n31.length;_t76++)e.push(_n31[_t76]);}else e=_n31;}return e?si(i?e:e.sort(ni)):Ye;}},{key:"forEachSet",value:function forEachSet(t){for(var _e72=0;_e72<this.members.length;_e72++)this.members[_e72].forEachSet(t);}}],[{key:"from",value:function from(t){switch(t.length){case 0:return Ze;case 1:return t[0];default:return new _e(t.every(function(t){return t instanceof Xe;})?t:t.reduce(function(t,e){return t.concat(e instanceof Xe?e:e.members);},[]));}}}]);}();hi={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},fi=T&&C<=11;ui=/*#__PURE__*/function(){function ui(){_classCallCheck(this,ui);this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0;}return _createClass(ui,[{key:"set",value:function set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset;}},{key:"clear",value:function clear(){this.anchorNode=this.focusNode=null;}},{key:"eq",value:function eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset;}}]);}();ci=/*#__PURE__*/function(){function ci(t,e){var _this12=this;_classCallCheck(this,ci);this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ui(),this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(function(e){for(var _t79=0;_t79<e.length;_t79++)_this12.queue.push(e[_t79]);T&&C<=11&&e.some(function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length;})?_this12.flushSoon():A&&t.composing&&e.some(function(t){return"childList"==t.type&&"TR"==t.target.nodeName;})?(t.input.badSafariComposition=!0,_this12.flushSoon()):_this12.flush();}),fi&&(this.onCharData=function(t){_this12.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),_this12.flushSoon();}),this.onSelectionChange=this.onSelectionChange.bind(this);}return _createClass(ci,[{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,hi)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection();}},{key:"stop",value:function stop(){var _this14=this;if(this.observer){var _t80=this.observer.takeRecords();if(_t80.length){for(var _e74=0;_e74<_t80.length;_e74++)this.queue.push(_t80[_e74]);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(qt(this.view)){if(this.suppressingSelectionUpdates)return Rt(this.view);if(T&&C<=11&&!this.view.state.selection.empty){var _t81=this.view.domSelectionRange();if(_t81.focusNode&&p(_t81.focusNode,_t81.focusOffset,_t81.anchorNode,_t81.anchorOffset))return this.flushSoon();}this.flush();}}},{key:"setCurSelection",value:function setCurSelection(){this.currentSelection.set(this.view.domSelectionRange());}},{key:"ignoreSelectionChange",value:function ignoreSelectionChange(t){if(!t.focusNode)return!0;var e,i=new Set();for(var _e75=t.focusNode;_e75;_e75=c(_e75))i.add(_e75);for(var _r46=t.anchorNode;_r46;_r46=c(_r46))if(i.has(_r46)){e=_r46;break;}var r=e&&this.view.docView.nearestDesc(e);return r&&r.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0;}},{key:"pendingRecords",value:function pendingRecords(){if(this.observer){var _iterator2=_createForOfIteratorHelper(this.observer.takeRecords()),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _t82=_step2.value;this.queue.push(_t82);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}}return this.queue;}},{key:"flush",value:function flush(){var t=this.view;if(!t.docView||this.flushingSoon>-1)return;var e=this.pendingRecords();e.length&&(this.queue=[]);var i=t.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&qt(t)&&!this.ignoreSelectionChange(i),s=-1,l=-1,o=!1,h=[];if(t.editable)for(var _t83=0;_t83<e.length;_t83++){var _i63=this.registerMutation(e[_t83],h);_i63&&(s=s<0?_i63.from:Math.min(_i63.from,s),l=l<0?_i63.to:Math.max(_i63.to,l),_i63.typeOver&&(o=!0));}if(h.some(function(t){return"BR"==t.nodeName;})&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode||N&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&e.some(function(t){return"childList"==t.type&&t.removedNodes.length;}))){var _iterator3=_createForOfIteratorHelper(h),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _t84=_step3.value;if("BR"==_t84.nodeName&&_t84.parentNode){var _e76=_t84.nextSibling;for(;_e76&&1==_e76.nodeType;){if("false"==_e76.contentEditable){_t84.parentNode.removeChild(_t84);break;}_e76=_e76.firstChild;}}}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}}else if(P&&h.length){var _e77=h.filter(function(t){return"BR"==t.nodeName;});if(2==_e77.length){var _e78=_slicedToArray(_e77,2),_t85=_e78[0],_i64=_e78[1];_t85.parentNode&&_t85.parentNode.parentNode==_i64.parentNode?_i64.remove():_t85.remove();}else{var _i65=this.currentSelection.focusNode;var _iterator4=_createForOfIteratorHelper(_e77),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _r47=_step4.value;var _e79=_r47.parentNode;!_e79||"LI"!=_e79.nodeName||_i65&&mi(t,_i65)==_e79||_r47.remove();}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}}}var f=null;s<0&&n&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&k(i)&&(f=Et(t))&&f.eq(r.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Rt(t),this.currentSelection.set(i),t.scrollToSelection()):(s>-1||n)&&(s>-1&&(t.docView.markDirty(s,l),function(t){if(ai.has(t))return;if(ai.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)){if(t.requiresGeckoHackNode=P,di)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."),di=!0;}}(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(t,e){var i;var _t$domSelectionRange5=t.domSelectionRange(),r=_t$domSelectionRange5.focusNode,n=_t$domSelectionRange5.focusOffset;var _iterator5=_createForOfIteratorHelper(e),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var _s28=_step5.value;if("TR"==(null===(i=_s28.parentNode)||void 0===i?void 0:i.nodeName)){var _e80=_s28.nextSibling;for(;_e80&&"TD"!=_e80.nodeName&&"TH"!=_e80.nodeName;)_e80=_e80.nextSibling;if(_e80){var _i66=_e80;for(;;){var _t86=_i66.firstChild;if(!_t86||1!=_t86.nodeType||"false"==_t86.contentEditable||/^(BR|IMG)$/.test(_t86.nodeName))break;_i66=_t86;}_i66.insertBefore(_s28,_i66.firstChild),r==_s28&&t.domSelection().collapse(_s28,n);}else _s28.parentNode.removeChild(_s28);}}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}(t,h)),this.handleDOMChange(s,l,o,h),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(i)||Rt(t),this.currentSelection.set(i));}},{key:"registerMutation",value:function registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;var i=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(i==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!i||i.ignoreMutation(t))return null;if("childList"==t.type){for(var _i67=0;_i67<t.addedNodes.length;_i67++){var _r48=t.addedNodes[_i67];e.push(_r48),3==_r48.nodeType&&(this.lastChangedTextNode=_r48);}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(t.target))return{from:i.posBefore,to:i.posAfter};var _r49=t.previousSibling,_n34=t.nextSibling;if(T&&C<=11&&t.addedNodes.length)for(var _e81=0;_e81<t.addedNodes.length;_e81++){var _t$addedNodes$_e=t.addedNodes[_e81],_i68=_t$addedNodes$_e.previousSibling,_s29=_t$addedNodes$_e.nextSibling;(!_i68||Array.prototype.indexOf.call(t.addedNodes,_i68)<0)&&(_r49=_i68),(!_s29||Array.prototype.indexOf.call(t.addedNodes,_s29)<0)&&(_n34=_s29);}var _s30=_r49&&_r49.parentNode==t.target?u(_r49)+1:0,_l22=i.localPosFromDOM(t.target,_s30,-1),_o15=_n34&&_n34.parentNode==t.target?u(_n34):t.target.childNodes.length;return{from:_l22,to:i.localPosFromDOM(t.target,_o15,1)};}return"attributes"==t.type?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=t.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:t.target.nodeValue==t.oldValue});}}]);}();ai=new WeakMap(),di=!1;bi=function bi(t){return function(e){var i=e.pmViewDesc;if(i)return i.parseRule(t);if("BR"==e.nodeName&&e.parentNode){if(A&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var _t87=document.createElement("div");return _t87.appendChild(document.createElement("li")),{skip:_t87};}if(e.parentNode.lastChild==e||A&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0};}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null;};},gi=/^(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;_export("E",yi=/*#__PURE__*/function(){function yi(t,e){var _this16=this;_classCallCheck(this,yi);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 me(),this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(Si),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=xi(this),Di(this),this.nodeViews=Oi(this),this.docView=pt(this.state.doc,vi(this),oi(this),this.dom,this),this.domObserver=new ci(this,function(t,e,i,r){return wi(_this16,t,e,i,r);}),this.domObserver.start(),function(t){var _loop4=function _loop4(){var i=ae[_e92];t.dom.addEventListener(_e92,t.input.eventHandlers[_e92]=function(e){!ke(t,e)||we(t,e)||!t.editable&&e.type in de||i(t,e);},pe[_e92]?{passive:!0}:void 0);};for(var _e92 in ae){_loop4();}A&&t.dom.addEventListener("input",function(){return null;}),ge(t);}(this),this.updatePluginViews();}return _createClass(yi,[{key:"composing",get:function get(){return this.input.composing;}},{key:"props",get:function get(){if(this._props.state!=this.state){var _t94=this._props;this._props={};for(var _e93 in _t94)this._props[_e93]=_t94[_e93];this._props.state=this.state;}return this._props;}},{key:"update",value:function update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&ge(this);var e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Si),this.directPlugins=t.plugins),this.updateStateInner(t.state,e);}},{key:"setProps",value:function setProps(t){var e={};for(var _t95 in this._props)e[_t95]=this._props[_t95];e.state=this.state;for(var _i75 in t)e[_i75]=t[_i75];this.update(e);}},{key:"updateState",value:function updateState(t){this.updateStateInner(t,this._props);}},{key:"updateStateInner",value:function updateStateInner(t,e){var i;var r=this.state,n=!1,s=!1;t.storedMarks&&this.composing&&($e(this),s=!0),this.state=t;var l=r.plugins!=t.plugins||this._props.plugins!=e.plugins;if(l||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){var _t96=Oi(this);(function(t,e){var i=0,r=0;for(var _r51 in t){if(t[_r51]!=e[_r51])return!0;i++;}for(var _t97 in e)r++;return i!=r;})(_t96,this.nodeViews)&&(this.nodeViews=_t96,n=!0);}(l||e.handleDOMEvents!=this._props.handleDOMEvents)&&ge(this),this.editable=xi(this),Di(this);var o=oi(this),h=vi(this),f=r.plugins==t.plugins||r.doc.eq(t.doc)?t.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=n||!this.docView.matchesNode(t.doc,h,o);!u&&t.selection.eq(r.selection)||(s=!0);var c="preserve"==f&&s&&null==this.dom.style.overflowAnchor&&function(t){var e,i,r=t.dom.getBoundingClientRect(),n=Math.max(0,r.top);for(var _s31=(r.left+r.right)/2,_l23=n+1;_l23<Math.min(innerHeight,r.bottom);_l23+=5){var _r52=t.root.elementFromPoint(_s31,_l23);if(!_r52||_r52==t.dom||!t.dom.contains(_r52))continue;var _o16=_r52.getBoundingClientRect();if(_o16.top>=n-20){e=_r52,i=_o16.top;break;}}return{refDOM:e,refTop:i,stack:V(t.dom)};}(this);if(s){this.domObserver.stop();var _e94=u&&(T||N)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&function(t,e){var i=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(i)!=e.$anchor.start(i);}(r.selection,t.selection);if(u){var _i76=N?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ie(this)),!n&&this.docView.update(t.doc,h,o,this)||(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=pt(t.doc,h,o,this.dom,this)),!_i76||this.trackWrites&&this.dom.contains(this.trackWrites)||(_e94=!0);}var _i77=this.input.mouseDown;_e94||!(_i77&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(t){var e=t.docView.domFromPos(t.state.selection.anchor,0),i=t.domSelectionRange();return p(e.node,e.offset,i.anchorNode,i.anchorOffset);}(this)&&_i77.delaySelUpdate())?Rt(this,_e94):(Ft(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start();}this.updatePluginViews(r),(null===(i=this.dragging)||void 0===i?void 0:i.node)&&!r.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==f?this.dom.scrollTop=0:"to selection"==f?this.scrollToSelection():c&&function(_ref7){var t=_ref7.refDOM,e=_ref7.refTop,i=_ref7.stack;var r=t?t.getBoundingClientRect().top:0;z(i,0==r?0:r-e);}(c);}},{key:"scrollToSelection",value:function scrollToSelection(){var _this17=this;var e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode)){if(this.someProp("handleScrollToSelection",function(t){return t(_this17);}));else if(this.state.selection instanceof t){var _t98=this.docView.domAfterPos(this.state.selection.from);1==_t98.nodeType&&j(this,_t98.getBoundingClientRect(),e);}else j(this,this.coordsAtPos(this.state.selection.head,1),e);}else;}},{key:"destroyPluginViews",value:function destroyPluginViews(){var t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy();}},{key:"updatePluginViews",value:function updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var _e95=0;_e95<this.pluginViews.length;_e95++){var _i78=this.pluginViews[_e95];_i78.update&&_i78.update(this,t);}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var _t99=0;_t99<this.directPlugins.length;_t99++){var _e96=this.directPlugins[_t99];_e96.spec.view&&this.pluginViews.push(_e96.spec.view(this));}for(var _t100=0;_t100<this.state.plugins.length;_t100++){var _e97=this.state.plugins[_t100];_e97.spec.view&&this.pluginViews.push(_e97.spec.view(this));}}}},{key:"updateDraggedNode",value:function updateDraggedNode(e,i){var r=e.node,n=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{var _t101=r.from+(this.state.doc.content.size-i.doc.content.size);(_t101>0&&_t101<this.state.doc.content.size&&this.state.doc.nodeAt(_t101))==r.node&&(n=_t101);}this.dragging=new He(e.slice,e.move,n<0?void 0:t.create(this.state.doc,n));}},{key:"someProp",value:function someProp(t,e){var i,r=this._props&&this._props[t];if(null!=r&&(i=e?e(r):r))return i;for(var _r53=0;_r53<this.directPlugins.length;_r53++){var _n35=this.directPlugins[_r53].props[t];if(null!=_n35&&(i=e?e(_n35):_n35))return i;}var n=this.state.plugins;if(n)for(var _r54=0;_r54<n.length;_r54++){var _s32=n[_r54].props[t];if(null!=_s32&&(i=e?e(_s32):_s32))return i;}}},{key:"hasFocus",value:function hasFocus(){if(T){var _t102=this.root.activeElement;if(_t102==this.dom)return!0;if(!_t102||!this.dom.contains(_t102))return!1;for(;_t102&&this.dom!=_t102&&this.dom.contains(_t102);){if("false"==_t102.contentEditable)return!1;_t102=_t102.parentElement;}return!0;}return this.root.activeElement==this.dom;}},{key:"focus",value:function focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(G)return t.focus(G);var e=V(t);t.focus(null==G?{get preventScroll(){return G={preventScroll:!0},!0;}}:void 0),G||(G=!1,z(e,0));}(this.dom),Rt(this),this.domObserver.start();}},{key:"root",get:function get(){var _this18=this;var t=this._root;if(null==t){var _loop5=function _loop5(_t103){if(9==_t103.nodeType||11==_t103.nodeType&&_t103.host)return{v:(_t103.getSelection||(Object.getPrototypeOf(_t103).getSelection=function(){return _t103.ownerDocument.getSelection();}),_this18._root=_t103)};},_ret3;for(var _t103=this.dom.parentNode;_t103;_t103=_t103.parentNode){_ret3=_loop5(_t103);if(_ret3)return _ret3.v;}}return t||document;}},{key:"updateRoot",value:function updateRoot(){this._root=null;}},{key:"posAtCoords",value:function posAtCoords(t){return Q(this,t);}},{key:"coordsAtPos",value:function coordsAtPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;return tt(this,t,e);}},{key:"domAtPos",value:function domAtPos(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return this.docView.domFromPos(t,e);}},{key:"nodeDOM",value:function nodeDOM(t){var e=this.docView.descAt(t);return e?e.nodeDOM:null;}},{key:"posAtDOM",value:function posAtDOM(t,e){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:-1;var r=this.docView.posFromDOM(t,e,i);if(null==r)throw new RangeError("DOM position not inside the editor");return r;}},{key:"endOfTextblock",value:function endOfTextblock(t,e){return ht(this,e||this.state,t);}},{key:"pasteHTML",value:function pasteHTML(t,e){return Le(this,"",t,!1,e||new ClipboardEvent("paste"));}},{key:"pasteText",value:function pasteText(t,e){return Le(this,t,null,!0,e||new ClipboardEvent("paste"));}},{key:"serializeForClipboard",value:function serializeForClipboard(t){return ee(this,t);}},{key:"destroy",value:function destroy(){this.docView&&(!function(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(var _e98 in t.input.eventHandlers)t.dom.removeEventListener(_e98,t.input.eventHandlers[_e98]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout);}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],oi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,a=null);}},{key:"isDestroyed",get:function get(){return null==this.docView;}},{key:"dispatchEvent",value:function dispatchEvent(t){return function(t,e){we(t,e)||!ae[e.type]||!t.editable&&e.type in de||ae[e.type](t,e);}(this,t);}},{key:"domSelectionRange",value:function domSelectionRange(){var t=this.domSelection();return t?A&&11===this.root.nodeType&&function(t){var e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e;}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){var _i79=e.getComposedRanges(t.root)[0];if(_i79)return pi(t,_i79);}var i;function r(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0];}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),i?pi(t,i):null;}(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0};}},{key:"domSelection",value:function domSelection(){return this.root.getSelection();}}]);}());yi.prototype.dispatch=function(t){var e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t));};}};});
2
- //# sourceMappingURL=index-3ca67627.cjs.js.map
@@ -1 +0,0 @@
1
- function t(t){this.content=t}function e(t,r,s){for(let h=0;;h++){if(h==t.childCount||h==r.childCount)return t.childCount==r.childCount?null:s;let l=t.child(h),o=r.child(h);if(l!=o){if(!l.sameMarkup(o))return s;if(l.isText&&l.text!=o.text){let t=l.text,e=o.text,r=0;for(;t[r]==e[r];r++)s++;return r&&r<t.length&&r<e.length&&n(t.charCodeAt(r-1))&&i(t.charCodeAt(r))&&s--,s}if(l.content.size||o.content.size){let t=e(l.content,o.content,s+1);if(null!=t)return t}s+=l.nodeSize}else s+=l.nodeSize}}function r(t,e,s,h){for(let l=t.childCount,o=e.childCount;;){if(0==l||0==o)return l==o?null:{a:s,b:h};let u=t.child(--l),f=e.child(--o),a=u.nodeSize;if(u!=f){if(!u.sameMarkup(f))return{a:s,b:h};if(u.isText&&u.text!=f.text){let t=u.text,e=f.text,r=t.length,l=e.length;for(;r>0&&l>0&&t[r-1]==e[l-1];)r--,l--,s--,h--;return r&&l&&r<t.length&&n(t.charCodeAt(r-1))&&i(t.charCodeAt(r))&&(s++,h++),{a:s,b:h}}if(u.content.size||f.content.size){let t=r(u.content,f.content,s-1,h-1);if(t)return t}s-=a,h-=a}else s-=a,h-=a}}function i(t){return t>=56320&&t<57344}function n(t){return t>=55296&&t<56320}t.prototype={constructor:t,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(e,r,i){var n=i&&i!=e?this.remove(i):this,s=n.find(e),h=n.content.slice();return-1==s?h.push(i||e,r):(h[s+1]=r,i&&(h[s]=i)),new t(h)},remove:function(e){var r=this.find(e);if(-1==r)return this;var i=this.content.slice();return i.splice(r,2),new t(i)},addToStart:function(e,r){return new t([e,r].concat(this.remove(e).content))},addToEnd:function(e,r){var i=this.remove(e).content.slice();return i.push(e,r),new t(i)},addBefore:function(e,r,i){var n=this.remove(r),s=n.content.slice(),h=n.find(e);return s.splice(-1==h?s.length:h,0,r,i),new t(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(e){return(e=t.from(e)).size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=t.from(e)).size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var r=this;e=t.from(e);for(var i=0;i<e.content.length;i+=2)r=r.remove(e.content[i]);return r},toObject:function(){var t={};return this.forEach((function(e,r){t[e]=r})),t},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var r=[];if(e)for(var i in e)r.push(i,e[i]);return new t(r)};class s{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,r,i=0,n){for(let s=0,h=0;h<e;s++){let l=this.content[s],o=h+l.nodeSize;if(o>t&&!1!==r(l,i+h,n||null,s)&&l.content.size){let n=h+1;l.nodesBetween(Math.max(0,t-n),Math.min(l.content.size,e-n),r,i+n)}h=o}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,r,i){let n="",s=!0;return this.nodesBetween(t,e,((h,l)=>{let o=h.isText?h.text.slice(Math.max(t,l)-l,e-l):h.isLeaf?i?"function"==typeof i?i(h):i:h.type.spec.leafText?h.type.spec.leafText(h):"":"";h.isBlock&&(h.isLeaf&&o||h.isTextblock)&&r&&(s?s=!1:n+=r),n+=o}),0),n}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,r=t.firstChild,i=this.content.slice(),n=0;for(e.isText&&e.sameMarkup(r)&&(i[i.length-1]=e.withText(e.text+r.text),n=1);n<t.content.length;n++)i.push(t.content[n]);return new s(i,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let r=[],i=0;if(e>t)for(let n=0,s=0;s<e;n++){let h=this.content[n],l=s+h.nodeSize;l>t&&((s<t||l>e)&&(h=h.isText?h.cut(Math.max(0,t-s),Math.min(h.text.length,e-s)):h.cut(Math.max(0,t-s-1),Math.min(h.content.size,e-s-1))),r.push(h),i+=h.nodeSize),s=l}return new s(r,i)}cutByIndex(t,e){return t==e?s.empty:0==t&&e==this.content.length?this:new s(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let i=this.content.slice(),n=this.size+e.nodeSize-r.nodeSize;return i[t]=e,new s(i,n)}addToStart(t){return new s([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new s(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,r=0;e<this.content.length;e++){let i=this.content[e];t(i,r,e),r+=i.nodeSize}}findDiffStart(t,r=0){return e(this,t,r)}findDiffEnd(t,e=this.size,i=t.size){return r(this,t,e,i)}findIndex(t){if(0==t)return l(0,t);if(t==this.size)return l(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,r=0;;e++){let i=r+this.child(e).nodeSize;if(i>=t)return i==t?l(e+1,i):l(e,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return s.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return s.fromArray(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return s.empty;let e,r=0;for(let i=0;i<t.length;i++){let n=t[i];r+=n.nodeSize,i&&n.isText&&t[i-1].sameMarkup(n)?(e||(e=t.slice(0,i)),e[e.length-1]=n.withText(e[e.length-1].text+n.text)):e&&e.push(n)}return new s(e||t,r)}static from(t){if(!t)return s.empty;if(t instanceof s)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new s([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}s.empty=new s([],0);const h={index:0,offset:0};function l(t,e){return h.index=t,h.offset=e,h}function o(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let r=Array.isArray(t);if(Array.isArray(e)!=r)return!1;if(r){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!o(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!o(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class u{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,r=!1;for(let i=0;i<t.length;i++){let n=t[i];if(this.eq(n))return t;if(this.type.excludes(n.type))e||(e=t.slice(0,i));else{if(n.type.excludes(this.type))return t;!r&&n.type.rank>this.type.rank&&(e||(e=t.slice(0,i)),e.push(this),r=!0),e&&e.push(n)}}return e||(e=t.slice()),r||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&o(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[e.type];if(!r)throw new RangeError(`There is no mark type ${e.type} in this schema`);let i=r.create(e.attrs);return r.checkAttrs(i.attrs),i}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(e[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return u.none;if(t instanceof u)return[t];let e=t.slice();return e.sort(((t,e)=>t.type.rank-e.type.rank)),e}}u.none=[];class f extends Error{}class a{constructor(t,e,r){this.content=t,this.openStart=e,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let r=p(this.content,t+this.openStart,e,this.openStart+1,this.openEnd+1);return r&&new a(r,this.openStart,this.openEnd)}removeBetween(t,e){return new a(c(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return a.empty;let r=e.openStart||0,i=e.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new a(s.fromJSON(t,e.content),r,i)}static maxOpen(t,e=!0){let r=0,i=0;for(let i=t.firstChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.firstChild)r++;for(let r=t.lastChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.lastChild)i++;return new a(t,r,i)}}function c(t,e,r){let{index:i,offset:n}=t.findIndex(e),s=t.maybeChild(i),{index:h,offset:l}=t.findIndex(r);if(n==e||s.isText){if(l!=r&&!t.child(h).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(r))}if(i!=h)throw new RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(c(s.content,e-n-1,r-n-1)))}function p(t,e,r,i,n,s){let{index:h,offset:l}=t.findIndex(e),o=t.maybeChild(h);if(l==e||o.isText)return s&&i<=0&&n<=0&&!s.canReplace(h,h,r)?null:t.cut(0,e).append(r).append(t.cut(e));let u=p(o.content,e-l-1,r,0==h?i-1:0,h==t.childCount-1?n-1:0,o);return u&&t.replaceChild(h,o.copy(u))}function d(t,e,r){if(r.openStart>t.depth)throw new f("Inserted content deeper than insertion position");if(t.depth-r.openStart!=e.depth-r.openEnd)throw new f("Inconsistent open depths");return w(t,e,r,0)}function w(t,e,r,i){let n=t.index(i),h=t.node(i);if(n==e.index(i)&&i<t.depth-r.openStart){let s=w(t,e,r,i+1);return h.copy(h.content.replaceChild(n,s))}if(r.content.size){if(r.openStart||r.openEnd||t.depth!=i||e.depth!=i){let{start:n,end:l}=function(t,e){let r=e.depth-t.openStart,i=e.node(r).copy(t.content);for(let t=r-1;t>=0;t--)i=e.node(t).copy(s.from(i));return{start:i.resolveNoCache(t.openStart+r),end:i.resolveNoCache(i.content.size-t.openEnd-r)}}(r,t);return b(h,v(t,n,l,e,i))}{let i=t.parent,n=i.content;return b(i,n.cut(0,t.parentOffset).append(r.content).append(n.cut(e.parentOffset)))}}return b(h,k(t,e,i))}function g(t,e){if(!e.type.compatibleContent(t.type))throw new f("Cannot join "+e.type.name+" onto "+t.type.name)}function m(t,e,r){let i=t.node(r);return g(i,e.node(r)),i}function y(t,e){let r=e.length-1;r>=0&&t.isText&&t.sameMarkup(e[r])?e[r]=t.withText(e[r].text+t.text):e.push(t)}function S(t,e,r,i){let n=(e||t).node(r),s=0,h=e?e.index(r):n.childCount;t&&(s=t.index(r),t.depth>r?s++:t.textOffset&&(y(t.nodeAfter,i),s++));for(let t=s;t<h;t++)y(n.child(t),i);e&&e.depth==r&&e.textOffset&&y(e.nodeBefore,i)}function b(t,e){if(!t.type.validContent(e))throw new f("Invalid content for node "+t.type.name);return t.copy(e)}function v(t,e,r,i,n){let h=t.depth>n&&m(t,e,n+1),l=i.depth>n&&m(r,i,n+1),o=[];return S(null,t,n,o),h&&l&&e.index(n)==r.index(n)?(g(h,l),y(b(h,v(t,e,r,i,n+1)),o)):(h&&y(b(h,k(t,e,n+1)),o),S(e,r,n,o),l&&y(b(l,k(r,i,n+1)),o)),S(i,null,n,o),new s(o)}function k(t,e,r){let i=[];if(S(null,t,r,i),t.depth>r){y(b(m(t,e,r+1),k(t,e,r+1)),i)}return S(e,null,r,i),new s(i)}a.empty=new a(s.empty,0,0);class x{constructor(t,e,r){this.pos=t,this.path=e,this.parentOffset=r,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(e);return r?t.child(e).cut(r):i}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let r=this.path[3*e],i=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)i+=r.child(e).nodeSize;return i}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return u.none;if(this.textOffset)return t.child(e).marks;let r=t.maybeChild(e-1),i=t.maybeChild(e);if(!r){let t=r;r=i,i=t}let n=r.marks;for(var s=0;s<n.length;s++)!1!==n[s].type.spec.inclusive||i&&n[s].isInSet(i.marks)||(n=n[s--].removeFromSet(n));return n}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let r=e.marks,i=t.parent.maybeChild(t.index());for(var n=0;n<r.length;n++)!1!==r[n].type.spec.inclusive||i&&r[n].isInSet(i.marks)||(r=r[n--].removeFromSet(r));return r}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new R(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let r=[],i=0,n=e;for(let e=t;;){let{index:t,offset:s}=e.content.findIndex(n),h=n-s;if(r.push(e,t,i+s),!h)break;if(e=e.child(t),e.isText)break;n=h-1,i+=s+1}return new x(e,r,n)}static resolveCached(t,e){let r=O.get(t);if(r)for(let t=0;t<r.elts.length;t++){let i=r.elts[t];if(i.pos==e)return i}else O.set(t,r=new E);let i=r.elts[r.i]=x.resolve(t,e);return r.i=(r.i+1)%N,i}}class E{constructor(){this.elts=[],this.i=0}}const N=12,O=new WeakMap;class R{constructor(t,e,r){this.$from=t,this.$to=e,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const M=Object.create(null);class J{constructor(t,e,r,i=u.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||s.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,r,i=0){this.content.nodesBetween(t,e,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,r,i){return this.content.textBetween(t,e,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,r){return this.type==t&&o(this.attrs,e||t.defaultAttrs||M)&&u.sameSet(this.marks,r||u.none)}copy(t=null){return t==this.content?this:new J(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new J(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,r=!1){if(t==e)return a.empty;let i=this.resolve(t),n=this.resolve(e),s=r?0:i.sharedDepth(e),h=i.start(s),l=i.node(s).content.cut(i.pos-h,n.pos-h);return new a(l,i.depth-s,n.depth-s)}replace(t,e,r){return d(this.resolve(t),this.resolve(e),r)}nodeAt(t){for(let e=this;;){let{index:r,offset:i}=e.content.findIndex(t);if(e=e.maybeChild(r),!e)return null;if(i==t||e.isText)return e;t-=i+1}}childAfter(t){let{index:e,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:r}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(e),index:e,offset:r};let i=this.content.child(e-1);return{node:i,index:e-1,offset:r-i.nodeSize}}resolve(t){return x.resolveCached(this,t)}resolveNoCache(t){return x.resolve(this,t)}rangeHasMark(t,e,r){let i=!1;return e>t&&this.nodesBetween(t,e,(t=>(r.isInSet(t.marks)&&(i=!0),!i))),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),T(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,r=s.empty,i=0,n=r.childCount){let h=this.contentMatchAt(t).matchFragment(r,i,n),l=h&&h.matchFragment(this.content,e);if(!l||!l.validEnd)return!1;for(let t=i;t<n;t++)if(!this.type.allowsMarks(r.child(t).marks))return!1;return!0}canReplaceWith(t,e,r,i){if(i&&!this.type.allowsMarks(i))return!1;let n=this.contentMatchAt(t).matchType(r),s=n&&n.matchFragment(this.content,e);return!!s&&s.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=u.none;for(let e=0;e<this.marks.length;e++){let r=this.marks[e];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!u.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let r;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,r)}let i=s.fromJSON(t,e.content),n=t.nodeType(e.type).create(e.attrs,i,r);return n.type.checkAttrs(n.attrs),n}}J.prototype.text=void 0;class I extends J{constructor(t,e,r,i){if(super(t,e,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):T(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new I(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new I(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function T(t,e){for(let r=t.length-1;r>=0;r--)e=t[r].type.name+"("+e+")";return e}class A{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let r=new j(t,e);if(null==r.next)return A.empty;let i=C(r);r.next&&r.err("Unexpected trailing text");let n=function(t){let e=Object.create(null);return r(W(t,0));function r(i){let n=[];i.forEach((e=>{t[e].forEach((({term:e,to:r})=>{if(!e)return;let i;for(let t=0;t<n.length;t++)n[t][0]==e&&(i=n[t][1]);W(t,r).forEach((t=>{i||n.push([e,i=[]]),-1==i.indexOf(t)&&i.push(t)}))}))}));let s=e[i.join(",")]=new A(i.indexOf(t.length-1)>-1);for(let t=0;t<n.length;t++){let i=n[t][1].sort(q);s.next.push({type:n[t][0],next:e[i.join(",")]||r(i)})}return s}}(function(t){let e=[[]];return n(s(t,0),r()),e;function r(){return e.push([])-1}function i(t,r,i){let n={term:i,to:r};return e[t].push(n),n}function n(t,e){t.forEach((t=>t.to=e))}function s(t,e){if("choice"==t.type)return t.exprs.reduce(((t,r)=>t.concat(s(r,e))),[]);if("seq"!=t.type){if("star"==t.type){let h=r();return i(e,h),n(s(t.expr,h),h),[i(h)]}if("plus"==t.type){let h=r();return n(s(t.expr,e),h),n(s(t.expr,h),h),[i(h)]}if("opt"==t.type)return[i(e)].concat(s(t.expr,e));if("range"==t.type){let h=e;for(let e=0;e<t.min;e++){let e=r();n(s(t.expr,h),e),h=e}if(-1==t.max)n(s(t.expr,h),h);else for(let e=t.min;e<t.max;e++){let e=r();i(h,e),n(s(t.expr,h),e),h=e}return[i(h)]}if("name"==t.type)return[i(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let i=0;;i++){let h=s(t.exprs[i],e);if(i==t.exprs.length-1)return h;n(h,e=r())}}}(i));return function(t,e){for(let r=0,i=[t];r<i.length;r++){let t=i[r],n=!t.validEnd,s=[];for(let e=0;e<t.next.length;e++){let{type:r,next:h}=t.next[e];s.push(r.name),!n||r.isText||r.hasRequiredAttrs()||(n=!1),-1==i.indexOf(h)&&i.push(h)}n&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(n,r),n}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,r=t.childCount){let i=this;for(let n=e;i&&n<r;n++)i=i.matchType(t.child(n).type);return i}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let r=0;r<t.next.length;r++)if(this.next[e].type==t.next[r].type)return!0;return!1}fillBefore(t,e=!1,r=0){let i=[this];return function n(h,l){let o=h.matchFragment(t,r);if(o&&(!e||o.validEnd))return s.from(l.map((t=>t.createAndFill())));for(let t=0;t<h.next.length;t++){let{type:e,next:r}=h.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==i.indexOf(r)){i.push(r);let t=n(r,l.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),n=i.match;if(n.matchType(t)){let t=[];for(let e=i;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<n.next.length;t++){let{type:s,next:h}=n.next[t];s.isLeaf||s.hasRequiredAttrs()||s.name in e||i.type&&!h.validEnd||(r.push({match:s.contentMatch,type:s,via:i}),e[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(r){t.push(r);for(let i=0;i<r.next.length;i++)-1==t.indexOf(r.next[i].next)&&e(r.next[i].next)}(this),t.map(((e,r)=>{let i=r+(e.validEnd?"*":" ")+" ";for(let r=0;r<e.next.length;r++)i+=(r?", ":"")+e.next[r].type.name+"->"+t.indexOf(e.next[r].next);return i})).join("\n")}}A.empty=new A(!0);class j{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function C(t){let e=[];do{e.push($(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function $(t){let e=[];do{e.push(D(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function D(t){let e=function(t){if(t.eat("(")){let e=C(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let r=t.nodeTypes,i=r[e];if(i)return[i];let n=[];for(let t in r){let i=r[t];i.isInGroup(e)&&n.push(i)}0==n.length&&t.err("No node type or group '"+e+"' found");return n}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=F(t,e)}return e}function B(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function F(t,e){let r=B(t),i=r;return t.eat(",")&&(i="}"!=t.next?B(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:r,max:i,expr:e}}function q(t,e){return e-t}function W(t,e){let r=[];return function e(i){let n=t[i];if(1==n.length&&!n[0].term)return e(n[0].to);r.push(i);for(let t=0;t<n.length;t++){let{term:i,to:s}=n[t];i||-1!=r.indexOf(s)||e(s)}}(e),r.sort(q)}function z(t){let e=Object.create(null);for(let r in t){let i=t[r];if(!i.hasDefault)return null;e[r]=i.default}return e}function P(t,e){let r=Object.create(null);for(let i in t){let n=e&&e[i];if(void 0===n){let e=t[i];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+i);n=e.default}r[i]=n}return r}function U(t,e,r,i){for(let n in e)if(!(n in t))throw new RangeError(`Unsupported attribute ${n} for ${r} of type ${i}`);for(let r in t)t[r].validate&&t[r].validate(e[r])}function _(t,e){let r=Object.create(null);if(e)for(let i in e)r[i]=new G(t,i,e[i]);return r}class L{constructor(t,e,r){this.name=t,this.schema=e,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=_(t,r.attrs),this.defaultAttrs=z(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==A.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:P(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new J(this,this.computeAttrs(t),s.from(e),u.setFrom(r))}createChecked(t=null,e,r){return e=s.from(e),this.checkContent(e),new J(this,this.computeAttrs(t),e,u.setFrom(r))}createAndFill(t=null,e,r){if(t=this.computeAttrs(t),(e=s.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let i=this.contentMatch.matchFragment(e),n=i&&i.fillBefore(s.empty,!0);return n?new J(this,t,e.append(n),u.setFrom(r)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){U(this.attrs,t,"node",this.name)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?e&&e.push(t[r]):e||(e=t.slice(0,r));return e?e.length?e:u.none:t}static compile(t,e){let r=Object.create(null);t.forEach(((t,i)=>r[t]=new L(t,e,i)));let i=e.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let t in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}class G{constructor(t,e,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(t,e,r){let i=r.split("|");return r=>{let n=null===r?"null":typeof r;if(i.indexOf(n)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${n}`)}}(t,e,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class V{constructor(t,e,r,i){this.name=t,this.rank=e,this.schema=r,this.spec=i,this.attrs=_(t,i.attrs),this.excluded=null;let n=z(this.attrs);this.instance=n?new u(this,n):null}create(t=null){return!t&&this.instance?this.instance:new u(this,P(this.attrs,t))}static compile(t,e){let r=Object.create(null),i=0;return t.forEach(((t,n)=>r[t]=new V(t,i++,e,n))),r}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){U(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class H{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let t in e)r[t]=e[t];r.nodes=t.from(e.nodes),r.marks=t.from(e.marks||{}),this.nodes=L.compile(this.spec.nodes,this),this.marks=V.compile(this.spec.marks,this);let i=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],r=e.spec.content||"",n=e.spec.marks;if(e.contentMatch=i[r]||(i[r]=A.parse(r,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==n?null:n?K(this,n.split(" ")):""!=n&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],r=e.spec.excludes;e.excluded=null==r?[e]:""==r?[]:K(this,r.split(" "))}this.nodeFromJSON=t=>J.fromJSON(this,t),this.markFromJSON=t=>u.fromJSON(this,t),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,r,i){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof L))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,r,i)}text(t,e){let r=this.nodes.text;return new I(r,r.defaultAttrs,t,u.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function K(t,e){let r=[];for(let i=0;i<e.length;i++){let n=e[i],s=t.marks[n],h=s;if(s)r.push(s);else for(let e in t.marks){let i=t.marks[e];("_"==n||i.spec.group&&i.spec.group.split(" ").indexOf(n)>-1)&&r.push(h=i)}if(!h)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return r}class Q{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let r=this.matchedStyles=[];e.forEach((t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];r.indexOf(e)<0&&r.push(e),this.styles.push(t)}})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let r=t.nodes[e.node];return r.contentMatch.matchType(r)}))}parse(t,e={}){let r=new rt(this,e,!1);return r.addAll(t,u.none,e.from,e.to),r.finish()}parseSlice(t,e={}){let r=new rt(this,e,!0);return r.addAll(t,u.none,e.from,e.to),a.maxOpen(r.finish())}matchTag(t,e,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let r=this.tags[i];if(it(t,r.tag)&&(void 0===r.namespace||t.namespaceURI==r.namespace)&&(!r.context||e.matchesContext(r.context))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}matchStyle(t,e,r,i){for(let n=i?this.styles.indexOf(i)+1:0;n<this.styles.length;n++){let i=this.styles[n],s=i.style;if(!(0!=s.indexOf(t)||i.context&&!r.matchesContext(i.context)||s.length>t.length&&(61!=s.charCodeAt(t.length)||s.slice(t.length+1)!=e))){if(i.getAttrs){let t=i.getAttrs(e);if(!1===t)continue;i.attrs=t||void 0}return i}}}static schemaRules(t){let e=[];function r(t){let r=null==t.priority?50:t.priority,i=0;for(;i<e.length;i++){let t=e[i];if((null==t.priority?50:t.priority)<r)break}e.splice(i,0,t)}for(let e in t.marks){let i=t.marks[e].spec.parseDOM;i&&i.forEach((t=>{r(t=nt(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let i=t.nodes[e].spec.parseDOM;i&&i.forEach((t=>{r(t=nt(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Q(t,Q.schemaRules(t)))}}const X={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},Y={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Z={ol:!0,ul:!0};function tt(t,e,r){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&r}class et{constructor(t,e,r,i,n,s){this.type=t,this.attrs=e,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=u.none,this.match=n||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(s.from(t));if(!e){let e,r=this.type.contentMatch;return(e=r.findWrapping(t.type))?(this.match=r,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let r=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-t[0].length))}}let e=s.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(s.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!X.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class rt{constructor(t,e,r){this.parser=t,this.options=e,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i,n=e.topNode,s=tt(null,e.preserveWhitespace,0)|(r?4:0);i=n?new et(n.type,n.attrs,u.none,!0,e.topMatch||n.type.contentMatch,s):new et(r?null:t.schema.topNodeType,null,u.none,!0,null,s),this.nodes=[i],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let r=t.nodeValue,i=this.top,n=2&i.options?"full":this.localPreserveWS||(1&i.options)>0,{schema:s}=this.parser;if("full"===n||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(n)if("full"===n)r=r.replace(/\r\n?/g,"\n");else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let t=r.split(/\r?\n|\r/);for(let r=0;r<t.length;r++)r&&this.insertNode(s.linebreakReplacement.create(),e,!0),t[r]&&this.insertNode(s.text(t[r]),e,!/\S/.test(t[r]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let e=i.content[i.content.length-1],n=t.previousSibling;(!e||n&&"BR"==n.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),e,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,e,r){let i=this.localPreserveWS,n=this.top;("PRE"==t.tagName||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s,h=t.nodeName.toLowerCase();Z.hasOwnProperty(h)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,r=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&Z.hasOwnProperty(t)&&r?(r.appendChild(e),e=r):"li"==t?r=e:t&&(r=null)}}(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(s=this.parser.matchTag(t,this,r));t:if(l?l.ignore:Y.hasOwnProperty(h))this.findInside(t),this.ignoreFallback(t,e);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let r,i=this.needsBlock;if(X.hasOwnProperty(h))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),r=!0,n.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);break t}let s=l&&l.skip?e:this.readStyles(t,e);s&&this.addAll(t,s),r&&this.sync(n),this.needsBlock=i}else{let r=this.readStyles(t,e);r&&this.addElementByRule(t,l,r,!1===l.consuming?s:void 0)}this.localPreserveWS=i}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e,!0)}readStyles(t,e){let r=t.style;if(r&&r.length)for(let t=0;t<this.parser.matchedStyles.length;t++){let i=this.parser.matchedStyles[t],n=r.getPropertyValue(i);if(n)for(let t;;){let r=this.parser.matchStyle(i,n,this,t);if(!r)break;if(r.ignore)return null;if(e=r.clearMark?e.filter((t=>!r.clearMark(t))):e.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;t=r}}return e}addElementByRule(t,e,r,i){let n,s;if(e.node)if(s=this.parser.schema.nodes[e.node],s.isLeaf)this.insertNode(s.create(e.attrs),r,"BR"==t.nodeName)||this.leafFallback(t,r);else{let t=this.enter(s,e.attrs||null,r,e.preserveWhitespace);t&&(n=!0,r=t)}else{let t=this.parser.schema.marks[e.mark];r=r.concat(t.create(e.attrs))}let h=this.top;if(s&&s.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t,r,!1)));else{let i=t;"string"==typeof e.contentElement?i=t.querySelector(e.contentElement):"function"==typeof e.contentElement?i=e.contentElement(t):e.contentElement&&(i=e.contentElement),this.findAround(t,i,!0),this.addAll(i,r),this.findAround(t,i,!1)}n&&this.sync(h)&&this.open--}addAll(t,e,r,i){let n=r||0;for(let s=r?t.childNodes[r]:t.firstChild,h=null==i?null:t.childNodes[i];s!=h;s=s.nextSibling,++n)this.findAtPoint(t,n),this.addDOM(s,e);this.findAtPoint(t,n)}findPlace(t,e,r){let i,n;for(let e=this.open,s=0;e>=0;e--){let h=this.nodes[e],l=h.findWrapping(t);if(l&&(!i||i.length>l.length+s)&&(i=l,n=h,!l.length))break;if(h.solid){if(r)break;s+=2}}if(!i)return null;this.sync(n);for(let t=0;t<i.length;t++)e=this.enterInner(i[t],null,e,!1);return e}insertNode(t,e,r){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&(e=this.enterInner(t,null,e))}let i=this.findPlace(t,e,r);if(i){this.closeExtra();let e=this.top;e.match&&(e.match=e.match.matchType(t.type));let r=u.none;for(let n of i.concat(t.marks))(e.type?e.type.allowsMarkType(n.type):st(n.type,t.type))&&(r=n.addToSet(r));return e.content.push(t.mark(r)),!0}return!1}enter(t,e,r,i){let n=this.findPlace(t.create(e),r,!1);return n&&(n=this.enterInner(t,e,r,!0,i)),n}enterInner(t,e,r,i=!1,n){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let h=tt(t,n,s.options);4&s.options&&0==s.content.length&&(h|=4);let l=u.none;return r=r.filter((e=>!(s.type?s.type.allowsMarkType(e.type):st(e.type,t))||(l=e.addToSet(l),!1))),this.nodes.push(new et(t,e,l,i,null,h)),this.open++,r}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=1)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let r=this.nodes[e].content;for(let e=r.length-1;e>=0;e--)t+=r[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==e&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,r){if(t!=e&&this.find)for(let i=0;i<this.find.length;i++)if(null==this.find[i].pos&&1==t.nodeType&&t.contains(this.find[i].node)){e.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),r=this.options.context,i=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),n=-(r?r.depth+1:0)+(i?0:1),s=(t,h)=>{for(;t>=0;t--){let l=e[t];if(""==l){if(t==e.length-1||0==t)continue;for(;h>=n;h--)if(s(t-1,h))return!0;return!1}{let t=h>0||0==h&&i?this.nodes[h].type:r&&h>=n?r.node(h-n).type:null;if(!t||t.name!=l&&!t.isInGroup(l))return!1;h--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function it(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function nt(t){let e={};for(let r in t)e[r]=t[r];return e}function st(t,e){let r=e.schema.nodes;for(let i in r){let n=r[i];if(!n.allowsMarkType(t))continue;let s=[],h=t=>{s.push(t);for(let r=0;r<t.edgeCount;r++){let{type:i,next:n}=t.edge(r);if(i==e)return!0;if(s.indexOf(n)<0&&h(n))return!0}};if(h(n.contentMatch))return!0}}class ht{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},r){r||(r=ot(e).createDocumentFragment());let i=r,n=[];return t.forEach((t=>{if(n.length||t.marks.length){let r=0,s=0;for(;r<n.length&&s<t.marks.length;){let e=t.marks[s];if(this.marks[e.type.name]){if(!e.eq(n[r][0])||!1===e.type.spec.spanning)break;r++,s++}else s++}for(;r<n.length;)i=n.pop()[1];for(;s<t.marks.length;){let r=t.marks[s++],h=this.serializeMark(r,t.isInline,e);h&&(n.push([r,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(t,e))})),r}serializeNodeInner(t,e){if(t.isText)return ot(e).createTextNode(t.text);let{dom:r,contentDOM:i}=at(ot(e),this.nodes[t.type.name](t),null,t.attrs);if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,i)}return r}serializeNode(t,e={}){let r=this.serializeNodeInner(t,e);for(let i=t.marks.length-1;i>=0;i--){let n=this.serializeMark(t.marks[i],t.isInline,e);n&&((n.contentDOM||n.dom).appendChild(r),r=n.dom)}return r}serializeMark(t,e,r={}){let i=this.marks[t.type.name];return i&&at(ot(r),i(t,e),null,t.attrs)}static renderSpec(t,e,r=null,i){return"string"==typeof e?{dom:t.createTextNode(e)}:at(t,e,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ht(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=lt(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return lt(t.marks)}}function lt(t){let e={};for(let r in t){let i=t[r].spec.toDOM;i&&(e[r]=i)}return e}function ot(t){return t.document||window.document}const ut=new WeakMap;function ft(t){let e=ut.get(t);return void 0===e&&ut.set(t,e=function(t){let e=null;function r(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])e||(e=[]),e.push(t);else for(let e=0;e<t.length;e++)r(t[e]);else for(let e in t)r(t[e])}return r(t),e}(t)),e}function at(t,e,r,i){if(1==e.nodeType)return{dom:e};if(e.dom&&1==e.dom.nodeType)return e;let n,s=e[0];if("string"!=typeof s)throw new RangeError("Invalid array passed to renderSpec");if(i&&(n=ft(i))&&n.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let h,l=s.indexOf(" ");l>0&&(r=s.slice(0,l),s=s.slice(l+1));let o=r?t.createElementNS(r,s):t.createElement(s),u=e[1],f=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){f=2;for(let t in u)if(null!=u[t]){let e=t.indexOf(" ");e>0?o.setAttributeNS(t.slice(0,e),t.slice(e+1),u[t]):"style"==t&&o.style?o.style.cssText=u[t]:o.setAttribute(t,u[t])}}for(let n=f;n<e.length;n++){let s=e[n];if(0===s){if(n<e.length-1||n>f)throw new RangeError("Content hole must be the only child of its parent node");return{dom:o,contentDOM:o}}if("string"==typeof s)o.appendChild(t.createTextNode(s));else{let{dom:e,contentDOM:n}=at(t,s,r,i);if(o.appendChild(e),n){if(h)throw new RangeError("Multiple content holes");h=n}}}return{dom:o,contentDOM:h}}const ct=Math.pow(2,16);function pt(t){return 65535&t}class dt{constructor(t,e,r){this.pos=t,this.delInfo=e,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class wt{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&wt.empty)return wt.empty}recover(t){let e=0,r=pt(t);if(!this.inverted)for(let t=0;t<r;t++)e+=this.ranges[3*t+2]-this.ranges[3*t+1];return this.ranges[3*r]+e+function(t){return(t-(65535&t))/ct}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,n=this.inverted?2:1,s=this.inverted?1:2;for(let h=0;h<this.ranges.length;h+=3){let l=this.ranges[h]-(this.inverted?i:0);if(l>t)break;let o=this.ranges[h+n],u=this.ranges[h+s],f=l+o;if(t<=f){let n=l+i+((o?t==l?-1:t==f?1:e:e)<0?0:u);if(r)return n;let s=t==(e<0?l:f)?null:h/3+(t-l)*ct,a=t==l?2:t==f?1:4;return(e<0?t!=l:t!=f)&&(a|=8),new dt(n,a,s)}i+=u-o}return r?t+i:new dt(t+i,0,null)}touches(t,e){let r=0,i=pt(e),n=this.inverted?2:1,s=this.inverted?1:2;for(let e=0;e<this.ranges.length;e+=3){let h=this.ranges[e]-(this.inverted?r:0);if(h>t)break;let l=this.ranges[e+n];if(t<=h+l&&e==3*i)return!0;r+=this.ranges[e+s]-l}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,n=0;i<this.ranges.length;i+=3){let s=this.ranges[i],h=s-(this.inverted?n:0),l=s+(this.inverted?0:n),o=this.ranges[i+e],u=this.ranges[i+r];t(h,h+o,l,l+u),n+=u-o}}invert(){return new wt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?wt.empty:new wt(t<0?[0,-t,0]:[0,0,t])}}wt.empty=new wt([]);class gt{constructor(t,e,r=0,i=(t?t.length:0)){this.mirror=e,this.from=r,this.to=i,this._maps=t||[],this.ownData=!(t||e)}get maps(){return this._maps}slice(t=0,e=this.maps.length){return new gt(this._maps,this.mirror,t,e)}appendMap(t,e){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),null!=e&&this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,r=this._maps.length;e<t._maps.length;e++){let i=t.getMirror(e);this.appendMap(t._maps[e],null!=i&&i<e?r+i:void 0)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this._maps.length+t._maps.length;e>=0;e--){let i=t.getMirror(e);this.appendMap(t._maps[e].invert(),null!=i&&i>e?r-i-1:void 0)}}invert(){let t=new gt;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let i=0;for(let r=this.from;r<this.to;r++){let n=this._maps[r].mapResult(t,e);if(null!=n.recover){let e=this.getMirror(r);if(null!=e&&e>r&&e<this.to){r=e,t=this._maps[e].recover(n.recover);continue}}i|=n.delInfo,t=n.pos}return r?t:new dt(t,i,null)}}const mt=Object.create(null);class yt{getMap(){return wt.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=mt[e.stepType];if(!r)throw new RangeError(`No step type ${e.stepType} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in mt)throw new RangeError("Duplicate use of step JSON ID "+t);return mt[t]=e,e.prototype.jsonID=t,e}}class St{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new St(t,null)}static fail(t){return new St(null,t)}static fromReplace(t,e,r,i){try{return St.ok(t.replace(e,r,i))}catch(t){if(t instanceof f)return St.fail(t.message);throw t}}}function bt(t,e,r){let i=[];for(let n=0;n<t.childCount;n++){let s=t.child(n);s.content.size&&(s=s.copy(bt(s.content,e,s))),s.isInline&&(s=e(s,r,n)),i.push(s)}return s.fromArray(i)}class vt extends yt{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),n=new a(bt(e.content,((t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t),i),e.openStart,e.openEnd);return St.fromReplace(t,this.from,this.to,n)}invert(){return new kt(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new vt(e.pos,r.pos,this.mark)}merge(t){return t instanceof vt&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new vt(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new vt(e.from,e.to,t.markFromJSON(e.mark))}}yt.jsonID("addMark",vt);class kt extends yt{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new a(bt(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return St.fromReplace(t,this.from,this.to,r)}invert(){return new vt(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new kt(e.pos,r.pos,this.mark)}merge(t){return t instanceof kt&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new kt(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new kt(e.from,e.to,t.markFromJSON(e.mark))}}yt.jsonID("removeMark",kt);class xt extends yt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return St.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return St.fromReplace(t,this.pos,this.pos+1,new a(s.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let r=0;r<e.marks.length;r++)if(!e.marks[r].isInSet(t))return new xt(this.pos,e.marks[r]);return new xt(this.pos,this.mark)}}return new Et(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new xt(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new xt(e.pos,t.markFromJSON(e.mark))}}yt.jsonID("addNodeMark",xt);class Et extends yt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return St.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return St.fromReplace(t,this.pos,this.pos+1,new a(s.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new xt(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Et(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Et(e.pos,t.markFromJSON(e.mark))}}yt.jsonID("removeNodeMark",Et);class Nt extends yt{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&Rt(t,this.from,this.to)?St.fail("Structure replace would overwrite content"):St.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new wt([this.from,this.to-this.from,this.slice.size])}invert(t){return new Nt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.to,-1),r=this.from==this.to&&Nt.MAP_BIAS<0?e:t.mapResult(this.from,1);return r.deletedAcross&&e.deletedAcross?null:new Nt(r.pos,Math.max(r.pos,e.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Nt)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?a.empty:new a(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Nt(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?a.empty:new a(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Nt(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Nt(e.from,e.to,a.fromJSON(t,e.slice),!!e.structure)}}Nt.MAP_BIAS=1,yt.jsonID("replace",Nt);class Ot extends yt{constructor(t,e,r,i,n,s,h=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=n,this.insert=s,this.structure=h}apply(t){if(this.structure&&(Rt(t,this.from,this.gapFrom)||Rt(t,this.gapTo,this.to)))return St.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return St.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?St.fromReplace(t,this.from,this.to,r):St.fail("Content does not fit in gap")}getMap(){return new wt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Ot(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),n=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||n>r.pos?null:new Ot(e.pos,r.pos,i,n,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ot(e.from,e.to,e.gapFrom,e.gapTo,a.fromJSON(t,e.slice),e.insert,!!e.structure)}}function Rt(t,e,r){let i=t.resolve(e),n=r-e,s=i.depth;for(;n>0&&s>0&&i.indexAfter(s)==i.node(s).childCount;)s--,n--;if(n>0){let t=i.node(s).maybeChild(i.indexAfter(s));for(;n>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,n--}}return!1}function Mt(t,e,r,i=r.contentMatch,n=!0){let h=t.doc.nodeAt(e),l=[],o=e+1;for(let e=0;e<h.childCount;e++){let u=h.child(e),f=o+u.nodeSize,c=i.matchType(u.type);if(c){i=c;for(let e=0;e<u.marks.length;e++)r.allowsMarkType(u.marks[e].type)||t.step(new kt(o,f,u.marks[e]));if(n&&u.isText&&"pre"!=r.whitespace){let t,e,i=/\r?\n|\r/g;for(;t=i.exec(u.text);)e||(e=new a(s.from(r.schema.text(" ",r.allowedMarks(u.marks))),0,0)),l.push(new Nt(o+t.index,o+t.index+t[0].length,e))}}else l.push(new Nt(o,f,a.empty));o=f}if(!i.validEnd){let e=i.fillBefore(s.empty,!0);t.replace(o,o,new a(e,0,0))}for(let e=l.length-1;e>=0;e--)t.step(l[e])}function Jt(t,e,r){return(0==e||t.canReplace(e,t.childCount))&&(r==t.childCount||t.canReplace(0,r))}function It(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,n=0;;--r){let s=t.$from.node(r),h=t.$from.index(r)+i,l=t.$to.indexAfter(r)-n;if(r<t.depth&&s.canReplace(h,l,e))return r;if(0==r||s.type.spec.isolating||!Jt(s,h,l))break;h&&(i=1),l<s.childCount&&(n=1)}return null}function Tt(t,e,r=null,i=t){let n=function(t,e){let{parent:r,startIndex:i,endIndex:n}=t,s=r.contentMatchAt(i).findWrapping(e);if(!s)return null;let h=s.length?s[0]:e;return r.canReplaceWith(i,n,h)?s:null}(t,e),s=n&&function(t,e){let{parent:r,startIndex:i,endIndex:n}=t,s=r.child(i),h=e.contentMatch.findWrapping(s.type);if(!h)return null;let l=(h.length?h[h.length-1]:e).contentMatch;for(let t=i;l&&t<n;t++)l=l.matchType(r.child(t).type);return l&&l.validEnd?h:null}(i,e);return s?n.map(At).concat({type:e,attrs:r}).concat(s.map(At)):null}function At(t){return{type:t,attrs:null}}function jt(t,e,r,i){e.forEach(((n,s)=>{if(n.isText){let h,l=/\r?\n|\r/g;for(;h=l.exec(n.text);){let n=t.mapping.slice(i).map(r+1+s+h.index);t.replaceWith(n,n+1,e.type.schema.linebreakReplacement.create())}}}))}function Ct(t,e,r,i){e.forEach(((n,s)=>{if(n.type==n.type.schema.linebreakReplacement){let n=t.mapping.slice(i).map(r+1+s);t.replaceWith(n,n+1,e.type.schema.text("\n"))}}))}function $t(t,e,r=1,i){let n=t.resolve(e),s=n.depth-r,h=i&&i[i.length-1]||n.parent;if(s<0||n.parent.type.spec.isolating||!n.parent.canReplace(n.index(),n.parent.childCount)||!h.type.validContent(n.parent.content.cutByIndex(n.index(),n.parent.childCount)))return!1;for(let t=n.depth-1,e=r-2;t>s;t--,e--){let r=n.node(t),s=n.index(t);if(r.type.spec.isolating)return!1;let h=r.content.cutByIndex(s,r.childCount),l=i&&i[e+1];l&&(h=h.replaceChild(0,l.type.create(l.attrs)));let o=i&&i[e]||r;if(!r.canReplace(s+1,r.childCount)||!o.type.validContent(h))return!1}let l=n.indexAfter(s),o=i&&i[0];return n.node(s).canReplaceWith(l,l,o?o.type:n.node(s+1).type)}function Dt(t,e){let r=t.resolve(e),i=r.index();return n=r.nodeBefore,s=r.nodeAfter,!(!n||!s||n.isLeaf||!function(t,e){e.content.size||t.type.compatibleContent(e.type);let r=t.contentMatchAt(t.childCount),{linebreakReplacement:i}=t.type.schema;for(let n=0;n<e.childCount;n++){let s=e.child(n),h=s.type==i?t.type.schema.nodes.text:s.type;if(r=r.matchType(h),!r)return!1;if(!t.type.allowsMarks(s.marks))return!1}return r.validEnd}(n,s))&&r.parent.canReplace(i,i+1);var n,s}function Bt(t,e,r){let i=t.resolve(e);if(!r.content.size)return e;let n=r.content;for(let t=0;t<r.openStart;t++)n=n.firstChild.content;for(let t=1;t<=(0==r.openStart&&r.size?2:1);t++)for(let e=i.depth;e>=0;e--){let r=e==i.depth?0:i.pos<=(i.start(e+1)+i.end(e+1))/2?-1:1,s=i.index(e)+(r>0?1:0),h=i.node(e),l=!1;if(1==t)l=h.canReplace(s,s,n);else{let t=h.contentMatchAt(s).findWrapping(n.firstChild.type);l=t&&h.canReplaceWith(s,s,t[0])}if(l)return 0==r?i.pos:r<0?i.before(e+1):i.after(e+1)}return null}function Ft(t,e,r=e,i=a.empty){if(e==r&&!i.size)return null;let n=t.resolve(e),s=t.resolve(r);return qt(n,s,i)?new Nt(e,r,i):new Wt(n,s,i).fit()}function qt(t,e,r){return!r.openStart&&!r.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),r.content)}yt.jsonID("replaceAround",Ot);class Wt{constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=s.empty;for(let e=0;e<=t.depth;e++){let r=t.node(e);this.frontier.push({type:r.type,match:r.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=s.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let n=this.placed,s=r.depth,h=i.depth;for(;s&&h&&1==n.childCount;)n=n.firstChild.content,s--,h--;let l=new a(n,s,h);return t>-1?new Ot(r.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||r.pos!=this.$to.pos?new Nt(r.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let n=e.firstChild;if(e.childCount>1&&(i=0),n.type.spec.isolating&&i<=r){t=r;break}e=n.content}for(let e=1;e<=2;e++)for(let r=1==e?t:this.unplaced.openStart;r>=0;r--){let t,i=null;r?(i=Ut(this.unplaced.content,r-1).firstChild,t=i.content):t=this.unplaced.content;let n=t.firstChild;for(let t=this.depth;t>=0;t--){let h,{type:l,match:o}=this.frontier[t],u=null;if(1==e&&(n?o.matchType(n.type)||(u=o.fillBefore(s.from(n),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:t,parent:i,inject:u};if(2==e&&n&&(h=o.findWrapping(n.type)))return{sliceDepth:r,frontierDepth:t,parent:i,wrap:h};if(i&&o.matchType(i.type))break}}}openMore(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=Ut(t,e);return!(!i.childCount||i.firstChild.isLeaf)&&(this.unplaced=new a(t,e+1,Math.max(r,i.size+e>=t.size-r?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=Ut(t,e);if(i.childCount<=1&&e>0){let n=t.size-e<=e+i.size;this.unplaced=new a(zt(t,e-1,1),e-1,n?e-1:r)}else this.unplaced=new a(zt(t,e,1),e,r)}placeNodes({sliceDepth:t,frontierDepth:e,parent:r,inject:i,wrap:n}){for(;this.depth>e;)this.closeFrontierNode();if(n)for(let t=0;t<n.length;t++)this.openFrontierNode(n[t]);let h=this.unplaced,l=r?r.content:h.content,o=h.openStart-t,u=0,f=[],{match:c,type:p}=this.frontier[e];if(i){for(let t=0;t<i.childCount;t++)f.push(i.child(t));c=c.matchFragment(i)}let d=l.size+t-(h.content.size-h.openEnd);for(;u<l.childCount;){let t=l.child(u),e=c.matchType(t.type);if(!e)break;u++,(u>1||0==o||t.content.size)&&(c=e,f.push(_t(t.mark(p.allowedMarks(t.marks)),1==u?o:0,u==l.childCount?d:-1)))}let w=u==l.childCount;w||(d=-1),this.placed=Pt(this.placed,e,s.from(f)),this.frontier[e].match=c,w&&d<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=l;t<d;t++){let t=e.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),e=t.content}this.unplaced=w?0==t?a.empty:new a(zt(h.content,t-1,1),t-1,d<0?h.openEnd:t-1):new a(zt(h.content,t,u),h.openStart,h.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!Lt(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:r,type:i}=this.frontier[e],n=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=Lt(t,e,i,r,n);if(s){for(let r=e-1;r>=0;r--){let{match:e,type:i}=this.frontier[r],n=Lt(t,r,i,e,!0);if(!n||n.childCount)continue t}return{depth:e,fit:s,move:n?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Pt(this.placed,e.depth,e.fit)),t=e.move;for(let r=e.depth+1;r<=t.depth;r++){let e=t.node(r),i=e.type.contentMatch.fillBefore(e.content,!0,t.index(r));this.openFrontierNode(e.type,e.attrs,i)}return t}openFrontierNode(t,e=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Pt(this.placed,this.depth,s.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(s.empty,!0);t.childCount&&(this.placed=Pt(this.placed,this.frontier.length,t))}}function zt(t,e,r){return 0==e?t.cutByIndex(r,t.childCount):t.replaceChild(0,t.firstChild.copy(zt(t.firstChild.content,e-1,r)))}function Pt(t,e,r){return 0==e?t.append(r):t.replaceChild(t.childCount-1,t.lastChild.copy(Pt(t.lastChild.content,e-1,r)))}function Ut(t,e){for(let r=0;r<e;r++)t=t.firstChild.content;return t}function _t(t,e,r){if(e<=0)return t;let i=t.content;return e>1&&(i=i.replaceChild(0,_t(i.firstChild,e-1,1==i.childCount?r-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),r<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(s.empty,!0)))),t.copy(i)}function Lt(t,e,r,i,n){let s=t.node(e),h=n?t.indexAfter(e):t.index(e);if(h==s.childCount&&!r.compatibleContent(s.type))return null;let l=i.fillBefore(s.content,!0,h);return l&&!function(t,e,r){for(let i=r;i<e.childCount;i++)if(!t.allowsMarks(e.child(i).marks))return!0;return!1}(r,s.content,h)?l:null}function Gt(t,e,r,i,n){if(e<r){let n=t.firstChild;t=t.replaceChild(0,n.copy(Gt(n.content,e+1,r,i,n)))}if(e>i){let e=n.contentMatchAt(0),r=e.fillBefore(t).append(t);t=r.append(e.matchFragment(r).fillBefore(s.empty,!0))}return t}function Vt(t,e){let r=[];for(let i=Math.min(t.depth,e.depth);i>=0;i--){let n=t.start(i);if(n<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(n==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==n-1)&&r.push(i)}return r}class Ht extends yt{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return St.fail("No node at attribute step's position");let r=Object.create(null);for(let t in e.attrs)r[t]=e.attrs[t];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return St.fromReplace(t,this.pos,this.pos+1,new a(s.from(i),0,e.isLeaf?0:1))}getMap(){return wt.empty}invert(t){return new Ht(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ht(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ht(e.pos,e.attr,e.value)}}yt.jsonID("attr",Ht);class Kt extends yt{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let r in t.attrs)e[r]=t.attrs[r];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return St.ok(r)}getMap(){return wt.empty}invert(t){return new Kt(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if("string"!=typeof e.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Kt(e.attr,e.value)}}yt.jsonID("docAttr",Kt);let Qt=class extends Error{};Qt=function t(e){let r=Error.call(this,e);return r.__proto__=t.prototype,r},(Qt.prototype=Object.create(Error.prototype)).constructor=Qt,Qt.prototype.name="TransformError";class Xt{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new gt}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Qt(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,e=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(t=i.map(t,1),e=i.map(e,-1)),i.forEach(((r,i,n,s)=>{t=Math.min(t,n),e=Math.max(e,s)}))}return 1e9==t?null:{from:t,to:e}}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,r=a.empty){let i=Ft(this.doc,t,e,r);return i&&this.step(i),this}replaceWith(t,e,r){return this.replace(t,e,new a(s.from(r),0,0))}delete(t,e){return this.replace(t,e,a.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return function(t,e,r,i){if(!i.size)return t.deleteRange(e,r);let n=t.doc.resolve(e),s=t.doc.resolve(r);if(qt(n,s,i))return t.step(new Nt(e,r,i));let h=Vt(n,s);0==h[h.length-1]&&h.pop();let l=-(n.depth+1);h.unshift(l);for(let t=n.depth,e=n.pos-1;t>0;t--,e--){let r=n.node(t).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;h.indexOf(t)>-1?l=t:n.before(t)==e&&h.splice(1,0,-t)}let o=h.indexOf(l),u=[],f=i.openStart;for(let t=i.content,e=0;;e++){let r=t.firstChild;if(u.push(r),e==i.openStart)break;t=r.content}for(let t=f-1;t>=0;t--){let e=u[t],r=(c=e.type).spec.defining||c.spec.definingForContent;if(r&&!e.sameMarkup(n.node(Math.abs(l)-1)))f=t;else if(r||!e.type.isTextblock)break}var c;for(let e=i.openStart;e>=0;e--){let l=(e+f+1)%(i.openStart+1),c=u[l];if(c)for(let e=0;e<h.length;e++){let u=h[(e+o)%h.length],f=!0;u<0&&(f=!1,u=-u);let p=n.node(u-1),d=n.index(u-1);if(p.canReplaceWith(d,d,c.type,c.marks))return t.replace(n.before(u),f?s.after(u):r,new a(Gt(i.content,0,i.openStart,l),l,i.openEnd))}}let p=t.steps.length;for(let l=h.length-1;l>=0&&(t.replace(e,r,i),!(t.steps.length>p));l--){let t=h[l];t<0||(e=n.before(t),r=s.after(t))}}(this,t,e,r),this}replaceRangeWith(t,e,r){return function(t,e,r,i){if(!i.isInline&&e==r&&t.doc.resolve(e).parent.content.size){let n=function(t,e,r){let i=t.resolve(e);if(i.parent.canReplaceWith(i.index(),i.index(),r))return e;if(0==i.parentOffset)for(let t=i.depth-1;t>=0;t--){let e=i.index(t);if(i.node(t).canReplaceWith(e,e,r))return i.before(t+1);if(e>0)return null}if(i.parentOffset==i.parent.content.size)for(let t=i.depth-1;t>=0;t--){let e=i.indexAfter(t);if(i.node(t).canReplaceWith(e,e,r))return i.after(t+1);if(e<i.node(t).childCount)return null}return null}(t.doc,e,i.type);null!=n&&(e=r=n)}t.replaceRange(e,r,new a(s.from(i),0,0))}(this,t,e,r),this}deleteRange(t,e){return function(t,e,r){let i=t.doc.resolve(e),n=t.doc.resolve(r);if(i.parent.isTextblock&&n.parent.isTextblock&&i.start()!=n.start()&&0==i.parentOffset&&0==n.parentOffset){let s=i.sharedDepth(r),h=!1;for(let t=i.depth;t>s;t--)i.node(t).type.spec.isolating&&(h=!0);for(let t=n.depth;t>s;t--)n.node(t).type.spec.isolating&&(h=!0);if(!h){for(let t=i.depth;t>0&&e==i.start(t);t--)e=i.before(t);for(let t=n.depth;t>0&&r==n.start(t);t--)r=n.before(t);i=t.doc.resolve(e),n=t.doc.resolve(r)}}let s=Vt(i,n);for(let e=0;e<s.length;e++){let r=s[e],h=e==s.length-1;if(h&&0==r||i.node(r).type.contentMatch.validEnd)return t.delete(i.start(r),n.end(r));if(r>0&&(h||i.node(r-1).canReplace(i.index(r-1),n.indexAfter(r-1))))return t.delete(i.before(r),n.after(r))}for(let s=1;s<=i.depth&&s<=n.depth;s++)if(e-i.start(s)==i.depth-s&&r>i.end(s)&&n.end(s)-r!=n.depth-s&&i.start(s-1)==n.start(s-1)&&i.node(s-1).canReplace(i.index(s-1),n.index(s-1)))return t.delete(i.before(s),r);t.delete(e,r)}(this,t,e),this}lift(t,e){return function(t,e,r){let{$from:i,$to:n,depth:h}=e,l=i.before(h+1),o=n.after(h+1),u=l,f=o,c=s.empty,p=0;for(let t=h,e=!1;t>r;t--)e||i.index(t)>0?(e=!0,c=s.from(i.node(t).copy(c)),p++):u--;let d=s.empty,w=0;for(let t=h,e=!1;t>r;t--)e||n.after(t+1)<n.end(t)?(e=!0,d=s.from(n.node(t).copy(d)),w++):f++;t.step(new Ot(u,f,l,o,new a(c.append(d),p,w),c.size-p,!0))}(this,t,e),this}join(t,e=1){return function(t,e,r){let i=null,{linebreakReplacement:n}=t.doc.type.schema,s=t.doc.resolve(e-r),h=s.node().type;if(n&&h.inlineContent){let t="pre"==h.whitespace,e=!!h.contentMatch.matchType(n);t&&!e?i=!1:!t&&e&&(i=!0)}let l=t.steps.length;if(!1===i){let i=t.doc.resolve(e+r);Ct(t,i.node(),i.before(),l)}h.inlineContent&&Mt(t,e+r-1,h,s.node().contentMatchAt(s.index()),null==i);let o=t.mapping.slice(l),u=o.map(e-r);if(t.step(new Nt(u,o.map(e+r,-1),a.empty,!0)),!0===i){let e=t.doc.resolve(u);jt(t,e.node(),e.before(),t.steps.length)}}(this,t,e),this}wrap(t,e){return function(t,e,r){let i=s.empty;for(let t=r.length-1;t>=0;t--){if(i.size){let e=r[t].type.contentMatch.matchFragment(i);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=s.from(r[t].type.create(r[t].attrs,i))}let n=e.start,h=e.end;t.step(new Ot(n,h,n,h,new a(i,0,0),r.length,!0))}(this,t,e),this}setBlockType(t,e=t,r,i=null){return function(t,e,r,i,n){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let h=t.steps.length;t.doc.nodesBetween(e,r,((e,r)=>{let l="function"==typeof n?n(e):n;if(e.isTextblock&&!e.hasMarkup(i,l)&&function(t,e,r){let i=t.resolve(e),n=i.index();return i.parent.canReplaceWith(n,n+1,r)}(t.doc,t.mapping.slice(h).map(r),i)){let n=null;if(i.schema.linebreakReplacement){let t="pre"==i.whitespace,e=!!i.contentMatch.matchType(i.schema.linebreakReplacement);t&&!e?n=!1:!t&&e&&(n=!0)}!1===n&&Ct(t,e,r,h),Mt(t,t.mapping.slice(h).map(r,1),i,void 0,null===n);let o=t.mapping.slice(h),u=o.map(r,1),f=o.map(r+e.nodeSize,1);return t.step(new Ot(u,f,u+1,f-1,new a(s.from(i.create(l,null,e.marks)),0,0),1,!0)),!0===n&&jt(t,e,r,h),!1}}))}(this,t,e,r,i),this}setNodeMarkup(t,e,r=null,i){return function(t,e,r,i,n){let h=t.doc.nodeAt(e);if(!h)throw new RangeError("No node at given position");r||(r=h.type);let l=r.create(i,null,n||h.marks);if(h.isLeaf)return t.replaceWith(e,e+h.nodeSize,l);if(!r.validContent(h.content))throw new RangeError("Invalid content for node type "+r.name);t.step(new Ot(e,e+h.nodeSize,e+1,e+h.nodeSize-1,new a(s.from(l),0,0),1,!0))}(this,t,e,r,i),this}setNodeAttribute(t,e,r){return this.step(new Ht(t,e,r)),this}setDocAttribute(t,e){return this.step(new Kt(t,e)),this}addNodeMark(t,e){return this.step(new xt(t,e)),this}removeNodeMark(t,e){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(e instanceof u)e.isInSet(r.marks)&&this.step(new Et(t,e));else{let i,n=r.marks,s=[];for(;i=e.isInSet(n);)s.push(new Et(t,i)),n=i.removeFromSet(n);for(let t=s.length-1;t>=0;t--)this.step(s[t])}return this}split(t,e=1,r){return function(t,e,r=1,i){let n=t.doc.resolve(e),h=s.empty,l=s.empty;for(let t=n.depth,e=n.depth-r,o=r-1;t>e;t--,o--){h=s.from(n.node(t).copy(h));let e=i&&i[o];l=s.from(e?e.type.create(e.attrs,l):n.node(t).copy(l))}t.step(new Nt(e,e,new a(h.append(l),r,r),!0))}(this,t,e,r),this}addMark(t,e,r){return function(t,e,r,i){let n,s,h=[],l=[];t.doc.nodesBetween(e,r,((t,o,u)=>{if(!t.isInline)return;let f=t.marks;if(!i.isInSet(f)&&u.type.allowsMarkType(i.type)){let u=Math.max(o,e),a=Math.min(o+t.nodeSize,r),c=i.addToSet(f);for(let t=0;t<f.length;t++)f[t].isInSet(c)||(n&&n.to==u&&n.mark.eq(f[t])?n.to=a:h.push(n=new kt(u,a,f[t])));s&&s.to==u?s.to=a:l.push(s=new vt(u,a,i))}})),h.forEach((e=>t.step(e))),l.forEach((e=>t.step(e)))}(this,t,e,r),this}removeMark(t,e,r){return function(t,e,r,i){let n=[],s=0;t.doc.nodesBetween(e,r,((t,h)=>{if(!t.isInline)return;s++;let l=null;if(i instanceof V){let e,r=t.marks;for(;e=i.isInSet(r);)(l||(l=[])).push(e),r=e.removeFromSet(r)}else i?i.isInSet(t.marks)&&(l=[i]):l=t.marks;if(l&&l.length){let i=Math.min(h+t.nodeSize,r);for(let t=0;t<l.length;t++){let r,o=l[t];for(let t=0;t<n.length;t++){let e=n[t];e.step==s-1&&o.eq(n[t].style)&&(r=e)}r?(r.to=i,r.step=s):n.push({style:o,from:Math.max(h,e),to:i,step:s})}}})),n.forEach((e=>t.step(new kt(e.from,e.to,e.style))))}(this,t,e,r),this}clearIncompatible(t,e,r){return Mt(this,t,e,r),this}}const Yt=Object.create(null);class Zt{constructor(t,e,r){this.$anchor=t,this.$head=e,this.ranges=r||[new te(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=a.empty){let r=e.content.lastChild,i=null;for(let t=0;t<e.openEnd;t++)i=r,r=r.lastChild;let n=t.steps.length,s=this.ranges;for(let h=0;h<s.length;h++){let{$from:l,$to:o}=s[h],u=t.mapping.slice(n);t.replaceRange(u.map(l.pos),u.map(o.pos),h?a.empty:e),0==h&&fe(t,n,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,e){let r=t.steps.length,i=this.ranges;for(let n=0;n<i.length;n++){let{$from:s,$to:h}=i[n],l=t.mapping.slice(r),o=l.map(s.pos),u=l.map(h.pos);n?t.deleteRange(o,u):(t.replaceRangeWith(o,u,e),fe(t,r,e.isInline?-1:1))}}static findFrom(t,e,r=!1){let i=t.parent.inlineContent?new ie(t):ue(t.node(0),t.parent,t.pos,t.index(),e,r);if(i)return i;for(let i=t.depth-1;i>=0;i--){let n=e<0?ue(t.node(0),t.node(i),t.before(i+1),t.index(i),e,r):ue(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,r);if(n)return n}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new le(t.node(0))}static atStart(t){return ue(t,t,0,0,1)||new le(t)}static atEnd(t){return ue(t,t,t.content.size,t.childCount,-1)||new le(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Yt[e.type];if(!r)throw new RangeError(`No selection type ${e.type} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in Yt)throw new RangeError("Duplicate use of selection JSON ID "+t);return Yt[t]=e,e.prototype.jsonID=t,e}getBookmark(){return ie.between(this.$anchor,this.$head).getBookmark()}}Zt.prototype.visible=!0;class te{constructor(t,e){this.$from=t,this.$to=e}}let ee=!1;function re(t){ee||t.parent.inlineContent||(ee=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ie extends Zt{constructor(t,e=t){re(t),re(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let r=t.resolve(e.map(this.head));if(!r.parent.inlineContent)return Zt.near(r);let i=t.resolve(e.map(this.anchor));return new ie(i.parent.inlineContent?i:r,r)}replace(t,e=a.empty){if(super.replace(t,e),e==a.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof ie&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new ne(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new ie(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,r=e){let i=t.resolve(e);return new this(i,r==e?i:t.resolve(r))}static between(t,e,r){let i=t.pos-e.pos;if(r&&!i||(r=i>=0?1:-1),!e.parent.inlineContent){let t=Zt.findFrom(e,r,!0)||Zt.findFrom(e,-r,!0);if(!t)return Zt.near(e,r);e=t.$head}return t.parent.inlineContent||(0==i||(t=(Zt.findFrom(t,-r,!0)||Zt.findFrom(t,r,!0)).$anchor).pos<e.pos!=i<0)&&(t=e),new ie(t,e)}}Zt.jsonID("text",ie);class ne{constructor(t,e){this.anchor=t,this.head=e}map(t){return new ne(t.map(this.anchor),t.map(this.head))}resolve(t){return ie.between(t.resolve(this.anchor),t.resolve(this.head))}}class se extends Zt{constructor(t){let e=t.nodeAfter,r=t.node(0).resolve(t.pos+e.nodeSize);super(t,r),this.node=e}map(t,e){let{deleted:r,pos:i}=e.mapResult(this.anchor),n=t.resolve(i);return r?Zt.near(n):new se(n)}content(){return new a(s.from(this.node),0,0)}eq(t){return t instanceof se&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new he(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new se(t.resolve(e.anchor))}static create(t,e){return new se(t.resolve(e))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}}se.prototype.visible=!1,Zt.jsonID("node",se);class he{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:r}=t.mapResult(this.anchor);return e?new ne(r,r):new he(r)}resolve(t){let e=t.resolve(this.anchor),r=e.nodeAfter;return r&&se.isSelectable(r)?new se(e):Zt.near(e)}}class le extends Zt{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=a.empty){if(e==a.empty){t.delete(0,t.doc.content.size);let e=Zt.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new le(t)}map(t){return new le(t)}eq(t){return t instanceof le}getBookmark(){return oe}}Zt.jsonID("all",le);const oe={map(){return this},resolve:t=>new le(t)};function ue(t,e,r,i,n,s=!1){if(e.inlineContent)return ie.create(t,r);for(let h=i-(n>0?0:1);n>0?h<e.childCount:h>=0;h+=n){let i=e.child(h);if(i.isAtom){if(!s&&se.isSelectable(i))return se.create(t,r-(n<0?i.nodeSize:0))}else{let e=ue(t,i,r+n,n<0?i.childCount:0,n,s);if(e)return e}r+=i.nodeSize*n}return null}function fe(t,e,r){let i=t.steps.length-1;if(i<e)return;let n,s=t.steps[i];(s instanceof Nt||s instanceof Ot)&&(t.mapping.maps[i].forEach(((t,e,r,i)=>{null==n&&(n=i)})),t.setSelection(Zt.near(t.doc.resolve(n),r)))}class ae extends Xt{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){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}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return u.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let r=this.selection;return e&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||u.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,r){let i=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(null==r&&(r=e),!t)return this.deleteRange(e,r);let n=this.storedMarks;if(!n){let t=this.doc.resolve(e);n=r==e?t.marks():t.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(e,r,i.text(t,n)),this.selection.empty||this.selection.to!=e+t.length||this.setSelection(Zt.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function ce(t,e){return e&&t?t.bind(e):t}class pe{constructor(t,e,r){this.name=t,this.init=ce(e.init,r),this.apply=ce(e.apply,r)}}const de=[new pe("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new pe("selection",{init:(t,e)=>t.selection||Zt.atStart(e.doc),apply:t=>t.selection}),new pe("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,r,i)=>i.selection.$cursor?t.storedMarks:null}),new pe("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e})];class we{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=de.slice(),e&&e.forEach((t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new pe(t.key,t.spec.state,t))}))}}class ge{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=e){let e=this.config.plugins[r];if(e.spec.filterTransaction&&!e.spec.filterTransaction.call(e,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],r=this.applyInner(t),i=null;for(;;){let n=!1;for(let s=0;s<this.config.plugins.length;s++){let h=this.config.plugins[s];if(h.spec.appendTransaction){let l=i?i[s].n:0,o=i?i[s].state:this,u=l<e.length&&h.spec.appendTransaction.call(h,l?e.slice(l):e,o,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",t),!i){i=[];for(let t=0;t<this.config.plugins.length;t++)i.push(t<s?{state:r,n:e.length}:{state:this,n:0})}e.push(u),r=r.applyInner(u),n=!0}i&&(i[s]={state:r,n:e.length})}}if(!n)return{state:r,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new ge(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let n=r[i];e[n.name]=n.apply(t,this[n.name],this,e)}return e}get tr(){return new ae(this)}static create(t){let e=new we(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new ge(e);for(let i=0;i<e.fields.length;i++)r[e.fields[i].name]=e.fields[i].init(t,r);return r}reconfigure(t){let e=new we(this.schema,t.plugins),r=e.fields,i=new ge(e);for(let e=0;e<r.length;e++){let n=r[e].name;i[n]=this.hasOwnProperty(n)?this[n]:r[e].init(t,i)}return i}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((t=>t.toJSON()))),t&&"object"==typeof t)for(let r in t){if("doc"==r||"selection"==r)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],n=i.spec.state;n&&n.toJSON&&(e[r]=n.toJSON.call(i,this[i.key]))}return e}static fromJSON(t,e,r){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new we(t.schema,t.plugins),n=new ge(i);return i.fields.forEach((i=>{if("doc"==i.name)n.doc=J.fromJSON(t.schema,e.doc);else if("selection"==i.name)n.selection=Zt.fromJSON(n.doc,e.selection);else if("storedMarks"==i.name)e.storedMarks&&(n.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let s in r){let h=r[s],l=h.spec.state;if(h.key==i.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(e,s))return void(n[i.name]=l.fromJSON.call(h,t,e[s],n))}n[i.name]=i.init(t,n)}})),n}}function me(t,e,r){for(let i in t){let n=t[i];n instanceof Function?n=n.bind(e):"handleDOMEvents"==i&&(n=me(n,e,{})),r[i]=n}return r}class ye{constructor(t){this.spec=t,this.props={},t.props&&me(t.props,this,this.props),this.key=t.key?t.key.key:be("plugin")}getState(t){return t[this.key]}}const Se=Object.create(null);function be(t){return t in Se?t+"$"+ ++Se[t]:(Se[t]=0,t+"$")}class ve{constructor(t="key"){this.key=be(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}export{le as A,Q as D,ge as E,s as F,u as M,J as N,t as O,ve as P,Ot as R,Zt as S,ie as T,ht as a,ye as b,se as c,a as d,Bt as e,Tt as f,Dt as g,R as h,$t as i,H as j,te as k,It as l,Xt as m,gt as n,Ft as r};