@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 +1 @@
1
- import{l as t,f as e,k as n,S as r,A as i,T as u,i as s,c as o,r as l,d as f,F as c,R as a,g as h,P as d,b as m,n as p}from"../../index-6f3fa4ab.esm.js";import{l as g,a as w,w as v,M as $,b}from"./schema.esm.js";import{d as M,e as y,s as k,m as C,f as j,g as x,h as B,i as A,j as L,l as H}from"../../index-7b1c9857.esm.js";import"./plugins/embeds.esm.js";import"../../index-ba47645d.esm.js";import"../../index-920675c4.esm.js";const S=(t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function T(t,e,n=!1){for(let r=t;r;r="start"==e?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function E(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function F(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const I=(e,n)=>{let{$from:r,$to:i}=e.selection,u=r.blockRange(i),s=u&&t(u);return null!=s&&(n&&n(e.tr.lift(u,s).scrollIntoView()),!0)};function R(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const _=(t,e)=>{let{$head:n,$anchor:i}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(i))return!1;let u=n.node(-1),s=n.indexAfter(-1),o=R(u.contentMatchAt(s));if(!o||!u.canReplaceWith(s,s,o))return!1;if(e){let i=n.after(),u=t.tr.replaceWith(i,i,o.createAndFill());u.setSelection(r.near(u.doc.resolve(i),1)),e(u.scrollIntoView())}return!0};const D=(t,e)=>{if(t.selection instanceof o&&t.selection.node.isBlock){let{$from:n}=t.selection;return!(!n.parentOffset||!s(t.doc,n.pos)||(e&&e(t.tr.split(n.pos).scrollIntoView()),0))}if(!t.selection.$from.depth)return!1;let n=t.tr;!t.selection.empty&&(t.selection instanceof u||t.selection instanceof i)&&n.deleteSelection();let r,l,{$from:f}=n.selection,c=n.steps.length,a=[],h=!1,d=!1;for(let t=f.depth;;t--){if(f.node(t).isBlock){h=f.end(t)==f.pos+(f.depth-t),d=f.start(t)==f.pos-(f.depth-t),l=R(f.node(t-1).contentMatchAt(f.indexAfter(t-1)));let e=O&&O(f.parent,h,f);a.unshift(e||(h&&l?{type:l}:null)),r=t;break}if(1==t)return!1;a.unshift(null)}let m=f.pos,p=s(n.doc,m,a.length,a);if(p||(a[0]=l?{type:l}:null,p=s(n.doc,m,a.length,a)),!p)return!1;if(n.split(m,a.length,a),!h&&d&&f.node(r).type!=l){let t=n.mapping.slice(c),e=t.map(f.before(r)),i=n.doc.resolve(e);l&&f.node(r-1).canReplaceWith(i.index(),i.index()+1,l)&&n.setNodeMarkup(t.map(f.before(r)),l)}return e&&e(n.scrollIntoView()),!0};var O;function z(e,n,i,u){let s,o,l=n.nodeBefore,d=n.nodeAfter,m=l.type.spec.isolating||d.type.spec.isolating;if(!m&&function(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,u=e.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&e.parent.canReplace(u-1,u)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(u,u+1)||!i.isTextblock&&!h(t.doc,e.pos)||(n&&n(t.tr.join(e.pos).scrollIntoView()),0)))}(e,n,i))return!0;let p=!m&&n.parent.canReplace(n.index(),n.index()+1);if(p&&(s=(o=l.contentMatchAt(l.childCount)).findWrapping(d.type))&&o.matchType(s[0]||d.type).validEnd){if(i){let t=n.pos+d.nodeSize,r=c.empty;for(let t=s.length-1;t>=0;t--)r=c.from(s[t].create(null,r));r=c.from(l.copy(r));let u=e.tr.step(new a(n.pos-1,t,n.pos,t,new f(r,1,0),s.length,!0)),o=u.doc.resolve(t+2*s.length);o.nodeAfter&&o.nodeAfter.type==l.type&&h(u.doc,o.pos)&&u.join(o.pos),i(u.scrollIntoView())}return!0}let g=d.type.spec.isolating||u>0&&m?null:r.findFrom(n,1),w=g&&g.$from.blockRange(g.$to),v=w&&t(w);if(null!=v&&v>=n.depth)return i&&i(e.tr.lift(w,v).scrollIntoView()),!0;if(p&&T(d,"start",!0)&&T(l,"end")){let t=l,r=[];for(;r.push(t),!t.isTextblock;)t=t.lastChild;let u=d,s=1;for(;!u.isTextblock;u=u.firstChild)s++;if(t.canReplace(t.childCount,t.childCount,u.content)){if(i){let t=c.empty;for(let e=r.length-1;e>=0;e--)t=c.from(r[e].copy(t));i(e.tr.step(new a(n.pos-r.length,n.pos+d.nodeSize,n.pos+s,n.pos+d.nodeSize-s,new f(t,r.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function P(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(e.tr.setSelection(u.create(e.doc,t<0?i.start(s):i.end(s)))),!0)}}const q=P(-1),G=P(1);function U(t,e=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:u},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(u,s,((r,u)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)i=!0;else{let e=n.doc.resolve(u),r=e.index();i=e.parent.canReplaceWith(r,r+1,t)}}))}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:u},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(u,s,t,e)}r(i.scrollIntoView())}return!0}}function W(t,e=null,r){let i=!1!==(r&&r.removeWhenPresent),u=!1!==(r&&r.enterInlineAtoms),s=!(r&&r.includeWhitespace);return function(r,o){let{empty:l,$cursor:f,ranges:c}=r.selection;if(l&&!f||!function(t,e,n,r){for(let i=0;i<e.length;i++){let{$from:u,$to:s}=e[i],o=0==u.depth&&t.inlineContent&&t.type.allowsMarkType(n);if(t.nodesBetween(u.pos,s.pos,((t,e)=>{if(o||!r&&t.isAtom&&t.isInline&&e>=u.pos&&e+t.nodeSize<=s.pos)return!1;o=t.inlineContent&&t.type.allowsMarkType(n)})),o)return!0}return!1}(r.doc,c,t,u))return!1;if(o)if(f)t.isInSet(r.storedMarks||f.marks())?o(r.tr.removeStoredMark(t)):o(r.tr.addStoredMark(t.create(e)));else{let l,f=r.tr;u||(c=function(t){let e=[];for(let r=0;r<t.length;r++){let{$from:i,$to:u}=t[r];i.doc.nodesBetween(i.pos,u.pos,((t,r)=>{if(t.isAtom&&t.content.size&&t.isInline&&r>=i.pos&&r+t.nodeSize<=u.pos)return r+1>i.pos&&e.push(new n(i,i.doc.resolve(r+1))),i=i.doc.resolve(r+1+t.content.size),!1})),i.pos<u.pos&&e.push(new n(i,u))}return e}(c)),l=i?!c.some((e=>r.doc.rangeHasMark(e.$from.pos,e.$to.pos,t))):!c.every((e=>{let n=!1;return f.doc.nodesBetween(e.$from.pos,e.$to.pos,((r,i,u)=>{if(n)return!1;n=!t.isInSet(r.marks)&&!!u&&u.type.allowsMarkType(t)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,e.$from.pos-i),Math.min(r.nodeSize,e.$to.pos-i))))})),!n}));for(let n=0;n<c.length;n++){let{$from:r,$to:i}=c[n];if(l){let n=r.pos,u=i.pos,o=r.nodeAfter,l=i.nodeBefore,c=s&&o&&o.isText?/^\s*/.exec(o.text)[0].length:0,a=s&&l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<u&&(n+=c,u-=a),f.addMark(n,u,t.create(e))}else f.removeMark(r.pos,i.pos,t)}o(f.scrollIntoView())}return!0}}function J(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}let K=J(S,((e,n,i)=>{let u=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}(e,i);if(!u)return!1;let s=E(u);if(!s){let r=u.blockRange(),i=r&&t(r);return null!=i&&(n&&n(e.tr.lift(r,i).scrollIntoView()),!0)}let c=s.nodeBefore;if(z(e,s,n,-1))return!0;if(0==u.parent.content.size&&(T(c,"end")||o.isSelectable(c)))for(let t=u.depth;;t--){let i=l(e.doc,u.before(t),u.after(t),f.empty);if(i&&i.slice.size<i.to-i.from){if(n){let t=e.tr.step(i);t.setSelection(T(c,"end")?r.findFrom(t.doc.resolve(t.mapping.map(s.pos,-1)),-1):o.create(t.doc,s.pos-c.nodeSize)),n(t.scrollIntoView())}return!0}if(1==t||u.node(t-1).childCount>1)break}return!(!c.isAtom||s.depth!=u.depth-1)&&(n&&n(e.tr.delete(s.pos-c.nodeSize,s.pos).scrollIntoView()),!0)}),((t,e,n)=>{let{$head:r,empty:i}=t.selection,u=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;u=E(r)}let s=u&&u.nodeBefore;return!(!s||!o.isSelectable(s))&&(e&&e(t.tr.setSelection(o.create(t.doc,u.pos-s.nodeSize)).scrollIntoView()),!0)})),N=J(S,((t,e,n)=>{let i=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}(t,n);if(!i)return!1;let u=F(i);if(!u)return!1;let s=u.nodeAfter;if(z(t,u,e,1))return!0;if(0==i.parent.content.size&&(T(s,"start")||o.isSelectable(s))){let n=l(t.doc,i.before(),i.after(),f.empty);if(n&&n.slice.size<n.to-n.from){if(e){let i=t.tr.step(n);i.setSelection(T(s,"start")?r.findFrom(i.doc.resolve(i.mapping.map(u.pos)),1):o.create(i.doc,i.mapping.map(u.pos))),e(i.scrollIntoView())}return!0}}return!(!s.isAtom||u.depth!=i.depth-1)&&(e&&e(t.tr.delete(u.pos,u.pos+s.nodeSize).scrollIntoView()),!0)}),((t,e,n)=>{let{$head:r,empty:i}=t.selection,u=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;u=F(r)}let s=u&&u.nodeAfter;return!(!s||!o.isSelectable(s))&&(e&&e(t.tr.setSelection(o.create(t.doc,u.pos)).scrollIntoView()),!0)}));const Q={Enter:J(((t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}),((t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof i||r.parent.inlineContent||s.parent.inlineContent)return!1;let o=R(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let n=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,i=t.tr.insert(n,o.createAndFill());i.setSelection(u.create(i.doc,n+1)),e(i.scrollIntoView())}return!0}),((e,n)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let t=r.before();if(s(e.doc,t))return n&&n(e.tr.split(t).scrollIntoView()),!0}let i=r.blockRange(),u=i&&t(i);return null!=u&&(n&&n(e.tr.lift(i,u).scrollIntoView()),!0)}),D),"Mod-Enter":_,Backspace:K,"Mod-Backspace":K,"Shift-Backspace":K,Delete:N,"Mod-Delete":N,"Mod-a":(t,e)=>(e&&e(t.tr.setSelection(new i(t.doc))),!0)},V={"Ctrl-h":Q.Backspace,"Alt-Backspace":Q["Mod-Backspace"],"Ctrl-d":Q.Delete,"Ctrl-Alt-Backspace":Q["Mod-Delete"],"Alt-Delete":Q["Mod-Delete"],"Alt-d":Q["Mod-Delete"],"Ctrl-a":q,"Ctrl-e":G};for(let t in Q)V[t]=Q[t];const X=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?V:Q;var Y=200,Z=function(){};Z.prototype.append=function(t){return t.length?(t=Z.from(t),!this.length&&t||t.length<Y&&this.leafAppend(t)||this.length<Y&&t.leafPrepend(this)||this.appendInner(t)):this},Z.prototype.prepend=function(t){return t.length?Z.from(t).append(this):this},Z.prototype.appendInner=function(t){return new et(this,t)},Z.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Z.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Z.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Z.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Z.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Z.from=function(t){return t instanceof Z?t:t&&t.length?new tt(t):Z.empty};var tt=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var i=e;i<n;i++)if(!1===t(this.values[i],r+i))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var i=e-1;i>=n;i--)if(!1===t(this.values[i],r+i))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Y)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Y)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Z);Z.empty=new tt([]);var et=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var i=this.left.length;return!(e<i&&!1===this.left.forEachInner(t,e,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(t,Math.max(e-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var i=this.left.length;return!(e>i&&!1===this.right.forEachInvertedInner(t,e-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(t,Math.min(e,i),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Z);class nt{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,r,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(n=this.remapping(i,this.items.length),r=n.maps.length);let u,s,o=t.tr,l=[],f=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(i,e+1),r=n.maps.length),r--,void f.push(t);if(n){f.push(new rt(t.map));let e,i=t.step.map(n.slice(r));i&&o.maybeStep(i).doc&&(e=o.mapping.maps[o.mapping.maps.length-1],l.push(new rt(e,void 0,void 0,l.length+f.length))),r--,e&&n.appendMap(e,r)}else o.maybeStep(t.step);return t.selection?(u=n?t.selection.map(n.slice(r)):t.selection,s=new nt(this.items.slice(0,i).append(f.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:o,selection:u}}addTransform(t,e,n,r){let i=[],u=this.eventCount,s=this.items,o=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<t.steps.length;n++){let l,f=t.steps[n].invert(t.docs[n]),c=new rt(t.mapping.maps[n],f,e);(l=o&&o.merge(c))&&(c=l,n?i.pop():s=s.slice(0,s.length-1)),i.push(c),e&&(u++,e=void 0),r||(o=c)}let l=u-n.depth;return l>ut&&(s=function(t,e){let n;return t.forEach(((t,r)=>{if(t.selection&&0==e--)return n=r,!1})),t.slice(n)}(s,l),u-=l),new nt(s.append(i),u)}remapping(t,e){let n=new p;return this.items.forEach(((e,r)=>{let i=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0;n.appendMap(e.map,i)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new nt(this.items.append(t.map((t=>new rt(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-e),i=t.mapping,u=t.steps.length,s=this.eventCount;this.items.forEach((t=>{t.selection&&s--}),r);let o=e;this.items.forEach((e=>{let r=i.getMirror(--o);if(null==r)return;u=Math.min(u,r);let l=i.maps[r];if(e.step){let u=t.steps[r].invert(t.docs[r]),f=e.selection&&e.selection.map(i.slice(o+1,r));f&&s++,n.push(new rt(l,u,f))}else n.push(new rt(l))}),r);let l=[];for(let t=e;t<u;t++)l.push(new rt(i.maps[t]));let f=this.items.slice(0,r).append(l).append(n),c=new nt(f,s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,r=[],i=0;return this.items.forEach(((u,s)=>{if(s>=t)r.push(u),u.selection&&i++;else if(u.step){let t=u.step.map(e.slice(n)),s=t&&t.getMap();if(n--,s&&e.appendMap(s,n),t){let o=u.selection&&u.selection.map(e.slice(n));o&&i++;let l,f=new rt(s.invert(),t,o),c=r.length-1;(l=r.length&&r[c].merge(f))?r[c]=l:r.push(f)}}else u.map&&n--}),this.items.length,0),new nt(Z.from(r.reverse()),i)}}nt.empty=new nt(Z.empty,0);class rt{constructor(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new rt(e.getMap().invert(),e,this.selection)}}}class it{constructor(t,e,n,r,i){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}const ut=20;function st(t){let e=[];for(let n=t.length-1;n>=0&&0==e.length;n--)t[n].forEach(((t,n,r,i)=>e.push(r,i)));return e}function ot(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),u=e.map(t[r+1],-1);i<=u&&n.push(i,u)}return n}let lt=!1,ft=null;function ct(t){let e=t.plugins;if(ft!=e){lt=!1,ft=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){lt=!0;break}}return lt}const at=new d("history"),ht=new d("closeHistory");function dt(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new m({key:at,state:{init:()=>new it(nt.empty,nt.empty,null,0,-1),apply:(e,n,r)=>function(t,e,n,r){let i,u=n.getMeta(at);if(u)return u.historyState;n.getMeta(ht)&&(t=new it(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(at))return s.getMeta(at).redo?new it(t.done.addTransform(n,void 0,r,ct(e)),t.undone,st(n.mapping.maps),t.prevTime,t.prevComposition):new it(t.done,t.undone.addTransform(n,void 0,r,ct(e)),null,t.prevTime,t.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new it(t.done.rebased(n,i),t.undone.rebased(n,i),ot(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new it(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ot(t.prevRanges,n.mapping),t.prevTime,t.prevComposition);{let i=n.getMeta("composition"),u=0==t.prevTime||!s&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,r)=>{for(let i=0;i<e.length;i+=2)t<=e[i+1]&&r>=e[i]&&(n=!0)})),n}(n,t.prevRanges)),o=s?ot(t.prevRanges,n.mapping):st(n.mapping.maps);return new it(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,ct(e)),nt.empty,o,n.time,null==i?t.prevComposition:i)}}(n,r,e,t)},config:t,props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,r="historyUndo"==n?pt:"historyRedo"==n?gt:null;return!(!r||!t.editable)&&(e.preventDefault(),r(t.state,t.dispatch))}}}})}function mt(t,e){return(n,r)=>{let i=at.getState(n);if(!i||0==(t?i.undone:i.done).eventCount)return!1;if(r){let u=function(t,e,n){let r=ct(e),i=at.get(e).spec.config,u=(n?t.undone:t.done).popEvent(e,r);if(!u)return null;let s=u.selection.resolve(u.transform.doc),o=(n?t.done:t.undone).addTransform(u.transform,e.selection.getBookmark(),i,r),l=new it(n?o:u.remaining,n?u.remaining:o,null,0,-1);return u.transform.setSelection(s).setMeta(at,{redo:n,historyState:l})}(i,n,t);u&&r(e?u.scrollIntoView():u)}return!0}}const pt=mt(!1,!0),gt=mt(!0,!0);function wt(t,e){const{parent:n,parentOffset:r}=t,i=n.childAfter(r);if(!i.node||!e.isInSet(i.node.marks))return null;let u=i.index,s=t.start()+i.offset;for(;u>0&&e.isInSet(n.child(u-1).marks);)u-=1,s-=n.child(u).nodeSize;let o=i.index+1,l=s+i.node.nodeSize;for(;o<n.childCount&&e.isInSet(n.child(o).marks);)l+=n.child(o).nodeSize,o+=1;return{from:s,to:l}}function vt(t,e){return(n,r)=>{const{empty:i,ranges:s,$from:o}=n.selection;if(i&&!(n.selection instanceof u&&n.selection.$cursor))return!1;if(!i&&!n.selection.content().content.firstChild)return!1;if(r){const u=n.tr;if(i)u.removeStoredMark(t),e&&u.addStoredMark(t.create(e));else{for(const n of s)u.removeMark(n.$from.pos,n.$to.pos,t),e&&u.addMark(n.$from.pos,n.$to.pos,t.create(e));u.scrollIntoView()}r(u)}return!0}}function $t(t){const{$from:e}=t.selection,{bullet_list:n,ordered_list:r,task_list:i}=t.schema.nodes;for(let t=e.depth;t>0;t-=1){const u=e.node(t);if(u.type===n||u.type===r||u.type===i)return{node:u,pos:e.before(t),depth:t}}return null}function bt(t){const{schema:e}=t;return t===e.nodes.task_list?e.nodes.task_item:e.nodes.list_item}function Mt(t,e){return(n,r,i)=>{const s=$t(n);if(s){if(s.node.type===t)return g(bt(s.node.type))(n,r,i);if(r){const i=bt(s.node.type),o=[];s.node.forEach((t=>{o.push(t.type===i&&i!==e?e.create(null,t.content,t.marks):t)}));const l=t.create(s.node.attrs,o),f=n.tr,{from:c,to:a}=n.selection;f.replaceWith(s.pos,s.pos+s.node.nodeSize,l),f.setSelection(u.create(f.doc,c,a)),r(f)}return!0}return v(t)(n,r,i)}}function yt(t){return(n,r,i)=>function(t,e){const{$from:n}=t.selection;for(let t=n.depth;t>0;t-=1)if(n.node(t).type===e)return!0;return!1}(n,t)?I(n,r):function(t,n=null){return function(r,i){let{$from:u,$to:s}=r.selection,o=u.blockRange(s),l=o&&e(o,t,n);return!!l&&(i&&i(r.tr.wrap(o,l).scrollIntoView()),!0)}}(t)(n,r,i)}function kt(t){return(e,n)=>{const{from:r,to:i}=e.selection,u=[];if(e.doc.nodesBetween(r,i,((e,n)=>{if(e.isTextblock&&e.type.spec.attrs&&"indent"in e.type.spec.attrs){const r=e.attrs.indent??0,i=Math.max(0,Math.min(b,r+t));i!==r&&u.push({pos:n,node:e,next:i})}return!0})),0===u.length)return!1;if(n){const t=e.tr;for(const{pos:e,node:n,next:r}of u)t.setNodeMarkup(e,void 0,{...n.attrs,indent:r});n(t)}return!0}}function Ct(t){const{image:e,figure:n}=t.schema.nodes,r=t.selection;if(r instanceof o){if(r.node.type===e)return{node:r.node,pos:r.from,isFigure:!1};if(r.node.type===n)return{node:r.node,pos:r.from,isFigure:!0}}const{$from:i}=r;for(let t=i.depth;t>0;t-=1)if(i.node(t).type===n)return{node:i.node(t),pos:i.before(t),isFigure:!0};return null}function jt(t){const e=t.selection;return e instanceof o&&e.node.type===t.schema.nodes.embed?{node:e.node,pos:e.from}:null}function xt(t,e,n={}){const{schema:r}=t,{nodes:i,marks:s}=r;switch(e){case"bold":return W(s.bold);case"italic":return W(s.italic);case"underline":return W(s.underline);case"strike":return W(s.strike);case"subscript":return W(s.subscript);case"superscript":return W(s.superscript);case"code":return W(s.code);case"paragraph":return U(i.paragraph);case"heading":return U(i.heading,{level:n.level??1});case"blockquote":return yt(i.blockquote);case"align":return p=n.align??null,(t,e)=>{const{from:n,to:r}=t.selection,i=[];if(t.doc.nodesBetween(n,r,((t,e)=>(t.isTextblock&&t.type.spec.attrs&&"align"in t.type.spec.attrs&&i.push({pos:e,node:t}),!0))),0===i.length)return!1;if(e){const n=t.tr;for(const{pos:t,node:e}of i)n.setNodeMarkup(t,void 0,{...e.attrs,align:p});e(n)}return!0};case"lineHeight":return m=n.lineHeight??null,(t,e)=>{const{from:n,to:r}=t.selection,i=[];if(t.doc.nodesBetween(n,r,((t,e)=>(t.isTextblock&&t.type.spec.attrs&&"lineHeight"in t.type.spec.attrs&&i.push({pos:e,node:t}),!0))),0===i.length)return!1;if(e){const n=t.tr;for(const{pos:t,node:e}of i)n.setNodeMarkup(t,void 0,{...e.attrs,lineHeight:m});e(n)}return!0};case"bulletList":return Mt(i.bullet_list,i.list_item);case"orderedList":return Mt(i.ordered_list,i.list_item);case"taskList":return Mt(i.task_list,i.task_item);case"indent":return J(w(i.task_item),w(i.list_item),kt(1));case"outdent":return J(g(i.task_item),g(i.list_item),kt(-1),I);case"setListStyle":return d=n.style??null,(t,e)=>{const n=$t(t);if(!n)return!1;let r=n;const{$from:i}=t.selection,u=t.schema.nodes.ordered_list;for(let t=1;t<=i.depth;t+=1){const e=i.node(t);if(e.type===u&&(d===$||e.attrs.style===$)){r={node:e,pos:i.before(t),depth:t};break}}return e&&e(t.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,style:d})),!0};case"setListStart":return h=n.start??1,(t,e)=>{const n=$t(t);return!(!n||n.node.type!==t.schema.nodes.ordered_list||(e&&e(t.tr.setNodeMarkup(n.pos,void 0,{...n.node.attrs,order:Math.max(1,Math.round(h))})),0))};case"toggleImageCaption":return function(t){return(e,n)=>{const r=Ct(e);if(!r)return!1;if(n){const i=e.tr;if(r.isFigure){const{src:e,alt:n,title:u,width:s}=r.node.attrs,l=t.nodes.image.create({src:e,alt:n,title:u,width:s});i.replaceWith(r.pos,r.pos+r.node.nodeSize,t.nodes.paragraph.create(null,l)),i.setSelection(o.create(i.doc,r.pos+1))}else{const{src:n,alt:s,title:o,width:l}=r.node.attrs,f=s?t.text(s):null,c=t.nodes.figure.create({src:n,alt:s,title:o,width:l,align:null},f),a=e.doc.resolve(r.pos),h=a.parent,d=1===h.childCount&&"paragraph"===h.type.name,m=d?a.before():r.pos,p=d?a.after():r.pos+r.node.nodeSize;i.replaceWith(m,p,c),i.setSelection(u.create(i.doc,m+1+c.content.size))}n(i.scrollIntoView())}return!0}}(r);case"setImageAlign":return function(t,e){return(n,r)=>{const i=Ct(n);if(!i)return!1;const u="left"===e||"center"===e||"right"===e?e:null;if(r){const e=n.tr;if(i.isFigure)e.setNodeMarkup(i.pos,void 0,{...i.node.attrs,align:u}),n.selection instanceof o&&e.setSelection(o.create(e.doc,i.pos));else{const{src:r,alt:s,title:l,width:f}=i.node.attrs,c=t.nodes.figure.create({src:r,alt:s,title:l,width:f,align:u}),a=n.doc.resolve(i.pos),h=a.parent,d=1===h.childCount&&"paragraph"===h.type.name,m=d?a.before():i.pos,p=d?a.after():i.pos+i.node.nodeSize;e.replaceWith(m,p,c),e.setSelection(o.create(e.doc,m))}r(e.scrollIntoView())}return!0}}(r,n.align??null);case"setImageWidth":return a=n.width??null,(t,e)=>{const n=Ct(t);if(!n)return!1;if(e){const r=t.tr.setNodeMarkup(n.pos,void 0,{...n.node.attrs,width:a&&a>0?Math.round(a):null});t.selection instanceof o&&r.setSelection(o.create(r.doc,n.pos)),e(r)}return!0};case"deleteImage":return(t,e)=>{const n=Ct(t);return!!n&&(e&&e(t.tr.delete(n.pos,n.pos+n.node.nodeSize).scrollIntoView()),!0)};case"setEmbedAlign":return function(t){return(e,n)=>{const r=jt(e);if(!r)return!1;const i="left"===t||"center"===t||"right"===t?t:null;if(n){const t=e.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,align:i});t.setSelection(o.create(t.doc,r.pos)),n(t.scrollIntoView())}return!0}}(n.align??null);case"deleteEmbed":return(t,e)=>{const n=jt(t);return!!n&&(e&&e(t.tr.delete(n.pos,n.pos+n.node.nodeSize).scrollIntoView()),!0)};case"link":return function(t,e){return(n,r)=>{if(!e.href)return!1;const{empty:i,$from:u,from:s,to:o}=n.selection;let l={from:s,to:o};if(i){const e=wt(u,t);if(!e)return!1;l=e}if(r){const i=n.tr;i.removeMark(l.from,l.to,t),i.addMark(l.from,l.to,t.create({href:e.href,title:e.title??null,target:e.target??null})),r(i.scrollIntoView())}return!0}}(s.link,n);case"unlink":return c=s.link,(t,e)=>{const{empty:n,$from:r,from:i,to:u}=t.selection;let s={from:i,to:u};if(n){const t=wt(r,c);if(!t)return!1;s=t}else if(!t.doc.rangeHasMark(i,u,c))return!1;return e&&e(t.tr.removeMark(s.from,s.to,c)),!0};case"insertBookmark":return function(t,e){return(n,r)=>{const i=e.id?.trim();if(!i)return!1;if(r){const e=t.nodes.bookmark.create({id:i});r(n.tr.replaceSelectionWith(e,!1).scrollIntoView())}return!0}}(r,n);case"textColor":return vt(s.text_color,n.color?{color:n.color}:null);case"bgColor":return vt(s.bg_color,n.color?{color:n.color}:null);case"fontFamily":return vt(s.font_family,n.family?{family:n.family}:null);case"fontSize":return vt(s.font_size,n.size?{size:n.size}:null);case"horizontalRule":return f=i.horizontal_rule,(t,e)=>(e&&e(t.tr.replaceSelectionWith(f.create()).scrollIntoView()),!0);case"clearFormatting":return(t,e)=>{const{from:n,to:r,empty:i}=t.selection;if(e){const u=t.tr;i||u.removeMark(n,r,null),u.setStoredMarks([]),t.doc.nodesBetween(n,r,((t,e)=>(t.isTextblock&&t.type.spec.attrs&&"align"in t.type.spec.attrs&&(t.attrs.align||t.attrs.lineHeight)&&u.setNodeMarkup(e,void 0,{...t.attrs,align:null,lineHeight:null}),!0))),e(u)}return!0};case"undo":return pt;case"redo":return gt;case"codeBlock":return function(t,e){return(n,r,i)=>{const{$from:u}=n.selection;return u.parent.type===t.nodes.code_block?U(t.nodes.paragraph)(n,r,i):U(t.nodes.code_block,{language:e})(n,r,i)}}(r,n.language??null);case"setCodeBlockLanguage":return function(t,e){return(n,r)=>{const{$from:i}=n.selection;for(let u=i.depth;u>0;u-=1)if(i.node(u).type===t.nodes.code_block)return r&&r(n.tr.setNodeMarkup(i.before(u),void 0,{language:e})),!0;return!1}}(r,n.language??null);case"insertEmbed":return function(t,e){return(n,r)=>{if(!e.src)return!1;const i=t.nodes.embed.create({src:e.src,provider:e.provider??null,title:e.title??null});return r&&r(n.tr.replaceSelectionWith(i).scrollIntoView()),!0}}(r,n);case"insertImage":return function(t,e){return(n,r)=>{if(!e.src)return!1;const i=e.src,u=e.alt??null,s=e.title??null,o=null!=e.caption?String(e.caption).trim():"",l=o?t.nodes.figure.create({src:i,alt:u,title:s,width:null,align:null},t.text(o)):t.nodes.image.create({src:i,alt:u,title:s});return r&&r(n.tr.replaceSelectionWith(l).scrollIntoView()),!0}}(r,n);case"updateImage":return function(t,e){return(n,r)=>{const i=Ct(n);if(!i||!e.src)return!1;const u=e.src,s=e.alt??null,l=e.title??null,f=null!=e.caption?String(e.caption).trim():"",c=i.node.attrs.width??null,a=i.isFigure?i.node.attrs.align??null:null;if(r){const e=n.tr;if(f){const r=t.nodes.figure.create({src:u,alt:s,title:l,width:c,align:a},t.text(f));if(i.isFigure)e.replaceWith(i.pos,i.pos+i.node.nodeSize,r),e.setSelection(o.create(e.doc,i.pos));else{const t=n.doc.resolve(i.pos),u=t.parent,s=1===u.childCount&&"paragraph"===u.type.name,l=s?t.before():i.pos,f=s?t.after():i.pos+i.node.nodeSize;e.replaceWith(l,f,r),e.setSelection(o.create(e.doc,l))}}else if(i.isFigure){const n=t.nodes.image.create({src:u,alt:s,title:l,width:c});e.replaceWith(i.pos,i.pos+i.node.nodeSize,t.nodes.paragraph.create(null,n)),e.setSelection(o.create(e.doc,i.pos+1))}else e.setNodeMarkup(i.pos,void 0,{src:u,alt:s,title:l,width:c}),n.selection instanceof o&&e.setSelection(o.create(e.doc,i.pos));r(e.scrollIntoView())}return!0}}(r,n);case"insertTable":return function(t,e){const n=Math.max(1,e.rows??3),r=Math.max(1,e.cols??3),i=e.withHeaderRow??!0;return(e,u)=>{const{table:s,table_row:o,table_cell:l,table_header:f}=t.nodes,c=[];for(let t=0;t<n;t+=1){const e=0===t&&i?f:l,n=[];for(let t=0;t<r;t+=1)n.push(e.createAndFill());c.push(o.create(null,n))}return u&&u(e.tr.replaceSelectionWith(s.create(null,c)).scrollIntoView()),!0}}(r,n);case"addRowBefore":return H;case"addRowAfter":return L;case"addColumnBefore":return A;case"addColumnAfter":return B;case"deleteRow":return x;case"deleteColumn":return j;case"mergeCells":return C;case"splitCell":return k;case"toggleHeaderRow":return y;case"toggleLayoutTable":return(t,e)=>{const{$from:n}=t.selection;for(let r=n.depth;r>0;r-=1){const i=n.node(r);if(i.type===t.schema.nodes.table)return e&&e(t.tr.setNodeMarkup(n.before(r),void 0,{...i.attrs,layout:!i.attrs.layout})),!0}return!1};case"deleteTable":return M;case"changeCase":return l=n.textCase??"upper",(t,e)=>{const{from:n,to:r,empty:i}=t.selection;if(i)return!1;const u=[];if(t.doc.nodesBetween(n,r,((t,e)=>{if(!t.isText||!t.text)return;const i=Math.max(n,e),s=Math.min(r,e+t.nodeSize);if(i>=s)return;const o=t.text.slice(i-e,s-e),f=function(t,e){switch(e){case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();case"title":return t.toLowerCase().replace(/(^|\s)(\p{L})/gu,((t,e,n)=>e+n.toUpperCase()));case"sentence":return t.toLowerCase().replace(/(^|[.!?]\s+)(\p{L})/gu,((t,e,n)=>e+n.toUpperCase()))}}(o,l);f!==o&&u.push({from:i,to:s,text:f,marks:t.marks})})),0===u.length)return!1;if(e){const n=t.tr;for(const e of u.reverse())n.replaceWith(e.from,e.to,t.schema.text(e.text,e.marks));e(n.scrollIntoView())}return!0};case"insertMergeField":return function(t,e){return(n,r)=>{const i=t.nodes.merge_field;if(!i||!e.id)return!1;if(r){const t=i.create({id:e.id,label:e.label??null});r(n.tr.replaceSelectionWith(t).scrollIntoView())}return!0}}(r,n);case"insertMath":return function(t,e){return(n,r)=>{const i=t.nodes.math,u=(e.latex??"").trim();if(!i||!u)return!1;if(r){const t=i.create({latex:u,display:e.mathDisplay??"inline"});r(n.tr.replaceSelectionWith(t).scrollIntoView())}return!0}}(r,n);default:return null}var l,f,c,a,h,d,m,p}export{jt as a,xt as b,J as c,X as d,_ as e,wt as g,dt as h,gt as r,Ct as s,pt as u};
1
+ import{l as t,f as e,e as n,S as r,A as i,T as u,b as s,N as o,r as l,R as f,c,P as a,a as h,M as d}from"../../index-7ca72b78.esm.js";import{S as m,F as p}from"../../index-5d34cff1.esm.js";import{f as g,g as w,h as v,m as $,j as b,n as M,o as y,p as k,q as C,r as j,l as x,a as B,w as A,M as L,u as S}from"./schema.esm.js";import"../../index-4df50481.esm.js";import"../../index-920675c4.esm.js";import"./plugins/embeds.esm.js";import"./email-css.esm.js";import"./sanitize.esm.js";const H=(t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function T(t,e,n=!1){for(let r=t;r;r="start"==e?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function E(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function F(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const I=(e,n)=>{let{$from:r,$to:i}=e.selection,u=r.blockRange(i),s=u&&t(u);return null!=s&&(n&&n(e.tr.lift(u,s).scrollIntoView()),!0)};function R(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const _=(t,e)=>{let{$head:n,$anchor:i}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(i))return!1;let u=n.node(-1),s=n.indexAfter(-1),o=R(u.contentMatchAt(s));if(!o||!u.canReplaceWith(s,s,o))return!1;if(e){let i=n.after(),u=t.tr.replaceWith(i,i,o.createAndFill());u.setSelection(r.near(u.doc.resolve(i),1)),e(u.scrollIntoView())}return!0};const D=(t,e)=>{if(t.selection instanceof o&&t.selection.node.isBlock){let{$from:n}=t.selection;return!(!n.parentOffset||!s(t.doc,n.pos)||(e&&e(t.tr.split(n.pos).scrollIntoView()),0))}if(!t.selection.$from.depth)return!1;let n=t.tr;!t.selection.empty&&(t.selection instanceof u||t.selection instanceof i)&&n.deleteSelection();let r,l,{$from:f}=n.selection,c=n.steps.length,a=[],h=!1,d=!1;for(let t=f.depth;;t--){if(f.node(t).isBlock){h=f.end(t)==f.pos+(f.depth-t),d=f.start(t)==f.pos-(f.depth-t),l=R(f.node(t-1).contentMatchAt(f.indexAfter(t-1)));let e=O&&O(f.parent,h,f);a.unshift(e||(h&&l?{type:l}:null)),r=t;break}if(1==t)return!1;a.unshift(null)}let m=f.pos,p=s(n.doc,m,a.length,a);if(p||(a[0]=l?{type:l}:null,p=s(n.doc,m,a.length,a)),!p)return!1;if(n.split(m,a.length,a),!h&&d&&f.node(r).type!=l){let t=n.mapping.slice(c),e=t.map(f.before(r)),i=n.doc.resolve(e);l&&f.node(r-1).canReplaceWith(i.index(),i.index()+1,l)&&n.setNodeMarkup(t.map(f.before(r)),l)}return e&&e(n.scrollIntoView()),!0};var O;function z(e,n,i,u){let s,o,l=n.nodeBefore,a=n.nodeAfter,h=l.type.spec.isolating||a.type.spec.isolating;if(!h&&function(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,u=e.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&e.parent.canReplace(u-1,u)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(u,u+1)||!i.isTextblock&&!c(t.doc,e.pos)||(n&&n(t.tr.join(e.pos).scrollIntoView()),0)))}(e,n,i))return!0;let d=!h&&n.parent.canReplace(n.index(),n.index()+1);if(d&&(s=(o=l.contentMatchAt(l.childCount)).findWrapping(a.type))&&o.matchType(s[0]||a.type).validEnd){if(i){let t=n.pos+a.nodeSize,r=p.empty;for(let t=s.length-1;t>=0;t--)r=p.from(s[t].create(null,r));r=p.from(l.copy(r));let u=e.tr.step(new f(n.pos-1,t,n.pos,t,new m(r,1,0),s.length,!0)),o=u.doc.resolve(t+2*s.length);o.nodeAfter&&o.nodeAfter.type==l.type&&c(u.doc,o.pos)&&u.join(o.pos),i(u.scrollIntoView())}return!0}let g=a.type.spec.isolating||u>0&&h?null:r.findFrom(n,1),w=g&&g.$from.blockRange(g.$to),v=w&&t(w);if(null!=v&&v>=n.depth)return i&&i(e.tr.lift(w,v).scrollIntoView()),!0;if(d&&T(a,"start",!0)&&T(l,"end")){let t=l,r=[];for(;r.push(t),!t.isTextblock;)t=t.lastChild;let u=a,s=1;for(;!u.isTextblock;u=u.firstChild)s++;if(t.canReplace(t.childCount,t.childCount,u.content)){if(i){let t=p.empty;for(let e=r.length-1;e>=0;e--)t=p.from(r[e].copy(t));i(e.tr.step(new f(n.pos-r.length,n.pos+a.nodeSize,n.pos+s,n.pos+a.nodeSize-s,new m(t,r.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function q(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return!!i.node(s).isTextblock&&(n&&n(e.tr.setSelection(u.create(e.doc,t<0?i.start(s):i.end(s)))),!0)}}const P=q(-1),G=q(1);function N(t,e=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:u},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(u,s,((r,u)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)i=!0;else{let e=n.doc.resolve(u),r=e.index();i=e.parent.canReplaceWith(r,r+1,t)}}))}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:u},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(u,s,t,e)}r(i.scrollIntoView())}return!0}}function U(t,e=null,r){let i=!1!==(r&&r.removeWhenPresent),u=!1!==(r&&r.enterInlineAtoms),s=!(r&&r.includeWhitespace);return function(r,o){let{empty:l,$cursor:f,ranges:c}=r.selection;if(l&&!f||!function(t,e,n,r){for(let i=0;i<e.length;i++){let{$from:u,$to:s}=e[i],o=0==u.depth&&t.inlineContent&&t.type.allowsMarkType(n);if(t.nodesBetween(u.pos,s.pos,((t,e)=>{if(o||!r&&t.isAtom&&t.isInline&&e>=u.pos&&e+t.nodeSize<=s.pos)return!1;o=t.inlineContent&&t.type.allowsMarkType(n)})),o)return!0}return!1}(r.doc,c,t,u))return!1;if(o)if(f)t.isInSet(r.storedMarks||f.marks())?o(r.tr.removeStoredMark(t)):o(r.tr.addStoredMark(t.create(e)));else{let l,f=r.tr;u||(c=function(t){let e=[];for(let r=0;r<t.length;r++){let{$from:i,$to:u}=t[r];i.doc.nodesBetween(i.pos,u.pos,((t,r)=>{if(t.isAtom&&t.content.size&&t.isInline&&r>=i.pos&&r+t.nodeSize<=u.pos)return r+1>i.pos&&e.push(new n(i,i.doc.resolve(r+1))),i=i.doc.resolve(r+1+t.content.size),!1})),i.pos<u.pos&&e.push(new n(i,u))}return e}(c)),l=i?!c.some((e=>r.doc.rangeHasMark(e.$from.pos,e.$to.pos,t))):!c.every((e=>{let n=!1;return f.doc.nodesBetween(e.$from.pos,e.$to.pos,((r,i,u)=>{if(n)return!1;n=!t.isInSet(r.marks)&&!!u&&u.type.allowsMarkType(t)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,e.$from.pos-i),Math.min(r.nodeSize,e.$to.pos-i))))})),!n}));for(let n=0;n<c.length;n++){let{$from:r,$to:i}=c[n];if(l){let n=r.pos,u=i.pos,o=r.nodeAfter,l=i.nodeBefore,c=s&&o&&o.isText?/^\s*/.exec(o.text)[0].length:0,a=s&&l&&l.isText?/\s*$/.exec(l.text)[0].length:0;n+c<u&&(n+=c,u-=a),f.addMark(n,u,t.create(e))}else f.removeMark(r.pos,i.pos,t)}o(f.scrollIntoView())}return!0}}function W(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}let J=W(H,((e,n,i)=>{let u=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}(e,i);if(!u)return!1;let s=E(u);if(!s){let r=u.blockRange(),i=r&&t(r);return null!=i&&(n&&n(e.tr.lift(r,i).scrollIntoView()),!0)}let f=s.nodeBefore;if(z(e,s,n,-1))return!0;if(0==u.parent.content.size&&(T(f,"end")||o.isSelectable(f)))for(let t=u.depth;;t--){let i=l(e.doc,u.before(t),u.after(t),m.empty);if(i&&i.slice.size<i.to-i.from){if(n){let t=e.tr.step(i);t.setSelection(T(f,"end")?r.findFrom(t.doc.resolve(t.mapping.map(s.pos,-1)),-1):o.create(t.doc,s.pos-f.nodeSize)),n(t.scrollIntoView())}return!0}if(1==t||u.node(t-1).childCount>1)break}return!(!f.isAtom||s.depth!=u.depth-1)&&(n&&n(e.tr.delete(s.pos-f.nodeSize,s.pos).scrollIntoView()),!0)}),((t,e,n)=>{let{$head:r,empty:i}=t.selection,u=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;u=E(r)}let s=u&&u.nodeBefore;return!(!s||!o.isSelectable(s))&&(e&&e(t.tr.setSelection(o.create(t.doc,u.pos-s.nodeSize)).scrollIntoView()),!0)})),K=W(H,((t,e,n)=>{let i=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}(t,n);if(!i)return!1;let u=F(i);if(!u)return!1;let s=u.nodeAfter;if(z(t,u,e,1))return!0;if(0==i.parent.content.size&&(T(s,"start")||o.isSelectable(s))){let n=l(t.doc,i.before(),i.after(),m.empty);if(n&&n.slice.size<n.to-n.from){if(e){let i=t.tr.step(n);i.setSelection(T(s,"start")?r.findFrom(i.doc.resolve(i.mapping.map(u.pos)),1):o.create(i.doc,i.mapping.map(u.pos))),e(i.scrollIntoView())}return!0}}return!(!s.isAtom||u.depth!=i.depth-1)&&(e&&e(t.tr.delete(u.pos,u.pos+s.nodeSize).scrollIntoView()),!0)}),((t,e,n)=>{let{$head:r,empty:i}=t.selection,u=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;u=F(r)}let s=u&&u.nodeAfter;return!(!s||!o.isSelectable(s))&&(e&&e(t.tr.setSelection(o.create(t.doc,u.pos)).scrollIntoView()),!0)}));const Q={Enter:W(((t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}),((t,e)=>{let n=t.selection,{$from:r,$to:s}=n;if(n instanceof i||r.parent.inlineContent||s.parent.inlineContent)return!1;let o=R(s.parent.contentMatchAt(s.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let n=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,i=t.tr.insert(n,o.createAndFill());i.setSelection(u.create(i.doc,n+1)),e(i.scrollIntoView())}return!0}),((e,n)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let t=r.before();if(s(e.doc,t))return n&&n(e.tr.split(t).scrollIntoView()),!0}let i=r.blockRange(),u=i&&t(i);return null!=u&&(n&&n(e.tr.lift(i,u).scrollIntoView()),!0)}),D),"Mod-Enter":_,Backspace:J,"Mod-Backspace":J,"Shift-Backspace":J,Delete:K,"Mod-Delete":K,"Mod-a":(t,e)=>(e&&e(t.tr.setSelection(new i(t.doc))),!0)},V={"Ctrl-h":Q.Backspace,"Alt-Backspace":Q["Mod-Backspace"],"Ctrl-d":Q.Delete,"Ctrl-Alt-Backspace":Q["Mod-Delete"],"Alt-Delete":Q["Mod-Delete"],"Alt-d":Q["Mod-Delete"],"Ctrl-a":P,"Ctrl-e":G};for(let t in Q)V[t]=Q[t];const X=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?V:Q;var Y=200,Z=function(){};Z.prototype.append=function(t){return t.length?(t=Z.from(t),!this.length&&t||t.length<Y&&this.leafAppend(t)||this.length<Y&&t.leafPrepend(this)||this.appendInner(t)):this},Z.prototype.prepend=function(t){return t.length?Z.from(t).append(this):this},Z.prototype.appendInner=function(t){return new et(this,t)},Z.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?Z.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},Z.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Z.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},Z.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},Z.from=function(t){return t instanceof Z?t:t&&t.length?new tt(t):Z.empty};var tt=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var i=e;i<n;i++)if(!1===t(this.values[i],r+i))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var i=e-1;i>=n;i--)if(!1===t(this.values[i],r+i))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Y)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Y)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Z);Z.empty=new tt([]);var et=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var i=this.left.length;return!(e<i&&!1===this.left.forEachInner(t,e,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(t,Math.max(e-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var i=this.left.length;return!(e>i&&!1===this.right.forEachInvertedInner(t,e-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(t,Math.min(e,i),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(Z);class nt{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,r,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(n=this.remapping(i,this.items.length),r=n.maps.length);let u,s,o=t.tr,l=[],f=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(i,e+1),r=n.maps.length),r--,void f.push(t);if(n){f.push(new rt(t.map));let e,i=t.step.map(n.slice(r));i&&o.maybeStep(i).doc&&(e=o.mapping.maps[o.mapping.maps.length-1],l.push(new rt(e,void 0,void 0,l.length+f.length))),r--,e&&n.appendMap(e,r)}else o.maybeStep(t.step);return t.selection?(u=n?t.selection.map(n.slice(r)):t.selection,s=new nt(this.items.slice(0,i).append(f.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:o,selection:u}}addTransform(t,e,n,r){let i=[],u=this.eventCount,s=this.items,o=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<t.steps.length;n++){let l,f=t.steps[n].invert(t.docs[n]),c=new rt(t.mapping.maps[n],f,e);(l=o&&o.merge(c))&&(c=l,n?i.pop():s=s.slice(0,s.length-1)),i.push(c),e&&(u++,e=void 0),r||(o=c)}let l=u-n.depth;return l>ut&&(s=function(t,e){let n;return t.forEach(((t,r)=>{if(t.selection&&0==e--)return n=r,!1})),t.slice(n)}(s,l),u-=l),new nt(s.append(i),u)}remapping(t,e){let n=new d;return this.items.forEach(((e,r)=>{let i=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0;n.appendMap(e.map,i)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new nt(this.items.append(t.map((t=>new rt(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-e),i=t.mapping,u=t.steps.length,s=this.eventCount;this.items.forEach((t=>{t.selection&&s--}),r);let o=e;this.items.forEach((e=>{let r=i.getMirror(--o);if(null==r)return;u=Math.min(u,r);let l=i.maps[r];if(e.step){let u=t.steps[r].invert(t.docs[r]),f=e.selection&&e.selection.map(i.slice(o+1,r));f&&s++,n.push(new rt(l,u,f))}else n.push(new rt(l))}),r);let l=[];for(let t=e;t<u;t++)l.push(new rt(i.maps[t]));let f=this.items.slice(0,r).append(l).append(n),c=new nt(f,s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,r=[],i=0;return this.items.forEach(((u,s)=>{if(s>=t)r.push(u),u.selection&&i++;else if(u.step){let t=u.step.map(e.slice(n)),s=t&&t.getMap();if(n--,s&&e.appendMap(s,n),t){let o=u.selection&&u.selection.map(e.slice(n));o&&i++;let l,f=new rt(s.invert(),t,o),c=r.length-1;(l=r.length&&r[c].merge(f))?r[c]=l:r.push(f)}}else u.map&&n--}),this.items.length,0),new nt(Z.from(r.reverse()),i)}}nt.empty=new nt(Z.empty,0);class rt{constructor(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new rt(e.getMap().invert(),e,this.selection)}}}class it{constructor(t,e,n,r,i){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}const ut=20;function st(t){let e=[];for(let n=t.length-1;n>=0&&0==e.length;n--)t[n].forEach(((t,n,r,i)=>e.push(r,i)));return e}function ot(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),u=e.map(t[r+1],-1);i<=u&&n.push(i,u)}return n}let lt=!1,ft=null;function ct(t){let e=t.plugins;if(ft!=e){lt=!1,ft=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){lt=!0;break}}return lt}const at=new a("history"),ht=new a("closeHistory");function dt(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new h({key:at,state:{init:()=>new it(nt.empty,nt.empty,null,0,-1),apply:(e,n,r)=>function(t,e,n,r){let i,u=n.getMeta(at);if(u)return u.historyState;n.getMeta(ht)&&(t=new it(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(at))return s.getMeta(at).redo?new it(t.done.addTransform(n,void 0,r,ct(e)),t.undone,st(n.mapping.maps),t.prevTime,t.prevComposition):new it(t.done,t.undone.addTransform(n,void 0,r,ct(e)),null,t.prevTime,t.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new it(t.done.rebased(n,i),t.undone.rebased(n,i),ot(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new it(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ot(t.prevRanges,n.mapping),t.prevTime,t.prevComposition);{let i=n.getMeta("composition"),u=0==t.prevTime||!s&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,r)=>{for(let i=0;i<e.length;i+=2)t<=e[i+1]&&r>=e[i]&&(n=!0)})),n}(n,t.prevRanges)),o=s?ot(t.prevRanges,n.mapping):st(n.mapping.maps);return new it(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,ct(e)),nt.empty,o,n.time,null==i?t.prevComposition:i)}}(n,r,e,t)},config:t,props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,r="historyUndo"==n?pt:"historyRedo"==n?gt:null;return!(!r||!t.editable)&&(e.preventDefault(),r(t.state,t.dispatch))}}}})}function mt(t,e){return(n,r)=>{let i=at.getState(n);if(!i||0==(t?i.undone:i.done).eventCount)return!1;if(r){let u=function(t,e,n){let r=ct(e),i=at.get(e).spec.config,u=(n?t.undone:t.done).popEvent(e,r);if(!u)return null;let s=u.selection.resolve(u.transform.doc),o=(n?t.done:t.undone).addTransform(u.transform,e.selection.getBookmark(),i,r),l=new it(n?o:u.remaining,n?u.remaining:o,null,0,-1);return u.transform.setSelection(s).setMeta(at,{redo:n,historyState:l})}(i,n,t);u&&r(e?u.scrollIntoView():u)}return!0}}const pt=mt(!1,!0),gt=mt(!0,!0);function wt(t,e){const{parent:n,parentOffset:r}=t,i=n.childAfter(r);if(!i.node||!e.isInSet(i.node.marks))return null;let u=i.index,s=t.start()+i.offset;for(;u>0&&e.isInSet(n.child(u-1).marks);)u-=1,s-=n.child(u).nodeSize;let o=i.index+1,l=s+i.node.nodeSize;for(;o<n.childCount&&e.isInSet(n.child(o).marks);)l+=n.child(o).nodeSize,o+=1;return{from:s,to:l}}function vt(t,e){return(n,r)=>{const{empty:i,ranges:s,$from:o}=n.selection;if(i&&!(n.selection instanceof u&&n.selection.$cursor))return!1;if(!i&&!n.selection.content().content.firstChild)return!1;if(r){const u=n.tr;if(i)u.removeStoredMark(t),e&&u.addStoredMark(t.create(e));else{for(const n of s)u.removeMark(n.$from.pos,n.$to.pos,t),e&&u.addMark(n.$from.pos,n.$to.pos,t.create(e));u.scrollIntoView()}r(u)}return!0}}function $t(t){const{$from:e}=t.selection,{bullet_list:n,ordered_list:r,task_list:i}=t.schema.nodes;for(let t=e.depth;t>0;t-=1){const u=e.node(t);if(u.type===n||u.type===r||u.type===i)return{node:u,pos:e.before(t),depth:t}}return null}function bt(t){const{schema:e}=t;return t===e.nodes.task_list?e.nodes.task_item:e.nodes.list_item}function Mt(t,e){return(n,r,i)=>{const s=$t(n);if(s){if(s.node.type===t)return x(bt(s.node.type))(n,r,i);if(r){const i=bt(s.node.type),o=[];s.node.forEach((t=>{o.push(t.type===i&&i!==e?e.create(null,t.content,t.marks):t)}));const l=t.create(s.node.attrs,o),f=n.tr,{from:c,to:a}=n.selection;f.replaceWith(s.pos,s.pos+s.node.nodeSize,l),f.setSelection(u.create(f.doc,c,a)),r(f)}return!0}return A(t)(n,r,i)}}function yt(t){return(n,r,i)=>function(t,e){const{$from:n}=t.selection;for(let t=n.depth;t>0;t-=1)if(n.node(t).type===e)return!0;return!1}(n,t)?I(n,r):function(t,n=null){return function(r,i){let{$from:u,$to:s}=r.selection,o=u.blockRange(s),l=o&&e(o,t,n);return!!l&&(i&&i(r.tr.wrap(o,l).scrollIntoView()),!0)}}(t)(n,r,i)}function kt(t){return(e,n)=>{const{from:r,to:i}=e.selection,u=[];if(e.doc.nodesBetween(r,i,((e,n)=>{if(e.isTextblock&&e.type.spec.attrs&&"indent"in e.type.spec.attrs){const r=e.attrs.indent??0,i=Math.max(0,Math.min(S,r+t));i!==r&&u.push({pos:n,node:e,next:i})}return!0})),0===u.length)return!1;if(n){const t=e.tr;for(const{pos:e,node:n,next:r}of u)t.setNodeMarkup(e,void 0,{...n.attrs,indent:r});n(t)}return!0}}function Ct(t){const{image:e,figure:n}=t.schema.nodes,r=t.selection;if(r instanceof o){if(r.node.type===e)return{node:r.node,pos:r.from,isFigure:!1};if(r.node.type===n)return{node:r.node,pos:r.from,isFigure:!0}}const{$from:i}=r;for(let t=i.depth;t>0;t-=1)if(i.node(t).type===n)return{node:i.node(t),pos:i.before(t),isFigure:!0};return null}function jt(t){const e=t.selection;return e instanceof o&&e.node.type===t.schema.nodes.embed?{node:e.node,pos:e.from}:null}function xt(t,e,n={}){const{schema:r}=t,{nodes:i,marks:s}=r;switch(e){case"bold":return U(s.bold);case"italic":return U(s.italic);case"underline":return U(s.underline);case"strike":return U(s.strike);case"subscript":return U(s.subscript);case"superscript":return U(s.superscript);case"code":return U(s.code);case"paragraph":return N(i.paragraph);case"heading":return N(i.heading,{level:n.level??1});case"blockquote":return yt(i.blockquote);case"align":return p=n.align??null,(t,e)=>{const{from:n,to:r}=t.selection,i=[];if(t.doc.nodesBetween(n,r,((t,e)=>(t.isTextblock&&t.type.spec.attrs&&"align"in t.type.spec.attrs&&i.push({pos:e,node:t}),!0))),0===i.length)return!1;if(e){const n=t.tr;for(const{pos:t,node:e}of i)n.setNodeMarkup(t,void 0,{...e.attrs,align:p});e(n)}return!0};case"lineHeight":return m=n.lineHeight??null,(t,e)=>{const{from:n,to:r}=t.selection,i=[];if(t.doc.nodesBetween(n,r,((t,e)=>(t.isTextblock&&t.type.spec.attrs&&"lineHeight"in t.type.spec.attrs&&i.push({pos:e,node:t}),!0))),0===i.length)return!1;if(e){const n=t.tr;for(const{pos:t,node:e}of i)n.setNodeMarkup(t,void 0,{...e.attrs,lineHeight:m});e(n)}return!0};case"bulletList":return Mt(i.bullet_list,i.list_item);case"orderedList":return Mt(i.ordered_list,i.list_item);case"taskList":return Mt(i.task_list,i.task_item);case"indent":return W(B(i.task_item),B(i.list_item),kt(1));case"outdent":return W(x(i.task_item),x(i.list_item),kt(-1),I);case"setListStyle":return d=n.style??null,(t,e)=>{const n=$t(t);if(!n)return!1;let r=n;const{$from:i}=t.selection,u=t.schema.nodes.ordered_list;for(let t=1;t<=i.depth;t+=1){const e=i.node(t);if(e.type===u&&(d===L||e.attrs.style===L)){r={node:e,pos:i.before(t),depth:t};break}}return e&&e(t.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,style:d})),!0};case"setListStart":return h=n.start??1,(t,e)=>{const n=$t(t);return!(!n||n.node.type!==t.schema.nodes.ordered_list||(e&&e(t.tr.setNodeMarkup(n.pos,void 0,{...n.node.attrs,order:Math.max(1,Math.round(h))})),0))};case"toggleImageCaption":return function(t){return(e,n)=>{const r=Ct(e);if(!r)return!1;if(n){const i=e.tr;if(r.isFigure){const{src:e,alt:n,title:u,width:s}=r.node.attrs,l=t.nodes.image.create({src:e,alt:n,title:u,width:s});i.replaceWith(r.pos,r.pos+r.node.nodeSize,t.nodes.paragraph.create(null,l)),i.setSelection(o.create(i.doc,r.pos+1))}else{const{src:n,alt:s,title:o,width:l}=r.node.attrs,f=s?t.text(s):null,c=t.nodes.figure.create({src:n,alt:s,title:o,width:l,align:null},f),a=e.doc.resolve(r.pos),h=a.parent,d=1===h.childCount&&"paragraph"===h.type.name,m=d?a.before():r.pos,p=d?a.after():r.pos+r.node.nodeSize;i.replaceWith(m,p,c),i.setSelection(u.create(i.doc,m+1+c.content.size))}n(i.scrollIntoView())}return!0}}(r);case"setImageAlign":return function(t,e){return(n,r)=>{const i=Ct(n);if(!i)return!1;const u="left"===e||"center"===e||"right"===e?e:null;if(r){const e=n.tr;if(i.isFigure)e.setNodeMarkup(i.pos,void 0,{...i.node.attrs,align:u}),n.selection instanceof o&&e.setSelection(o.create(e.doc,i.pos));else{const{src:r,alt:s,title:l,width:f}=i.node.attrs,c=t.nodes.figure.create({src:r,alt:s,title:l,width:f,align:u}),a=n.doc.resolve(i.pos),h=a.parent,d=1===h.childCount&&"paragraph"===h.type.name,m=d?a.before():i.pos,p=d?a.after():i.pos+i.node.nodeSize;e.replaceWith(m,p,c),e.setSelection(o.create(e.doc,m))}r(e.scrollIntoView())}return!0}}(r,n.align??null);case"setImageWidth":return a=n.width??null,(t,e)=>{const n=Ct(t);if(!n)return!1;if(e){const r=t.tr.setNodeMarkup(n.pos,void 0,{...n.node.attrs,width:a&&a>0?Math.round(a):null});t.selection instanceof o&&r.setSelection(o.create(r.doc,n.pos)),e(r)}return!0};case"deleteImage":return(t,e)=>{const n=Ct(t);return!!n&&(e&&e(t.tr.delete(n.pos,n.pos+n.node.nodeSize).scrollIntoView()),!0)};case"setEmbedAlign":return function(t){return(e,n)=>{const r=jt(e);if(!r)return!1;const i="left"===t||"center"===t||"right"===t?t:null;if(n){const t=e.tr.setNodeMarkup(r.pos,void 0,{...r.node.attrs,align:i});t.setSelection(o.create(t.doc,r.pos)),n(t.scrollIntoView())}return!0}}(n.align??null);case"deleteEmbed":return(t,e)=>{const n=jt(t);return!!n&&(e&&e(t.tr.delete(n.pos,n.pos+n.node.nodeSize).scrollIntoView()),!0)};case"link":return function(t,e){return(n,r)=>{if(!e.href)return!1;const{empty:i,$from:u,from:s,to:o}=n.selection;let l={from:s,to:o};if(i){const e=wt(u,t);if(!e)return!1;l=e}if(r){const i=n.tr;i.removeMark(l.from,l.to,t),i.addMark(l.from,l.to,t.create({href:e.href,title:e.title??null,target:e.target??null})),r(i.scrollIntoView())}return!0}}(s.link,n);case"unlink":return c=s.link,(t,e)=>{const{empty:n,$from:r,from:i,to:u}=t.selection;let s={from:i,to:u};if(n){const t=wt(r,c);if(!t)return!1;s=t}else if(!t.doc.rangeHasMark(i,u,c))return!1;return e&&e(t.tr.removeMark(s.from,s.to,c)),!0};case"insertBookmark":return function(t,e){return(n,r)=>{const i=e.id?.trim();if(!i)return!1;if(r){const e=t.nodes.bookmark.create({id:i});r(n.tr.replaceSelectionWith(e,!1).scrollIntoView())}return!0}}(r,n);case"textColor":return vt(s.text_color,n.color?{color:n.color}:null);case"bgColor":return vt(s.bg_color,n.color?{color:n.color}:null);case"fontFamily":return vt(s.font_family,n.family?{family:n.family}:null);case"fontSize":return vt(s.font_size,n.size?{size:n.size}:null);case"horizontalRule":return f=i.horizontal_rule,(t,e)=>(e&&e(t.tr.replaceSelectionWith(f.create()).scrollIntoView()),!0);case"clearFormatting":return(t,e)=>{const{from:n,to:r,empty:i}=t.selection;if(e){const u=t.tr;i||u.removeMark(n,r,null),u.setStoredMarks([]),t.doc.nodesBetween(n,r,((t,e)=>(t.isTextblock&&t.type.spec.attrs&&"align"in t.type.spec.attrs&&(t.attrs.align||t.attrs.lineHeight)&&u.setNodeMarkup(e,void 0,{...t.attrs,align:null,lineHeight:null}),!0))),e(u)}return!0};case"undo":return pt;case"redo":return gt;case"codeBlock":return function(t,e){return(n,r,i)=>{const{$from:u}=n.selection;return u.parent.type===t.nodes.code_block?N(t.nodes.paragraph)(n,r,i):N(t.nodes.code_block,{language:e})(n,r,i)}}(r,n.language??null);case"setCodeBlockLanguage":return function(t,e){return(n,r)=>{const{$from:i}=n.selection;for(let u=i.depth;u>0;u-=1)if(i.node(u).type===t.nodes.code_block)return r&&r(n.tr.setNodeMarkup(i.before(u),void 0,{language:e})),!0;return!1}}(r,n.language??null);case"insertEmbed":return function(t,e){return(n,r)=>{if(!e.src)return!1;const i=t.nodes.embed.create({src:e.src,provider:e.provider??null,title:e.title??null});return r&&r(n.tr.replaceSelectionWith(i).scrollIntoView()),!0}}(r,n);case"insertImage":return function(t,e){return(n,r)=>{if(!e.src)return!1;const i=e.src,u=e.alt??null,s=e.title??null,o=null!=e.caption?String(e.caption).trim():"",l=o?t.nodes.figure.create({src:i,alt:u,title:s,width:null,align:null},t.text(o)):t.nodes.image.create({src:i,alt:u,title:s});return r&&r(n.tr.replaceSelectionWith(l).scrollIntoView()),!0}}(r,n);case"updateImage":return function(t,e){return(n,r)=>{const i=Ct(n);if(!i||!e.src)return!1;const u=e.src,s=e.alt??null,l=e.title??null,f=null!=e.caption?String(e.caption).trim():"",c=i.node.attrs.width??null,a=i.isFigure?i.node.attrs.align??null:null;if(r){const e=n.tr;if(f){const r=t.nodes.figure.create({src:u,alt:s,title:l,width:c,align:a},t.text(f));if(i.isFigure)e.replaceWith(i.pos,i.pos+i.node.nodeSize,r),e.setSelection(o.create(e.doc,i.pos));else{const t=n.doc.resolve(i.pos),u=t.parent,s=1===u.childCount&&"paragraph"===u.type.name,l=s?t.before():i.pos,f=s?t.after():i.pos+i.node.nodeSize;e.replaceWith(l,f,r),e.setSelection(o.create(e.doc,l))}}else if(i.isFigure){const n=t.nodes.image.create({src:u,alt:s,title:l,width:c});e.replaceWith(i.pos,i.pos+i.node.nodeSize,t.nodes.paragraph.create(null,n)),e.setSelection(o.create(e.doc,i.pos+1))}else e.setNodeMarkup(i.pos,void 0,{src:u,alt:s,title:l,width:c}),n.selection instanceof o&&e.setSelection(o.create(e.doc,i.pos));r(e.scrollIntoView())}return!0}}(r,n);case"insertTable":return function(t,e){const n=Math.max(1,e.rows??3),r=Math.max(1,e.cols??3),i=e.withHeaderRow??!0;return(e,u)=>{const{table:s,table_row:o,table_cell:l,table_header:f}=t.nodes,c=[];for(let t=0;t<n;t+=1){const e=0===t&&i?f:l,n=[];for(let t=0;t<r;t+=1)n.push(e.createAndFill());c.push(o.create(null,n))}return u&&u(e.tr.replaceSelectionWith(s.create(null,c)).scrollIntoView()),!0}}(r,n);case"addRowBefore":return j;case"addRowAfter":return C;case"addColumnBefore":return k;case"addColumnAfter":return y;case"deleteRow":return M;case"deleteColumn":return b;case"mergeCells":return $;case"splitCell":return v;case"toggleHeaderRow":return w;case"toggleLayoutTable":return(t,e)=>{const{$from:n}=t.selection;for(let r=n.depth;r>0;r-=1){const i=n.node(r);if(i.type===t.schema.nodes.table)return e&&e(t.tr.setNodeMarkup(n.before(r),void 0,{...i.attrs,layout:!i.attrs.layout})),!0}return!1};case"deleteTable":return g;case"changeCase":return l=n.textCase??"upper",(t,e)=>{const{from:n,to:r,empty:i}=t.selection;if(i)return!1;const u=[];if(t.doc.nodesBetween(n,r,((t,e)=>{if(!t.isText||!t.text)return;const i=Math.max(n,e),s=Math.min(r,e+t.nodeSize);if(i>=s)return;const o=t.text.slice(i-e,s-e),f=function(t,e){switch(e){case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();case"title":return t.toLowerCase().replace(/(^|\s)(\p{L})/gu,((t,e,n)=>e+n.toUpperCase()));case"sentence":return t.toLowerCase().replace(/(^|[.!?]\s+)(\p{L})/gu,((t,e,n)=>e+n.toUpperCase()))}}(o,l);f!==o&&u.push({from:i,to:s,text:f,marks:t.marks})})),0===u.length)return!1;if(e){const n=t.tr;for(const e of u.reverse())n.replaceWith(e.from,e.to,t.schema.text(e.text,e.marks));e(n.scrollIntoView())}return!0};case"insertMergeField":return function(t,e){return(n,r)=>{const i=t.nodes.merge_field;if(!i||!e.id)return!1;if(r){const t=i.create({id:e.id,label:e.label??null});r(n.tr.replaceSelectionWith(t).scrollIntoView())}return!0}}(r,n);case"insertMath":return function(t,e){return(n,r)=>{const i=t.nodes.math,u=(e.latex??"").trim();if(!i||!u)return!1;if(r){const t=i.create({latex:u,display:e.mathDisplay??"inline"});r(n.tr.replaceSelectionWith(t).scrollIntoView())}return!0}}(r,n);default:return null}var l,f,c,a,h,d,m,p}export{jt as a,xt as b,W as c,X as d,_ as e,wt as g,dt as h,gt as r,Ct as s,pt as u};
@@ -1,2 +1,2 @@
1
- System.register(["../../index-89c520e9.cjs.js","./commands.cjs.js","../../index-c3210a9c.cjs.js","../../index-3ca67627.cjs.js","./keymap.cjs.js","./inputrules.cjs.js","./plugins/placeholder.cjs.js","./plugins/link.cjs.js","./plugins/single-line.cjs.js","./plugins/tables.cjs.js","./plugins/image.cjs.js","./plugins/suggestions.cjs.js","./plugins/find-replace.cjs.js","./plugins/max-length.cjs.js","./plugins/code-highlight.cjs.js","./plugins/embeds.cjs.js","./plugins/paste.cjs.js","./plugins/format-painter.cjs.js","./schema.cjs.js","../../index-178e1e57.cjs.js","../../index-403841c7.cjs.js","./markdown-parse.cjs.js","./serializer.cjs.js","./sanitize.cjs.js","../../xml-09119317.cjs.js"],function(_export,_context){"use strict";var t,e,s,r,i,n,o,l,u,a,h,f,c,p,m,g,d,j,w,v,x,b,k,S,y,O,T,z,C,F,L,D,N,R,B;function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}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 _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}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 ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}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 _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 A(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor;}function E(t,e){var s="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,i,n){var o=t.selection,l=e>0?o.$to:o.$from,u=o.empty;if(o instanceof r){if(!n.endOfTextblock(s)||0==l.depth)return!1;u=!1,l=t.doc.resolve(e>0?l.after():l.before());}var a=F.findGapCursorFrom(l,e,u);return!!a&&(i&&i(t.tr.setSelection(new F(a))),!0);};}function M(t,e,s){if(!t||!t.editable)return!1;var r=t.state.doc.resolve(e);if(!F.valid(r))return!1;var n=t.posAtCoords({left:s.clientX,top:s.clientY});return!(n&&n.inside>-1&&i.isSelectable(t.state.doc.nodeAt(n.inside)))&&(t.dispatch(t.state.tr.setSelection(new F(r))),!0);}function P(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof F))return!1;var s=t.state.selection.$from,i=s.parent.contentMatchAt(s.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;var l=n.empty;for(var _t6=i.length-1;_t6>=0;_t6--)l=n.from(i[_t6].createAndFill(null,l));var u=t.state.tr.replace(s.pos,s.pos,new o(l,0,0));return u.setSelection(r.near(u.doc.resolve(s.pos+1))),t.dispatch(u),!1;}function J(t){if(!(t.selection instanceof F))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",f.create(t.doc,[c.widget(t.selection.head,e,{key:"gapcursor"})]);}function G(){var _e$schema,_e$getPlaceholder;var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var s=(_e$schema=e.schema)!==null&&_e$schema!==void 0?_e$schema:z,r=[];return e.mentions&&r.push(x(N,e.mentions)),e.slashCommands&&r.push(x(R,_objectSpread(_objectSpread({},e.slashCommands),{},{getTriggers:function getTriggers(){return["/"];},startOfLine:!0}))),e.emoji&&r.push(x(B,_objectSpread(_objectSpread({},e.emoji),{},{getTriggers:function getTriggers(){return[":"];},minQueryLength:2}))),r.push.apply(r,[m(s,{textTransform:e.textTransform})].concat(_toConsumableArray(p(s,{onLinkShortcut:e.onLinkShortcut,onFindShortcut:e.onFindShortcut,onShortcutHelp:e.onShortcutHelp})),[a(),function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new t({view:function view(t){return new C(t,e);}});}(),new t({props:{decorations:J,createSelectionBetween:function createSelectionBetween(t,e,s){return e.pos==s.pos&&F.valid(s)?new F(s):null;},handleClick:M,handleKeyDown:D,handleDOMEvents:{beforeinput:P}}}),g((_e$getPlaceholder=e.getPlaceholder)!==null&&_e$getPlaceholder!==void 0?_e$getPlaceholder:function(){return"";}),d({onOpenLink:e.onOpenLink})],_toConsumableArray(w()),[v({onImageFiles:e.onImageFiles}),b(),S(),y(),T(),O(s,{getForcePlainText:e.getForcePlainText,getMarkdownPaste:e.getMarkdownPaste,getSanitize:e.getSanitize})])),e.getMaxLength&&r.push(k(e.getMaxLength)),e.singleLine&&r.push(j()),e.plugins&&r.push.apply(r,_toConsumableArray(e.plugins)),u.create({schema:s,doc:e.doc,plugins:r});}_export("c",G);return{setters:[function(_index00bCjsJs){t=_index00bCjsJs.b;e=_index00bCjsJs.e;s=_index00bCjsJs.S;r=_index00bCjsJs.T;i=_index00bCjsJs.c;n=_index00bCjsJs.F;o=_index00bCjsJs.d;l=_index00bCjsJs.P;u=_index00bCjsJs.E;},function(_commandsCjsJs){a=_commandsCjsJs.h;},function(_index001CjsJs){h=_index001CjsJs.b;},function(_index00aCjsJs){f=_index00aCjsJs.D;c=_index00aCjsJs.a;},function(_keymapCjsJs){p=_keymapCjsJs.b;},function(_inputrulesCjsJs){m=_inputrulesCjsJs.b;},function(_pluginsPlaceholderCjsJs){g=_pluginsPlaceholderCjsJs.p;},function(_pluginsLinkCjsJs){d=_pluginsLinkCjsJs.l;},function(_pluginsSingleLineCjsJs){j=_pluginsSingleLineCjsJs.s;},function(_pluginsTablesCjsJs){w=_pluginsTablesCjsJs.t;},function(_pluginsImageCjsJs){v=_pluginsImageCjsJs.i;},function(_pluginsSuggestionsCjsJs){x=_pluginsSuggestionsCjsJs.s;},function(_pluginsFindReplaceCjsJs){b=_pluginsFindReplaceCjsJs.f;},function(_pluginsMaxLengthCjsJs){k=_pluginsMaxLengthCjsJs.m;},function(_pluginsCodeHighlightCjsJs){S=_pluginsCodeHighlightCjsJs.c;},function(_pluginsEmbedsCjsJs){y=_pluginsEmbedsCjsJs.e;},function(_pluginsPasteCjsJs){O=_pluginsPasteCjsJs.a;},function(_pluginsFormatPainterCjsJs){T=_pluginsFormatPainterCjsJs.f;},function(_schemaCjsJs){z=_schemaCjsJs.d;},function(_index008CjsJs){},function(_index00dCjsJs){},function(_markdownParseCjsJs){},function(_serializerCjsJs){},function(_sanitizeCjsJs){},function(_xml00cCjsJs){}],execute:function execute(){C=/*#__PURE__*/function(){function C(t,e){var _this=this;_classCallCheck(this,C);var s;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=null!==(s=e.width)&&void 0!==s?s:1,this.color=!1===e.color?void 0:e.color||"black",this["class"]=e["class"],this.handlers=["dragover","dragend","drop","dragleave"].map(function(e){var s=function s(t){_this[e](t);};return t.dom.addEventListener(e,s),{name:e,handler:s};});}return _createClass(C,[{key:"destroy",value:function destroy(){var _this2=this;this.handlers.forEach(function(_ref){var t=_ref.name,e=_ref.handler;return _this2.editorView.dom.removeEventListener(t,e);});}},{key:"update",value:function update(t,e){if(null!=this.cursorPos&&e.doc!=t.state.doc)if(this.lastDragEvent){var _t=this.computeTarget(this.lastDragEvent);_t==this.cursorPos?this.updateOverlay():this.setCursor(_t);}else this.updateOverlay();}},{key:"setCursor",value:function setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay());}},{key:"updateOverlay",value:function updateOverlay(){var t,e=this.editorView.state.doc.resolve(this.cursorPos),s=!e.parent.inlineContent,r=this.editorView.dom,i=r.getBoundingClientRect(),n=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(s){var _s=e.nodeBefore,_r=e.nodeAfter;if(_s||_r){var _e=this.editorView.nodeDOM(this.cursorPos-(_s?_s.nodeSize:0));if(_e){var _i=_e.getBoundingClientRect(),_n=_s?_i.bottom:_i.top;_s&&_r&&(_n=(_n+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);var _l=this.width/2*o;t={left:_i.left,right:_i.right,top:_n-_l,bottom:_n+_l};}}}if(!t){var _e2=this.editorView.coordsAtPos(this.cursorPos),_s2=this.width/2*n;t={left:_e2.left-_s2,right:_e2.left+_s2,top:_e2.top,bottom:_e2.bottom};}var l,u,a=this.editorView.dom.offsetParent;if(this.element||(this.element=a.appendChild(document.createElement("div")),this["class"]&&(this.element.className=this["class"]),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s),!a||a==document.body&&"static"==getComputedStyle(a).position)l=-pageXOffset,u=-pageYOffset;else{var _t2=a.getBoundingClientRect(),_e3=_t2.width/a.offsetWidth,_s3=_t2.height/a.offsetHeight;l=_t2.left-a.scrollLeft*_e3,u=_t2.top-a.scrollTop*_s3;}this.element.style.left=(t.left-l)/n+"px",this.element.style.top=(t.top-u)/o+"px",this.element.style.width=(t.right-t.left)/n+"px",this.element.style.height=(t.bottom-t.top)/o+"px";}},{key:"scheduleRemoval",value:function scheduleRemoval(t){var _this3=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return _this3.setCursor(null);},t);}},{key:"computeTarget",value:function computeTarget(t){var s=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),i=r&&r.type.spec.disableDropCursor,n="function"==typeof i?i(this.editorView,s,t):i;if(!s||n)return null;var o=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){var _t3=e(this.editorView.state.doc,o,this.editorView.dragging.slice);null!=_t3&&(o=_t3);}return o;}},{key:"dragover",value:function dragover(t){if(!this.editorView.editable)return;this.lastDragEvent=t;var e=this.computeTarget(t);null!=e&&(this.setCursor(e),this.scheduleRemoval(5e3));}},{key:"dragend",value:function dragend(){this.scheduleRemoval(20);}},{key:"drop",value:function drop(){this.scheduleRemoval(20);}},{key:"dragleave",value:function dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null);}}]);}();F=/*#__PURE__*/function(_s4){function F(t){_classCallCheck(this,F);return _callSuper(this,F,[t,t]);}_inherits(F,_s4);return _createClass(F,[{key:"map",value:function map(t,e){var r=t.resolve(e.map(this.head));return F.valid(r)?new F(r):s.near(r);}},{key:"content",value:function content(){return o.empty;}},{key:"eq",value:function eq(t){return t instanceof F&&t.head==this.head;}},{key:"toJSON",value:function toJSON(){return{type:"gapcursor",pos:this.head};}},{key:"getBookmark",value:function getBookmark(){return new L(this.anchor);}}],[{key:"fromJSON",value:function fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new F(t.resolve(e.pos));}},{key:"valid",value:function valid(t){var e=t.parent;if(e.inlineContent||!function(t){for(var _e4=t.depth;_e4>=0;_e4--){var _s5=t.index(_e4),_r2=t.node(_e4);if(0!=_s5)for(var _t4=_r2.child(_s5-1);;_t4=_t4.lastChild){if(0==_t4.childCount&&!_t4.inlineContent||A(_t4.type))return!0;if(_t4.inlineContent)return!1;}else if(_r2.type.spec.isolating)return!0;}return!0;}(t)||!function(t){for(var _e5=t.depth;_e5>=0;_e5--){var _s6=t.indexAfter(_e5),_r3=t.node(_e5);if(_s6!=_r3.childCount)for(var _t5=_r3.child(_s6);;_t5=_t5.firstChild){if(0==_t5.childCount&&!_t5.inlineContent||A(_t5.type))return!0;if(_t5.inlineContent)return!1;}else if(_r3.type.spec.isolating)return!0;}return!0;}(t))return!1;var s=e.type.spec.allowGapCursor;if(null!=s)return s;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock;}},{key:"findGapCursorFrom",value:function findGapCursorFrom(t,e){var s=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;t:for(;;){if(!s&&F.valid(t))return t;var _r4=t.pos,_n2=null;for(var _s7=t.depth;;_s7--){var _i2=t.node(_s7);if(e>0?t.indexAfter(_s7)<_i2.childCount:t.index(_s7)>0){_n2=_i2.child(e>0?t.indexAfter(_s7):t.index(_s7)-1);break;}if(0==_s7)return null;_r4+=e;var _o=t.doc.resolve(_r4);if(F.valid(_o))return _o;}for(;;){var _o2=e>0?_n2.firstChild:_n2.lastChild;if(!_o2){if(_n2.isAtom&&!_n2.isText&&!i.isSelectable(_n2)){t=t.doc.resolve(_r4+_n2.nodeSize*e),s=!1;continue t;}break;}_n2=_o2,_r4+=e;var _l2=t.doc.resolve(_r4);if(F.valid(_l2))return _l2;}return null;}}}]);}(s);F.prototype.visible=!1,F.findFrom=F.findGapCursorFrom,s.jsonID("gapcursor",F);L=/*#__PURE__*/function(){function L(t){_classCallCheck(this,L);this.pos=t;}return _createClass(L,[{key:"map",value:function map(t){return new L(t.map(this.pos));}},{key:"resolve",value:function resolve(t){var e=t.resolve(this.pos);return F.valid(e)?new F(e):s.near(e);}}]);}();D=h({ArrowLeft:E("horiz",-1),ArrowRight:E("horiz",1),ArrowUp:E("vert",-1),ArrowDown:E("vert",1)});N=new l("nileMentionSuggest"),R=new l("nileSlashSuggest"),B=new l("nileEmojiSuggest");}};});
1
+ System.register(["../../index-bbe23ad8.cjs.js","./commands.cjs.js","./schema.cjs.js","../../index-ccc6a799.cjs.js","../../index-7ae95edd.cjs.js","./keymap.cjs.js","./inputrules.cjs.js","./plugins/placeholder.cjs.js","./plugins/link.cjs.js","./plugins/single-line.cjs.js","./plugins/tables.cjs.js","./plugins/image.cjs.js","./plugins/suggestions.cjs.js","./plugins/find-replace.cjs.js","./plugins/max-length.cjs.js","./plugins/code-highlight.cjs.js","./plugins/embeds.cjs.js","./plugins/paste.cjs.js","./plugins/format-painter.cjs.js","../../index-178e1e57.cjs.js","./email-css.cjs.js","./sanitize.cjs.js","../../index-129ef6fb.cjs.js","./markdown-parse.cjs.js","./html-detect.cjs.js","./serializer.cjs.js","./email-render.cjs.js","../../xml-09119317.cjs.js"],function(_export,_context){"use strict";var t,e,s,r,i,n,o,l,u,a,h,f,c,p,m,g,d,j,w,v,x,S,b,k,y,O,T,z,C,F,A,L,J,R,B;function _toConsumableArray(r){return _arrayWithoutHoles(r)||_iterableToArray(r)||_unsupportedIterableToArray(r)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}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 _iterableToArray(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r);}function _arrayWithoutHoles(r){if(Array.isArray(r))return _arrayLikeToArray(r);}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 ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}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 _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 E(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor;}function D(t,e){var s="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,i,n){var o=t.selection,l=e>0?o.$to:o.$from,u=o.empty;if(o instanceof r){if(!n.endOfTextblock(s)||0==l.depth)return!1;u=!1,l=t.doc.resolve(e>0?l.after():l.before());}var a=F.findGapCursorFrom(l,e,u);return!!a&&(i&&i(t.tr.setSelection(new F(a))),!0);};}function M(t,e,s){if(!t||!t.editable)return!1;var r=t.state.doc.resolve(e);if(!F.valid(r))return!1;var n=t.posAtCoords({left:s.clientX,top:s.clientY});return!(n&&n.inside>-1&&i.isSelectable(t.state.doc.nodeAt(n.inside)))&&(t.dispatch(t.state.tr.setSelection(new F(r))),!0);}function N(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof F))return!1;var s=t.state.selection.$from,i=s.parent.contentMatchAt(s.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;var n=h.empty;for(var _t6=i.length-1;_t6>=0;_t6--)n=h.from(i[_t6].createAndFill(null,n));var o=t.state.tr.replace(s.pos,s.pos,new f(n,0,0));return o.setSelection(r.near(o.doc.resolve(s.pos+1))),t.dispatch(o),!1;}function P(t){if(!(t.selection instanceof F))return null;var e=document.createElement("div");return e.className="ProseMirror-gapcursor",c.create(t.doc,[p.widget(t.selection.head,e,{key:"gapcursor"})]);}function G(){var _e$schema,_e$getPlaceholder;var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var s=(_e$schema=e.schema)!==null&&_e$schema!==void 0?_e$schema:a,r=[];return e.mentions&&r.push(S(J,e.mentions)),e.slashCommands&&r.push(S(R,_objectSpread(_objectSpread({},e.slashCommands),{},{getTriggers:function getTriggers(){return["/"];},startOfLine:!0}))),e.emoji&&r.push(S(B,_objectSpread(_objectSpread({},e.emoji),{},{getTriggers:function getTriggers(){return[":"];},minQueryLength:2}))),r.push.apply(r,[g(s,{textTransform:e.textTransform})].concat(_toConsumableArray(m(s,{onLinkShortcut:e.onLinkShortcut,onFindShortcut:e.onFindShortcut,onShortcutHelp:e.onShortcutHelp})),[l(),function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new t({view:function view(t){return new C(t,e);}});}(),new t({props:{decorations:P,createSelectionBetween:function createSelectionBetween(t,e,s){return e.pos==s.pos&&F.valid(s)?new F(s):null;},handleClick:M,handleKeyDown:L,handleDOMEvents:{beforeinput:N}}}),d((_e$getPlaceholder=e.getPlaceholder)!==null&&_e$getPlaceholder!==void 0?_e$getPlaceholder:function(){return"";}),j({onOpenLink:e.onOpenLink})],_toConsumableArray(v()),[x({onImageFiles:e.onImageFiles}),b(),y(),O(),z(),T(s,{getForcePlainText:e.getForcePlainText,getMarkdownPaste:e.getMarkdownPaste,getSanitize:e.getSanitize,getEmailFidelity:e.getEmailFidelity,getAllowedStyles:e.getAllowedStyles})])),e.getMaxLength&&r.push(k(e.getMaxLength)),e.singleLine&&r.push(w()),e.plugins&&r.push.apply(r,_toConsumableArray(e.plugins)),o.create({schema:s,doc:e.doc,plugins:r});}_export("c",G);return{setters:[function(_index00aCjsJs){t=_index00aCjsJs.a;e=_index00aCjsJs.d;s=_index00aCjsJs.S;r=_index00aCjsJs.T;i=_index00aCjsJs.N;n=_index00aCjsJs.P;o=_index00aCjsJs.E;},function(_commandsCjsJs){l=_commandsCjsJs.h;},function(_schemaCjsJs){u=_schemaCjsJs.d;a=_schemaCjsJs.e;},function(_index00bCjsJs){h=_index00bCjsJs.F;f=_index00bCjsJs.S;},function(_index009CjsJs){c=_index009CjsJs.D;p=_index009CjsJs.a;},function(_keymapCjsJs){m=_keymapCjsJs.b;},function(_inputrulesCjsJs){g=_inputrulesCjsJs.b;},function(_pluginsPlaceholderCjsJs){d=_pluginsPlaceholderCjsJs.p;},function(_pluginsLinkCjsJs){j=_pluginsLinkCjsJs.l;},function(_pluginsSingleLineCjsJs){w=_pluginsSingleLineCjsJs.s;},function(_pluginsTablesCjsJs){v=_pluginsTablesCjsJs.t;},function(_pluginsImageCjsJs){x=_pluginsImageCjsJs.i;},function(_pluginsSuggestionsCjsJs){S=_pluginsSuggestionsCjsJs.s;},function(_pluginsFindReplaceCjsJs){b=_pluginsFindReplaceCjsJs.f;},function(_pluginsMaxLengthCjsJs){k=_pluginsMaxLengthCjsJs.m;},function(_pluginsCodeHighlightCjsJs){y=_pluginsCodeHighlightCjsJs.c;},function(_pluginsEmbedsCjsJs){O=_pluginsEmbedsCjsJs.e;},function(_pluginsPasteCjsJs){T=_pluginsPasteCjsJs.a;},function(_pluginsFormatPainterCjsJs){z=_pluginsFormatPainterCjsJs.f;},function(_index007CjsJs){},function(_emailCssCjsJs){},function(_sanitizeCjsJs){},function(_index00dCjsJs){},function(_markdownParseCjsJs){},function(_htmlDetectCjsJs){},function(_serializerCjsJs){},function(_emailRenderCjsJs){},function(_xml00cCjsJs){}],execute:function execute(){C=/*#__PURE__*/function(){function C(t,e){var _this=this;_classCallCheck(this,C);var s;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=null!==(s=e.width)&&void 0!==s?s:1,this.color=!1===e.color?void 0:e.color||"black",this["class"]=e["class"],this.handlers=["dragover","dragend","drop","dragleave"].map(function(e){var s=function s(t){_this[e](t);};return t.dom.addEventListener(e,s),{name:e,handler:s};});}return _createClass(C,[{key:"destroy",value:function destroy(){var _this2=this;this.handlers.forEach(function(_ref){var t=_ref.name,e=_ref.handler;return _this2.editorView.dom.removeEventListener(t,e);});}},{key:"update",value:function update(t,e){if(null!=this.cursorPos&&e.doc!=t.state.doc)if(this.lastDragEvent){var _t=this.computeTarget(this.lastDragEvent);_t==this.cursorPos?this.updateOverlay():this.setCursor(_t);}else this.updateOverlay();}},{key:"setCursor",value:function setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay());}},{key:"updateOverlay",value:function updateOverlay(){var t,e=this.editorView.state.doc.resolve(this.cursorPos),s=!e.parent.inlineContent,r=this.editorView.dom,i=r.getBoundingClientRect(),n=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(s){var _s=e.nodeBefore,_r=e.nodeAfter;if(_s||_r){var _e=this.editorView.nodeDOM(this.cursorPos-(_s?_s.nodeSize:0));if(_e){var _i=_e.getBoundingClientRect(),_n=_s?_i.bottom:_i.top;_s&&_r&&(_n=(_n+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);var _l=this.width/2*o;t={left:_i.left,right:_i.right,top:_n-_l,bottom:_n+_l};}}}if(!t){var _e2=this.editorView.coordsAtPos(this.cursorPos),_s2=this.width/2*n;t={left:_e2.left-_s2,right:_e2.left+_s2,top:_e2.top,bottom:_e2.bottom};}var l,u,a=this.editorView.dom.offsetParent;if(this.element||(this.element=a.appendChild(document.createElement("div")),this["class"]&&(this.element.className=this["class"]),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s),!a||a==document.body&&"static"==getComputedStyle(a).position)l=-pageXOffset,u=-pageYOffset;else{var _t2=a.getBoundingClientRect(),_e3=_t2.width/a.offsetWidth,_s3=_t2.height/a.offsetHeight;l=_t2.left-a.scrollLeft*_e3,u=_t2.top-a.scrollTop*_s3;}this.element.style.left=(t.left-l)/n+"px",this.element.style.top=(t.top-u)/o+"px",this.element.style.width=(t.right-t.left)/n+"px",this.element.style.height=(t.bottom-t.top)/o+"px";}},{key:"scheduleRemoval",value:function scheduleRemoval(t){var _this3=this;clearTimeout(this.timeout),this.timeout=setTimeout(function(){return _this3.setCursor(null);},t);}},{key:"computeTarget",value:function computeTarget(t){var s=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),i=r&&r.type.spec.disableDropCursor,n="function"==typeof i?i(this.editorView,s,t):i;if(!s||n)return null;var o=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){var _t3=e(this.editorView.state.doc,o,this.editorView.dragging.slice);null!=_t3&&(o=_t3);}return o;}},{key:"dragover",value:function dragover(t){if(!this.editorView.editable)return;this.lastDragEvent=t;var e=this.computeTarget(t);null!=e&&(this.setCursor(e),this.scheduleRemoval(5e3));}},{key:"dragend",value:function dragend(){this.scheduleRemoval(20);}},{key:"drop",value:function drop(){this.scheduleRemoval(20);}},{key:"dragleave",value:function dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null);}}]);}();F=/*#__PURE__*/function(_s4){function F(t){_classCallCheck(this,F);return _callSuper(this,F,[t,t]);}_inherits(F,_s4);return _createClass(F,[{key:"map",value:function map(t,e){var r=t.resolve(e.map(this.head));return F.valid(r)?new F(r):s.near(r);}},{key:"content",value:function content(){return f.empty;}},{key:"eq",value:function eq(t){return t instanceof F&&t.head==this.head;}},{key:"toJSON",value:function toJSON(){return{type:"gapcursor",pos:this.head};}},{key:"getBookmark",value:function getBookmark(){return new A(this.anchor);}}],[{key:"fromJSON",value:function fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new F(t.resolve(e.pos));}},{key:"valid",value:function valid(t){var e=t.parent;if(e.inlineContent||!function(t){for(var _e4=t.depth;_e4>=0;_e4--){var _s5=t.index(_e4),_r2=t.node(_e4);if(0!=_s5)for(var _t4=_r2.child(_s5-1);;_t4=_t4.lastChild){if(0==_t4.childCount&&!_t4.inlineContent||E(_t4.type))return!0;if(_t4.inlineContent)return!1;}else if(_r2.type.spec.isolating)return!0;}return!0;}(t)||!function(t){for(var _e5=t.depth;_e5>=0;_e5--){var _s6=t.indexAfter(_e5),_r3=t.node(_e5);if(_s6!=_r3.childCount)for(var _t5=_r3.child(_s6);;_t5=_t5.firstChild){if(0==_t5.childCount&&!_t5.inlineContent||E(_t5.type))return!0;if(_t5.inlineContent)return!1;}else if(_r3.type.spec.isolating)return!0;}return!0;}(t))return!1;var s=e.type.spec.allowGapCursor;if(null!=s)return s;var r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock;}},{key:"findGapCursorFrom",value:function findGapCursorFrom(t,e){var s=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!1;t:for(;;){if(!s&&F.valid(t))return t;var _r4=t.pos,_n2=null;for(var _s7=t.depth;;_s7--){var _i2=t.node(_s7);if(e>0?t.indexAfter(_s7)<_i2.childCount:t.index(_s7)>0){_n2=_i2.child(e>0?t.indexAfter(_s7):t.index(_s7)-1);break;}if(0==_s7)return null;_r4+=e;var _o=t.doc.resolve(_r4);if(F.valid(_o))return _o;}for(;;){var _o2=e>0?_n2.firstChild:_n2.lastChild;if(!_o2){if(_n2.isAtom&&!_n2.isText&&!i.isSelectable(_n2)){t=t.doc.resolve(_r4+_n2.nodeSize*e),s=!1;continue t;}break;}_n2=_o2,_r4+=e;var _l2=t.doc.resolve(_r4);if(F.valid(_l2))return _l2;}return null;}}}]);}(s);F.prototype.visible=!1,F.findFrom=F.findGapCursorFrom,s.jsonID("gapcursor",F);A=/*#__PURE__*/function(){function A(t){_classCallCheck(this,A);this.pos=t;}return _createClass(A,[{key:"map",value:function map(t){return new A(t.map(this.pos));}},{key:"resolve",value:function resolve(t){var e=t.resolve(this.pos);return F.valid(e)?new F(e):s.near(e);}}]);}();L=u({ArrowLeft:D("horiz",-1),ArrowRight:D("horiz",1),ArrowUp:D("vert",-1),ArrowDown:D("vert",1)});J=new n("nileMentionSuggest"),R=new n("nileSlashSuggest"),B=new n("nileEmojiSuggest");}};});
2
2
  //# sourceMappingURL=create-state.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-state.cjs.js","sources":["../../../../../node_modules/prosemirror-gapcursor/dist/index.js","../../../../src/nile-wysiwyg-editor/engine/create-state.ts","../../../../../node_modules/prosemirror-dropcursor/dist/index.js"],"sourcesContent":["import { keydownHandler } from 'prosemirror-keymap';\nimport { Selection, NodeSelection, TextSelection, Plugin } from 'prosemirror-state';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\n\n/**\nGap cursor selections are represented using this class. Its\n`$anchor` and `$head` properties both point at the cursor position.\n*/\nclass GapCursor extends Selection {\n /**\n Create a gap cursor.\n */\n constructor($pos) {\n super($pos, $pos);\n }\n map(doc, mapping) {\n let $pos = doc.resolve(mapping.map(this.head));\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);\n }\n content() { return Slice.empty; }\n eq(other) {\n return other instanceof GapCursor && other.head == this.head;\n }\n toJSON() {\n return { type: \"gapcursor\", pos: this.head };\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.pos != \"number\")\n throw new RangeError(\"Invalid input for GapCursor.fromJSON\");\n return new GapCursor(doc.resolve(json.pos));\n }\n /**\n @internal\n */\n getBookmark() { return new GapBookmark(this.anchor); }\n /**\n @internal\n */\n static valid($pos) {\n let parent = $pos.parent;\n if (parent.inlineContent || !closedBefore($pos) || !closedAfter($pos))\n return false;\n let override = parent.type.spec.allowGapCursor;\n if (override != null)\n return override;\n let deflt = parent.contentMatchAt($pos.index()).defaultType;\n return deflt && deflt.isTextblock;\n }\n /**\n @internal\n */\n static findGapCursorFrom($pos, dir, mustMove = false) {\n search: for (;;) {\n if (!mustMove && GapCursor.valid($pos))\n return $pos;\n let pos = $pos.pos, next = null;\n // Scan up from this position\n for (let d = $pos.depth;; d--) {\n let parent = $pos.node(d);\n if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {\n next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);\n break;\n }\n else if (d == 0) {\n return null;\n }\n pos += dir;\n let $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur))\n return $cur;\n }\n // And then down into the next node\n for (;;) {\n let inside = dir > 0 ? next.firstChild : next.lastChild;\n if (!inside) {\n if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {\n $pos = $pos.doc.resolve(pos + next.nodeSize * dir);\n mustMove = false;\n continue search;\n }\n break;\n }\n next = inside;\n pos += dir;\n let $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur))\n return $cur;\n }\n return null;\n }\n }\n}\nGapCursor.prototype.visible = false;\nGapCursor.findFrom = GapCursor.findGapCursorFrom;\nSelection.jsonID(\"gapcursor\", GapCursor);\nclass GapBookmark {\n constructor(pos) {\n this.pos = pos;\n }\n map(mapping) {\n return new GapBookmark(mapping.map(this.pos));\n }\n resolve(doc) {\n let $pos = doc.resolve(this.pos);\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);\n }\n}\nfunction needsGap(type) {\n return type.isAtom || type.spec.isolating || type.spec.createGapCursor;\n}\nfunction closedBefore($pos) {\n for (let d = $pos.depth; d >= 0; d--) {\n let index = $pos.index(d), parent = $pos.node(d);\n // At the start of this parent, look at next one\n if (index == 0) {\n if (parent.type.spec.isolating)\n return true;\n continue;\n }\n // See if the node before (or its first ancestor) is closed\n for (let before = parent.child(index - 1);; before = before.lastChild) {\n if ((before.childCount == 0 && !before.inlineContent) || needsGap(before.type))\n return true;\n if (before.inlineContent)\n return false;\n }\n }\n // Hit start of document\n return true;\n}\nfunction closedAfter($pos) {\n for (let d = $pos.depth; d >= 0; d--) {\n let index = $pos.indexAfter(d), parent = $pos.node(d);\n if (index == parent.childCount) {\n if (parent.type.spec.isolating)\n return true;\n continue;\n }\n for (let after = parent.child(index);; after = after.firstChild) {\n if ((after.childCount == 0 && !after.inlineContent) || needsGap(after.type))\n return true;\n if (after.inlineContent)\n return false;\n }\n }\n return true;\n}\n\n/**\nCreate a gap cursor plugin. When enabled, this will capture clicks\nnear and arrow-key-motion past places that don't have a normally\nselectable position nearby, and create a gap cursor selection for\nthem. The cursor is drawn as an element with class\n`ProseMirror-gapcursor`. You can either include\n`style/gapcursor.css` from the package's directory or add your own\nstyles to make it visible.\n*/\nfunction gapCursor() {\n return new Plugin({\n props: {\n decorations: drawGapCursor,\n createSelectionBetween(_view, $anchor, $head) {\n return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;\n },\n handleClick,\n handleKeyDown,\n handleDOMEvents: { beforeinput: beforeinput }\n }\n });\n}\nconst handleKeyDown = keydownHandler({\n \"ArrowLeft\": arrow(\"horiz\", -1),\n \"ArrowRight\": arrow(\"horiz\", 1),\n \"ArrowUp\": arrow(\"vert\", -1),\n \"ArrowDown\": arrow(\"vert\", 1)\n});\nfunction arrow(axis, dir) {\n const dirStr = axis == \"vert\" ? (dir > 0 ? \"down\" : \"up\") : (dir > 0 ? \"right\" : \"left\");\n return function (state, dispatch, view) {\n let sel = state.selection;\n let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;\n if (sel instanceof TextSelection) {\n if (!view.endOfTextblock(dirStr) || $start.depth == 0)\n return false;\n mustMove = false;\n $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());\n }\n let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);\n if (!$found)\n return false;\n if (dispatch)\n dispatch(state.tr.setSelection(new GapCursor($found)));\n return true;\n };\n}\nfunction handleClick(view, pos, event) {\n if (!view || !view.editable)\n return false;\n let $pos = view.state.doc.resolve(pos);\n if (!GapCursor.valid($pos))\n return false;\n let clickPos = view.posAtCoords({ left: event.clientX, top: event.clientY });\n if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside)))\n return false;\n view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));\n return true;\n}\n// This is a hack that, when a composition starts while a gap cursor\n// is active, quickly creates an inline context for the composition to\n// happen in, to avoid it being aborted by the DOM selection being\n// moved into a valid position.\nfunction beforeinput(view, event) {\n if (event.inputType != \"insertCompositionText\" || !(view.state.selection instanceof GapCursor))\n return false;\n let { $from } = view.state.selection;\n let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);\n if (!insert)\n return false;\n let frag = Fragment.empty;\n for (let i = insert.length - 1; i >= 0; i--)\n frag = Fragment.from(insert[i].createAndFill(null, frag));\n let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));\n tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));\n view.dispatch(tr);\n return false;\n}\nfunction drawGapCursor(state) {\n if (!(state.selection instanceof GapCursor))\n return null;\n let node = document.createElement(\"div\");\n node.className = \"ProseMirror-gapcursor\";\n return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, { key: \"gapcursor\" })]);\n}\n\nexport { GapCursor, gapCursor };\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state';\nimport { Node as PMNode, Schema } from 'prosemirror-model';\nimport { history } from 'prosemirror-history';\nimport { dropCursor } from 'prosemirror-dropcursor';\nimport { gapCursor } from 'prosemirror-gapcursor';\nimport { buildKeymapPlugins, KeymapOptions } from './keymap';\nimport { buildInputRules } from './inputrules';\nimport { placeholderPlugin } from './plugins/placeholder';\nimport { linkPlugin, LinkPluginOptions } from './plugins/link';\nimport { singleLinePlugin } from './plugins/single-line';\nimport { tablePlugins } from './plugins/tables';\nimport { imagePlugin, ImagePluginOptions } from './plugins/image';\nimport { suggestionPlugin, SuggestionOptions } from './plugins/suggestions';\nimport { findReplacePlugin } from './plugins/find-replace';\nimport { maxLengthPlugin } from './plugins/max-length';\nimport { codeHighlightPlugin } from './plugins/code-highlight';\nimport { embedPastePlugin } from './plugins/embeds';\nimport { pastePlugin } from './plugins/paste';\nimport { formatPainterPlugin } from './plugins/format-painter';\nimport { defaultSchema } from './schema';\n\nexport const mentionSuggestKey = new PluginKey('nileMentionSuggest');\nexport const slashSuggestKey = new PluginKey('nileSlashSuggest');\nexport const emojiSuggestKey = new PluginKey('nileEmojiSuggest');\n\nexport interface CreateStateOptions\n extends KeymapOptions,\n LinkPluginOptions,\n ImagePluginOptions {\n schema?: Schema;\n doc?: PMNode;\n /** Read live so the placeholder updates without rebuilding state. */\n getPlaceholder?: () => string;\n singleLine?: boolean;\n /** Mention suggestions (omit onChange to disable the plugin). */\n mentions?: Omit<SuggestionOptions, 'startOfLine'>;\n /** Slash-command suggestions, anchored to the start of a block. */\n slashCommands?: Omit<SuggestionOptions, 'startOfLine' | 'getTriggers'>;\n /** \":\" emoji suggestions (activates after two query characters). */\n emoji?: Omit<SuggestionOptions, 'startOfLine' | 'getTriggers' | 'minQueryLength'>;\n /** Character limit, read live. Return 0/undefined for unlimited. */\n getMaxLength?: () => number;\n /** Read live: when true, all pastes drop formatting. */\n getForcePlainText?: () => boolean;\n /** Read live: when false, plain-text pastes are never parsed as Markdown. */\n getMarkdownPaste?: () => boolean;\n /** Read live: whether pasted/parsed HTML is sanitized. Defaults to on. */\n getSanitize?: () => boolean;\n /** Typography autocorrect (smart quotes, dashes, (c)…). Defaults to on. */\n textTransform?: boolean;\n /** Extra plugins appended after the built-in set (later phases, tests). */\n plugins?: Plugin[];\n}\n\nexport function createEditorState(options: CreateStateOptions = {}): EditorState {\n const schema = options.schema ?? defaultSchema;\n const plugins: Plugin[] = [];\n\n // Suggestion plugins must come BEFORE the keymaps: handleKeyDown props run\n // in plugin order, and the popup needs first claim on Enter/Tab/arrows\n // while a mention or slash query is active.\n if (options.mentions) {\n plugins.push(suggestionPlugin(mentionSuggestKey, options.mentions));\n }\n if (options.slashCommands) {\n plugins.push(\n suggestionPlugin(slashSuggestKey, {\n ...options.slashCommands,\n getTriggers: () => ['/'],\n startOfLine: true,\n })\n );\n }\n if (options.emoji) {\n plugins.push(\n suggestionPlugin(emojiSuggestKey, {\n ...options.emoji,\n getTriggers: () => [':'],\n minQueryLength: 2,\n })\n );\n }\n\n plugins.push(\n buildInputRules(schema, { textTransform: options.textTransform }),\n ...buildKeymapPlugins(schema, {\n onLinkShortcut: options.onLinkShortcut,\n onFindShortcut: options.onFindShortcut,\n onShortcutHelp: options.onShortcutHelp,\n }),\n history(),\n dropCursor(),\n gapCursor(),\n placeholderPlugin(options.getPlaceholder ?? (() => '')),\n linkPlugin({ onOpenLink: options.onOpenLink }),\n ...tablePlugins(),\n imagePlugin({ onImageFiles: options.onImageFiles }),\n findReplacePlugin(),\n codeHighlightPlugin(),\n embedPastePlugin(),\n formatPainterPlugin(),\n pastePlugin(schema, {\n getForcePlainText: options.getForcePlainText,\n getMarkdownPaste: options.getMarkdownPaste,\n getSanitize: options.getSanitize,\n })\n );\n if (options.getMaxLength) plugins.push(maxLengthPlugin(options.getMaxLength));\n if (options.singleLine) plugins.push(singleLinePlugin());\n if (options.plugins) plugins.push(...options.plugins);\n\n return EditorState.create({\n schema,\n doc: options.doc,\n plugins,\n });\n}\n","import { Plugin } from 'prosemirror-state';\nimport { dropPoint } from 'prosemirror-transform';\n\n/**\nCreate a plugin that, when added to a ProseMirror instance,\ncauses a decoration to show up at the drop position when something\nis dragged over the editor.\n\nNodes may add a `disableDropCursor` property to their spec to\ncontrol the showing of a drop cursor inside them. This may be a\nboolean or a function, which will be called with a view and a\nposition, and should return a boolean.\n*/\nfunction dropCursor(options = {}) {\n return new Plugin({\n view(editorView) { return new DropCursorView(editorView, options); }\n });\n}\nclass DropCursorView {\n constructor(editorView, options) {\n var _a;\n this.editorView = editorView;\n this.cursorPos = null;\n this.element = null;\n this.timeout = -1;\n this.lastDragEvent = null;\n this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;\n this.color = options.color === false ? undefined : (options.color || \"black\");\n this.class = options.class;\n this.handlers = [\"dragover\", \"dragend\", \"drop\", \"dragleave\"].map(name => {\n let handler = (e) => { this[name](e); };\n editorView.dom.addEventListener(name, handler);\n return { name, handler };\n });\n }\n destroy() {\n this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));\n }\n update(editorView, prevState) {\n if (this.cursorPos != null && prevState.doc != editorView.state.doc) {\n // if we currently have an on-going drag event\n // we need to update the cursor position again and update the overlay\n if (this.lastDragEvent) {\n let target = this.computeTarget(this.lastDragEvent);\n if (target == this.cursorPos)\n this.updateOverlay();\n else\n this.setCursor(target);\n }\n else {\n this.updateOverlay();\n }\n }\n }\n setCursor(pos) {\n if (pos == this.cursorPos)\n return;\n this.cursorPos = pos;\n if (pos == null) {\n this.element.parentNode.removeChild(this.element);\n this.element = null;\n }\n else {\n this.updateOverlay();\n }\n }\n updateOverlay() {\n let $pos = this.editorView.state.doc.resolve(this.cursorPos);\n let isBlock = !$pos.parent.inlineContent, rect;\n let editorDOM = this.editorView.dom, editorRect = editorDOM.getBoundingClientRect();\n let scaleX = editorRect.width / editorDOM.offsetWidth, scaleY = editorRect.height / editorDOM.offsetHeight;\n if (isBlock) {\n let before = $pos.nodeBefore, after = $pos.nodeAfter;\n if (before || after) {\n let node = this.editorView.nodeDOM(this.cursorPos - (before ? before.nodeSize : 0));\n if (node) {\n let nodeRect = node.getBoundingClientRect();\n let top = before ? nodeRect.bottom : nodeRect.top;\n if (before && after)\n top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2;\n let halfWidth = (this.width / 2) * scaleY;\n rect = { left: nodeRect.left, right: nodeRect.right, top: top - halfWidth, bottom: top + halfWidth };\n }\n }\n }\n if (!rect) {\n let coords = this.editorView.coordsAtPos(this.cursorPos);\n let halfWidth = (this.width / 2) * scaleX;\n rect = { left: coords.left - halfWidth, right: coords.left + halfWidth, top: coords.top, bottom: coords.bottom };\n }\n let parent = this.editorView.dom.offsetParent;\n if (!this.element) {\n this.element = parent.appendChild(document.createElement(\"div\"));\n if (this.class)\n this.element.className = this.class;\n this.element.style.cssText = \"position: absolute; z-index: 50; pointer-events: none;\";\n if (this.color) {\n this.element.style.backgroundColor = this.color;\n }\n }\n this.element.classList.toggle(\"prosemirror-dropcursor-block\", isBlock);\n this.element.classList.toggle(\"prosemirror-dropcursor-inline\", !isBlock);\n let parentLeft, parentTop;\n if (!parent || parent == document.body && getComputedStyle(parent).position == \"static\") {\n parentLeft = -pageXOffset;\n parentTop = -pageYOffset;\n }\n else {\n let rect = parent.getBoundingClientRect();\n let parentScaleX = rect.width / parent.offsetWidth, parentScaleY = rect.height / parent.offsetHeight;\n parentLeft = rect.left - parent.scrollLeft * parentScaleX;\n parentTop = rect.top - parent.scrollTop * parentScaleY;\n }\n this.element.style.left = (rect.left - parentLeft) / scaleX + \"px\";\n this.element.style.top = (rect.top - parentTop) / scaleY + \"px\";\n this.element.style.width = (rect.right - rect.left) / scaleX + \"px\";\n this.element.style.height = (rect.bottom - rect.top) / scaleY + \"px\";\n }\n scheduleRemoval(timeout) {\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => this.setCursor(null), timeout);\n }\n computeTarget(event) {\n let pos = this.editorView.posAtCoords({ left: event.clientX, top: event.clientY });\n let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);\n let disableDropCursor = node && node.type.spec.disableDropCursor;\n let disabled = typeof disableDropCursor == \"function\"\n ? disableDropCursor(this.editorView, pos, event)\n : disableDropCursor;\n if (!pos || disabled)\n return null;\n let target = pos.pos;\n if (this.editorView.dragging && this.editorView.dragging.slice) {\n let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);\n if (point != null)\n target = point;\n }\n return target;\n }\n dragover(event) {\n if (!this.editorView.editable)\n return;\n this.lastDragEvent = event;\n let target = this.computeTarget(event);\n if (target != null) {\n this.setCursor(target);\n this.scheduleRemoval(5000);\n }\n }\n dragend() {\n this.scheduleRemoval(20);\n }\n drop() {\n this.scheduleRemoval(20);\n }\n dragleave(event) {\n if (!this.editorView.dom.contains(event.relatedTarget))\n this.setCursor(null);\n }\n}\n\nexport { dropCursor };\n"],"names":["needsGap","type","isAtom","spec","isolating","createGapCursor","arrow","axis","dir","dirStr","state","dispatch","view","sel","selection","$start","$to","$from","mustMove","empty","TextSelection","endOfTextblock","depth","doc","resolve","after","before","$found","GapCursor","findGapCursorFrom","tr","setSelection","handleClick","pos","event","editable","$pos","valid","clickPos","posAtCoords","left","clientX","top","clientY","inside","NodeSelection","isSelectable","nodeAt","beforeinput","inputType","insert","parent","contentMatchAt","index","findWrapping","schema","nodes","text","frag","Fragment","i","length","from","createAndFill","replace","Slice","near","drawGapCursor","node","document","createElement","className","DecorationSet","create","Decoration","widget","head","key","createEditorState","options","defaultSchema","plugins","mentions","push","suggestionPlugin","mentionSuggestKey","slashCommands","slashSuggestKey","getTriggers","startOfLine","emoji","emojiSuggestKey","minQueryLength","buildInputRules","textTransform","buildKeymapPlugins","onLinkShortcut","onFindShortcut","onShortcutHelp","history","Plugin","editorView","DropCursorView","dropCursor","props","decorations","createSelectionBetween","_view","$anchor","$head","handleKeyDown","handleDOMEvents","placeholderPlugin","getPlaceholder","linkPlugin","onOpenLink","tablePlugins","imagePlugin","onImageFiles","findReplacePlugin","codeHighlightPlugin","embedPastePlugin","formatPainterPlugin","pastePlugin","getForcePlainText","getMarkdownPaste","getSanitize","getMaxLength","maxLengthPlugin","singleLine","singleLinePlugin","EditorState","C","_a","this","cursorPos","element","timeout","lastDragEvent","width","color","undefined","handlers","map","name","handler","e","dom","addEventListener","s","_createClass","value","destroy","forEach","_ref","removeEventListener","update","prevState","target","computeTarget","updateOverlay","setCursor","parentNode","removeChild","rect","isBlock","inlineContent","editorDOM","editorRect","getBoundingClientRect","scaleX","offsetWidth","scaleY","height","offsetHeight","nodeBefore","nodeAfter","nodeDOM","nodeSize","nodeRect","bottom","halfWidth","right","coords","coordsAtPos","parentLeft","parentTop","offsetParent","appendChild","class","style","cssText","backgroundColor","classList","toggle","body","getComputedStyle","position","pageXOffset","pageYOffset","parentScaleX","parentScaleY","scrollLeft","scrollTop","scheduleRemoval","clearTimeout","setTimeout","disableDropCursor","disabled","dragging","slice","point","dropPoint","dragover","dragend","drop","dragleave","contains","relatedTarget","Selection","F","_inherits","_s4","mapping","content","eq","other","toJSON","getBookmark","GapBookmark","anchor","fromJSON","json","RangeError","d","child","lastChild","childCount","closedBefore","indexAfter","firstChild","closedAfter","override","allowGapCursor","deflt","defaultType","isTextblock","search","next","$cur","isText","prototype","visible","findFrom","jsonID","L","keydownHandler","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PluginKey"],"mappings":"u+JA+GA,QAASA,CAAAA,CAASC,CAAAA,CAAAA,CAAAA,CACd,MAAOA,CAAAA,CAAKC,CAAAA,MAAAA,EAAUD,EAAKE,IAAKC,CAAAA,SAAAA,EAAaH,EAAKE,IAAKE,CAAAA,eAC3D,EAmEA,QAASC,CAAAA,CAAMC,CAAAA,CAAAA,CAAMC,GACjB,GAAMC,CAAAA,CAAAA,CAAiB,QAARF,CAAkBC,CAAAA,CAAAA,CAAM,EAAI,MAAS,CAAA,IAAA,CAASA,EAAM,CAAI,CAAA,OAAA,CAAU,OACjF,MAAO,UAAUE,EAAOC,CAAUC,CAAAA,CAAAA,CAAAA,CAC9B,GAAIC,CAAAA,CAAMH,CAAAA,CAAAA,CAAMI,UACZC,CAASP,CAAAA,CAAAA,CAAM,EAAIK,CAAIG,CAAAA,GAAAA,CAAMH,EAAII,KAAOC,CAAAA,CAAAA,CAAWL,EAAIM,KAC3D,CAAA,GAAIN,YAAeO,CAAAA,CAAe,CAAA,CAC9B,IAAKR,CAAKS,CAAAA,cAAAA,CAAeZ,IAA2B,CAAhBM,EAAAA,CAAAA,CAAOO,MACvC,MAAO,CAAA,CAAA,CACXJ,GAAW,CACXH,CAAAA,CAAAA,CAASL,EAAMa,GAAIC,CAAAA,OAAAA,CAAQhB,EAAM,CAAIO,CAAAA,CAAAA,CAAOU,QAAUV,CAAOW,CAAAA,MAA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AAAA,CAAgBkJ,EAAe,CACjCC,SAAAA,CAAa3P,EAAM,OAAU,CAAA,CAAA,CAAA,CAAA,CAC7B4P,WAAc5P,CAAM,CAAA,OAAA,CAAS,GAC7B6P,OAAW7P,CAAAA,CAAAA,CAAM,QAAS,CAC1B8P,CAAAA,CAAAA,SAAAA,CAAa9P,EAAM,MAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CC7JlB+E,CAAoB,CAAA,GAAIgL,CAAAA,EAAU,oBAClC9K,CAAAA,CAAAA,CAAAA,CAAkB,GAAI8K,CAAAA,CAAU,CAAA,kBAAA,CAAA,CAChC1K,EAAkB,GAAI0K,CAAAA,CAAAA,CAAU","x_google_ignoreList":[0,2]}
1
+ {"version":3,"file":"create-state.cjs.js","sources":["../../../../../node_modules/prosemirror-gapcursor/dist/index.js","../../../../src/nile-wysiwyg-editor/engine/create-state.ts","../../../../../node_modules/prosemirror-dropcursor/dist/index.js"],"sourcesContent":["import { keydownHandler } from 'prosemirror-keymap';\nimport { Selection, NodeSelection, TextSelection, Plugin } from 'prosemirror-state';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { DecorationSet, Decoration } from 'prosemirror-view';\n\n/**\nGap cursor selections are represented using this class. Its\n`$anchor` and `$head` properties both point at the cursor position.\n*/\nclass GapCursor extends Selection {\n /**\n Create a gap cursor.\n */\n constructor($pos) {\n super($pos, $pos);\n }\n map(doc, mapping) {\n let $pos = doc.resolve(mapping.map(this.head));\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);\n }\n content() { return Slice.empty; }\n eq(other) {\n return other instanceof GapCursor && other.head == this.head;\n }\n toJSON() {\n return { type: \"gapcursor\", pos: this.head };\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.pos != \"number\")\n throw new RangeError(\"Invalid input for GapCursor.fromJSON\");\n return new GapCursor(doc.resolve(json.pos));\n }\n /**\n @internal\n */\n getBookmark() { return new GapBookmark(this.anchor); }\n /**\n @internal\n */\n static valid($pos) {\n let parent = $pos.parent;\n if (parent.inlineContent || !closedBefore($pos) || !closedAfter($pos))\n return false;\n let override = parent.type.spec.allowGapCursor;\n if (override != null)\n return override;\n let deflt = parent.contentMatchAt($pos.index()).defaultType;\n return deflt && deflt.isTextblock;\n }\n /**\n @internal\n */\n static findGapCursorFrom($pos, dir, mustMove = false) {\n search: for (;;) {\n if (!mustMove && GapCursor.valid($pos))\n return $pos;\n let pos = $pos.pos, next = null;\n // Scan up from this position\n for (let d = $pos.depth;; d--) {\n let parent = $pos.node(d);\n if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {\n next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);\n break;\n }\n else if (d == 0) {\n return null;\n }\n pos += dir;\n let $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur))\n return $cur;\n }\n // And then down into the next node\n for (;;) {\n let inside = dir > 0 ? next.firstChild : next.lastChild;\n if (!inside) {\n if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {\n $pos = $pos.doc.resolve(pos + next.nodeSize * dir);\n mustMove = false;\n continue search;\n }\n break;\n }\n next = inside;\n pos += dir;\n let $cur = $pos.doc.resolve(pos);\n if (GapCursor.valid($cur))\n return $cur;\n }\n return null;\n }\n }\n}\nGapCursor.prototype.visible = false;\nGapCursor.findFrom = GapCursor.findGapCursorFrom;\nSelection.jsonID(\"gapcursor\", GapCursor);\nclass GapBookmark {\n constructor(pos) {\n this.pos = pos;\n }\n map(mapping) {\n return new GapBookmark(mapping.map(this.pos));\n }\n resolve(doc) {\n let $pos = doc.resolve(this.pos);\n return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);\n }\n}\nfunction needsGap(type) {\n return type.isAtom || type.spec.isolating || type.spec.createGapCursor;\n}\nfunction closedBefore($pos) {\n for (let d = $pos.depth; d >= 0; d--) {\n let index = $pos.index(d), parent = $pos.node(d);\n // At the start of this parent, look at next one\n if (index == 0) {\n if (parent.type.spec.isolating)\n return true;\n continue;\n }\n // See if the node before (or its first ancestor) is closed\n for (let before = parent.child(index - 1);; before = before.lastChild) {\n if ((before.childCount == 0 && !before.inlineContent) || needsGap(before.type))\n return true;\n if (before.inlineContent)\n return false;\n }\n }\n // Hit start of document\n return true;\n}\nfunction closedAfter($pos) {\n for (let d = $pos.depth; d >= 0; d--) {\n let index = $pos.indexAfter(d), parent = $pos.node(d);\n if (index == parent.childCount) {\n if (parent.type.spec.isolating)\n return true;\n continue;\n }\n for (let after = parent.child(index);; after = after.firstChild) {\n if ((after.childCount == 0 && !after.inlineContent) || needsGap(after.type))\n return true;\n if (after.inlineContent)\n return false;\n }\n }\n return true;\n}\n\n/**\nCreate a gap cursor plugin. When enabled, this will capture clicks\nnear and arrow-key-motion past places that don't have a normally\nselectable position nearby, and create a gap cursor selection for\nthem. The cursor is drawn as an element with class\n`ProseMirror-gapcursor`. You can either include\n`style/gapcursor.css` from the package's directory or add your own\nstyles to make it visible.\n*/\nfunction gapCursor() {\n return new Plugin({\n props: {\n decorations: drawGapCursor,\n createSelectionBetween(_view, $anchor, $head) {\n return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;\n },\n handleClick,\n handleKeyDown,\n handleDOMEvents: { beforeinput: beforeinput }\n }\n });\n}\nconst handleKeyDown = keydownHandler({\n \"ArrowLeft\": arrow(\"horiz\", -1),\n \"ArrowRight\": arrow(\"horiz\", 1),\n \"ArrowUp\": arrow(\"vert\", -1),\n \"ArrowDown\": arrow(\"vert\", 1)\n});\nfunction arrow(axis, dir) {\n const dirStr = axis == \"vert\" ? (dir > 0 ? \"down\" : \"up\") : (dir > 0 ? \"right\" : \"left\");\n return function (state, dispatch, view) {\n let sel = state.selection;\n let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;\n if (sel instanceof TextSelection) {\n if (!view.endOfTextblock(dirStr) || $start.depth == 0)\n return false;\n mustMove = false;\n $start = state.doc.resolve(dir > 0 ? $start.after() : $start.before());\n }\n let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);\n if (!$found)\n return false;\n if (dispatch)\n dispatch(state.tr.setSelection(new GapCursor($found)));\n return true;\n };\n}\nfunction handleClick(view, pos, event) {\n if (!view || !view.editable)\n return false;\n let $pos = view.state.doc.resolve(pos);\n if (!GapCursor.valid($pos))\n return false;\n let clickPos = view.posAtCoords({ left: event.clientX, top: event.clientY });\n if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside)))\n return false;\n view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));\n return true;\n}\n// This is a hack that, when a composition starts while a gap cursor\n// is active, quickly creates an inline context for the composition to\n// happen in, to avoid it being aborted by the DOM selection being\n// moved into a valid position.\nfunction beforeinput(view, event) {\n if (event.inputType != \"insertCompositionText\" || !(view.state.selection instanceof GapCursor))\n return false;\n let { $from } = view.state.selection;\n let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);\n if (!insert)\n return false;\n let frag = Fragment.empty;\n for (let i = insert.length - 1; i >= 0; i--)\n frag = Fragment.from(insert[i].createAndFill(null, frag));\n let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));\n tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));\n view.dispatch(tr);\n return false;\n}\nfunction drawGapCursor(state) {\n if (!(state.selection instanceof GapCursor))\n return null;\n let node = document.createElement(\"div\");\n node.className = \"ProseMirror-gapcursor\";\n return DecorationSet.create(state.doc, [Decoration.widget(state.selection.head, node, { key: \"gapcursor\" })]);\n}\n\nexport { GapCursor, gapCursor };\n","import { EditorState, Plugin, PluginKey } from 'prosemirror-state';\nimport { Node as PMNode, Schema } from 'prosemirror-model';\nimport { history } from 'prosemirror-history';\nimport { dropCursor } from 'prosemirror-dropcursor';\nimport { gapCursor } from 'prosemirror-gapcursor';\nimport { buildKeymapPlugins, KeymapOptions } from './keymap';\nimport { buildInputRules } from './inputrules';\nimport { placeholderPlugin } from './plugins/placeholder';\nimport { linkPlugin, LinkPluginOptions } from './plugins/link';\nimport { singleLinePlugin } from './plugins/single-line';\nimport { tablePlugins } from './plugins/tables';\nimport { imagePlugin, ImagePluginOptions } from './plugins/image';\nimport { suggestionPlugin, SuggestionOptions } from './plugins/suggestions';\nimport { findReplacePlugin } from './plugins/find-replace';\nimport { maxLengthPlugin } from './plugins/max-length';\nimport { codeHighlightPlugin } from './plugins/code-highlight';\nimport { embedPastePlugin } from './plugins/embeds';\nimport { pastePlugin } from './plugins/paste';\nimport { formatPainterPlugin } from './plugins/format-painter';\nimport { defaultSchema } from './schema';\nimport { NormalizedAllowedStyles } from './email-css';\n\nexport const mentionSuggestKey = new PluginKey('nileMentionSuggest');\nexport const slashSuggestKey = new PluginKey('nileSlashSuggest');\nexport const emojiSuggestKey = new PluginKey('nileEmojiSuggest');\n\nexport interface CreateStateOptions\n extends KeymapOptions,\n LinkPluginOptions,\n ImagePluginOptions {\n schema?: Schema;\n doc?: PMNode;\n /** Read live so the placeholder updates without rebuilding state. */\n getPlaceholder?: () => string;\n singleLine?: boolean;\n /** Mention suggestions (omit onChange to disable the plugin). */\n mentions?: Omit<SuggestionOptions, 'startOfLine'>;\n /** Slash-command suggestions, anchored to the start of a block. */\n slashCommands?: Omit<SuggestionOptions, 'startOfLine' | 'getTriggers'>;\n /** \":\" emoji suggestions (activates after two query characters). */\n emoji?: Omit<SuggestionOptions, 'startOfLine' | 'getTriggers' | 'minQueryLength'>;\n /** Character limit, read live. Return 0/undefined for unlimited. */\n getMaxLength?: () => number;\n /** Read live: when true, all pastes drop formatting. */\n getForcePlainText?: () => boolean;\n /** Read live: when false, plain-text pastes are never parsed as Markdown. */\n getMarkdownPaste?: () => boolean;\n /** Read live: when true, HTML source pasted as plain text is parsed as HTML. */\n getEmailFidelity?: () => boolean;\n /** Read live: the validated per-app email-fidelity style allowlist. */\n getAllowedStyles?: () => NormalizedAllowedStyles;\n /** Read live: whether pasted/parsed HTML is sanitized. Defaults to on. */\n getSanitize?: () => boolean;\n /** Typography autocorrect (smart quotes, dashes, (c)…). Defaults to on. */\n textTransform?: boolean;\n /** Extra plugins appended after the built-in set (later phases, tests). */\n plugins?: Plugin[];\n}\n\nexport function createEditorState(options: CreateStateOptions = {}): EditorState {\n const schema = options.schema ?? defaultSchema;\n const plugins: Plugin[] = [];\n\n // Suggestion plugins must come BEFORE the keymaps: handleKeyDown props run\n // in plugin order, and the popup needs first claim on Enter/Tab/arrows\n // while a mention or slash query is active.\n if (options.mentions) {\n plugins.push(suggestionPlugin(mentionSuggestKey, options.mentions));\n }\n if (options.slashCommands) {\n plugins.push(\n suggestionPlugin(slashSuggestKey, {\n ...options.slashCommands,\n getTriggers: () => ['/'],\n startOfLine: true,\n })\n );\n }\n if (options.emoji) {\n plugins.push(\n suggestionPlugin(emojiSuggestKey, {\n ...options.emoji,\n getTriggers: () => [':'],\n minQueryLength: 2,\n })\n );\n }\n\n plugins.push(\n buildInputRules(schema, { textTransform: options.textTransform }),\n ...buildKeymapPlugins(schema, {\n onLinkShortcut: options.onLinkShortcut,\n onFindShortcut: options.onFindShortcut,\n onShortcutHelp: options.onShortcutHelp,\n }),\n history(),\n dropCursor(),\n gapCursor(),\n placeholderPlugin(options.getPlaceholder ?? (() => '')),\n linkPlugin({ onOpenLink: options.onOpenLink }),\n ...tablePlugins(),\n imagePlugin({ onImageFiles: options.onImageFiles }),\n findReplacePlugin(),\n codeHighlightPlugin(),\n embedPastePlugin(),\n formatPainterPlugin(),\n pastePlugin(schema, {\n getForcePlainText: options.getForcePlainText,\n getMarkdownPaste: options.getMarkdownPaste,\n getSanitize: options.getSanitize,\n getEmailFidelity: options.getEmailFidelity,\n getAllowedStyles: options.getAllowedStyles,\n })\n );\n if (options.getMaxLength) plugins.push(maxLengthPlugin(options.getMaxLength));\n if (options.singleLine) plugins.push(singleLinePlugin());\n if (options.plugins) plugins.push(...options.plugins);\n\n return EditorState.create({\n schema,\n doc: options.doc,\n plugins,\n });\n}\n","import { Plugin } from 'prosemirror-state';\nimport { dropPoint } from 'prosemirror-transform';\n\n/**\nCreate a plugin that, when added to a ProseMirror instance,\ncauses a decoration to show up at the drop position when something\nis dragged over the editor.\n\nNodes may add a `disableDropCursor` property to their spec to\ncontrol the showing of a drop cursor inside them. This may be a\nboolean or a function, which will be called with a view and a\nposition, and should return a boolean.\n*/\nfunction dropCursor(options = {}) {\n return new Plugin({\n view(editorView) { return new DropCursorView(editorView, options); }\n });\n}\nclass DropCursorView {\n constructor(editorView, options) {\n var _a;\n this.editorView = editorView;\n this.cursorPos = null;\n this.element = null;\n this.timeout = -1;\n this.lastDragEvent = null;\n this.width = (_a = options.width) !== null && _a !== void 0 ? _a : 1;\n this.color = options.color === false ? undefined : (options.color || \"black\");\n this.class = options.class;\n this.handlers = [\"dragover\", \"dragend\", \"drop\", \"dragleave\"].map(name => {\n let handler = (e) => { this[name](e); };\n editorView.dom.addEventListener(name, handler);\n return { name, handler };\n });\n }\n destroy() {\n this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));\n }\n update(editorView, prevState) {\n if (this.cursorPos != null && prevState.doc != editorView.state.doc) {\n // if we currently have an on-going drag event\n // we need to update the cursor position again and update the overlay\n if (this.lastDragEvent) {\n let target = this.computeTarget(this.lastDragEvent);\n if (target == this.cursorPos)\n this.updateOverlay();\n else\n this.setCursor(target);\n }\n else {\n this.updateOverlay();\n }\n }\n }\n setCursor(pos) {\n if (pos == this.cursorPos)\n return;\n this.cursorPos = pos;\n if (pos == null) {\n this.element.parentNode.removeChild(this.element);\n this.element = null;\n }\n else {\n this.updateOverlay();\n }\n }\n updateOverlay() {\n let $pos = this.editorView.state.doc.resolve(this.cursorPos);\n let isBlock = !$pos.parent.inlineContent, rect;\n let editorDOM = this.editorView.dom, editorRect = editorDOM.getBoundingClientRect();\n let scaleX = editorRect.width / editorDOM.offsetWidth, scaleY = editorRect.height / editorDOM.offsetHeight;\n if (isBlock) {\n let before = $pos.nodeBefore, after = $pos.nodeAfter;\n if (before || after) {\n let node = this.editorView.nodeDOM(this.cursorPos - (before ? before.nodeSize : 0));\n if (node) {\n let nodeRect = node.getBoundingClientRect();\n let top = before ? nodeRect.bottom : nodeRect.top;\n if (before && after)\n top = (top + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2;\n let halfWidth = (this.width / 2) * scaleY;\n rect = { left: nodeRect.left, right: nodeRect.right, top: top - halfWidth, bottom: top + halfWidth };\n }\n }\n }\n if (!rect) {\n let coords = this.editorView.coordsAtPos(this.cursorPos);\n let halfWidth = (this.width / 2) * scaleX;\n rect = { left: coords.left - halfWidth, right: coords.left + halfWidth, top: coords.top, bottom: coords.bottom };\n }\n let parent = this.editorView.dom.offsetParent;\n if (!this.element) {\n this.element = parent.appendChild(document.createElement(\"div\"));\n if (this.class)\n this.element.className = this.class;\n this.element.style.cssText = \"position: absolute; z-index: 50; pointer-events: none;\";\n if (this.color) {\n this.element.style.backgroundColor = this.color;\n }\n }\n this.element.classList.toggle(\"prosemirror-dropcursor-block\", isBlock);\n this.element.classList.toggle(\"prosemirror-dropcursor-inline\", !isBlock);\n let parentLeft, parentTop;\n if (!parent || parent == document.body && getComputedStyle(parent).position == \"static\") {\n parentLeft = -pageXOffset;\n parentTop = -pageYOffset;\n }\n else {\n let rect = parent.getBoundingClientRect();\n let parentScaleX = rect.width / parent.offsetWidth, parentScaleY = rect.height / parent.offsetHeight;\n parentLeft = rect.left - parent.scrollLeft * parentScaleX;\n parentTop = rect.top - parent.scrollTop * parentScaleY;\n }\n this.element.style.left = (rect.left - parentLeft) / scaleX + \"px\";\n this.element.style.top = (rect.top - parentTop) / scaleY + \"px\";\n this.element.style.width = (rect.right - rect.left) / scaleX + \"px\";\n this.element.style.height = (rect.bottom - rect.top) / scaleY + \"px\";\n }\n scheduleRemoval(timeout) {\n clearTimeout(this.timeout);\n this.timeout = setTimeout(() => this.setCursor(null), timeout);\n }\n computeTarget(event) {\n let pos = this.editorView.posAtCoords({ left: event.clientX, top: event.clientY });\n let node = pos && pos.inside >= 0 && this.editorView.state.doc.nodeAt(pos.inside);\n let disableDropCursor = node && node.type.spec.disableDropCursor;\n let disabled = typeof disableDropCursor == \"function\"\n ? disableDropCursor(this.editorView, pos, event)\n : disableDropCursor;\n if (!pos || disabled)\n return null;\n let target = pos.pos;\n if (this.editorView.dragging && this.editorView.dragging.slice) {\n let point = dropPoint(this.editorView.state.doc, target, this.editorView.dragging.slice);\n if (point != null)\n target = point;\n }\n return target;\n }\n dragover(event) {\n if (!this.editorView.editable)\n return;\n this.lastDragEvent = event;\n let target = this.computeTarget(event);\n if (target != null) {\n this.setCursor(target);\n this.scheduleRemoval(5000);\n }\n }\n dragend() {\n this.scheduleRemoval(20);\n }\n drop() {\n this.scheduleRemoval(20);\n }\n dragleave(event) {\n if (!this.editorView.dom.contains(event.relatedTarget))\n this.setCursor(null);\n }\n}\n\nexport { dropCursor };\n"],"names":["needsGap","type","isAtom","spec","isolating","createGapCursor","arrow","axis","dir","dirStr","state","dispatch","view","sel","selection","$start","$to","$from","mustMove","empty","TextSelection","endOfTextblock","depth","doc","resolve","after","before","$found","GapCursor","findGapCursorFrom","tr","setSelection","handleClick","pos","event","editable","$pos","valid","clickPos","posAtCoords","left","clientX","top","clientY","inside","NodeSelection","isSelectable","nodeAt","beforeinput","inputType","insert","parent","contentMatchAt","index","findWrapping","schema","nodes","text","frag","Fragment","i","length","from","createAndFill","replace","Slice","near","drawGapCursor","node","document","createElement","className","DecorationSet","create","Decoration","widget","head","key","createEditorState","options","arguments","undefined","defaultSchema","plugins","mentions","push","suggestionPlugin","mentionSuggestKey","slashCommands","slashSuggestKey","_objectSpread","getTriggers","startOfLine","emoji","emojiSuggestKey","minQueryLength","buildInputRules","textTransform","buildKeymapPlugins","onLinkShortcut","onFindShortcut","onShortcutHelp","history","Plugin","editorView","DropCursorView","dropCursor","props","decorations","createSelectionBetween","_view","$anchor","$head","handleKeyDown","handleDOMEvents","placeholderPlugin","getPlaceholder","linkPlugin","onOpenLink","tablePlugins","imagePlugin","onImageFiles","findReplacePlugin","codeHighlightPlugin","embedPastePlugin","formatPainterPlugin","pastePlugin","getForcePlainText","getMarkdownPaste","getSanitize","getEmailFidelity","getAllowedStyles","getMaxLength","maxLengthPlugin","singleLine","singleLinePlugin","EditorState","C","_a","this","cursorPos","element","timeout","lastDragEvent","width","color","handlers","map","name","handler","e","dom","addEventListener","s","_createClass","value","destroy","forEach","_ref","removeEventListener","update","prevState","target","computeTarget","updateOverlay","setCursor","parentNode","removeChild","rect","isBlock","inlineContent","editorDOM","editorRect","getBoundingClientRect","scaleX","offsetWidth","scaleY","height","offsetHeight","nodeBefore","nodeAfter","nodeDOM","nodeSize","nodeRect","bottom","halfWidth","right","coords","coordsAtPos","parentLeft","parentTop","offsetParent","appendChild","class","style","cssText","backgroundColor","classList","toggle","body","getComputedStyle","position","pageXOffset","pageYOffset","parentScaleX","parentScaleY","scrollLeft","scrollTop","scheduleRemoval","clearTimeout","setTimeout","disableDropCursor","disabled","dragging","slice","point","dropPoint","dragover","dragend","drop","dragleave","contains","relatedTarget","Selection","F","_inherits","_s4","mapping","content","eq","other","toJSON","getBookmark","GapBookmark","anchor","fromJSON","json","RangeError","d","child","lastChild","childCount","closedBefore","indexAfter","firstChild","closedAfter","override","allowGapCursor","deflt","defaultType","isTextblock","search","next","$cur","isText","prototype","visible","findFrom","jsonID","A","keydownHandler","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PluginKey"],"mappings":"2iKA+GA,QAASA,CAAAA,CAAAA,CAASC,CACd,CAAA,CAAA,MAAOA,CAAAA,CAAKC,CAAAA,MAAAA,EAAUD,EAAKE,IAAKC,CAAAA,SAAAA,EAAaH,EAAKE,IAAKE,CAAAA,eAC3D,EAmEA,QAASC,CAAAA,CAAMC,CAAAA,CAAAA,CAAMC,GACjB,GAAMC,CAAAA,CAAAA,CAAiB,QAARF,CAAkBC,CAAAA,CAAAA,CAAM,EAAI,MAAS,CAAA,IAAA,CAASA,EAAM,CAAI,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AA,CAAU,CAAA,oBAAA,CAAA,CAClChL,EAAkB,GAAIgL,CAAAA,CAAAA,CAAU,oBAChC3K,CAAkB,CAAA,GAAI2K,CAAAA,EAAU,kBAmC7B,CAAA","x_google_ignoreList":[0,2]}
@@ -1 +1 @@
1
- import{b as t,e,S as s,T as r,c as i,F as n,d as o,P as l,E as u}from"../../index-6f3fa4ab.esm.js";import{h as a}from"./commands.esm.js";import{b as m}from"../../index-7b1c9857.esm.js";import{D as h,a as f}from"../../index-ba47645d.esm.js";import{b as p}from"./keymap.esm.js";import{b as c}from"./inputrules.esm.js";import{p as g}from"./plugins/placeholder.esm.js";import{l as d}from"./plugins/link.esm.js";import{s as w}from"./plugins/single-line.esm.js";import{t as j}from"./plugins/tables.esm.js";import{i as v}from"./plugins/image.esm.js";import{s as x}from"./plugins/suggestions.esm.js";import{f as b}from"./plugins/find-replace.esm.js";import{m as k}from"./plugins/max-length.esm.js";import{c as S}from"./plugins/code-highlight.esm.js";import{e as y}from"./plugins/embeds.esm.js";import{a as O}from"./plugins/paste.esm.js";import{f as T}from"./plugins/format-painter.esm.js";import{d as z}from"./schema.esm.js";import"../../index-920675c4.esm.js";import"../../index-1faa963c.esm.js";import"./markdown-parse.esm.js";import"./serializer.esm.js";import"./sanitize.esm.js";import"../../xml-9bf771b3.esm.js";class C{constructor(t,e){var s;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=null!==(s=e.width)&&void 0!==s?s:1,this.color=!1===e.color?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map((e=>{let s=t=>{this[e](t)};return t.dom.addEventListener(e,s),{name:e,handler:s}}))}destroy(){this.handlers.forEach((({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e)))}update(t,e){if(null!=this.cursorPos&&e.doc!=t.state.doc)if(this.lastDragEvent){let t=this.computeTarget(this.lastDragEvent);t==this.cursorPos?this.updateOverlay():this.setCursor(t)}else this.updateOverlay()}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t,e=this.editorView.state.doc.resolve(this.cursorPos),s=!e.parent.inlineContent,r=this.editorView.dom,i=r.getBoundingClientRect(),n=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(s){let s=e.nodeBefore,r=e.nodeAfter;if(s||r){let e=this.editorView.nodeDOM(this.cursorPos-(s?s.nodeSize:0));if(e){let i=e.getBoundingClientRect(),n=s?i.bottom:i.top;s&&r&&(n=(n+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let l=this.width/2*o;t={left:i.left,right:i.right,top:n-l,bottom:n+l}}}}if(!t){let e=this.editorView.coordsAtPos(this.cursorPos),s=this.width/2*n;t={left:e.left-s,right:e.left+s,top:e.top,bottom:e.bottom}}let l,u,a=this.editorView.dom.offsetParent;if(this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s),!a||a==document.body&&"static"==getComputedStyle(a).position)l=-pageXOffset,u=-pageYOffset;else{let t=a.getBoundingClientRect(),e=t.width/a.offsetWidth,s=t.height/a.offsetHeight;l=t.left-a.scrollLeft*e,u=t.top-a.scrollTop*s}this.element.style.left=(t.left-l)/n+"px",this.element.style.top=(t.top-u)/o+"px",this.element.style.width=(t.right-t.left)/n+"px",this.element.style.height=(t.bottom-t.top)/o+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),t)}computeTarget(t){let s=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),i=r&&r.type.spec.disableDropCursor,n="function"==typeof i?i(this.editorView,s,t):i;if(!s||n)return null;let o=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=e(this.editorView.state.doc,o,this.editorView.dragging.slice);null!=t&&(o=t)}return o}dragover(t){if(!this.editorView.editable)return;this.lastDragEvent=t;let e=this.computeTarget(t);null!=e&&(this.setCursor(e),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class F extends s{constructor(t){super(t,t)}map(t,e){let r=t.resolve(e.map(this.head));return F.valid(r)?new F(r):s.near(r)}content(){return o.empty}eq(t){return t instanceof F&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new F(t.resolve(e.pos))}getBookmark(){return new L(this.anchor)}static valid(t){let e=t.parent;if(e.inlineContent||!function(t){for(let e=t.depth;e>=0;e--){let s=t.index(e),r=t.node(e);if(0!=s)for(let t=r.child(s-1);;t=t.lastChild){if(0==t.childCount&&!t.inlineContent||A(t.type))return!0;if(t.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t)||!function(t){for(let e=t.depth;e>=0;e--){let s=t.indexAfter(e),r=t.node(e);if(s!=r.childCount)for(let t=r.child(s);;t=t.firstChild){if(0==t.childCount&&!t.inlineContent||A(t.type))return!0;if(t.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t))return!1;let s=e.type.spec.allowGapCursor;if(null!=s)return s;let r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,e,s=!1){t:for(;;){if(!s&&F.valid(t))return t;let r=t.pos,n=null;for(let s=t.depth;;s--){let i=t.node(s);if(e>0?t.indexAfter(s)<i.childCount:t.index(s)>0){n=i.child(e>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;r+=e;let o=t.doc.resolve(r);if(F.valid(o))return o}for(;;){let o=e>0?n.firstChild:n.lastChild;if(!o){if(n.isAtom&&!n.isText&&!i.isSelectable(n)){t=t.doc.resolve(r+n.nodeSize*e),s=!1;continue t}break}n=o,r+=e;let l=t.doc.resolve(r);if(F.valid(l))return l}return null}}}F.prototype.visible=!1,F.findFrom=F.findGapCursorFrom,s.jsonID("gapcursor",F);class L{constructor(t){this.pos=t}map(t){return new L(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return F.valid(e)?new F(e):s.near(e)}}function A(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}const D=m({ArrowLeft:E("horiz",-1),ArrowRight:E("horiz",1),ArrowUp:E("vert",-1),ArrowDown:E("vert",1)});function E(t,e){const s="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,i,n){let o=t.selection,l=e>0?o.$to:o.$from,u=o.empty;if(o instanceof r){if(!n.endOfTextblock(s)||0==l.depth)return!1;u=!1,l=t.doc.resolve(e>0?l.after():l.before())}let a=F.findGapCursorFrom(l,e,u);return!!a&&(i&&i(t.tr.setSelection(new F(a))),!0)}}function M(t,e,s){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!F.valid(r))return!1;let n=t.posAtCoords({left:s.clientX,top:s.clientY});return!(n&&n.inside>-1&&i.isSelectable(t.state.doc.nodeAt(n.inside)))&&(t.dispatch(t.state.tr.setSelection(new F(r))),!0)}function P(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof F))return!1;let{$from:s}=t.state.selection,i=s.parent.contentMatchAt(s.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let l=n.empty;for(let t=i.length-1;t>=0;t--)l=n.from(i[t].createAndFill(null,l));let u=t.state.tr.replace(s.pos,s.pos,new o(l,0,0));return u.setSelection(r.near(u.doc.resolve(s.pos+1))),t.dispatch(u),!1}function J(t){if(!(t.selection instanceof F))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",h.create(t.doc,[f.widget(t.selection.head,e,{key:"gapcursor"})])}const N=new l("nileMentionSuggest"),R=new l("nileSlashSuggest"),B=new l("nileEmojiSuggest");function G(e={}){const s=e.schema??z,r=[];return e.mentions&&r.push(x(N,e.mentions)),e.slashCommands&&r.push(x(R,{...e.slashCommands,getTriggers:()=>["/"],startOfLine:!0})),e.emoji&&r.push(x(B,{...e.emoji,getTriggers:()=>[":"],minQueryLength:2})),r.push(c(s,{textTransform:e.textTransform}),...p(s,{onLinkShortcut:e.onLinkShortcut,onFindShortcut:e.onFindShortcut,onShortcutHelp:e.onShortcutHelp}),a(),function(e={}){return new t({view:t=>new C(t,e)})}(),new t({props:{decorations:J,createSelectionBetween:(t,e,s)=>e.pos==s.pos&&F.valid(s)?new F(s):null,handleClick:M,handleKeyDown:D,handleDOMEvents:{beforeinput:P}}}),g(e.getPlaceholder??(()=>"")),d({onOpenLink:e.onOpenLink}),...j(),v({onImageFiles:e.onImageFiles}),b(),S(),y(),T(),O(s,{getForcePlainText:e.getForcePlainText,getMarkdownPaste:e.getMarkdownPaste,getSanitize:e.getSanitize})),e.getMaxLength&&r.push(k(e.getMaxLength)),e.singleLine&&r.push(w()),e.plugins&&r.push(...e.plugins),u.create({schema:s,doc:e.doc,plugins:r})}export{G as c};
1
+ import{a as t,d as e,S as s,T as r,N as i,P as n,E as o}from"../../index-7ca72b78.esm.js";import{h as l}from"./commands.esm.js";import{d as u,e as m}from"./schema.esm.js";import{F as a,S as h}from"../../index-5d34cff1.esm.js";import{D as f,a as p}from"../../index-4df50481.esm.js";import{b as c}from"./keymap.esm.js";import{b as g}from"./inputrules.esm.js";import{p as d}from"./plugins/placeholder.esm.js";import{l as j}from"./plugins/link.esm.js";import{s as w}from"./plugins/single-line.esm.js";import{t as v}from"./plugins/tables.esm.js";import{i as x}from"./plugins/image.esm.js";import{s as S}from"./plugins/suggestions.esm.js";import{f as b}from"./plugins/find-replace.esm.js";import{m as k}from"./plugins/max-length.esm.js";import{c as y}from"./plugins/code-highlight.esm.js";import{e as O}from"./plugins/embeds.esm.js";import{a as T}from"./plugins/paste.esm.js";import{f as z}from"./plugins/format-painter.esm.js";import"../../index-920675c4.esm.js";import"./email-css.esm.js";import"./sanitize.esm.js";import"../../index-36f2a6b5.esm.js";import"./markdown-parse.esm.js";import"./html-detect.esm.js";import"./serializer.esm.js";import"./email-render.esm.js";import"../../xml-9bf771b3.esm.js";class C{constructor(t,e){var s;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=null!==(s=e.width)&&void 0!==s?s:1,this.color=!1===e.color?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map((e=>{let s=t=>{this[e](t)};return t.dom.addEventListener(e,s),{name:e,handler:s}}))}destroy(){this.handlers.forEach((({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e)))}update(t,e){if(null!=this.cursorPos&&e.doc!=t.state.doc)if(this.lastDragEvent){let t=this.computeTarget(this.lastDragEvent);t==this.cursorPos?this.updateOverlay():this.setCursor(t)}else this.updateOverlay()}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t,e=this.editorView.state.doc.resolve(this.cursorPos),s=!e.parent.inlineContent,r=this.editorView.dom,i=r.getBoundingClientRect(),n=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(s){let s=e.nodeBefore,r=e.nodeAfter;if(s||r){let e=this.editorView.nodeDOM(this.cursorPos-(s?s.nodeSize:0));if(e){let i=e.getBoundingClientRect(),n=s?i.bottom:i.top;s&&r&&(n=(n+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let l=this.width/2*o;t={left:i.left,right:i.right,top:n-l,bottom:n+l}}}}if(!t){let e=this.editorView.coordsAtPos(this.cursorPos),s=this.width/2*n;t={left:e.left-s,right:e.left+s,top:e.top,bottom:e.bottom}}let l,u,m=this.editorView.dom.offsetParent;if(this.element||(this.element=m.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",s),this.element.classList.toggle("prosemirror-dropcursor-inline",!s),!m||m==document.body&&"static"==getComputedStyle(m).position)l=-pageXOffset,u=-pageYOffset;else{let t=m.getBoundingClientRect(),e=t.width/m.offsetWidth,s=t.height/m.offsetHeight;l=t.left-m.scrollLeft*e,u=t.top-m.scrollTop*s}this.element.style.left=(t.left-l)/n+"px",this.element.style.top=(t.top-u)/o+"px",this.element.style.width=(t.right-t.left)/n+"px",this.element.style.height=(t.bottom-t.top)/o+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),t)}computeTarget(t){let s=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=s&&s.inside>=0&&this.editorView.state.doc.nodeAt(s.inside),i=r&&r.type.spec.disableDropCursor,n="function"==typeof i?i(this.editorView,s,t):i;if(!s||n)return null;let o=s.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=e(this.editorView.state.doc,o,this.editorView.dragging.slice);null!=t&&(o=t)}return o}dragover(t){if(!this.editorView.editable)return;this.lastDragEvent=t;let e=this.computeTarget(t);null!=e&&(this.setCursor(e),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class F extends s{constructor(t){super(t,t)}map(t,e){let r=t.resolve(e.map(this.head));return F.valid(r)?new F(r):s.near(r)}content(){return h.empty}eq(t){return t instanceof F&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new F(t.resolve(e.pos))}getBookmark(){return new A(this.anchor)}static valid(t){let e=t.parent;if(e.inlineContent||!function(t){for(let e=t.depth;e>=0;e--){let s=t.index(e),r=t.node(e);if(0!=s)for(let t=r.child(s-1);;t=t.lastChild){if(0==t.childCount&&!t.inlineContent||E(t.type))return!0;if(t.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t)||!function(t){for(let e=t.depth;e>=0;e--){let s=t.indexAfter(e),r=t.node(e);if(s!=r.childCount)for(let t=r.child(s);;t=t.firstChild){if(0==t.childCount&&!t.inlineContent||E(t.type))return!0;if(t.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(t))return!1;let s=e.type.spec.allowGapCursor;if(null!=s)return s;let r=e.contentMatchAt(t.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,e,s=!1){t:for(;;){if(!s&&F.valid(t))return t;let r=t.pos,n=null;for(let s=t.depth;;s--){let i=t.node(s);if(e>0?t.indexAfter(s)<i.childCount:t.index(s)>0){n=i.child(e>0?t.indexAfter(s):t.index(s)-1);break}if(0==s)return null;r+=e;let o=t.doc.resolve(r);if(F.valid(o))return o}for(;;){let o=e>0?n.firstChild:n.lastChild;if(!o){if(n.isAtom&&!n.isText&&!i.isSelectable(n)){t=t.doc.resolve(r+n.nodeSize*e),s=!1;continue t}break}n=o,r+=e;let l=t.doc.resolve(r);if(F.valid(l))return l}return null}}}F.prototype.visible=!1,F.findFrom=F.findGapCursorFrom,s.jsonID("gapcursor",F);class A{constructor(t){this.pos=t}map(t){return new A(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return F.valid(e)?new F(e):s.near(e)}}function E(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}const L=u({ArrowLeft:D("horiz",-1),ArrowRight:D("horiz",1),ArrowUp:D("vert",-1),ArrowDown:D("vert",1)});function D(t,e){const s="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,i,n){let o=t.selection,l=e>0?o.$to:o.$from,u=o.empty;if(o instanceof r){if(!n.endOfTextblock(s)||0==l.depth)return!1;u=!1,l=t.doc.resolve(e>0?l.after():l.before())}let m=F.findGapCursorFrom(l,e,u);return!!m&&(i&&i(t.tr.setSelection(new F(m))),!0)}}function M(t,e,s){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!F.valid(r))return!1;let n=t.posAtCoords({left:s.clientX,top:s.clientY});return!(n&&n.inside>-1&&i.isSelectable(t.state.doc.nodeAt(n.inside)))&&(t.dispatch(t.state.tr.setSelection(new F(r))),!0)}function N(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof F))return!1;let{$from:s}=t.state.selection,i=s.parent.contentMatchAt(s.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let n=a.empty;for(let t=i.length-1;t>=0;t--)n=a.from(i[t].createAndFill(null,n));let o=t.state.tr.replace(s.pos,s.pos,new h(n,0,0));return o.setSelection(r.near(o.doc.resolve(s.pos+1))),t.dispatch(o),!1}function P(t){if(!(t.selection instanceof F))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",f.create(t.doc,[p.widget(t.selection.head,e,{key:"gapcursor"})])}const J=new n("nileMentionSuggest"),R=new n("nileSlashSuggest"),B=new n("nileEmojiSuggest");function G(e={}){const s=e.schema??m,r=[];return e.mentions&&r.push(S(J,e.mentions)),e.slashCommands&&r.push(S(R,{...e.slashCommands,getTriggers:()=>["/"],startOfLine:!0})),e.emoji&&r.push(S(B,{...e.emoji,getTriggers:()=>[":"],minQueryLength:2})),r.push(g(s,{textTransform:e.textTransform}),...c(s,{onLinkShortcut:e.onLinkShortcut,onFindShortcut:e.onFindShortcut,onShortcutHelp:e.onShortcutHelp}),l(),function(e={}){return new t({view:t=>new C(t,e)})}(),new t({props:{decorations:P,createSelectionBetween:(t,e,s)=>e.pos==s.pos&&F.valid(s)?new F(s):null,handleClick:M,handleKeyDown:L,handleDOMEvents:{beforeinput:N}}}),d(e.getPlaceholder??(()=>"")),j({onOpenLink:e.onOpenLink}),...v(),x({onImageFiles:e.onImageFiles}),b(),y(),O(),z(),T(s,{getForcePlainText:e.getForcePlainText,getMarkdownPaste:e.getMarkdownPaste,getSanitize:e.getSanitize,getEmailFidelity:e.getEmailFidelity,getAllowedStyles:e.getAllowedStyles})),e.getMaxLength&&r.push(k(e.getMaxLength)),e.singleLine&&r.push(w()),e.plugins&&r.push(...e.plugins),o.create({schema:s,doc:e.doc,plugins:r})}export{G as c};
@@ -0,0 +1,2 @@
1
+ System.register([],function(_export,_context){"use strict";var t,n,i;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 n(){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 _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 _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 _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 _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 e(t){return!!/^(?:mso-)?[a-z]+(?:-[a-z]+)*$/.test(t)&&!n.has(t)&&!i.has(t);}function o(t){var n=t.trim();if(!n||n.length>128)return!1;if(/[^\x00-\x7f]/.test(n))return!1;if(/\b(?:url|expression|var|calc|attr|env|image-set)\b/i.test(n))return!1;if(/[\\<>{};@]/.test(n))return!1;if(/\/\*/.test(n))return!1;if(/\//.test(n))return!1;if(/!important/i.test(n))return!1;if(/[()]/.test(n)){var _n$match;if(1!==((_n$match=n.match(/\(/g))!==null&&_n$match!==void 0?_n$match:[]).length)return!1;var _t=/(?:rgba?|hsla?)\(\s*[\d.]+%?(?:\s*,\s*[\d.]+%?){2,3}\s*\)/i.exec(n);if(!_t||/[()]/.test(n.replace(_t[0],"")))return!1;}return!0;}function r(o){var r=new Map();if(!o||"object"!=_typeof(o))return r;for(var _i=0,_Object$entries=Object.entries(o);_i<_Object$entries.length;_i++){var _r$get;var _Object$entries$_i=_slicedToArray(_Object$entries[_i],2),_a=_Object$entries$_i[0],_s=_Object$entries$_i[1];var _o=String(_a).toLowerCase();if(!t.has(_o)){console.warn("[nile-wysiwyg-editor] allowedStyles: ignoring tag \"".concat(_a,"\" (unsupported tag)"));continue;}if(!Array.isArray(_s))continue;var c=(_r$get=r.get(_o))!==null&&_r$get!==void 0?_r$get:new Set();var _iterator=_createForOfIteratorHelper(_s),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _t2=_step.value;var _r=String(_t2);if(e(_r))c.add(_r);else{var _e=n.has(_r)?"denylisted":i.has(_r)?"already handled by a built-in":"invalid property name";console.warn("[nile-wysiwyg-editor] allowedStyles: ignoring \"".concat(_o,": ").concat(_t2,"\" (").concat(_e,")"));}}}catch(err){_iterator.e(err);}finally{_iterator.f();}c.size&&r.set(_o,c);}return r;}function a(t){var n={};var _iterator2=_createForOfIteratorHelper(t.split(";")),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var _i2=_step2.value;var _t3=_i2.indexOf(":");if(-1===_t3)continue;var _e2=_i2.slice(0,_t3).trim();if(!_e2)continue;var _o2=_i2.slice(_t3+1).split(",").map(function(t){return t.trim();}).filter(Boolean);_o2.length&&(n[_e2]=_o2);}}catch(err){_iterator2.e(err);}finally{_iterator2.f();}return n;}function s(t){var n=[];var _iterator3=_createForOfIteratorHelper(String(t!==null&&t!==void 0?t:"").split(";")),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var _i3=_step3.value;var _t4=_i3.indexOf(":");if(-1===_t4)continue;var _r2=_i3.slice(0,_t4).trim().toLowerCase(),_a2=_i3.slice(_t4+1).trim();e(_r2)&&o(_a2)&&n.push("".concat(_r2,": ").concat(_a2));}}catch(err){_iterator3.e(err);}finally{_iterator3.f();}return n.join("; ");}_export({i:o,n:r,p:a,s:s});return{setters:[],execute:function execute(){t=new Set(["td","th","table","p","h1","h2","h3","h4","h5","h6"]),n=new Set(["position","top","right","bottom","left","inset","inset-block","inset-block-start","inset-block-end","inset-inline","inset-inline-start","inset-inline-end","z-index","content","behavior","-moz-binding","transform","transform-origin","transform-box","filter","backdrop-filter","perspective","perspective-origin","display","visibility","opacity","pointer-events","clip","clip-path","mask","mask-image","mask-repeat","mask-position","mask-size","animation","animation-name","transition","transition-property","will-change","cursor","float","clear","overflow","overflow-x","overflow-y","background","background-image","list-style-image","border-image","border-image-source"]),i=new Set(["color","background-color","font-family","font-size","font-style","font-weight","text-align","text-decoration","text-decoration-line","vertical-align","margin-left","margin-inline-start","list-style-type","line-height","text-decoration-style","text-decoration-color","padding","padding-top","padding-right","padding-bottom","padding-left","width","border","border-top","border-right","border-bottom","border-left","border-radius","max-width","margin-right","margin","margin-top","margin-bottom"]);}};});
2
+ //# sourceMappingURL=email-css.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-css.cjs.js","sources":["../../../../src/nile-wysiwyg-editor/engine/email-css.ts"],"sourcesContent":["/** Container tags an app may widen with `allowedStyles`. */\nconst EXTENSION_TAGS = new Set(['td', 'th', 'table', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']);\n\n/** Properties an app can never allow, whatever its config. */\nexport const EXTENSION_DENYLIST = new Set([\n 'position', 'top', 'right', 'bottom', 'left', 'inset', 'inset-block',\n 'inset-block-start', 'inset-block-end', 'inset-inline', 'inset-inline-start',\n 'inset-inline-end', 'z-index', 'content', 'behavior', '-moz-binding',\n 'transform', 'transform-origin', 'transform-box', 'filter', 'backdrop-filter',\n 'perspective', 'perspective-origin', 'display', 'visibility', 'opacity',\n 'pointer-events', 'clip', 'clip-path', 'mask', 'mask-image', 'mask-repeat',\n 'mask-position', 'mask-size', 'animation', 'animation-name', 'transition',\n 'transition-property', 'will-change', 'cursor', 'float', 'clear', 'overflow',\n 'overflow-x', 'overflow-y', 'background', 'background-image',\n 'list-style-image', 'border-image', 'border-image-source',\n]);\n\n/** Properties a built-in fidelity path already handles; kept in sync with `sanitize.ts`. */\nconst BUILTIN_HANDLED = new Set([\n // ALLOWED_STYLES\n 'color', 'background-color', 'font-family', 'font-size', 'font-style',\n 'font-weight', 'text-align', 'text-decoration', 'text-decoration-line',\n 'vertical-align', 'margin-left', 'margin-inline-start', 'list-style-type',\n 'line-height',\n // CONTAINER_DROP\n 'text-decoration-style', 'text-decoration-color',\n // CELL_LAYOUT\n 'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left',\n 'width', 'border', 'border-top', 'border-right', 'border-bottom',\n 'border-left', 'border-radius',\n // TABLE_LAYOUT\n 'max-width', 'margin-right',\n // BLOCK_LAYOUT\n 'margin', 'margin-top', 'margin-bottom',\n]);\n\n/** Lowercase name (optionally `mso-`), not denylisted and not built in. */\nexport function isExtensionPropValid(name: string): boolean {\n if (!/^(?:mso-)?[a-z]+(?:-[a-z]+)*$/.test(name)) return false;\n if (EXTENSION_DENYLIST.has(name)) return false;\n if (BUILTIN_HANDLED.has(name)) return false;\n return true;\n}\n\n/** Strict value grammar: no functions except numeric colours, no escape characters. */\nexport function isExtensionValueValid(value: string): boolean {\n const v = value.trim();\n if (!v || v.length > 128) return false;\n // eslint-disable-next-line no-control-regex\n if (/[^\\x00-\\x7f]/.test(v)) return false;\n if (/\\b(?:url|expression|var|calc|attr|env|image-set)\\b/i.test(v)) return false;\n if (/[\\\\<>{};@]/.test(v)) return false;\n if (/\\/\\*/.test(v)) return false;\n if (/\\//.test(v)) return false;\n if (/!important/i.test(v)) return false;\n if (/[()]/.test(v)) {\n if ((v.match(/\\(/g) ?? []).length !== 1) return false;\n const fn = /(?:rgba?|hsla?)\\(\\s*[\\d.]+%?(?:\\s*,\\s*[\\d.]+%?){2,3}\\s*\\)/i.exec(v);\n if (!fn || /[()]/.test(v.replace(fn[0], ''))) return false;\n }\n return true;\n}\n\n/** tag → set of accepted extension property names. */\nexport type NormalizedAllowedStyles = Map<string, Set<string>>;\n\n/** Validated tag → props map; warns once per dropped entry. */\nexport function normalizeEmailAllowedStyles(\n config: Record<string, string[]>\n): NormalizedAllowedStyles {\n const out: NormalizedAllowedStyles = new Map();\n if (!config || typeof config !== 'object') return out;\n for (const [rawTag, rawProps] of Object.entries(config)) {\n const tag = String(rawTag).toLowerCase();\n if (!EXTENSION_TAGS.has(tag)) {\n // eslint-disable-next-line no-console\n console.warn(\n `[nile-wysiwyg-editor] allowedStyles: ignoring tag \"${rawTag}\" (unsupported tag)`\n );\n continue;\n }\n if (!Array.isArray(rawProps)) continue;\n const props = out.get(tag) ?? new Set<string>();\n for (const rawProp of rawProps) {\n const prop = String(rawProp);\n if (!isExtensionPropValid(prop)) {\n const reason = EXTENSION_DENYLIST.has(prop)\n ? 'denylisted'\n : BUILTIN_HANDLED.has(prop)\n ? 'already handled by a built-in'\n : 'invalid property name';\n // eslint-disable-next-line no-console\n console.warn(\n `[nile-wysiwyg-editor] allowedStyles: ignoring \"${tag}: ${rawProp}\" (${reason})`\n );\n continue;\n }\n props.add(prop);\n }\n if (props.size) out.set(tag, props);\n }\n return out;\n}\n\n/** `\"td: letter-spacing; p: text-indent\"` → `{ td: ['letter-spacing'], p: ['text-indent'] }`. */\nexport function parseAllowedStylesAttr(raw: string): Record<string, string[]> {\n const out: Record<string, string[]> = {};\n for (const group of raw.split(';')) {\n const idx = group.indexOf(':');\n if (idx === -1) continue;\n const tag = group.slice(0, idx).trim();\n if (!tag) continue;\n const props = group\n .slice(idx + 1)\n .split(',')\n .map(p => p.trim())\n .filter(Boolean);\n if (props.length) out[tag] = props;\n }\n return out;\n}\n\n/** Re-validates a stored `extraStyle` on write-back, where the per-app allowlist isn't visible. */\nexport function sanitizeExtraStyleForWrite(s: string): string {\n const kept: string[] = [];\n for (const decl of String(s ?? '').split(';')) {\n const idx = decl.indexOf(':');\n if (idx === -1) continue;\n const name = decl.slice(0, idx).trim().toLowerCase();\n const value = decl.slice(idx + 1).trim();\n if (isExtensionPropValid(name) && isExtensionValueValid(value)) {\n kept.push(`${name}: ${value}`);\n }\n }\n return kept.join('; ');\n}\n"],"names":["isExtensionPropValid","name","test","EXTENSION_DENYLIST","has","BUILTIN_HANDLED","isExtensionValueValid","value","v","trim","length","_n$match","match","fn","exec","replace","normalizeEmailAllowedStyles","config","out","Map","_typeof","_i","_Object$entries","Object","entries","_r$get","_Object$entries$_i","_slicedToArray","rawTag","rawProps","tag","String","toLowerCase","EXTENSION_TAGS","console","warn","Array","isArray","props","get","Set","_iterator","_createForOfIteratorHelper","s","_step","n","done","rawProp","prop","add","reason","size","set","parseAllowedStylesAttr","raw","_iterator2","split","_step2","group","idx","indexOf","slice","map","p","filter","Boolean","err","e","f","sanitizeExtraStyleForWrite","kept","_iterator3","_step3","decl","push","join","_export","i"],"mappings":"+xEAqCM,QAAUA,CAAAA,CAAAA,CAAqBC,GACnC,MAAK,CAAA,CAAA,+BAAA,CAAgCC,KAAKD,CACtCE,CAAAA,EAAAA,CAAAA,CAAAA,CAAmBC,IAAIH,CACvBI,CAAAA,EAAAA,CAAAA,CAAAA,CAAgBD,IAAIH,CAE1B,CAAA,EAGM,QAAUK,CAAAA,CAAsBC,CAAAA,CAAAA,CAAAA,CACpC,GAAMC,CAAAA,CAAAA,CAAID,CAAME,CAAAA,IAAAA,CAAAA,CAAAA,CAChB,IAAKD,CAAKA,EAAAA,CAAAA,CAAEE,OAAS,GAAK,CAAA,MAAA,CAAO,EAEjC,GAAI,cAAA,CAAeR,IAAKM,CAAAA,CAAAA,CAAAA,CAAI,MAAO,CAAA,CAAA,CACnC,GAAI,qDAAsDN,CAAAA,IAAAA,CAAKM,GAAI,MAAO,CAAA,CAAA,CAC1E,GAAI,YAAaN,CAAAA,IAAAA,CAAKM,CAAI,CAAA,CAAA,MAAA,CAAO,CACjC,CAAA,GAAI,OAAON,IAAKM,CAAAA,CAAAA,CAAAA,CAAI,OAAO,CAC3B,CAAA,GAAI,KAAKN,IAAKM,CAAAA,CAAAA,CAAAA,CAAI,MAAO,CAAA,CAAA,CACzB,GAAI,aAAA,CAAcN,KAAKM,CAAI,CAAA,CAAA,MAAA,CAAO,EAClC,GAAI,MAAA,CAAON,KAAKM,CAAI,CAAA,CAAA,KAAAG,QAAA,CAClB,GAAsC,CAAA,GAAA,EAAAA,QAAA,CAAjCH,CAAEI,CAAAA,KAAAA,CAAM,2CAAU,EAAIF,EAAAA,MAAAA,CAAc,OAAO,CAChD,CAAA,GAAMG,CAAAA,GAAK,4DAA6DC,CAAAA,IAAAA,CAAKN,CAC7E,CAAA,CAAA,GAAA,CAAKK,EAAM,EAAA,MAAA,CAAOX,KAAKM,CAAEO,C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@
1
+ const t=new Set(["td","th","table","p","h1","h2","h3","h4","h5","h6"]),n=new Set(["position","top","right","bottom","left","inset","inset-block","inset-block-start","inset-block-end","inset-inline","inset-inline-start","inset-inline-end","z-index","content","behavior","-moz-binding","transform","transform-origin","transform-box","filter","backdrop-filter","perspective","perspective-origin","display","visibility","opacity","pointer-events","clip","clip-path","mask","mask-image","mask-repeat","mask-position","mask-size","animation","animation-name","transition","transition-property","will-change","cursor","float","clear","overflow","overflow-x","overflow-y","background","background-image","list-style-image","border-image","border-image-source"]),i=new Set(["color","background-color","font-family","font-size","font-style","font-weight","text-align","text-decoration","text-decoration-line","vertical-align","margin-left","margin-inline-start","list-style-type","line-height","text-decoration-style","text-decoration-color","padding","padding-top","padding-right","padding-bottom","padding-left","width","border","border-top","border-right","border-bottom","border-left","border-radius","max-width","margin-right","margin","margin-top","margin-bottom"]);function e(t){return!!/^(?:mso-)?[a-z]+(?:-[a-z]+)*$/.test(t)&&(!n.has(t)&&!i.has(t))}function o(t){const n=t.trim();if(!n||n.length>128)return!1;if(/[^\x00-\x7f]/.test(n))return!1;if(/\b(?:url|expression|var|calc|attr|env|image-set)\b/i.test(n))return!1;if(/[\\<>{};@]/.test(n))return!1;if(/\/\*/.test(n))return!1;if(/\//.test(n))return!1;if(/!important/i.test(n))return!1;if(/[()]/.test(n)){if(1!==(n.match(/\(/g)??[]).length)return!1;const t=/(?:rgba?|hsla?)\(\s*[\d.]+%?(?:\s*,\s*[\d.]+%?){2,3}\s*\)/i.exec(n);if(!t||/[()]/.test(n.replace(t[0],"")))return!1}return!0}function r(o){const r=new Map;if(!o||"object"!=typeof o)return r;for(const[a,s]of Object.entries(o)){const o=String(a).toLowerCase();if(!t.has(o)){console.warn(`[nile-wysiwyg-editor] allowedStyles: ignoring tag "${a}" (unsupported tag)`);continue}if(!Array.isArray(s))continue;const c=r.get(o)??new Set;for(const t of s){const r=String(t);if(e(r))c.add(r);else{const e=n.has(r)?"denylisted":i.has(r)?"already handled by a built-in":"invalid property name";console.warn(`[nile-wysiwyg-editor] allowedStyles: ignoring "${o}: ${t}" (${e})`)}}c.size&&r.set(o,c)}return r}function a(t){const n={};for(const i of t.split(";")){const t=i.indexOf(":");if(-1===t)continue;const e=i.slice(0,t).trim();if(!e)continue;const o=i.slice(t+1).split(",").map((t=>t.trim())).filter(Boolean);o.length&&(n[e]=o)}return n}function s(t){const n=[];for(const i of String(t??"").split(";")){const t=i.indexOf(":");if(-1===t)continue;const r=i.slice(0,t).trim().toLowerCase(),a=i.slice(t+1).trim();e(r)&&o(a)&&n.push(`${r}: ${a}`)}return n.join("; ")}export{o as i,r as n,a as p,s};