@aquera/nile-elements 2.0.16 → 2.0.17
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.
- package/README.md +3 -0
- package/dist/{index-f6944844.cjs.js → index-0c0c869d.cjs.js} +2 -2
- package/dist/{index-f6944844.cjs.js.map → index-0c0c869d.cjs.js.map} +1 -1
- package/dist/{index-403841c7.cjs.js → index-129ef6fb.cjs.js} +3 -3
- package/dist/{index-403841c7.cjs.js.map → index-129ef6fb.cjs.js.map} +1 -1
- package/dist/{index-1faa963c.esm.js → index-36f2a6b5.esm.js} +1 -1
- package/dist/index-4df50481.esm.js +1 -0
- package/dist/index-5d34cff1.esm.js +1 -0
- package/dist/index-7ae95edd.cjs.js +2 -0
- package/dist/{index-3ca67627.cjs.js.map → index-7ae95edd.cjs.js.map} +1 -1
- package/dist/index-7ca72b78.esm.js +1 -0
- package/dist/index-bbe23ad8.cjs.js +2 -0
- package/dist/index-bbe23ad8.cjs.js.map +1 -0
- package/dist/index-ccc6a799.cjs.js +5 -0
- package/dist/index-ccc6a799.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +122 -70
- package/dist/nile-auto-complete/index.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
- package/dist/nile-auto-complete/portal-manager.cjs.js +1 -1
- package/dist/nile-auto-complete/portal-utils.cjs.js +1 -1
- package/dist/nile-code-editor/extensionSetup.cjs.js +2 -2
- package/dist/nile-code-editor/index.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- package/dist/nile-color-picker/index.cjs.js +1 -1
- package/dist/nile-color-picker/nile-color-picker.cjs.js +1 -1
- package/dist/nile-combobox/index.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/portal-manager.cjs.js +1 -1
- package/dist/nile-context-menu/index.cjs.js +1 -1
- package/dist/nile-context-menu/nile-context-menu.cjs.js +1 -1
- package/dist/nile-context-submenu/index.cjs.js +1 -1
- package/dist/nile-context-submenu/nile-context-submenu.cjs.js +1 -1
- package/dist/nile-detail/index.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-dropdown/index.cjs.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.cjs.js +1 -1
- package/dist/nile-dropdown/portal-manager.cjs.js +1 -1
- package/dist/nile-file-upload/index.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.template.cjs.js +1 -1
- package/dist/nile-floating-panel/index.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-lite-tooltip/index.cjs.js +1 -1
- package/dist/nile-lite-tooltip/nile-lite-tooltip.cjs.js +1 -1
- package/dist/nile-markdown-editor/index.cjs.js +1 -1
- package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
- package/dist/nile-popover/index.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/portal-manager.cjs.js +1 -1
- package/dist/nile-popup/index.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.cjs.js +1 -1
- package/dist/nile-segmented-progress-bar/index.cjs.js +1 -1
- package/dist/nile-segmented-progress-bar/nile-segmented-progress-bar.cjs.js +1 -1
- package/dist/nile-select/index.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/portal-manager.cjs.js +1 -1
- package/dist/nile-side-bar-action/index.cjs.js +1 -1
- package/dist/nile-side-bar-action/nile-side-bar-action.cjs.js +1 -1
- package/dist/nile-side-bar-action/portal-manager.cjs.js +1 -1
- package/dist/nile-tooltip/index.cjs.js +1 -1
- package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
- package/dist/nile-virtual-select/index.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
- package/dist/nile-virtual-select/portal-manager.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/commands.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/create-state.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/email-css.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/email-css.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/email-css.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/email-render.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/email-render.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/email-render.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/html-detect.cjs.js +2 -0
- package/dist/nile-wysiwyg-editor/engine/html-detect.cjs.js.map +1 -0
- package/dist/nile-wysiwyg-editor/engine/html-detect.esm.js +1 -0
- package/dist/nile-wysiwyg-editor/engine/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/inputrules.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/keymap.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/code-highlight.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embed-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/embeds.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/find-replace.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/format-painter.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image-view.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/image.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/link.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/max-length.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/paste.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/placeholder.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/single-line.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/suggestions.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/plugins/tables.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js +2 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/sanitize.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/schema.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/selection-state.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/engine/serializer.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.css.esm.js +45 -4
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bookmark-panel.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +5 -5
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/code-block-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-panel.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/emoji-picker.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/find-replace.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/find-replace.esm.js +3 -3
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +3 -3
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-panel.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/insert-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/insert-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/link-editor.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/link-editor.esm.js +9 -9
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/markdown-panel.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/math-panel.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/shortcut-help.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/source-view.esm.js +4 -4
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/special-chars.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/special-chars.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/suggest-list.esm.js +23 -12
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-grid-picker.esm.js +7 -7
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/create-state.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.js +2 -0
- package/dist/src/nile-wysiwyg-editor/engine/create-state.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/email-css.d.ts +14 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-css.js +140 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-css.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.js +1045 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-fidelity.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-render.d.ts +11 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-render.js +93 -0
- package/dist/src/nile-wysiwyg-editor/engine/email-render.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/html-detect.d.ts +2 -0
- package/dist/src/nile-wysiwyg-editor/engine/html-detect.js +24 -0
- package/dist/src/nile-wysiwyg-editor/engine/html-detect.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/engine/index.d.ts +4 -1
- package/dist/src/nile-wysiwyg-editor/engine/index.js +3 -1
- package/dist/src/nile-wysiwyg-editor/engine/index.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.d.ts +0 -5
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.js +19 -0
- package/dist/src/nile-wysiwyg-editor/engine/inputrules.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js +3 -2
- package/dist/src/nile-wysiwyg-editor/engine/plugins/image-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.d.ts +4 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js +56 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/link.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.d.ts +5 -0
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js +27 -6
- package/dist/src/nile-wysiwyg-editor/engine/plugins/paste.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js +30 -7
- package/dist/src/nile-wysiwyg-editor/engine/plugins/tables.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js +46 -0
- package/dist/src/nile-wysiwyg-editor/engine/pm.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.d.ts +9 -1
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js +730 -7
- package/dist/src/nile-wysiwyg-editor/engine/sanitize.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/schema.d.ts +3 -0
- package/dist/src/nile-wysiwyg-editor/engine/schema.js +215 -34
- package/dist/src/nile-wysiwyg-editor/engine/schema.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.js +3 -1
- package/dist/src/nile-wysiwyg-editor/engine/selection-state.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/engine/serializer.d.ts +12 -4
- package/dist/src/nile-wysiwyg-editor/engine/serializer.js +18 -8
- package/dist/src/nile-wysiwyg-editor/engine/serializer.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.d.ts +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.js +287 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.js.map +1 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js +45 -4
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.d.ts +23 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js +113 -15
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js +213 -0
- package/dist/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js +2 -2
- package/dist/src/nile-wysiwyg-editor/ui/bookmark-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/bubble-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/embed-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/emoji-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/find-replace.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/image-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/insert-menu.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js +2 -2
- package/dist/src/nile-wysiwyg-editor/ui/link-editor.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/markdown-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/math-panel.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/shortcut-help.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js +2 -2
- package/dist/src/nile-wysiwyg-editor/ui/source-view.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/special-chars.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js +14 -3
- package/dist/src/nile-wysiwyg-editor/ui/suggest-list.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js +2 -2
- package/dist/src/nile-wysiwyg-editor/ui/table-grid-picker.js.map +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js +1 -1
- package/dist/src/nile-wysiwyg-editor/ui/table-menu.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-wysiwyg-editor/engine/create-state.ts +7 -0
- package/src/nile-wysiwyg-editor/engine/email-css.ts +136 -0
- package/src/nile-wysiwyg-editor/engine/email-fidelity.test.ts +1347 -0
- package/src/nile-wysiwyg-editor/engine/email-render.ts +99 -0
- package/src/nile-wysiwyg-editor/engine/html-detect.ts +26 -0
- package/src/nile-wysiwyg-editor/engine/index.ts +10 -1
- package/src/nile-wysiwyg-editor/engine/inputrules.ts +18 -1
- package/src/nile-wysiwyg-editor/engine/plugins/image-view.ts +3 -2
- package/src/nile-wysiwyg-editor/engine/plugins/link.ts +58 -2
- package/src/nile-wysiwyg-editor/engine/plugins/paste.ts +31 -8
- package/src/nile-wysiwyg-editor/engine/plugins/tables.ts +29 -7
- package/src/nile-wysiwyg-editor/engine/pm.test.ts +73 -0
- package/src/nile-wysiwyg-editor/engine/sanitize.ts +729 -7
- package/src/nile-wysiwyg-editor/engine/schema.ts +206 -33
- package/src/nile-wysiwyg-editor/engine/selection-state.ts +3 -1
- package/src/nile-wysiwyg-editor/engine/serializer.ts +30 -8
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor-email-fidelity.test.ts +357 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.css.ts +45 -4
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.test.ts +258 -0
- package/src/nile-wysiwyg-editor/nile-wysiwyg-editor.ts +119 -12
- package/src/nile-wysiwyg-editor/ui/bookmark-panel.ts +2 -2
- package/src/nile-wysiwyg-editor/ui/bubble-menu.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/embed-menu.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/embed-panel.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/emoji-picker.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/find-replace.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/image-menu.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/image-panel.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/insert-menu.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/link-editor.ts +2 -2
- package/src/nile-wysiwyg-editor/ui/markdown-panel.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/math-panel.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/shortcut-help.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/source-view.ts +2 -2
- package/src/nile-wysiwyg-editor/ui/special-chars.ts +1 -1
- package/src/nile-wysiwyg-editor/ui/suggest-list.ts +14 -3
- package/src/nile-wysiwyg-editor/ui/table-grid-picker.ts +2 -2
- package/src/nile-wysiwyg-editor/ui/table-menu.ts +1 -1
- package/vscode-html-custom-data.json +15 -1
- package/web-test-runner.config.mjs +4 -0
- package/dist/index-3ca67627.cjs.js +0 -2
- package/dist/index-6f3fa4ab.esm.js +0 -1
- package/dist/index-7b1c9857.esm.js +0 -1
- package/dist/index-89c520e9.cjs.js +0 -5
- package/dist/index-89c520e9.cjs.js.map +0 -1
- package/dist/index-ba47645d.esm.js +0 -1
- package/dist/index-c3210a9c.cjs.js +0 -2
- package/dist/index-c3210a9c.cjs.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
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);}System.register(["./index-
|
|
1
|
+
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);}System.register(["./index-bbe23ad8.cjs.js"],function(_export,_context){"use strict";var t,n,e,i,u;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 _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function r(_ref){var n=_ref.rules;var e=new t({state:{init:function init(){return null;},apply:function apply(t,n){var e=t.getMeta(this);return e||(t.selectionSet||t.docChanged?null:n);}},props:{handleTextInput:function handleTextInput(t,i,r,u){return l(t,i,r,u,n,e);},handleDOMEvents:{compositionend:function compositionend(t){setTimeout(function(){var i=t.state.selection.$cursor;i&&l(t,i.pos,i.pos,"",n,e);});}}},isInputRules:!0});return e;}function l(t,n,e,i,r,l){if(t.composing)return!1;var u=t.state,o=u.doc.resolve(n),s=o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,null,"")+i;var _loop=function _loop(){var a=r[f];if(!a.inCodeMark&&o.marks().some(function(t){return t.type.spec.code;}))return 0;// continue
|
|
2
2
|
if(o.parent.type.spec.code){if(!a.inCode)return 0;// continue
|
|
3
3
|
}else if("only"===a.inCode)return 0;// continue
|
|
4
4
|
var c=a.match.exec(s);if(!c||c[0].length<i.length)return 0;// continue
|
|
5
5
|
var d=n-(c[0].length-i.length);if(!a.inCodeMark){var _t2=!1;if(u.doc.nodesBetween(d,o.pos,function(n){n.isInline&&n.marks.some(function(t){return t.type.spec.code;})&&(_t2=!0);}),_t2)return 0;// continue
|
|
6
|
-
}var h=a.handler(u,c,d,e);if(h)return{v:(a.undoable&&h.setMeta(l,{transform:h,from:n,to:e,text:i}),t.dispatch(h),!0)};},_ret;for(var f=0;f<r.length;f++){_ret=_loop();if(_ret===0)continue;if(_ret)return _ret.v;}return!1;}function o(t,r){var l=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var u=arguments.length>3?arguments[3]:undefined;return new i(t,function(t,i,o,s){var f=l instanceof Function?l(i):l,a=t.tr["delete"](o,s),c=a.doc.resolve(o).blockRange(),d=c&&n(c,r,f);if(!d)return null;a.wrap(c,d);var h=a.doc.resolve(o-1).nodeBefore;return h&&h.type==r&&e(a.doc,o-1)&&(!u||u(i,h))&&a.join(o-1),a;});}function s(t,n){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return new i(t,function(t,i,r,l){var u=t.doc.resolve(r),o=e instanceof Function?e(i):e;return u.node(-1).canReplaceWith(u.index(-1),u.indexAfter(-1),n)?t.tr["delete"](r,l).setBlockType(r,r,n,o):null;});}_export({i:r,t:s,w:o});return{setters:[function(
|
|
7
|
-
//# sourceMappingURL=index-
|
|
6
|
+
}var h=a.handler(u,c,d,e);if(h)return{v:(a.undoable&&h.setMeta(l,{transform:h,from:n,to:e,text:i}),t.dispatch(h),!0)};},_ret;for(var f=0;f<r.length;f++){_ret=_loop();if(_ret===0)continue;if(_ret)return _ret.v;}return!1;}function o(t,r){var l=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;var u=arguments.length>3?arguments[3]:undefined;return new i(t,function(t,i,o,s){var f=l instanceof Function?l(i):l,a=t.tr["delete"](o,s),c=a.doc.resolve(o).blockRange(),d=c&&n(c,r,f);if(!d)return null;a.wrap(c,d);var h=a.doc.resolve(o-1).nodeBefore;return h&&h.type==r&&e(a.doc,o-1)&&(!u||u(i,h))&&a.join(o-1),a;});}function s(t,n){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:null;return new i(t,function(t,i,r,l){var u=t.doc.resolve(r),o=e instanceof Function?e(i):e;return u.node(-1).canReplaceWith(u.index(-1),u.indexAfter(-1),n)?t.tr["delete"](r,l).setBlockType(r,r,n,o):null;});}_export({i:r,t:s,w:o});return{setters:[function(_index00aCjsJs){t=_index00aCjsJs.a;n=_index00aCjsJs.f;e=_index00aCjsJs.c;}],execute:function execute(){_export("I",i=/*#__PURE__*/_createClass(function i(t,n){var e=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};_classCallCheck(this,i);var _i;this.match=t,this.match=t,this.handler="string"==typeof n?(_i=n,function(t,n,e,r){var l=_i;if(n[1]){var _t=n[0].lastIndexOf(n[1]);l+=n[0].slice(_t+n[1].length);var _i2=(e+=_t)-r;_i2>0&&(l=n[0].slice(_t-_i2,_t)+l,e=r);}return t.tr.insertText(l,e,r);}):n,this.undoable=!1!==e.undoable,this.inCode=e.inCode||!1,this.inCodeMark=!1!==e.inCodeMark;}));_export("u",u=function u(t,n){var e=t.plugins;for(var _i3=0;_i3<e.length;_i3++){var _r=void 0,_l=e[_i3];if(_l.spec.isInputRules&&(_r=_l.getState(t))){if(n){var _e=t.tr,_i4=_r.transform;for(var _t3=_i4.steps.length-1;_t3>=0;_t3--)_e.step(_i4.steps[_t3].invert(_i4.docs[_t3]));if(_r.text){var _n=_e.doc.resolve(_r.from).marks();_e.replaceWith(_r.from,_r.to,t.schema.text(_r.text,_n));}else _e["delete"](_r.from,_r.to);n(_e);}return!0;}}return!1;});new i(/--$/,"—",{inCodeMark:!1}),new i(/\.\.\.$/,"…",{inCodeMark:!1}),new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new i(/"$/,"”",{inCodeMark:!1}),new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new i(/'$/,"’",{inCodeMark:!1});}};});
|
|
7
|
+
//# sourceMappingURL=index-129ef6fb.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-403841c7.cjs.js","sources":["../../../node_modules/prosemirror-inputrules/dist/index.js"],"sourcesContent":["import { Plugin } from 'prosemirror-state';\nimport { findWrapping, canJoin } from 'prosemirror-transform';\n\n/**\nInput rules are regular expressions describing a piece of text\nthat, when typed, causes something to happen. This might be\nchanging two dashes into an emdash, wrapping a paragraph starting\nwith `\"> \"` into a blockquote, or something entirely different.\n*/\nclass InputRule {\n /**\n Create an input rule. The rule applies when the user typed\n something and the text directly in front of the cursor matches\n `match`, which should end with `$`.\n \n The `handler` can be a string, in which case the matched text, or\n the first matched group in the regexp, is replaced by that\n string.\n \n Or a it can be a function, which will be called with the match\n array produced by\n [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec),\n as well as the start and end of the matched range, and which can\n return a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) that describes the\n rule's effect, or null to indicate the input was not handled.\n */\n constructor(\n /**\n @internal\n */\n match, handler, options = {}) {\n this.match = match;\n this.match = match;\n this.handler = typeof handler == \"string\" ? stringHandler(handler) : handler;\n this.undoable = options.undoable !== false;\n this.inCode = options.inCode || false;\n this.inCodeMark = options.inCodeMark !== false;\n }\n}\nfunction stringHandler(string) {\n return function (state, match, start, end) {\n let insert = string;\n if (match[1]) {\n let offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n let cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n return state.tr.insertText(insert, start, end);\n };\n}\nconst MAX_MATCH = 500;\n/**\nCreate an input rules plugin. When enabled, it will cause text\ninput that matches any of the given rules to trigger the rule's\naction.\n*/\nfunction inputRules({ rules }) {\n let plugin = new Plugin({\n state: {\n init() { return null; },\n apply(tr, prev) {\n let stored = tr.getMeta(this);\n if (stored)\n return stored;\n return tr.selectionSet || tr.docChanged ? null : prev;\n }\n },\n props: {\n handleTextInput(view, from, to, text) {\n return run(view, from, to, text, rules, plugin);\n },\n handleDOMEvents: {\n compositionend: (view) => {\n setTimeout(() => {\n let { $cursor } = view.state.selection;\n if ($cursor)\n run(view, $cursor.pos, $cursor.pos, \"\", rules, plugin);\n });\n }\n }\n },\n isInputRules: true\n });\n return plugin;\n}\nfunction run(view, from, to, text, rules, plugin) {\n if (view.composing)\n return false;\n let state = view.state, $from = state.doc.resolve(from);\n let textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - MAX_MATCH), $from.parentOffset, null, \"\\ufffc\") + text;\n for (let i = 0; i < rules.length; i++) {\n let rule = rules[i];\n if (!rule.inCodeMark && $from.marks().some(m => m.type.spec.code))\n continue;\n if ($from.parent.type.spec.code) {\n if (!rule.inCode)\n continue;\n }\n else if (rule.inCode === \"only\") {\n continue;\n }\n let match = rule.match.exec(textBefore);\n if (!match || match[0].length < text.length)\n continue;\n let startPos = from - (match[0].length - text.length);\n if (!rule.inCodeMark) {\n let hasMark = false;\n state.doc.nodesBetween(startPos, $from.pos, node => {\n if (node.isInline && node.marks.some(m => m.type.spec.code))\n hasMark = true;\n });\n if (hasMark)\n continue;\n }\n let tr = rule.handler(state, match, startPos, to);\n if (!tr)\n continue;\n if (rule.undoable)\n tr.setMeta(plugin, { transform: tr, from, to, text });\n view.dispatch(tr);\n return true;\n }\n return false;\n}\n/**\nThis is a command that will undo an input rule, if applying such a\nrule was the last thing that the user did.\n*/\nconst undoInputRule = (state, dispatch) => {\n let plugins = state.plugins;\n for (let i = 0; i < plugins.length; i++) {\n let plugin = plugins[i], undoable;\n if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n if (dispatch) {\n let tr = state.tr, toUndo = undoable.transform;\n for (let j = toUndo.steps.length - 1; j >= 0; j--)\n tr.step(toUndo.steps[j].invert(toUndo.docs[j]));\n if (undoable.text) {\n let marks = tr.doc.resolve(undoable.from).marks();\n tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));\n }\n else {\n tr.delete(undoable.from, undoable.to);\n }\n dispatch(tr);\n }\n return true;\n }\n }\n return false;\n};\n\n/**\nConverts double dashes to an emdash.\n*/\nconst emDash = new InputRule(/--$/, \"—\", { inCodeMark: false });\n/**\nConverts three dots to an ellipsis character.\n*/\nconst ellipsis = new InputRule(/\\.\\.\\.$/, \"…\", { inCodeMark: false });\n/**\n“Smart” opening double quotes.\n*/\nconst openDoubleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(\")$/, \"“\", { inCodeMark: false });\n/**\n“Smart” closing double quotes.\n*/\nconst closeDoubleQuote = new InputRule(/\"$/, \"”\", { inCodeMark: false });\n/**\n“Smart” opening single quotes.\n*/\nconst openSingleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(')$/, \"‘\", { inCodeMark: false });\n/**\n“Smart” closing single quotes.\n*/\nconst closeSingleQuote = new InputRule(/'$/, \"’\", { inCodeMark: false });\n/**\nSmart-quote related input rules.\n*/\nconst smartQuotes = [openDoubleQuote, closeDoubleQuote, openSingleQuote, closeSingleQuote];\n\n/**\nBuild an input rule for automatically wrapping a textblock when a\ngiven string is typed. The `regexp` argument is\ndirectly passed through to the `InputRule` constructor. You'll\nprobably want the regexp to start with `^`, so that the pattern can\nonly occur at the start of a textblock.\n\n`nodeType` is the type of node to wrap in. If it needs attributes,\nyou can either pass them directly, or pass a function that will\ncompute them from the regular expression match.\n\nBy default, if there's a node with the same type above the newly\nwrapped node, the rule will try to [join](https://prosemirror.net/docs/ref/#transform.Transform.join) those\ntwo nodes. You can pass a join predicate, which takes a regular\nexpression match and the node before the wrapped node, and can\nreturn a boolean to indicate whether a join should happen.\n*/\nfunction wrappingInputRule(regexp, nodeType, getAttrs = null, joinPredicate) {\n return new InputRule(regexp, (state, match, start, end) => {\n let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n let tr = state.tr.delete(start, end);\n let $start = tr.doc.resolve(start), range = $start.blockRange(), wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping)\n return null;\n tr.wrap(range, wrapping);\n let before = tr.doc.resolve(start - 1).nodeBefore;\n if (before && before.type == nodeType && canJoin(tr.doc, start - 1) &&\n (!joinPredicate || joinPredicate(match, before)))\n tr.join(start - 1);\n return tr;\n });\n}\n/**\nBuild an input rule that changes the type of a textblock when the\nmatched text is typed into it. You'll usually want to start your\nregexp with `^` to that it is only matched at the start of a\ntextblock. The optional `getAttrs` parameter can be used to compute\nthe new node's attributes, and works the same as in the\n`wrappingInputRule` function.\n*/\nfunction textblockTypeInputRule(regexp, nodeType, getAttrs = null) {\n return new InputRule(regexp, (state, match, start, end) => {\n let $start = state.doc.resolve(start);\n let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType))\n return null;\n return state.tr\n .delete(start, end)\n .setBlockType(start, start, nodeType, attrs);\n });\n}\n\nexport { InputRule, closeDoubleQuote, closeSingleQuote, ellipsis, emDash, inputRules, openDoubleQuote, openSingleQuote, smartQuotes, textblockTypeInputRule, undoInputRule, wrappingInputRule };\n"],"names":["inputRules","rules","plugin","Plugin","state","init","apply","tr","prev","stored","getMeta","this","selectionSet","docChanged","props","handleTextInput","view","from","to","text","run","handleDOMEvents","compositionend","setTimeout","$cursor","selection","pos","isInputRules","composing","$from","doc","resolve","textBefore","parent","textBetween","Math","max","parentOffset","_loop","rule","i","inCodeMark","marks","some","m","type","spec","code","inCode","match","exec","length","startPos","hasMark","nodesBetween","node","isInline","handler","v","undoable","setMeta","transform","dispatch","_ret","wrappingInputRule","regexp","nodeType","getAttrs","joinPredicate","arguments","undefined","InputRule","start","end","attrs","Function","delete","range","blockRange","wrapping","findWrapping","wrap","before","nodeBefore","canJoin","join","textblockTypeInputRule","$start","canReplaceWith","index","indexAfter","setBlockType","_export","options","string","insert","offset","lastIndexOf","slice","cutOff","insertText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CAAA,GAAA,CAAK,CAAE9B,UAAAA,CAAAA,CAAY,IAIxE,GAAI8B,CAAAA,CAAAA,CAAU,IAAM,CAAA,GAAA,CAAK,CAAE9B,UAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index-129ef6fb.cjs.js","sources":["../../../node_modules/prosemirror-inputrules/dist/index.js"],"sourcesContent":["import { Plugin } from 'prosemirror-state';\nimport { findWrapping, canJoin } from 'prosemirror-transform';\n\n/**\nInput rules are regular expressions describing a piece of text\nthat, when typed, causes something to happen. This might be\nchanging two dashes into an emdash, wrapping a paragraph starting\nwith `\"> \"` into a blockquote, or something entirely different.\n*/\nclass InputRule {\n /**\n Create an input rule. The rule applies when the user typed\n something and the text directly in front of the cursor matches\n `match`, which should end with `$`.\n \n The `handler` can be a string, in which case the matched text, or\n the first matched group in the regexp, is replaced by that\n string.\n \n Or a it can be a function, which will be called with the match\n array produced by\n [`RegExp.exec`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec),\n as well as the start and end of the matched range, and which can\n return a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) that describes the\n rule's effect, or null to indicate the input was not handled.\n */\n constructor(\n /**\n @internal\n */\n match, handler, options = {}) {\n this.match = match;\n this.match = match;\n this.handler = typeof handler == \"string\" ? stringHandler(handler) : handler;\n this.undoable = options.undoable !== false;\n this.inCode = options.inCode || false;\n this.inCodeMark = options.inCodeMark !== false;\n }\n}\nfunction stringHandler(string) {\n return function (state, match, start, end) {\n let insert = string;\n if (match[1]) {\n let offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n let cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n return state.tr.insertText(insert, start, end);\n };\n}\nconst MAX_MATCH = 500;\n/**\nCreate an input rules plugin. When enabled, it will cause text\ninput that matches any of the given rules to trigger the rule's\naction.\n*/\nfunction inputRules({ rules }) {\n let plugin = new Plugin({\n state: {\n init() { return null; },\n apply(tr, prev) {\n let stored = tr.getMeta(this);\n if (stored)\n return stored;\n return tr.selectionSet || tr.docChanged ? null : prev;\n }\n },\n props: {\n handleTextInput(view, from, to, text) {\n return run(view, from, to, text, rules, plugin);\n },\n handleDOMEvents: {\n compositionend: (view) => {\n setTimeout(() => {\n let { $cursor } = view.state.selection;\n if ($cursor)\n run(view, $cursor.pos, $cursor.pos, \"\", rules, plugin);\n });\n }\n }\n },\n isInputRules: true\n });\n return plugin;\n}\nfunction run(view, from, to, text, rules, plugin) {\n if (view.composing)\n return false;\n let state = view.state, $from = state.doc.resolve(from);\n let textBefore = $from.parent.textBetween(Math.max(0, $from.parentOffset - MAX_MATCH), $from.parentOffset, null, \"\\ufffc\") + text;\n for (let i = 0; i < rules.length; i++) {\n let rule = rules[i];\n if (!rule.inCodeMark && $from.marks().some(m => m.type.spec.code))\n continue;\n if ($from.parent.type.spec.code) {\n if (!rule.inCode)\n continue;\n }\n else if (rule.inCode === \"only\") {\n continue;\n }\n let match = rule.match.exec(textBefore);\n if (!match || match[0].length < text.length)\n continue;\n let startPos = from - (match[0].length - text.length);\n if (!rule.inCodeMark) {\n let hasMark = false;\n state.doc.nodesBetween(startPos, $from.pos, node => {\n if (node.isInline && node.marks.some(m => m.type.spec.code))\n hasMark = true;\n });\n if (hasMark)\n continue;\n }\n let tr = rule.handler(state, match, startPos, to);\n if (!tr)\n continue;\n if (rule.undoable)\n tr.setMeta(plugin, { transform: tr, from, to, text });\n view.dispatch(tr);\n return true;\n }\n return false;\n}\n/**\nThis is a command that will undo an input rule, if applying such a\nrule was the last thing that the user did.\n*/\nconst undoInputRule = (state, dispatch) => {\n let plugins = state.plugins;\n for (let i = 0; i < plugins.length; i++) {\n let plugin = plugins[i], undoable;\n if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n if (dispatch) {\n let tr = state.tr, toUndo = undoable.transform;\n for (let j = toUndo.steps.length - 1; j >= 0; j--)\n tr.step(toUndo.steps[j].invert(toUndo.docs[j]));\n if (undoable.text) {\n let marks = tr.doc.resolve(undoable.from).marks();\n tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));\n }\n else {\n tr.delete(undoable.from, undoable.to);\n }\n dispatch(tr);\n }\n return true;\n }\n }\n return false;\n};\n\n/**\nConverts double dashes to an emdash.\n*/\nconst emDash = new InputRule(/--$/, \"—\", { inCodeMark: false });\n/**\nConverts three dots to an ellipsis character.\n*/\nconst ellipsis = new InputRule(/\\.\\.\\.$/, \"…\", { inCodeMark: false });\n/**\n“Smart” opening double quotes.\n*/\nconst openDoubleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(\")$/, \"“\", { inCodeMark: false });\n/**\n“Smart” closing double quotes.\n*/\nconst closeDoubleQuote = new InputRule(/\"$/, \"”\", { inCodeMark: false });\n/**\n“Smart” opening single quotes.\n*/\nconst openSingleQuote = new InputRule(/(?:^|[\\s\\{\\[\\(\\<'\"\\u2018\\u201C])(')$/, \"‘\", { inCodeMark: false });\n/**\n“Smart” closing single quotes.\n*/\nconst closeSingleQuote = new InputRule(/'$/, \"’\", { inCodeMark: false });\n/**\nSmart-quote related input rules.\n*/\nconst smartQuotes = [openDoubleQuote, closeDoubleQuote, openSingleQuote, closeSingleQuote];\n\n/**\nBuild an input rule for automatically wrapping a textblock when a\ngiven string is typed. The `regexp` argument is\ndirectly passed through to the `InputRule` constructor. You'll\nprobably want the regexp to start with `^`, so that the pattern can\nonly occur at the start of a textblock.\n\n`nodeType` is the type of node to wrap in. If it needs attributes,\nyou can either pass them directly, or pass a function that will\ncompute them from the regular expression match.\n\nBy default, if there's a node with the same type above the newly\nwrapped node, the rule will try to [join](https://prosemirror.net/docs/ref/#transform.Transform.join) those\ntwo nodes. You can pass a join predicate, which takes a regular\nexpression match and the node before the wrapped node, and can\nreturn a boolean to indicate whether a join should happen.\n*/\nfunction wrappingInputRule(regexp, nodeType, getAttrs = null, joinPredicate) {\n return new InputRule(regexp, (state, match, start, end) => {\n let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n let tr = state.tr.delete(start, end);\n let $start = tr.doc.resolve(start), range = $start.blockRange(), wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping)\n return null;\n tr.wrap(range, wrapping);\n let before = tr.doc.resolve(start - 1).nodeBefore;\n if (before && before.type == nodeType && canJoin(tr.doc, start - 1) &&\n (!joinPredicate || joinPredicate(match, before)))\n tr.join(start - 1);\n return tr;\n });\n}\n/**\nBuild an input rule that changes the type of a textblock when the\nmatched text is typed into it. You'll usually want to start your\nregexp with `^` to that it is only matched at the start of a\ntextblock. The optional `getAttrs` parameter can be used to compute\nthe new node's attributes, and works the same as in the\n`wrappingInputRule` function.\n*/\nfunction textblockTypeInputRule(regexp, nodeType, getAttrs = null) {\n return new InputRule(regexp, (state, match, start, end) => {\n let $start = state.doc.resolve(start);\n let attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs;\n if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), nodeType))\n return null;\n return state.tr\n .delete(start, end)\n .setBlockType(start, start, nodeType, attrs);\n });\n}\n\nexport { InputRule, closeDoubleQuote, closeSingleQuote, ellipsis, emDash, inputRules, openDoubleQuote, openSingleQuote, smartQuotes, textblockTypeInputRule, undoInputRule, wrappingInputRule };\n"],"names":["inputRules","rules","plugin","Plugin","state","init","apply","tr","prev","stored","getMeta","this","selectionSet","docChanged","props","handleTextInput","view","from","to","text","run","handleDOMEvents","compositionend","setTimeout","$cursor","selection","pos","isInputRules","composing","$from","doc","resolve","textBefore","parent","textBetween","Math","max","parentOffset","_loop","rule","i","inCodeMark","marks","some","m","type","spec","code","inCode","match","exec","length","startPos","hasMark","nodesBetween","node","isInline","handler","v","undoable","setMeta","transform","dispatch","_ret","wrappingInputRule","regexp","nodeType","getAttrs","joinPredicate","arguments","undefined","InputRule","start","end","attrs","Function","delete","range","blockRange","wrapping","findWrapping","wrap","before","nodeBefore","canJoin","join","textblockTypeInputRule","$start","canReplaceWith","index","indexAfter","setBlockType","_export","options","string","insert","offset","lastIndexOf","slice","cutOff","insertText","undoInputRule","plugins","getState","toUndo","j","steps","step","invert","docs","replaceWith","schema"],"mappings":"qrCA6DA,QAASA,CAAAA,CAAWC,CAAAA,IAAAA,KAAEA,CAAAA,OAAFA,KAAAA,CAChB,GAAIC,CAAAA,CAAAA,CAAS,GAAIC,CAAAA,CAAAA,CAAO,CACpBC,KAAO,CAAA,CACHC,IAAI,CAAA,QAAJA,CAAAA,IAAIA,CAAA,QAAY,QAChBC,KAAAA,SAAA,CAAAA,KAAAA,CAAMC,CAAIC,CAAAA,CAAAA,CAAAA,CACN,GAAIC,CAAAA,CAAAA,CAASF,CAAGG,CAAAA,OAAAA,CAAQC,MACxB,MAAIF,CAAAA,CAAAA,GAEGF,CAAGK,CAAAA,YAAAA,EAAgBL,EAAGM,UAAa,CAAA,IAAA,CAAOL,CACpD,CAAA,EAAA,CAAA,CAELM,MAAO,CACHC,eAAAA,CAAe,QAAfA,CAAAA,eAAAA,CAAgBC,CAAAA,CAAMC,EAAMC,CAAIC,CAAAA,CAAAA,QACrBC,CAAAA,CAAIJ,CAAAA,CAAAA,CAAMC,EAAMC,CAAIC,CAAAA,CAAAA,CAAMlB,CAAOC,CAAAA,CAAAA,CAAAA,GAE5CmB,gBAAiB,CACbC,cAAAA,CAAiBN,QAAjBM,CAAAA,cAAAA,CAAiBN,CACbO,CAAAA,CAAAA,UAAAA,CAAW,WACP,GAAMC,CAAAA,CAAYR,CAAAA,CAAAA,CAAKZ,KAAMqB,CAAAA,SAAAA,CAAzBD,OAAAA,CACAA,CACAJ,EAAAA,CAAAA,CAAIJ,EAAMQ,CAAQE,CAAAA,GAAAA,CAAKF,CAAQE,CAAAA,GAAAA,CAAK,GAAIzB,CAAOC,CAAAA,CAAAA,CAAO,EAC5D,CAAA,EAAA,CAAA,CAAA,C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CAAA,GAAI8B,CAAAA,CAAU,CAAA,IAAA,CAAM,IAAK,CAAE9B,UAAAA,CAAAA,CAAY,CAIxC,CAAA,CAAA,CAAA,GAAI8B,CAAAA,EAAU,sCAAwC,CAAA,GAAA,CAAK,CAAE9B,UAAAA,CAAAA,CAAY,IAIxE,GAAI8B,CAAAA,CAAAA,CAAU,IAAM,CAAA,GAAA,CAAK,CAAE9B,UAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as t,f as n,c as e}from"./index-7ca72b78.esm.js";class i{constructor(t,n,e={}){var i;this.match=t,this.match=t,this.handler="string"==typeof n?(i=n,function(t,n,e,r){let l=i;if(n[1]){let t=n[0].lastIndexOf(n[1]);l+=n[0].slice(t+n[1].length);let i=(e+=t)-r;i>0&&(l=n[0].slice(t-i,t)+l,e=r)}return t.tr.insertText(l,e,r)}):n,this.undoable=!1!==e.undoable,this.inCode=e.inCode||!1,this.inCodeMark=!1!==e.inCodeMark}}function r({rules:n}){let e=new t({state:{init:()=>null,apply(t,n){let e=t.getMeta(this);return e||(t.selectionSet||t.docChanged?null:n)}},props:{handleTextInput:(t,i,r,u)=>l(t,i,r,u,n,e),handleDOMEvents:{compositionend:t=>{setTimeout((()=>{let{$cursor:i}=t.state.selection;i&&l(t,i.pos,i.pos,"",n,e)}))}}},isInputRules:!0});return e}function l(t,n,e,i,r,l){if(t.composing)return!1;let u=t.state,o=u.doc.resolve(n),s=o.parent.textBetween(Math.max(0,o.parentOffset-500),o.parentOffset,null,"")+i;for(let f=0;f<r.length;f++){let a=r[f];if(!a.inCodeMark&&o.marks().some((t=>t.type.spec.code)))continue;if(o.parent.type.spec.code){if(!a.inCode)continue}else if("only"===a.inCode)continue;let c=a.match.exec(s);if(!c||c[0].length<i.length)continue;let d=n-(c[0].length-i.length);if(!a.inCodeMark){let t=!1;if(u.doc.nodesBetween(d,o.pos,(n=>{n.isInline&&n.marks.some((t=>t.type.spec.code))&&(t=!0)})),t)continue}let h=a.handler(u,c,d,e);if(h)return a.undoable&&h.setMeta(l,{transform:h,from:n,to:e,text:i}),t.dispatch(h),!0}return!1}const u=(t,n)=>{let e=t.plugins;for(let i=0;i<e.length;i++){let r,l=e[i];if(l.spec.isInputRules&&(r=l.getState(t))){if(n){let e=t.tr,i=r.transform;for(let t=i.steps.length-1;t>=0;t--)e.step(i.steps[t].invert(i.docs[t]));if(r.text){let n=e.doc.resolve(r.from).marks();e.replaceWith(r.from,r.to,t.schema.text(r.text,n))}else e.delete(r.from,r.to);n(e)}return!0}}return!1};function o(t,r,l=null,u){return new i(t,((t,i,o,s)=>{let f=l instanceof Function?l(i):l,a=t.tr.delete(o,s),c=a.doc.resolve(o).blockRange(),d=c&&n(c,r,f);if(!d)return null;a.wrap(c,d);let h=a.doc.resolve(o-1).nodeBefore;return h&&h.type==r&&e(a.doc,o-1)&&(!u||u(i,h))&&a.join(o-1),a}))}function s(t,n,e=null){return new i(t,((t,i,r,l)=>{let u=t.doc.resolve(r),o=e instanceof Function?e(i):e;return u.node(-1).canReplaceWith(u.index(-1),u.indexAfter(-1),n)?t.tr.delete(r,l).setBlockType(r,r,n,o):null}))}new i(/--$/,"—",{inCodeMark:!1}),new i(/\.\.\.$/,"…",{inCodeMark:!1}),new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1}),new i(/"$/,"”",{inCodeMark:!1}),new i(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1}),new i(/'$/,"’",{inCodeMark:!1});export{i as I,r as i,s as t,u,o as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{N as t,T as e,S as i,d as r,A as n}from"./index-7ca72b78.esm.js";import{a as s,S as l,F as o,D as h,M as f}from"./index-5d34cff1.esm.js";const u=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},c=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let a=null;const d=function(t,e,i){let r=a||(a=document.createRange());return r.setEnd(t,null==i?t.nodeValue.length:i),r.setStart(t,e||0),r},p=function(t,e,i,r){return i&&(b(t,e,i,r,-1)||b(t,e,i,r,1))},m=/^(img|br|input|textarea|hr)$/i;function b(t,e,i,r,n){for(var s;;){if(t==i&&e==r)return!0;if(e==(n<0?0:g(t))){let i=t.parentNode;if(!i||1!=i.nodeType||w(t)||m.test(t.nodeName)||"false"==t.contentEditable)return!1;e=u(t)+(n<0?0:1),t=i}else{if(1!=t.nodeType)return!1;{let i=t.childNodes[e+(n<0?-1:0)];if(1==i.nodeType&&"false"==i.contentEditable){if(!(null===(s=i.pmViewDesc)||void 0===s?void 0:s.ignoreForSelection))return!1;e+=n}else t=i,e=n<0?g(t):0}}}}function g(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function w(t){let e;for(let i=t;i&&!(e=i.pmViewDesc);i=i.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const k=function(t){return t.focusNode&&p(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function M(t,e){let i=document.createEvent("Event");return i.initEvent("keydown",!0,!0),i.keyCode=t,i.key=i.code=e,i}const y="undefined"!=typeof navigator?navigator:null,v="undefined"!=typeof document?document:null,D=y&&y.userAgent||"",x=/Edge\/(\d+)/.exec(D),O=/MSIE \d/.exec(D),S=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(D),T=!!(O||S||x),C=O?document.documentMode:S?+S[1]:x?+x[1]:0,P=!T&&/gecko\/(\d+)/i.test(D);P&&(/Firefox\/(\d+)/.exec(D)||[0,0])[1];const N=!T&&/Chrome\/(\d+)/.exec(D),E=!!N,R=N?+N[1]:0,A=!T&&!!y&&/Apple Computer/.test(y.vendor),B=A&&(/Mobile\/\w+/.test(D)||!!y&&y.maxTouchPoints>2),$=B||!!y&&/Mac/.test(y.platform),I=!!y&&/Win/.test(y.platform),F=/Android \d/.test(D),K=!!v&&"webkitFontSmoothing"in v.documentElement.style,L=K?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function q(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function H(t,e){return"number"==typeof t?t:t[e]}function W(t){let e=t.getBoundingClientRect(),i=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*i,top:e.top,bottom:e.top+t.clientHeight*r}}function j(t,e,i){if(!X(e)&&0==e.left)return;let r=t.someProp("scrollThreshold")||0,n=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let l=i||t.dom;l;){if(1!=l.nodeType){l=c(l);continue}let t=l,i=t==s.body,o=i?q(s):W(t),h=0,f=0;if(e.top<o.top+H(r,"top")?f=-(o.top-e.top+H(n,"top")):e.bottom>o.bottom-H(r,"bottom")&&(f=e.bottom-e.top>o.bottom-o.top?e.top+H(n,"top")-o.top:e.bottom-o.bottom+H(n,"bottom")),e.left<o.left+H(r,"left")?h=-(o.left-e.left+H(n,"left")):e.right>o.right-H(r,"right")&&(h=e.right-o.right+H(n,"right")),h||f)if(i)s.defaultView.scrollBy(h,f);else{let i=t.scrollLeft,r=t.scrollTop;f&&(t.scrollTop+=f),h&&(t.scrollLeft+=h);let n=t.scrollLeft-i,s=t.scrollTop-r;e={left:e.left-n,top:e.top-s,right:e.right-n,bottom:e.bottom-s}}let u=i?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(u))break;l="absolute"==u?l.offsetParent:c(l)}}function V(t){let e=[],i=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=i);r=c(r));return e}function z(t,e){for(let i=0;i<t.length;i++){let{dom:r,top:n,left:s}=t[i];r.scrollTop!=n+e&&(r.scrollTop=n+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let G=null;function U(t,e){let i,r,n,s,l=2e8,o=0,h=e.top,f=e.top;for(let u=t.firstChild,c=0;u;u=u.nextSibling,c++){let t;if(1==u.nodeType)t=u.getClientRects();else{if(3!=u.nodeType)continue;t=d(u).getClientRects()}for(let a=0;a<t.length;a++){let d=t[a];if(d.top<=h&&d.bottom>=f){h=Math.max(d.bottom,h),f=Math.min(d.top,f);let t=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(t<l){i=u,l=t,r=t&&3==i.nodeType?{left:d.right<e.left?d.right:d.left,top:e.top}:e,1==u.nodeType&&t&&(o=c+(e.left>=(d.left+d.right)/2?1:0));continue}}else d.top>e.top&&!n&&d.left<=e.left&&d.right>=e.left&&(n=u,s={left:Math.max(d.left,Math.min(d.right,e.left)),top:d.top});!i&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(o=c+1)}}return!i&&n&&(i=n,r=s,l=0),i&&3==i.nodeType?function(t,e){let i,r=t.nodeValue.length,n=document.createRange();for(let s=0;s<r;s++){n.setEnd(t,s+1),n.setStart(t,s);let r=Z(n,1);if(r.top!=r.bottom&&J(e,r)){i={node:t,offset:s+(e.left>=(r.left+r.right)/2?1:0)};break}}return n.detach(),i||{node:t,offset:0}}(i,r):!i||l&&1==i.nodeType?{node:t,offset:o}:U(i,r)}function J(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Y(t,e,i){let r=t.childNodes.length;if(r&&i.top<i.bottom)for(let n=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-i.top)/(i.bottom-i.top))-2)),s=n;;){let i=t.childNodes[s];if(1==i.nodeType){let t=i.getClientRects();for(let r=0;r<t.length;r++){let n=t[r];if(J(e,n))return Y(i,e,n)}}if((s=(s+1)%r)==n)break}return t}function Q(t,e){let i,r=t.dom.ownerDocument,n=0,s=function(t,e,i){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,i);if(r)return{node:r.offsetNode,offset:Math.min(g(r.offsetNode),r.offset)}}catch(t){}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,i);if(r)return{node:r.startContainer,offset:Math.min(g(r.startContainer),r.startOffset)}}}(r,e.left,e.top);s&&({node:i,offset:n}=s);let l,o=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top);if(!o||!t.dom.contains(1!=o.nodeType?o.parentNode:o)){let i=t.dom.getBoundingClientRect();if(!J(e,i))return null;if(o=Y(t.dom,e,i),!o)return null}if(A)for(let t=o;i&&t;t=c(t))t.draggable&&(i=void 0);if(o=function(t,e){let i=t.parentNode;return i&&/^li$/i.test(i.nodeName)&&e.left<t.getBoundingClientRect().left?i:t}(o,e),i){if(P&&1==i.nodeType&&(n=Math.min(n,i.childNodes.length),n<i.childNodes.length)){let t,r=i.childNodes[n];"IMG"==r.nodeName&&(t=r.getBoundingClientRect()).right<=e.left&&t.bottom>e.top&&n++}let r;K&&n&&1==i.nodeType&&1==(r=i.childNodes[n-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=e.top&&n--,i==t.dom&&n==i.childNodes.length-1&&1==i.lastChild.nodeType&&e.top>i.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:0!=n&&1==i.nodeType&&"BR"==i.childNodes[n-1].nodeName||(l=function(t,e,i,r){let n=-1;for(let i=e,s=!1;i!=t.dom;){let e,l=t.docView.nearestDesc(i,!0);if(!l)return null;if(1==l.dom.nodeType&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((e=l.dom.getBoundingClientRect()).width||e.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&e.left>r.left||e.top>r.top?n=l.posBefore:(!s&&e.right<r.left||e.bottom<r.top)&&(n=l.posAfter),s=!0),!l.contentDOM&&n<0&&!l.node.isText))return(l.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return n>-1?n:t.docView.posFromDOM(e,i,-1)}(t,i,n,e))}null==l&&(l=function(t,e,i){let{node:r,offset:n}=U(e,i),s=-1;if(1==r.nodeType&&!r.firstChild){let t=r.getBoundingClientRect();s=t.left!=t.right&&i.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(r,n,s)}(t,o,e));let h=t.docView.nearestDesc(o,!0);return{pos:l,inside:h?h.posAtStart-h.border:-1}}function X(t){return t.top<t.bottom||t.left<t.right}function Z(t,e){let i=t.getClientRects();if(i.length){let t=i[e<0?0:i.length-1];if(X(t))return t}return Array.prototype.find.call(i,X)||t.getBoundingClientRect()}const _=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tt(t,e,i){let{node:r,offset:n,atom:s}=t.docView.domFromPos(e,i<0?-1:1),l=K||P;if(3==r.nodeType){if(!l||!_.test(r.nodeValue)&&(i<0?n:n!=r.nodeValue.length)){let t=n,e=n,s=i<0?1:-1;return i<0&&!n?(e++,s=-1):i>=0&&n==r.nodeValue.length?(t--,s=1):i<0?t--:e++,et(Z(d(r,t,e),s),s<0)}{let t=Z(d(r,n,n),i);if(P&&n&&/\s/.test(r.nodeValue[n-1])&&n<r.nodeValue.length){let e=Z(d(r,n-1,n-1),-1);if(e.top==t.top){let i=Z(d(r,n,n+1),-1);if(i.top!=t.top)return et(i,i.left<e.left)}}return t}}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(null==s&&n&&(i<0||n==g(r))){let t=r.childNodes[n-1];if(1==t.nodeType)return it(t.getBoundingClientRect(),!1)}if(null==s&&n<g(r)){let t=r.childNodes[n];if(1==t.nodeType)return it(t.getBoundingClientRect(),!0)}return it(r.getBoundingClientRect(),i>=0)}if(null==s&&n&&(i<0||n==g(r))){let t=r.childNodes[n-1],e=3==t.nodeType?d(t,g(t)-(l?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return et(Z(e,1),!1)}if(null==s&&n<g(r)){let t=r.childNodes[n];for(;t.pmViewDesc&&t.pmViewDesc.ignoreForCoords;)t=t.nextSibling;let e=t?3==t.nodeType?d(t,0,l?0:1):1==t.nodeType?t:null:null;if(e)return et(Z(e,-1),!0)}return et(Z(3==r.nodeType?d(r):r,-i),i>=0)}function et(t,e){if(0==t.width)return t;let i=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:i,right:i}}function it(t,e){if(0==t.height)return t;let i=e?t.top:t.bottom;return{top:i,bottom:i,left:t.left,right:t.right}}function rt(t,e,i){let r=t.state,n=t.root.activeElement;r!=e&&t.updateState(e),n!=t.dom&&t.focus();try{return i()}finally{r!=e&&t.updateState(r),n!=t.dom&&n&&n.focus()}}const nt=/[\u0590-\u08ac]/;let st=null,lt=null,ot=!1;function ht(t,e,i){return st==e&<==i?ot:(st=e,lt=i,ot="up"==i||"down"==i?function(t,e,i){let r=e.selection,n="up"==i?r.$from:r.$to;return rt(t,e,(()=>{let{node:e}=t.docView.domFromPos(n.pos,"up"==i?-1:1);for(;;){let i=t.docView.nearestDesc(e,!0);if(!i)break;if(i.node.isBlock){e=i.contentDOM||i.dom;break}e=i.dom.parentNode}let r=tt(t,n.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=d(t,0,t.nodeValue.length).getClientRects()}for(let t=0;t<e.length;t++){let n=e[t];if(n.bottom>n.top+1&&("up"==i?r.top-n.top>2*(n.bottom-r.top):n.bottom-r.bottom>2*(r.bottom-n.top)))return!1}}return!0}))}(t,e,i):function(t,e,i){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let n=r.parentOffset,s=!n,l=n==r.parent.content.size,o=t.domSelection();return o?nt.test(r.parent.textContent)&&o.modify?rt(t,e,(()=>{let{focusNode:e,focusOffset:n,anchorNode:s,anchorOffset:l}=t.domSelectionRange(),h=o.caretBidiLevel;o.modify("move",i,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:u,focusOffset:c}=t.domSelectionRange(),a=u&&!f.contains(1==u.nodeType?u:u.parentNode)||e==u&&n==c;try{o.collapse(s,l),e&&(e!=s||n!=l)&&o.extend&&o.extend(e,n)}catch(t){}return null!=h&&(o.caretBidiLevel=h),a})):"left"==i||"backward"==i?s:l:r.pos==r.start()||r.pos==r.end()}(t,e,i))}class ft{constructor(t,e,i,r){this.parent=t,this.children=e,this.dom=i,this.contentDOM=r,this.dirty=0,i.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,i){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,i=this.posAtStart;;e++){let r=this.children[e];if(r==t)return i;i+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,i){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(i<0){let i,r;if(t==this.contentDOM)i=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&(!(r=i.pmViewDesc)||r.parent!=this);)i=i.previousSibling;return i?this.posBeforeChild(r)+r.size:this.posAtStart}{let i,r;if(t==this.contentDOM)i=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&(!(r=i.pmViewDesc)||r.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(r):this.posAtEnd}}let r;if(t==this.dom&&this.contentDOM)r=e>u(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!1;break}if(e.previousSibling)break}if(null==r&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!0;break}if(e.nextSibling)break}}return(null==r?i>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let i=!0,r=t;r;r=r.parentNode){let n,s=this.getDesc(r);if(s&&(!e||s.node)){if(!i||!(n=s.nodeDOM)||(1==n.nodeType?n.contains(1==t.nodeType?t:t.parentNode):n==t))return s;i=!1}}}getDesc(t){let e=t.pmViewDesc;for(let t=e;t;t=t.parent)if(t==this)return e}posFromDOM(t,e,i){for(let r=t;r;r=r.parentNode){let n=this.getDesc(r);if(n)return n.localPosFromDOM(t,e,i)}return-1}descAt(t){for(let e=0,i=0;e<this.children.length;e++){let r=this.children[e],n=i+r.size;if(i==t&&n!=i){for(;!r.border&&r.children.length;)for(let t=0;t<r.children.length;t++){let e=r.children[t];if(e.size){r=e;break}}return r}if(t<n)return r.descAt(t-i-r.border);i=n}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let i=0,r=0;for(let e=0;i<this.children.length;i++){let n=this.children[i],s=e+n.size;if(s>t||n instanceof bt){r=t-e;break}e=s}if(r)return this.children[i].domFromPos(r-this.children[i].border,e);for(let t;i&&!(t=this.children[i-1]).size&&t instanceof ut&&t.side>=0;i--);if(e<=0){let t,r=!0;for(;t=i?this.children[i-1]:null,t&&t.dom.parentNode!=this.contentDOM;i--,r=!1);return t&&e&&r&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?u(t.dom)+1:0}}{let t,r=!0;for(;t=i<this.children.length?this.children[i]:null,t&&t.dom.parentNode!=this.contentDOM;i++,r=!1);return t&&r&&!t.border&&!t.domAtom?t.domFromPos(0,e):{node:this.contentDOM,offset:t?u(t.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,i=0){if(0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,n=-1;for(let s=i,l=0;;l++){let i=this.children[l],o=s+i.size;if(-1==r&&t<=o){let n=s+i.border;if(t>=n&&e<=o-i.border&&i.node&&i.contentDOM&&this.contentDOM.contains(i.contentDOM))return i.parseRange(t,e,n);t=s;for(let e=l;e>0;e--){let i=this.children[e-1];if(i.size&&i.dom.parentNode==this.contentDOM&&!i.emptyChildAt(1)){r=u(i.dom)+1;break}t-=i.size}-1==r&&(r=0)}if(r>-1&&(o>e||l==this.children.length-1)){e=o;for(let t=l+1;t<this.children.length;t++){let i=this.children[t];if(i.size&&i.dom.parentNode==this.contentDOM&&!i.emptyChildAt(-1)){n=u(i.dom);break}e+=i.size}-1==n&&(n=this.contentDOM.childNodes.length);break}s=o}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:n}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:i}=this.domFromPos(t,0);if(1!=e.nodeType||i==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[i]}setSelection(t,e,i,r=!1){let n=Math.min(t,e),s=Math.max(t,e);for(let l=0,o=0;l<this.children.length;l++){let h=this.children[l],f=o+h.size;if(n>o&&s<f)return h.setSelection(t-o-h.border,e-o-h.border,i,r);o=f}let l=this.domFromPos(t,t?-1:1),o=e==t?l:this.domFromPos(e,e?-1:1),h=i.root.getSelection(),f=i.domSelectionRange(),c=!1;if((P||A)&&t==e){let{node:t,offset:e}=l;if(3==t.nodeType){if(c=!(!e||"\n"!=t.nodeValue[e-1]),c&&e==t.nodeValue.length)for(let e,i=t;i;i=i.parentNode){if(e=i.nextSibling){"BR"==e.nodeName&&(l=o={node:e.parentNode,offset:u(e)+1});break}let t=i.pmViewDesc;if(t&&t.node&&t.node.isBlock)break}}else{let i=t.childNodes[e-1];c=i&&("BR"==i.nodeName||"false"==i.contentEditable)}}if(P&&f.focusNode&&f.focusNode!=o.node&&1==f.focusNode.nodeType){let t=f.focusNode.childNodes[f.focusOffset];t&&"false"==t.contentEditable&&(r=!0)}if(!(r||c&&A)&&p(l.node,l.offset,f.anchorNode,f.anchorOffset)&&p(o.node,o.offset,f.focusNode,f.focusOffset))return;let a=!1;if((h.extend||t==e)&&(!c||!P)){h.collapse(l.node,l.offset);try{t!=e&&h.extend(o.node,o.offset),a=!0}catch(t){}}if(!a){if(t>e){let t=l;l=o,o=t}let i=document.createRange();i.setEnd(o.node,o.offset),i.setStart(l.node,l.offset),h.removeAllRanges(),h.addRange(i)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let i=0,r=0;r<this.children.length;r++){let n=this.children[r],s=i+n.size;if(i==s?t<=s&&e>=i:t<s&&e>i){let r=i+n.border,l=s-n.border;if(t>=r&&e<=l)return this.dirty=t==i||e==s?2:1,void(t!=r||e!=l||!n.contentLost&&n.dom.parentNode==this.contentDOM?n.markDirty(t-r,e-r):n.dirty=3);n.dirty=n.dom!=n.contentDOM||n.dom.parentNode!=this.contentDOM||n.children.length?3:2}i=s}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let i=1==t?2:1;e.dirty<i&&(e.dirty=i)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class ut extends ft{constructor(t,e,i,r){let n,s=e.type.toDOM;if("function"==typeof s&&(s=s(i,(()=>n?n.parent?n.parent.posBeforeChild(n):void 0:r))),!e.type.spec.raw){if(1!=s.nodeType){let t=document.createElement("span");t.appendChild(s),s=t}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=e,this.widget=e,n=this}matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return"selection"!=t.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ct extends ft{constructor(t,e,i,r){super(t,[],e,null),this.textDOM=i,this.text=r}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class at extends ft{constructor(t,e,i,r,n){super(t,[],i,r),this.mark=e,this.spec=n}static create(t,e,i,r){let n=r.nodeViews[e.type.name],l=n&&n(e,r,i);return l&&l.dom||(l=s.renderSpec(document,e.type.spec.toDOM(e,i),null,e.attrs)),new at(t,e,l.dom,l.contentDOM||l.dom,l)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let t=this.parent;for(;!t.node;)t=t.parent;t.dirty<this.dirty&&(t.dirty=this.dirty),this.dirty=0}}slice(t,e,i){let r=at.create(this.parent,this.mark,!0,i),n=this.children,s=this.size;e<s&&(n=Pt(n,e,s,i)),t>0&&(n=Pt(n,0,t,i));for(let t=0;t<n.length;t++)n[t].parent=r;return r.children=n,r}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class dt extends ft{constructor(t,e,i,r,n,s,l){super(t,[],n,s),this.node=e,this.outerDeco=i,this.innerDeco=r,this.nodeDOM=l}static create(t,e,i,r,n,l){let o,h=n.nodeViews[e.type.name],f=h&&h(e,n,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:l),i,r),u=f&&f.dom,c=f&&f.contentDOM;if(e.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(e.text);else if(!u){let t=s.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);({dom:u,contentDOM:c}=t)}c||e.isText||"BR"==u.nodeName||(u.hasAttribute("contenteditable")||(u.contentEditable="false"),e.type.spec.draggable&&(u.draggable=!0));let a=u;return u=xt(u,i,e),f?o=new gt(t,e,i,r,u,c||null,a,f):e.isText?new mt(t,e,i,r,u,a):new dt(t,e,i,r,u,c||null,a)}parseRule(t){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let i=this.children[t];if(this.dom.contains(i.dom.parentNode)){e.contentElement=i.dom.parentNode;break}}if(!e.contentElement){let i=t&&t.find((e=>1==e.nodeType&&t.indexOf(e.parentNode)<0&&this.dom.contains(e)));i?e.contentElement=i:e.getContent=()=>o.empty}}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(t,e,i){return 0==this.dirty&&t.eq(this.node)&&Ot(e,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let i=this.node.inlineContent,r=e,n=t.composing?this.localCompositionInfo(t,e):null,s=n&&n.pos>-1?n:null,l=n&&n.pos<0,o=new Tt(this,s&&s.node,t);!function(t,e,i,r){let n=e.locals(t),s=0;if(0==n.length){for(let i=0;i<t.childCount;i++){let l=t.child(i);r(l,n,e.forChild(s,l),i),s+=l.nodeSize}return}let l=0,o=[],h=null;for(let f=0;;){let u,c,a,d;for(;l<n.length&&n[l].to==s;){let t=n[l++];t.widget&&(u?(c||(c=[u])).push(t):u=t)}if(u)if(c){c.sort(Ct);for(let t=0;t<c.length;t++)i(c[t],f,!!h)}else i(u,f,!!h);if(h)d=-1,a=h,h=null;else{if(!(f<t.childCount))break;d=f,a=t.child(f++)}for(let t=0;t<o.length;t++)o[t].to<=s&&o.splice(t--,1);for(;l<n.length&&n[l].from<=s&&n[l].to>s;)o.push(n[l++]);let p=s+a.nodeSize;if(a.isText){let t=p;l<n.length&&n[l].from<t&&(t=n[l].from);for(let e=0;e<o.length;e++)o[e].to<t&&(t=o[e].to);t<p&&(h=a.cut(t-s),a=a.cut(0,t-s),p=t,d=-1)}else for(;l<n.length&&n[l].to<p;)l++;r(a,a.isInline&&!a.isLeaf?o.filter((t=>!t.inline)):o.slice(),e.forChild(s,a),d),s=p}}(this.node,this.innerDeco,((e,n,s)=>{e.spec.marks?o.syncToMarks(e.spec.marks,i,t,n):e.type.side>=0&&!s&&o.syncToMarks(n==this.node.childCount?f.none:this.node.child(n).marks,i,t,n),o.placeWidget(e,t,r)}),((e,s,h,f)=>{let u;o.syncToMarks(e.marks,i,t,f),o.findNodeMatch(e,s,h,f)||l&&t.state.selection.from>r&&t.state.selection.to<r+e.nodeSize&&(u=o.findIndexWithChild(n.node))>-1&&o.updateNodeAt(e,s,h,u,t)||o.updateNextNode(e,s,h,t,f,r)||o.addNode(e,s,h,t,r),r+=e.nodeSize})),o.syncToMarks([],i,t,0),this.node.isTextblock&&o.addTextblockHacks(),o.destroyRest(),(o.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),wt(this.contentDOM,this.children,t),B&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))}localCompositionInfo(t,i){let{from:r,to:n}=t.state.selection;if(!(t.state.selection instanceof e)||r<i||n>i+this.node.content.size)return null;let s=t.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let t=s.nodeValue,e=function(t,e,i,r){for(let n=0,s=0;n<t.childCount&&s<=r;){let l=t.child(n++),o=s;if(s+=l.nodeSize,!l.isText)continue;let h=l.text;for(;n<t.childCount;){let e=t.child(n++);if(s+=e.nodeSize,!e.isText)break;h+=e.text}if(s>=i){if(s>=r&&h.slice(r-e.length-o,r-o)==e)return r-e.length;let t=o<r?h.lastIndexOf(e,r-o-1):-1;if(t>=0&&t+e.length+o>=i)return o+t;if(i==r&&h.length>=r+e.length-o&&h.slice(r-o,r-o+e.length)==e)return r}}return-1}(this.node.content,t,r-i,n-i);return e<0?null:{node:s,pos:e,text:t}}return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:i,text:r}){if(this.getDesc(e))return;let n=e;for(;n.parentNode!=this.contentDOM;n=n.parentNode){for(;n.previousSibling;)n.parentNode.removeChild(n.previousSibling);for(;n.nextSibling;)n.parentNode.removeChild(n.nextSibling);n.pmViewDesc&&(n.pmViewDesc=void 0)}let s=new ct(this,n,e,r);t.input.compositionNodes.push(s),this.children=Pt(this.children,i,i+r.length,t,s)}update(t,e,i,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,i,r),!0)}updateInner(t,e,i,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(Ot(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,i=this.dom;this.dom=vt(this.dom,this.nodeDOM,yt(this.outerDeco,this.node,e),yt(t,this.node,e)),this.dom!=i&&(i.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function pt(t,e,i,r,n){xt(r,e,t);let s=new dt(void 0,t,e,i,r,r,r);return s.contentDOM&&s.updateChildren(n,0),s}class mt extends dt{constructor(t,e,i,r,n,s){super(t,e,i,r,n,null,s)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,i,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,i){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,i)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,i){let r=this.node.cut(t,e),n=document.createTextNode(r.text);return new mt(this.parent,r,this.outerDeco,this.innerDeco,n,n)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(t){return this.node.text==t}}class bt extends ft{parseRule(){return{ignore:!0}}matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class gt extends dt{constructor(t,e,i,r,n,s,l,o){super(t,e,i,r,n,s,l),this.spec=o}update(t,e,i,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let n=this.spec.update(t,e,i);return n&&this.updateInner(t,e,i,r),n}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,i,r){this.spec.setSelection?this.spec.setSelection(t,e,i.root):super.setSelection(t,e,i,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function wt(t,e,i){let r=t.firstChild,n=!1;for(let s=0;s<e.length;s++){let l=e[s],o=l.dom;if(o.parentNode==t){for(;o!=r;)r=St(r),n=!0;r=r.nextSibling}else n=!0,t.insertBefore(o,r);if(l instanceof at){let e=r?r.previousSibling:t.lastChild;wt(l.contentDOM,l.children,i),r=e?e.nextSibling:t.firstChild}}for(;r;)r=St(r),n=!0;n&&i.trackWrites==t&&(i.trackWrites=null)}const kt=function(t){t&&(this.nodeName=t)};kt.prototype=Object.create(null);const Mt=[new kt];function yt(t,e,i){if(0==t.length)return Mt;let r=i?Mt[0]:new kt,n=[r];for(let s=0;s<t.length;s++){let l=t[s].type.attrs;if(l){l.nodeName&&n.push(r=new kt(l.nodeName));for(let t in l){let s=l[t];null!=s&&(i&&1==n.length&&n.push(r=new kt(e.isInline?"span":"div")),"class"==t?r.class=(r.class?r.class+" ":"")+s:"style"==t?r.style=(r.style?r.style+";":"")+s:"nodeName"!=t&&(r[t]=s))}}}return n}function vt(t,e,i,r){if(i==Mt&&r==Mt)return e;let n=e;for(let e=0;e<r.length;e++){let s=r[e],l=i[e];if(e){let e;l&&l.nodeName==s.nodeName&&n!=t&&(e=n.parentNode)&&e.nodeName.toLowerCase()==s.nodeName||(e=document.createElement(s.nodeName),e.pmIsDeco=!0,e.appendChild(n),l=Mt[0]),n=e}Dt(n,l||Mt[0],s)}return n}function Dt(t,e,i){for(let r in e)"class"==r||"style"==r||"nodeName"==r||r in i||t.removeAttribute(r);for(let r in i)"class"!=r&&"style"!=r&&"nodeName"!=r&&i[r]!=e[r]&&t.setAttribute(r,i[r]);if(e.class!=i.class){let r=e.class?e.class.split(" ").filter(Boolean):[],n=i.class?i.class.split(" ").filter(Boolean):[];for(let e=0;e<r.length;e++)-1==n.indexOf(r[e])&&t.classList.remove(r[e]);for(let e=0;e<n.length;e++)-1==r.indexOf(n[e])&&t.classList.add(n[e]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=i.style){if(e.style){let i,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}i.style&&(t.style.cssText+=i.style)}}function xt(t,e,i){return vt(t,t,Mt,yt(e,i,1!=t.nodeType))}function Ot(t,e){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(!t[i].type.eq(e[i].type))return!1;return!0}function St(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Tt{constructor(t,e,i){this.lock=e,this.view=i,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(t,e){let i=e,r=i.children.length,n=t.childCount,s=new Map,l=[];t:for(;n>0;){let o;for(;;)if(r){let t=i.children[r-1];if(!(t instanceof at)){o=t,r--;break}i=t,r=t.children.length}else{if(i==e)break t;r=i.parent.children.indexOf(i),i=i.parent}let h=o.node;if(h){if(h!=t.child(n-1))break;--n,s.set(o,n),l.push(o)}}return{index:n,matched:s,matches:l.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let i=t;i<e;i++)this.top.children[i].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,i,r){let n=0,s=this.stack.length>>1,l=Math.min(s,t.length);for(;n<l&&(n==s-1?this.top:this.stack[n+1<<1]).matchesMark(t[n])&&!1!==t[n].type.spec.spanning;)n++;for(;n<s;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<t.length;){this.stack.push(this.top,this.index+1);let n=-1,l=this.top.children.length;r<this.preMatch.index&&(l=Math.min(this.index+3,l));for(let e=this.index;e<l;e++){let i=this.top.children[e];if(i.matchesMark(t[s])&&!this.isLocked(i.dom)){n=e;break}}if(n<0&&this.index<this.top.children.length){let e=this.top.children[this.index];e instanceof at&&3!=e.dirty&&e.mark.type==t[s].type&&e.spec.update&&!this.isLocked(e.dom)&&e.spec.update(t[s])&&(e.mark=t[s],n=this.index,this.changed=!0)}if(n>-1)n>this.index&&(this.changed=!0,this.destroyBetween(this.index,n)),this.top=this.top.children[this.index];else{let r=at.create(this.top,t[s],e,i);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,s++}}findNodeMatch(t,e,i,r){let n,s=-1;if(r>=this.preMatch.index&&(n=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&n.matchesNode(t,e,i))s=this.top.children.indexOf(n,this.index);else for(let r=this.index,n=Math.min(this.top.children.length,r+5);r<n;r++){let n=this.top.children[r];if(n.matchesNode(t,e,i)&&!this.preMatch.matched.has(n)){s=r;break}}return!(s<0)&&(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(t,e,i,r,n){let s=this.top.children[r];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(t,e,i,n)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let e=t.pmViewDesc;if(e)for(let t=this.index;t<this.top.children.length;t++)if(this.top.children[t]==e)return t;return-1}t=e}}updateNextNode(t,e,i,r,n,s){for(let l=this.index;l<this.top.children.length;l++){let o=this.top.children[l];if(o instanceof dt){let h=this.preMatch.matched.get(o);if(null!=h&&h!=n)return!1;let f,u=o.dom,c=this.isLocked(u)&&!(t.isText&&o.node&&o.node.isText&&o.nodeDOM.nodeValue==t.text&&3!=o.dirty&&Ot(e,o.outerDeco));if(!c&&o.update(t,e,i,r))return this.destroyBetween(this.index,l),o.dom!=u&&(this.changed=!0),this.index++,!0;if(!c&&(f=this.recreateWrapper(o,t,e,i,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=2,f.updateChildren(r,s+1),f.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,i,r,n,s){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!Ot(i,t.outerDeco)||!r.eq(t.innerDeco))return null;let l=dt.create(this.top,e,i,r,n,s);if(l.contentDOM){l.children=t.children,t.children=[];for(let t of l.children)t.parent=l}return t.destroy(),l}addNode(t,e,i,r,n){let s=dt.create(this.top,t,e,i,r,n);s.contentDOM&&s.updateChildren(r,n+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(t,e,i){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){let r=new ut(this.top,t,e,i);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof at;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof mt)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((A||E)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let i=document.createElement(t);"IMG"==t&&(i.className="ProseMirror-separator",i.alt=""),"BR"==t&&(i.className="ProseMirror-trailingBreak");let r=new bt(this.top,[],i,null);e!=this.top?e.children.push(r):e.children.splice(this.index++,0,r),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||1==t.nodeType&&t.contains(this.lock.parentNode))}}function Ct(t,e){return t.type.side-e.type.side}function Pt(t,e,i,r,n){let s=[];for(let l=0,o=0;l<t.length;l++){let h=t[l],f=o,u=o+=h.size;f>=i||u<=e?s.push(h):(f<e&&s.push(h.slice(0,e-f,r)),n&&(s.push(n),n=void 0),u>i&&s.push(h.slice(i-f,h.size,r)))}return s}function Nt(e,i=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let s=e.docView.nearestDesc(r.focusNode),l=s&&0==s.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let h,f,c=n.resolve(o);if(k(r)){for(h=o;s&&!s.node;)s=s.parent;let e=s.node;if(s&&e.isAtom&&t.isSelectable(e)&&s.parent&&(!e.isInline||!function(t,e,i){for(let r=0==e,n=e==g(t);r||n;){if(t==i)return!0;let e=u(t);if(!(t=t.parentNode))return!1;r=r&&0==e,n=n&&e==g(t)}}(r.focusNode,r.focusOffset,s.dom))){let e=s.posBefore;f=new t(o==e?c:n.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let t=o,i=o;for(let n=0;n<r.rangeCount;n++){let s=r.getRangeAt(n);t=Math.min(t,e.docView.posFromDOM(s.startContainer,s.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(t<0)return null;[h,o]=i==e.state.selection.anchor?[i,t]:[t,i],c=n.resolve(o)}else h=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(h<0)return null}let a=n.resolve(h);if(!f){f=Lt(e,a,c,"pointer"==i||e.state.selection.head<c.pos&&!l?1:-1)}return f}function Et(t){return t.editable?t.hasFocus():Ht(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Rt(t,i=!1){let r=t.state.selection;if(Ft(t,r),!Et(t))return;let n=t.input.mouseDown;if(!i&&E&&n){let e=t.domSelectionRange(),i=t.domObserver.currentSelection;if(e.anchorNode&&i.anchorNode&&p(e.anchorNode,e.anchorOffset,i.anchorNode,i.anchorOffset)&&n.delaySelUpdate())return void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){let e=t.domSelection();if(!e)return;let i=t.cursorWrapper.dom,r="IMG"==i.nodeName;r?e.collapse(i.parentNode,u(i)+1):e.collapse(i,0);!r&&!t.state.selection.visible&&T&&C<=11&&(i.disabled=!0,i.disabled=!1)}(t);else{let n,s,{anchor:l,head:o}=r;!At||r instanceof e||(r.$from.parent.inlineContent||(n=Bt(t,r.from)),r.empty||r.$from.parent.inlineContent||(s=Bt(t,r.to))),t.docView.setSelection(l,o,t,i),At&&(n&&It(n),s&&It(s)),r.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let i=t.domSelectionRange(),r=i.anchorNode,n=i.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{i.anchorNode==r&&i.anchorOffset==n||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{Et(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const At=A||E&&R<63;function Bt(t,e){let{node:i,offset:r}=t.docView.domFromPos(e,0),n=r<i.childNodes.length?i.childNodes[r]:null,s=r?i.childNodes[r-1]:null;if(A&&n&&"false"==n.contentEditable)return $t(n);if(!(n&&"false"!=n.contentEditable||s&&"false"!=s.contentEditable)){if(n)return $t(n);if(s)return $t(s)}}function $t(t){return t.contentEditable="true",A&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function It(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Ft(e,i){if(i instanceof t){let t=e.docView.descAt(i.from);t!=e.lastSelectedViewDesc&&(Kt(e),t&&t.selectNode(),e.lastSelectedViewDesc=t)}else Kt(e)}function Kt(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Lt(t,i,r,n){return t.someProp("createSelectionBetween",(e=>e(t,i,r)))||e.between(i,r,n)}function qt(t){return!(t.editable&&!t.hasFocus())&&Ht(t)}function Ht(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Wt(t,e){let{$anchor:r,$head:n}=t.selection,s=e>0?r.max(n):r.min(n),l=s.parent.inlineContent?s.depth?t.doc.resolve(e>0?s.after():s.before()):null:s;return l&&i.findFrom(l,e)}function jt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Vt(i,r,n){let s=i.state.selection;if(!(s instanceof e)){if(s instanceof t&&s.node.isInline)return jt(i,new e(r>0?s.$to:s.$from));{let t=Wt(i.state,r);return!!t&&jt(i,t)}}if(n.indexOf("s")>-1){let{$head:t}=s,n=t.textOffset?null:r<0?t.nodeBefore:t.nodeAfter;if(!n||n.isText||!n.isLeaf)return!1;let l=i.state.doc.resolve(t.pos+n.nodeSize*(r<0?-1:1));return jt(i,new e(s.$anchor,l))}if(!s.empty)return!1;if(i.endOfTextblock(r>0?"forward":"backward")){let e=Wt(i.state,r);return!!(e&&e instanceof t)&&jt(i,e)}if(!($&&n.indexOf("m")>-1)){let n,l=s.$head,o=l.textOffset?null:r<0?l.nodeBefore:l.nodeAfter;if(!o||o.isText)return!1;let h=r<0?l.pos-o.nodeSize:l.pos;return!!(o.isAtom||(n=i.docView.descAt(h))&&!n.contentDOM)&&(t.isSelectable(o)?jt(i,new t(r<0?i.state.doc.resolve(l.pos-o.nodeSize):l)):!!K&&jt(i,new e(i.state.doc.resolve(r<0?h:h+o.nodeSize))))}}function zt(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Gt(t,e){let i=t.pmViewDesc;return i&&0==i.size&&(e<0||t.nextSibling||"BR"!=t.nodeName)}function Ut(t,e){return e<0?function(t){let e=t.domSelectionRange(),i=e.focusNode,r=e.focusOffset;if(!i)return;let n,s,l=!1;P&&1==i.nodeType&&r<zt(i)&&Gt(i.childNodes[r],-1)&&(l=!0);for(;;)if(r>0){if(1!=i.nodeType)break;{let t=i.childNodes[r-1];if(Gt(t,-1))n=i,s=--r;else{if(3!=t.nodeType)break;i=t,r=i.nodeValue.length}}}else{if(Jt(i))break;{let e=i.previousSibling;for(;e&&Gt(e,-1);)n=i.parentNode,s=u(e),e=e.previousSibling;if(e)i=e,r=zt(i);else{if(i=i.parentNode,i==t.dom)break;r=0}}}l?Yt(t,i,r):n&&Yt(t,n,s)}(t):function(t){let e=t.domSelectionRange(),i=e.focusNode,r=e.focusOffset;if(!i)return;let n,s,l=zt(i);for(;;)if(r<l){if(1!=i.nodeType)break;if(!Gt(i.childNodes[r],1))break;n=i,s=++r}else{if(Jt(i))break;{let e=i.nextSibling;for(;e&&Gt(e,1);)n=e.parentNode,s=u(e)+1,e=e.nextSibling;if(e)i=e,r=0,l=zt(i);else{if(i=i.parentNode,i==t.dom)break;r=l=0}}}n&&Yt(t,n,s)}(t)}function Jt(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Yt(t,e,i){if(3!=e.nodeType){let t,r;(r=function(t,e){for(;t&&e==t.childNodes.length&&!w(t);)e=u(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let i=t.childNodes[e];if(3==i.nodeType)return i;if(1==i.nodeType&&"false"==i.contentEditable)break;t=i,e=0}}(e,i))?(e=r,i=0):(t=function(t,e){for(;t&&!e&&!w(t);)e=u(t),t=t.parentNode;for(;t&&e;){let i=t.childNodes[e-1];if(3==i.nodeType)return i;if(1==i.nodeType&&"false"==i.contentEditable)break;e=(t=i).childNodes.length}}(e,i))&&(e=t,i=t.nodeValue.length)}let r=t.domSelection();if(!r)return;if(k(r)){let t=document.createRange();t.setEnd(e,i),t.setStart(e,i),r.removeAllRanges(),r.addRange(t)}else r.extend&&r.extend(e,i);t.domObserver.setCurSelection();let{state:n}=t;setTimeout((()=>{t.state==n&&Rt(t)}),50)}function Qt(t,e){let i=t.state.doc.resolve(e);if(!E&&!I&&i.parent.inlineContent){let r=t.coordsAtPos(e);if(e>i.start()){let i=t.coordsAtPos(e-1),n=(i.top+i.bottom)/2;if(n>r.top&&n<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<i.end()){let i=t.coordsAtPos(e+1),n=(i.top+i.bottom)/2;if(n>r.top&&n<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr"}function Xt(r,s,l){let o=r.state.selection;if(o instanceof e&&!o.empty||l.indexOf("s")>-1)return!1;if($&&l.indexOf("m")>-1)return!1;let{$from:h,$to:f}=o;if(!h.parent.inlineContent||r.endOfTextblock(s<0?"up":"down")){let e=Wt(r.state,s);if(e&&e instanceof t)return jt(r,e)}if(!h.parent.inlineContent){let t=s<0?h:f,e=o instanceof n?i.near(t,s):i.findFrom(t,s);return!!e&&jt(r,e)}return!1}function Zt(t,i){if(!(t.state.selection instanceof e))return!0;let{$head:r,$anchor:n,empty:s}=t.state.selection;if(!r.sameParent(n))return!0;if(!s)return!1;if(t.endOfTextblock(i>0?"forward":"backward"))return!0;let l=!r.textOffset&&(i<0?r.nodeBefore:r.nodeAfter);if(l&&!l.isText){let e=t.state.tr;return i<0?e.delete(r.pos-l.nodeSize,r.pos):e.delete(r.pos,r.pos+l.nodeSize),t.dispatch(e),!0}return!1}function _t(t,e,i){t.domObserver.stop(),e.contentEditable=i,t.domObserver.start()}function te(t,e){let i=e.keyCode,r=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);if(8==i||$&&72==i&&"c"==r)return Zt(t,-1)||Ut(t,-1);if(46==i&&!e.shiftKey||$&&68==i&&"c"==r)return Zt(t,1)||Ut(t,1);if(13==i||27==i)return!0;if(37==i||$&&66==i&&"c"==r){let e=37==i?"ltr"==Qt(t,t.state.selection.from)?-1:1:-1;return Vt(t,e,r)||Ut(t,e)}if(39==i||$&&70==i&&"c"==r){let e=39==i?"ltr"==Qt(t,t.state.selection.from)?1:-1:1;return Vt(t,e,r)||Ut(t,e)}return 38==i||$&&80==i&&"c"==r?Xt(t,-1,r)||Ut(t,-1):40==i||$&&78==i&&"c"==r?function(t){if(!A||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:i}=t.domSelectionRange();if(e&&1==e.nodeType&&0==i&&e.firstChild&&"false"==e.firstChild.contentEditable){let i=e.firstChild;_t(t,i,"true"),setTimeout((()=>_t(t,i,"false")),20)}return!1}(t)||Xt(t,1,r)||Ut(t,1):r==($?"m":"c")&&(66==i||73==i||89==i||90==i)}function ee(t,e){t.someProp("transformCopied",(i=>{e=i(e,t)}));let i=[],{content:r,openStart:n,openEnd:l}=e;for(;n>1&&l>1&&1==r.childCount&&1==r.firstChild.childCount;){n--,l--;let t=r.firstChild;i.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),r=t.content}let o=t.someProp("clipboardSerializer")||s.fromSchema(t.state.schema),h=ue(),f=h.createElement("div");f.appendChild(o.serializeFragment(r,{document:h}));let u,c=f.firstChild,a=0;for(;c&&1==c.nodeType&&(u=fe[c.nodeName.toLowerCase()]);){for(let t=u.length-1;t>=0;t--){let e=h.createElement(u[t]);for(;f.firstChild;)e.appendChild(f.firstChild);f.appendChild(e),a++}c=f.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${n} ${l}${a?` -${a}`:""} ${JSON.stringify(i)}`),{dom:f,text:t.someProp("clipboardTextSerializer",(i=>i(e,t)))||e.content.textBetween(0,e.content.size,"\n\n"),slice:e}}function ie(t,e,i,r,n){let f,u,c=n.parent.type.spec.code;if(!i&&!e)return null;let a=!!e&&(r||c||!i);if(a){if(t.someProp("transformPastedText",(i=>{e=i(e,c||r,t)})),c)return u=new l(o.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0),t.someProp("transformPasted",(e=>{u=e(u,t,!0)})),u;let i=t.someProp("clipboardTextParser",(i=>i(e,n,r,t)));if(i)u=i;else{let i=n.marks(),{schema:r}=t.state,l=s.fromSchema(r);f=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=f.appendChild(document.createElement("p"));t&&e.appendChild(l.serializeNode(r.text(t,i)))}))}}else t.someProp("transformPastedHTML",(e=>{i=e(i,t)})),f=function(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let i,r=ue(),n=r.body,s=/<([a-z][^>\s]+)/i.exec(t);(i=s&&fe[s[1].toLowerCase()])&&(t=i.map((t=>"<"+t+">")).join("")+t+i.map((t=>"</"+t+">")).reverse().join(""));if(n.innerHTML=function(t){let e=window.trustedTypes;if(!e)return t;ce||(ce=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t}));return ce.createHTML(t)}(t),i)for(let t=0;t<i.length;t++)n=n.querySelector(i[t])||n;for(let t=0;t<r.styleSheets.length;t++){let e=r.styleSheets[t];for(let t=0;t<e.rules.length;t++){let i=e.rules[t];if(i instanceof CSSStyleRule){let t=n.querySelectorAll(i.selectorText);for(let e=0;e<t.length;e++)t[e].style.cssText+=i.style.cssText}}}return n}(i),K&&function(t){let e=t.querySelectorAll(E?"span:not([class]):not([style])":"span.Apple-converted-space");for(let i=0;i<e.length;i++){let r=e[i];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(f);let d=f&&f.querySelector("[data-pm-slice]"),p=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let t=+p[3];t>0;t--){let t=f.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;f=t}if(!u){let e=t.someProp("clipboardParser")||t.someProp("domParser")||h.fromSchema(t.state.schema);u=e.parseSlice(f,{preserveWhitespace:!(!a&&!p),context:n,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||re.test(t.parentNode.nodeName)?null:{ignore:!0}})}if(p)u=function(t,e){if(!t.size)return t;let i,r=t.content.firstChild.type.schema;try{i=JSON.parse(e)}catch(e){return t}let{content:n,openStart:s,openEnd:h}=t;for(let t=i.length-2;t>=0;t-=2){let e=r.nodes[i[t]];if(!e||e.hasRequiredAttrs())break;n=o.from(e.create(i[t+1],n)),s++,h++}return new l(n,s,h)}(he(u,+p[1],+p[2]),p[4]);else if(u=l.maxOpen(function(t,e){if(t.childCount<2)return t;for(let i=e.depth;i>=0;i--){let r,n=e.node(i).contentMatchAt(e.index(i)),s=[];if(t.forEach((t=>{if(!s)return;let e,i=n.findWrapping(t.type);if(!i)return s=null;if(e=s.length&&r.length&&se(i,r,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=le(s[s.length-1],r.length));let e=ne(t,i);s.push(e),n=n.matchType(e.type),r=i}})),s)return o.from(s)}return t}(u.content,n),!0),u.openStart||u.openEnd){let t=0,e=0;for(let e=u.content.firstChild;t<u.openStart&&!e.type.spec.isolating;t++,e=e.firstChild);for(let t=u.content.lastChild;e<u.openEnd&&!t.type.spec.isolating;e++,t=t.lastChild);u=he(u,t,e)}return t.someProp("transformPasted",(e=>{u=e(u,t,a)})),u}const re=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ne(t,e,i=0){for(let r=e.length-1;r>=i;r--)t=e[r].create(null,o.from(t));return t}function se(t,e,i,r,n){if(n<t.length&&n<e.length&&t[n]==e[n]){let s=se(t,e,i,r.lastChild,n+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(n==t.length-1?i.type:t[n+1]))return r.copy(r.content.append(o.from(ne(i,t,n+1))))}}function le(t,e){if(0==e)return t;let i=t.content.replaceChild(t.childCount-1,le(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(o.empty,!0);return t.copy(i.append(r))}function oe(t,e,i,r,n,s){let l=e<0?t.firstChild:t.lastChild,h=l.content;return t.childCount>1&&(s=0),n<r-1&&(h=oe(h,e,i,r,n+1,s)),n>=i&&(h=e<0?l.contentMatchAt(0).fillBefore(h,s<=n).append(h):h.append(l.contentMatchAt(l.childCount).fillBefore(o.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(h))}function he(t,e,i){return e<t.openStart&&(t=new l(oe(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),i<t.openEnd&&(t=new l(oe(t.content,1,i,t.openEnd,0,0),t.openStart,i)),t}const fe={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function ue(){return document.implementation.createHTMLDocument("title")}let ce=null;const ae={},de={},pe={touchstart:!0,touchmove:!0};class me{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function be(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function ge(t){t.someProp("handleDOMEvents",(e=>{for(let i in e)t.input.eventHandlers[i]||t.dom.addEventListener(i,t.input.eventHandlers[i]=e=>we(t,e))}))}function we(t,e){return t.someProp("handleDOMEvents",(i=>{let r=i[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function ke(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target;i!=t.dom;i=i.parentNode)if(!i||11==i.nodeType||i.pmViewDesc&&i.pmViewDesc.stopEvent(e))return!1;return!0}function Me(t){return{left:t.clientX,top:t.clientY}}function ye(t,e,i,r,n){if(-1==r)return!1;let s=t.state.doc.resolve(r);for(let r=s.depth+1;r>0;r--)if(t.someProp(e,(e=>r>s.depth?e(t,i,s.nodeAfter,s.before(r),n,!0):e(t,i,s.node(r),s.before(r),n,!1))))return!0;return!1}function ve(t,e,i){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);"pointer"==i&&r.setMeta("pointer",!0),t.dispatch(r)}function De(e,i,r,n,s){return ye(e,"handleClickOn",i,r,n)||e.someProp("handleClick",(t=>t(e,i,n)))||(s?function(e,i){if(-1==i)return!1;let r,n,s=e.state.selection;s instanceof t&&(r=s.node);let l=e.state.doc.resolve(i);for(let e=l.depth+1;e>0;e--){let i=e>l.depth?l.nodeAfter:l.node(e);if(t.isSelectable(i)){n=r&&s.$from.depth>0&&e>=s.$from.depth&&l.before(s.$from.depth+1)==s.$from.pos?l.before(s.$from.depth):l.before(e);break}}return null!=n&&(ve(e,t.create(e.state.doc,n),"pointer"),!0)}(e,r):function(e,i){if(-1==i)return!1;let r=e.state.doc.resolve(i),n=r.nodeAfter;return!!(n&&n.isAtom&&t.isSelectable(n))&&(ve(e,new t(r),"pointer"),!0)}(e,r))}function xe(t,e,i,r){return ye(t,"handleDoubleClickOn",e,i,r)||t.someProp("handleDoubleClick",(i=>i(t,e,r)))}function Oe(t,i,r,n){return ye(t,"handleTripleClickOn",i,r,n)||t.someProp("handleTripleClick",(e=>e(t,i,n)))||function(t,i,r){if(0!=r.button)return!1;let n=Se(t,i,!0),s=t.state.doc;if(!n)return!1;ve(t,n,"pointer"),n instanceof e&&s.eq(t.state.doc)&&(t.input.mouseDown=new Ee(t,n));return!0}(t,r,n)}function Se(i,r,n){let s=i.state.doc;if(-1==r)return s.inlineContent?e.create(s,0,s.content.size):null;let l=s.resolve(r);for(let i=l.depth+1;i>0;i--){let r=i>l.depth?l.nodeAfter:l.node(i),o=l.before(i);if(r.inlineContent)return e.create(s,o+1,o+1+r.content.size);if(n&&t.isSelectable(r))return t.create(s,o)}return null}function Te(t){return Fe(t)}de.keydown=(t,e)=>{let i=e;if(t.input.shiftKey=16==i.keyCode||i.shiftKey,!Re(t)&&(t.input.lastKeyCode=i.keyCode,t.input.lastKeyCodeTime=Date.now(),!F||!E||13!=i.keyCode))if(229!=i.keyCode&&t.domObserver.forceFlush(),!B||13!=i.keyCode||i.ctrlKey||i.altKey||i.metaKey)t.someProp("handleKeyDown",(e=>e(t,i)))||te(t,i)?i.preventDefault():be(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,M(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},de.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},de.keypress=(t,i)=>{let r=i;if(Re(t)||!r.charCode||r.ctrlKey&&!r.altKey||$&&r.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,r))))return void r.preventDefault();let n=t.state.selection;if(!(n instanceof e&&n.$from.sameParent(n.$to))){let e=String.fromCharCode(r.charCode),i=()=>t.state.tr.insertText(e).scrollIntoView();/[\r\n]/.test(e)||t.someProp("handleTextInput",(r=>r(t,n.$from.pos,n.$to.pos,e,i)))||t.dispatch(i()),r.preventDefault()}};const Ce=$?"metaKey":"ctrlKey";ae.mousedown=(t,e)=>{let i=e;t.input.shiftKey=i.shiftKey;let r=Te(t),n=Date.now(),s="singleClick";n-t.input.lastClick.time<500&&function(t,e){let i=e.x-t.clientX,r=e.y-t.clientY;return i*i+r*r<100}(i,t.input.lastClick)&&!i[Ce]&&t.input.lastClick.button==i.button&&("singleClick"==t.input.lastClick.type?s="doubleClick":"doubleClick"==t.input.lastClick.type&&(s="tripleClick")),t.input.lastClick={time:n,x:i.clientX,y:i.clientY,type:s,button:i.button},t.input.mouseDown&&t.input.mouseDown.done();let l=t.posAtCoords(Me(i));l&&("singleClick"==s?t.input.mouseDown=new Ne(t,l,i,!!r):("doubleClick"==s?xe:Oe)(t,l.pos,l.inside,i)?i.preventDefault():be(t,"pointer"))};class Pe{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){0==t.buttons&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class Ne extends Pe{constructor(e,i,r,n){let s,l;if(super(e),this.pos=i,this.event=r,this.flushed=n,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[Ce],this.allowDefault=r.shiftKey,i.inside>-1)s=e.state.doc.nodeAt(i.inside),l=i.inside;else{let t=e.state.doc.resolve(i.pos);s=t.parent,l=t.depth?t.before():0}const o=n?null:r.target,h=o?e.docView.nearestDesc(o,!0):null;this.target=h&&1==h.nodeDOM.nodeType?h.nodeDOM:null;let{selection:f}=e.state;0==r.button&&(s.type.spec.draggable&&!1!==s.type.spec.selectable||f instanceof t&&f.from<=l&&f.to>l)&&(this.mightDrag={node:s,pos:l,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!P||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),be(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>{this.view.isDestroyed||Rt(this.view)}))}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Me(t))),this.updateAllowDefault(t),this.allowDefault||!e?be(this.view,"pointer"):De(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||A&&this.mightDrag&&!this.mightDrag.node.isAtom||E&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(ve(this.view,i.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):be(this.view,"pointer")}move(t){this.updateAllowDefault(t),be(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}class Ee extends Pe{constructor(t,e){super(t),this.startSelection=e,this.startDoc=t.state.doc}move(t){if(0==t.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();t.preventDefault(),be(this.view,"pointer");let i=this.view.posAtCoords(Me(t)),r=i&&Se(this.view,i.inside,!1);if(!r)return;let{doc:n}=this.view.state,s=this.startSelection,[l,o]=r.from<s.from?[s.to,r.from]:[s.from,r.to];ve(this.view,e.create(n,l,o),"pointer")}}function Re(t,e){return!!t.composing||!!(A&&Math.abs(Date.now()-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}ae.touchstart=t=>{t.input.lastTouch=Date.now(),Te(t),be(t,"pointer")},ae.touchmove=t=>{t.input.lastTouch=Date.now(),be(t,"pointer")},ae.contextmenu=t=>Te(t);const Ae=F?5e3:-1;function Be(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>Fe(t)),e))}function $e(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Ie(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let i=function(t,e){for(;;){if(3==t.nodeType&&e)return t;if(1==t.nodeType&&e>0){if("false"==t.contentEditable)return null;e=g(t=t.childNodes[e-1])}else{if(!t.parentNode||w(t))return null;e=u(t),t=t.parentNode}}}(e.focusNode,e.focusOffset),r=function(t,e){for(;;){if(3==t.nodeType&&e<t.nodeValue.length)return t;if(1==t.nodeType&&e<t.childNodes.length){if("false"==t.contentEditable)return null;t=t.childNodes[e],e=0}else{if(!t.parentNode||w(t))return null;e=u(t)+1,t=t.parentNode}}}(e.focusNode,e.focusOffset);if(i&&r&&i!=r){let e=r.pmViewDesc,n=t.domObserver.lastChangedTextNode;if(i==n||r==n)return n;if(!e||!e.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let t=i.pmViewDesc;if(t&&t.isText(i.nodeValue))return r}}return i||r}function Fe(t,e=!1){if(!(F&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),$e(t),e||t.docView&&t.docView.dirty){let i=Nt(t),r=t.state.selection;return i&&!i.eq(r)?t.dispatch(t.state.tr.setSelection(i)):!t.markCursor&&!e||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),!0}return!1}}de.compositionstart=de.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:i}=t,r=i.selection.$to;if(i.selection instanceof e&&(i.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))||E&&I&&function(t){let{focusNode:e,focusOffset:i}=t.domSelectionRange();if(!e||1!=e.nodeType||i>=e.childNodes.length)return!1;let r=e.childNodes[i];return 1==r.nodeType&&"false"==r.contentEditable}(t)))t.markCursor=t.state.storedMarks||r.marks(),Fe(t,!0),t.markCursor=null;else if(Fe(t,!i.selection.empty),P&&i.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let e=t.domSelectionRange();for(let i=e.focusNode,r=e.focusOffset;i&&1==i.nodeType&&0!=r;){let e=r<0?i.lastChild:i.childNodes[r-1];if(!e)break;if(3==e.nodeType){let i=t.domSelection();i&&i.collapse(e,e.nodeValue.length);break}i=e,r=-1}}t.input.composing=!0}Be(t,Ae)},de.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then((()=>t.domObserver.flush())),t.input.compositionID++,Be(t,20))};const Ke=T&&C<15||B&&L<604;function Le(t,e,i,r,n){let s=ie(t,e,i,r,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,n,s||l.empty))))return!0;if(!s)return!1;let o=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(s),h=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(h.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function qe(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let i=t.getData("text/uri-list");return i?i.replace(/\r?\n/g," "):""}ae.copy=de.cut=(t,e)=>{let i=e,r=t.state.selection,n="cut"==i.type;if(r.empty)return;let s=Ke?null:i.clipboardData,l=r.content(),{dom:o,text:h}=ee(t,l);s?(i.preventDefault(),s.clearData(),s.setData("text/html",o.innerHTML),s.setData("text/plain",h)):function(t,e){if(!t.dom.parentNode)return;let i=t.dom.parentNode.appendChild(document.createElement("div"));i.appendChild(e),i.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),n=document.createRange();n.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(n),setTimeout((()=>{i.parentNode&&i.parentNode.removeChild(i),t.focus()}),50)}(t,o),n&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},de.paste=(t,e)=>{let i=e;if(t.composing&&!F)return;let r=Ke?null:i.clipboardData,n=t.input.shiftKey&&45!=t.input.lastKeyCode;r&&Le(t,qe(r),r.getData("text/html"),n,i)?i.preventDefault():function(t,e){if(!t.dom.parentNode)return;let i=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(i?"textarea":"div"));i||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let n=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout((()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),i?Le(t,r.value,null,n,e):Le(t,r.textContent,r.innerHTML,n,e)}),50)}(t,i)};class He{constructor(t,e,i){this.slice=t,this.move=e,this.node=i}}const We=$?"altKey":"ctrlKey";function je(t,e){let i;return t.someProp("dragCopies",(t=>{i=i||t(e)})),null!=i?!i:!e[We]}ae.dragstart=(e,i)=>{let r=i,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let s,l=e.state.selection,o=l.empty?null:e.posAtCoords(Me(r));if(o&&o.pos>=l.from&&o.pos<=(l instanceof t?l.to-1:l.to));else if(n&&n.mightDrag)s=t.create(e.state.doc,n.mightDrag.pos);else if(r.target&&1==r.target.nodeType){let i=e.docView.nearestDesc(r.target,!0);i&&i.node.type.spec.draggable&&i!=e.docView&&(s=t.create(e.state.doc,i.posBefore))}let h=(s||e.state.selection).content(),{dom:f,text:u,slice:c}=ee(e,h);(!r.dataTransfer.files.length||!E||R>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(Ke?"Text":"text/html",f.innerHTML),r.dataTransfer.effectAllowed="copyMove",Ke||r.dataTransfer.setData("text/plain",u),e.dragging=new He(c,je(e,r),s)},ae.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},de.dragover=de.dragenter=(t,e)=>e.preventDefault(),de.drop=(e,i)=>{try{!function(e,i,n){if(!i.dataTransfer)return;let s=e.posAtCoords(Me(i));if(!s)return;let o=e.state.doc.resolve(s.pos),h=n&&n.slice;h?e.someProp("transformPasted",(t=>{h=t(h,e,!1)})):h=ie(e,qe(i.dataTransfer),Ke?null:i.dataTransfer.getData("text/html"),!1,o);let f=!(!n||!je(e,i));if(e.someProp("handleDrop",(t=>t(e,i,h||l.empty,f))))return void i.preventDefault();if(!h)return;i.preventDefault();let u=h?r(e.state.doc,o.pos,h):o.pos;null==u&&(u=o.pos);let c=e.state.tr;if(f){let{node:t}=n;t?t.replace(c):c.deleteSelection()}let a=c.mapping.map(u),d=0==h.openStart&&0==h.openEnd&&1==h.content.childCount,p=c.doc;d?c.replaceRangeWith(a,a,h.content.firstChild):c.replaceRange(a,a,h);if(c.doc.eq(p))return;let m=c.doc.resolve(a);if(d&&t.isSelectable(h.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(h.content.firstChild))c.setSelection(new t(m));else{let t=c.mapping.map(u);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,i,r,n)=>t=n)),c.setSelection(Lt(e,m,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}(e,i,e.dragging)}finally{e.dragging=null}},ae.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Rt(t)}),20))},ae.blur=(t,e)=>{let i=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),i.relatedTarget&&t.dom.contains(i.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},ae.beforeinput=(t,e)=>{if(F&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,M(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())}),50)}};for(let t in de)ae[t]=de[t];function Ve(t,e){if(t==e)return!0;for(let i in t)if(t[i]!==e[i])return!1;for(let i in e)if(!(i in t))return!1;return!0}class ze{constructor(t,e){this.toDOM=t,this.spec=e||Qe,this.side=this.spec.side||0}map(t,e,i,r){let{pos:n,deleted:s}=t.mapResult(e.from+r,this.side<0?-1:1);return s?null:new Je(n-i,n-i,this)}valid(){return!0}eq(t){return this==t||t instanceof ze&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Ve(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Ge{constructor(t,e){this.attrs=t,this.spec=e||Qe}map(t,e,i,r){let n=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-i,s=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-i;return n>=s?null:new Je(n,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof Ge&&Ve(this.attrs,t.attrs)&&Ve(this.spec,t.spec)}static is(t){return t.type instanceof Ge}destroy(){}}class Ue{constructor(t,e){this.attrs=t,this.spec=e||Qe}map(t,e,i,r){let n=t.mapResult(e.from+r,1);if(n.deleted)return null;let s=t.mapResult(e.to+r,-1);return s.deleted||s.pos<=n.pos?null:new Je(n.pos-i,s.pos-i,this)}valid(t,e){let i,{index:r,offset:n}=t.content.findIndex(e.from);return n==e.from&&!(i=t.child(r)).isText&&n+i.nodeSize==e.to}eq(t){return this==t||t instanceof Ue&&Ve(this.attrs,t.attrs)&&Ve(this.spec,t.spec)}destroy(){}}class Je{constructor(t,e,i){this.from=t,this.to=e,this.type=i}copy(t,e){return new Je(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,i){return this.type.map(t,this,e,i)}static widget(t,e,i){return new Je(t,t,new ze(e,i))}static inline(t,e,i,r){return new Je(t,e,new Ge(i,r))}static node(t,e,i,r){return new Je(t,e,new Ue(i,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Ge}get widget(){return this.type instanceof ze}}const Ye=[],Qe={};class Xe{constructor(t,e){this.local=t.length?t:Ye,this.children=e.length?e:Ye}static create(t,e){return e.length?ri(e,t,0,Qe):Ze}find(t,e,i){let r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,i),r}findInner(t,e,i,r,n){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=e&&l.to>=t&&(!n||n(l.spec))&&i.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){let l=this.children[s]+1;this.children[s+2].findInner(t-l,e-l,i,r+l,n)}}map(t,e,i){return this==Ze||0==t.maps.length?this:this.mapInner(t,e,0,0,i||Qe)}mapInner(t,e,i,r,n){let s;for(let l=0;l<this.local.length;l++){let o=this.local[l].map(t,i,r);o&&o.type.valid(e,o)?(s||(s=[])).push(o):n.onRemove&&n.onRemove(this.local[l].spec)}return this.children.length?function(t,e,i,r,n,s,l){let o=t.slice();for(let t=0,e=s;t<i.maps.length;t++){let r=0;i.maps[t].forEach(((t,i,n,s)=>{let l=s-n-(i-t);for(let n=0;n<o.length;n+=3){let s=o[n+1];if(s<0||t>s+e-r)continue;let h=o[n]+e-r;i>=h?o[n+1]=t<=h?-2:-1:t>=e&&l&&(o[n]+=l,o[n+1]+=l)}r+=l})),e=i.maps[t].map(e,-1)}let h=!1;for(let e=0;e<o.length;e+=3)if(o[e+1]<0){if(-2==o[e+1]){h=!0,o[e+1]=-1;continue}let f=i.map(t[e]+s),u=f-n;if(u<0||u>=r.content.size){h=!0;continue}let c=i.map(t[e+1]+s,-1)-n,{index:a,offset:d}=r.content.findIndex(u),p=r.maybeChild(a);if(p&&d==u&&d+p.nodeSize==c){let r=o[e+2].mapInner(i,p,f+1,t[e]+s+1,l);r!=Ze?(o[e]=u,o[e+1]=c,o[e+2]=r):(o[e+1]=-2,h=!0)}else h=!0}if(h){let h=function(t,e,i,r,n,s,l){function o(t,e){for(let s=0;s<t.local.length;s++){let o=t.local[s].map(r,n,e);o?i.push(o):l.onRemove&&l.onRemove(t.local[s].spec)}for(let i=0;i<t.children.length;i+=3)o(t.children[i+2],t.children[i]+e+1)}for(let i=0;i<t.length;i+=3)-1==t[i+1]&&o(t[i+2],e[i]+s+1);return i}(o,t,e,i,n,s,l),f=ri(h,r,0,l);e=f.local;for(let t=0;t<o.length;t+=3)o[t+1]<0&&(o.splice(t,3),t-=3);for(let t=0,e=0;t<f.children.length;t+=3){let i=f.children[t];for(;e<o.length&&o[e]<i;)e+=3;o.splice(e,0,f.children[t],f.children[t+1],f.children[t+2])}}return new Xe(e.sort(ni),o)}(this.children,s||[],t,e,i,r,n):s?new Xe(s.sort(ni),Ye):Ze}add(t,e){return e.length?this==Ze?Xe.create(t,e):this.addInner(t,e,0):this}addInner(t,e,i){let r,n=0;t.forEach(((t,s)=>{let l,o=s+i;if(l=ei(e,t,o)){for(r||(r=this.children.slice());n<r.length&&r[n]<s;)n+=3;r[n]==s?r[n+2]=r[n+2].addInner(t,l,o+1):r.splice(n,0,s,s+t.nodeSize,ri(l,t,o+1,Qe)),n+=3}}));let s=ti(n?ii(e):e,-i);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||s.splice(e--,1);return new Xe(s.length?this.local.concat(s).sort(ni):this.local,r||this.children)}remove(t){return 0==t.length||this==Ze?this:this.removeInner(t,0)}removeInner(t,e){let i=this.children,r=this.local;for(let r=0;r<i.length;r+=3){let n,s=i[r]+e,l=i[r+1]+e;for(let e,i=0;i<t.length;i++)(e=t[i])&&e.from>s&&e.to<l&&(t[i]=null,(n||(n=[])).push(e));if(!n)continue;i==this.children&&(i=this.children.slice());let o=i[r+2].removeInner(n,s+1);o!=Ze?i[r+2]=o:(i.splice(r,3),r-=3)}if(r.length)for(let i,n=0;n<t.length;n++)if(i=t[n])for(let t=0;t<r.length;t++)r[t].eq(i,e)&&(r==this.local&&(r=this.local.slice()),r.splice(t--,1));return i==this.children&&r==this.local?this:r.length||i.length?new Xe(r,i):Ze}forChild(t,e){if(this==Ze)return this;if(e.isLeaf)return Xe.empty;let i,r;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(i=this.children[e+2]);break}let n=t+1,s=n+e.content.size;for(let t=0;t<this.local.length;t++){let e=this.local[t];if(e.from<s&&e.to>n&&e.type instanceof Ge){let t=Math.max(n,e.from)-n,i=Math.min(s,e.to)-n;t<i&&(r||(r=[])).push(e.copy(t,i))}}if(r){let t=new Xe(r.sort(ni),Ye);return i?new _e([t,i]):t}return i||Ze}eq(t){if(this==t)return!0;if(!(t instanceof Xe)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return si(this.localsInner(t))}localsInner(t){if(this==Ze)return Ye;if(t.inlineContent||!this.local.some(Ge.is))return this.local;let e=[];for(let t=0;t<this.local.length;t++)this.local[t].type instanceof Ge||e.push(this.local[t]);return e}forEachSet(t){t(this)}}Xe.empty=new Xe([],[]),Xe.removeOverlap=si;const Ze=Xe.empty;class _e{constructor(t){this.members=t}map(t,e){const i=this.members.map((i=>i.map(t,e,Qe)));return _e.from(i)}forChild(t,e){if(e.isLeaf)return Xe.empty;let i=[];for(let r=0;r<this.members.length;r++){let n=this.members[r].forChild(t,e);n!=Ze&&(n instanceof _e?i=i.concat(n.members):i.push(n))}return _e.from(i)}eq(t){if(!(t instanceof _e)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,i=!0;for(let r=0;r<this.members.length;r++){let n=this.members[r].localsInner(t);if(n.length)if(e){i&&(e=e.slice(),i=!1);for(let t=0;t<n.length;t++)e.push(n[t])}else e=n}return e?si(i?e:e.sort(ni)):Ye}static from(t){switch(t.length){case 0:return Ze;case 1:return t[0];default:return new _e(t.every((t=>t instanceof Xe))?t:t.reduce(((t,e)=>t.concat(e instanceof Xe?e:e.members)),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function ti(t,e){if(!e||!t.length)return t;let i=[];for(let r=0;r<t.length;r++){let n=t[r];i.push(new Je(n.from+e,n.to+e,n.type))}return i}function ei(t,e,i){if(e.isLeaf)return null;let r=i+e.nodeSize,n=null;for(let e,s=0;s<t.length;s++)(e=t[s])&&e.from>i&&e.to<r&&((n||(n=[])).push(e),t[s]=null);return n}function ii(t){let e=[];for(let i=0;i<t.length;i++)null!=t[i]&&e.push(t[i]);return e}function ri(t,e,i,r){let n=[],s=!1;e.forEach(((e,l)=>{let o=ei(t,e,l+i);if(o){s=!0;let t=ri(o,e,i+l+1,r);t!=Ze&&n.push(l,l+e.nodeSize,t)}}));let l=ti(s?ii(t):t,-i).sort(ni);for(let t=0;t<l.length;t++)l[t].type.valid(e,l[t])||(r.onRemove&&r.onRemove(l[t].spec),l.splice(t--,1));return l.length||n.length?new Xe(l,n):Ze}function ni(t,e){return t.from-e.from||t.to-e.to}function si(t){let e=t;for(let i=0;i<e.length-1;i++){let r=e[i];if(r.from!=r.to)for(let n=i+1;n<e.length;n++){let s=e[n];if(s.from!=r.from){s.from<r.to&&(e==t&&(e=t.slice()),e[i]=r.copy(r.from,s.from),li(e,n,r.copy(s.from,r.to)));break}s.to!=r.to&&(e==t&&(e=t.slice()),e[n]=s.copy(s.from,r.to),li(e,n+1,s.copy(r.to,s.to)))}}return e}function li(t,e,i){for(;e<t.length&&ni(i,t[e])>0;)e++;t.splice(e,0,i)}function oi(t){let e=[];return t.someProp("decorations",(i=>{let r=i(t.state);r&&r!=Ze&&e.push(r)})),t.cursorWrapper&&e.push(Xe.create(t.state.doc,[t.cursorWrapper.deco])),_e.from(e)}const hi={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},fi=T&&C<=11;class ui{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class ci{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ui,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);T&&C<=11&&e.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():A&&t.composing&&e.some((t=>"childList"==t.type&&"TR"==t.target.nodeName))?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()})),fi&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,hi)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(qt(this.view)){if(this.suppressingSelectionUpdates)return Rt(this.view);if(T&&C<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&p(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,i=new Set;for(let e=t.focusNode;e;e=c(e))i.add(e);for(let r=t.anchorNode;r;r=c(r))if(i.has(r)){e=r;break}let r=e&&this.view.docView.nearestDesc(e);return r&&r.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let r=t.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&qt(t)&&!this.ignoreSelectionChange(r),s=-1,l=-1,o=!1,h=[];if(t.editable)for(let t=0;t<e.length;t++){let i=this.registerMutation(e[t],h);i&&(s=s<0?i.from:Math.min(i.from,s),l=l<0?i.to:Math.max(i.to,l),i.typeOver&&(o=!0))}if(h.some((t=>"BR"==t.nodeName))&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode||E&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&e.some((t=>"childList"==t.type&&t.removedNodes.length)))){for(let t of h)if("BR"==t.nodeName&&t.parentNode){let e=t.nextSibling;for(;e&&1==e.nodeType;){if("false"==e.contentEditable){t.parentNode.removeChild(t);break}e=e.firstChild}}}else if(P&&h.length){let e=h.filter((t=>"BR"==t.nodeName));if(2==e.length){let[t,i]=e;t.parentNode&&t.parentNode.parentNode==i.parentNode?i.remove():t.remove()}else{let{focusNode:i}=this.currentSelection;for(let r of e){let e=r.parentNode;!e||"LI"!=e.nodeName||i&&mi(t,i)==e||r.remove()}}}let f=null;s<0&&n&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&k(r)&&(f=Nt(t))&&f.eq(i.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Rt(t),this.currentSelection.set(r),t.scrollToSelection()):(s>-1||n)&&(s>-1&&(t.docView.markDirty(s,l),function(t){if(ai.has(t))return;if(ai.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)){if(t.requiresGeckoHackNode=P,di)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),di=!0}}(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(t,e){var i;let{focusNode:r,focusOffset:n}=t.domSelectionRange();for(let s of e)if("TR"==(null===(i=s.parentNode)||void 0===i?void 0:i.nodeName)){let e=s.nextSibling;for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.nextSibling;if(e){let i=e;for(;;){let t=i.firstChild;if(!t||1!=t.nodeType||"false"==t.contentEditable||/^(BR|IMG)$/.test(t.nodeName))break;i=t}i.insertBefore(s,i.firstChild),r==s&&t.domSelection().collapse(s,n)}else s.parentNode.removeChild(s)}}(t,h)),this.handleDOMChange(s,l,o,h),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Rt(t),this.currentSelection.set(r))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let i=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(i==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!i||i.ignoreMutation(t))return null;if("childList"==t.type){for(let i=0;i<t.addedNodes.length;i++){let r=t.addedNodes[i];e.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(i.contentDOM&&i.contentDOM!=i.dom&&!i.contentDOM.contains(t.target))return{from:i.posBefore,to:i.posAfter};let r=t.previousSibling,n=t.nextSibling;if(T&&C<=11&&t.addedNodes.length)for(let e=0;e<t.addedNodes.length;e++){let{previousSibling:i,nextSibling:s}=t.addedNodes[e];(!i||Array.prototype.indexOf.call(t.addedNodes,i)<0)&&(r=i),(!s||Array.prototype.indexOf.call(t.addedNodes,s)<0)&&(n=s)}let s=r&&r.parentNode==t.target?u(r)+1:0,l=i.localPosFromDOM(t.target,s,-1),o=n&&n.parentNode==t.target?u(n):t.target.childNodes.length;return{from:l,to:i.localPosFromDOM(t.target,o,1)}}return"attributes"==t.type?{from:i.posAtStart-i.border,to:i.posAtEnd+i.border}:(this.lastChangedTextNode=t.target,{from:i.posAtStart,to:i.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let ai=new WeakMap,di=!1;function pi(t,e){let i=e.startContainer,r=e.startOffset,n=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return p(l.node,l.offset,n,s)&&([i,r,n,s]=[n,s,i,r]),{anchorNode:i,anchorOffset:r,focusNode:n,focusOffset:s}}function mi(t,e){for(let i=e.parentNode;i&&i!=t.dom;i=i.parentNode){let e=t.docView.nearestDesc(i,!0);if(e&&e.node.isBlock)return i}return null}const bi=t=>e=>{let i=e.pmViewDesc;if(i)return i.parseRule(t);if("BR"==e.nodeName&&e.parentNode){if(A&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}if(e.parentNode.lastChild==e||A&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},gi=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function wi(t,i,r,n,s){let l=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,i<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,i=Nt(t,e);if(i&&!t.state.selection.eq(i)){if(E&&F&&13===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",(e=>e(t,M(13,"Enter")))))return;let r=t.state.tr.setSelection(i);"pointer"==e?r.setMeta("pointer",!0):"key"==e&&r.scrollIntoView(),l&&r.setMeta("composition",l),t.dispatch(r)}return}let f=t.state.doc.resolve(i),u=f.sharedDepth(r);i=f.before(u+1),r=t.state.doc.resolve(r).after(u+1);let c,a,d=t.state.selection,p=function(t,e,i,r){let n,{node:s,fromOffset:l,toOffset:o,from:f,to:u}=t.docView.parseRange(e,i),c=t.domSelectionRange(),a=c.anchorNode;if(a&&t.dom.contains(1==a.nodeType?a:a.parentNode)&&(n=[{node:a,offset:c.anchorOffset}],k(c)||n.push({node:c.focusNode,offset:c.focusOffset})),E&&8===t.input.lastKeyCode)for(let t=o;t>l;t--){let e=s.childNodes[t-1],i=e.pmViewDesc;if("BR"==e.nodeName&&!i){o=t;break}if(!i||i.size)break}let d=t.state.doc,p=t.someProp("domParser")||h.fromSchema(t.state.schema),m=d.resolve(f),b=null,g=p.parse(s,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:l,to:o,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:n,ruleFromNode:bi(r),context:m});if(n&&null!=n[0].pos){let t=n[0].pos,e=n[1]&&n[1].pos;null==e&&(e=t),b={anchor:t+f,head:e+f}}return{doc:g,sel:b,from:f,to:u}}(t,i,r,s),m=t.state.doc,b=m.slice(p.from,p.to);8===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime?(c=t.state.selection.to,a="end"):(c=t.state.selection.from,a="start"),t.input.lastKeyCode=null;let g=function(t,e,i,r,n){let s=t.findDiffStart(e,i),l=i+t.size,o=i+e.size;if(null==s)return null;let{a:h,b:f}=t.findDiffEnd(e,l,o);if("end"==n){r-=h+Math.max(0,s-Math.min(h,f))-s}if(h<s&&l<o){s-=r<=s&&r>=h?s-r:0,f=s+(f-h),h=s}else if(f<s){s-=r<=s&&r>=f?s-r:0,h=s+(h-f),f=s}return{start:s,endA:h,endB:f}}(b.content,p.doc.content,p.from,c,a);if(g&&t.input.domChangeCount++,(B&&t.input.lastIOSEnter>Date.now()-225||F)&&s.some((t=>1==t.nodeType&&!gi.test(t.nodeName)))&&(!g||g.endA>=g.endB)&&t.someProp("handleKeyDown",(e=>e(t,M(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(!g){if(!(n&&d instanceof e&&!d.empty&&d.$head.sameParent(d.$anchor))||t.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let e=ki(t,t.state.doc,p.sel);if(e&&!e.eq(t.state.selection)){let i=t.state.tr.setSelection(e);l&&i.setMeta("composition",l),t.dispatch(i)}}return}g={start:d.from,endA:d.to,endB:d.to}}t.state.selection.from<t.state.selection.to&&g.start==g.endB&&t.state.selection instanceof e&&(g.start>t.state.selection.from&&g.start<=t.state.selection.from+2&&t.state.selection.from>=p.from?g.start=t.state.selection.from:g.endA<t.state.selection.to&&g.endA>=t.state.selection.to-2&&t.state.selection.to<=p.to&&(g.endB+=t.state.selection.to-g.endA,g.endA=t.state.selection.to)),T&&C<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>p.from&&" "==p.doc.textBetween(g.start-p.from-1,g.start-p.from+1)&&(g.start--,g.endA--,g.endB--);let w=p.doc.resolveNoCache(g.start-p.from),y=p.doc.resolveNoCache(g.endB-p.from),v=m.resolve(g.start),D=w.sameParent(y)&&w.parent.inlineContent&&v.end()>=g.endA;if((B&&t.input.lastIOSEnter>Date.now()-225&&(!D||s.some((t=>"DIV"==t.nodeName||"P"==t.nodeName)))||!D&&w.pos<p.doc.content.size&&(!w.sameParent(y)||!w.parent.inlineContent)&&w.pos<y.pos&&!/\S/.test(p.doc.textBetween(w.pos,y.pos,"","")))&&t.someProp("handleKeyDown",(e=>e(t,M(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>g.start&&function(t,e,i,r,n){if(i-e<=n.pos-r.pos||Mi(r,!0,!1)<n.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let t=s.nodeAfter;return null!=t&&i==e+t.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let l=t.resolve(Mi(s,!0,!0));return!(!l.parent.isTextblock||l.pos>i||Mi(l,!0,!1)<i)&&r.parent.content.cut(r.parentOffset).eq(l.parent.content)}(m,g.start,g.endA,w,y)&&t.someProp("handleKeyDown",(e=>e(t,M(8,"Backspace")))))return void(F&&E&&t.domObserver.suppressSelectionUpdates());E&&g.endB==g.start&&(t.input.lastChromeDelete=Date.now()),F&&!D&&w.start()!=y.start()&&0==y.parentOffset&&w.depth==y.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==g.endA&&(g.endB-=2,y=p.doc.resolveNoCache(g.endB-p.from),setTimeout((()=>{t.someProp("handleKeyDown",(function(e){return e(t,M(13,"Enter"))}))}),20));let x,O=g.start,S=g.endA,P=e=>{let i=e||t.state.tr.replace(O,S,p.doc.slice(g.start-p.from,g.endB-p.from));if(p.sel){let e=ki(t,i.doc,p.sel);e&&!(E&&t.composing&&e.empty&&(g.start!=g.endB||t.input.lastChromeDelete<Date.now()-100)&&(e.head==O||e.head==i.mapping.map(S)-1)||T&&e.empty&&e.head==O)&&i.setSelection(e)}return l&&i.setMeta("composition",l),i.scrollIntoView()};if(D)if(w.pos==y.pos){T&&C<=11&&0==w.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((()=>Rt(t)),20));let e=P(t.state.tr.delete(O,S)),i=m.resolve(g.start).marksAcross(m.resolve(g.endA));i&&e.ensureMarks(i),t.dispatch(e)}else if(g.endA==g.endB&&(x=function(t,e){let i,r,n,s=t.firstChild.marks,l=e.firstChild.marks,h=s,f=l;for(let t=0;t<l.length;t++)h=l[t].removeFromSet(h);for(let t=0;t<s.length;t++)f=s[t].removeFromSet(f);if(1==h.length&&0==f.length)r=h[0],i="add",n=t=>t.mark(r.addToSet(t.marks));else{if(0!=h.length||1!=f.length)return null;r=f[0],i="remove",n=t=>t.mark(r.removeFromSet(t.marks))}let u=[];for(let t=0;t<e.childCount;t++)u.push(n(e.child(t)));if(o.from(u).eq(t))return{mark:r,type:i}}(w.parent.content.cut(w.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,g.endA-v.start())))){let e=P(t.state.tr);"add"==x.type?e.addMark(O,S,x.mark):e.removeMark(O,S,x.mark),t.dispatch(e)}else if(w.parent.child(w.index()).isText&&w.index()==y.index()-(y.textOffset?0:1)){let e=w.parent.textBetween(w.parentOffset,y.parentOffset),i=()=>P(t.state.tr.insertText(e,O,S));t.someProp("handleTextInput",(r=>r(t,O,S,e,i)))||t.dispatch(i())}else t.dispatch(P());else t.dispatch(P())}function ki(t,e,i){return Math.max(i.anchor,i.head)>e.content.size?null:Lt(t,e.resolve(i.anchor),e.resolve(i.head))}function Mi(t,e,i){let r=t.depth,n=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,n++,e=!1;if(i){let e=t.node(r).maybeChild(t.indexAfter(r));for(;e&&!e.isLeaf;)e=e.firstChild,n++}return n}class yi{constructor(t,e){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new me,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(Si),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=xi(this),Di(this),this.nodeViews=Oi(this),this.docView=pt(this.state.doc,vi(this),oi(this),this.dom,this),this.domObserver=new ci(this,((t,e,i,r)=>wi(this,t,e,i,r))),this.domObserver.start(),function(t){for(let e in ae){let i=ae[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=e=>{!ke(t,e)||we(t,e)||!t.editable&&e.type in de||i(t,e)},pe[e]?{passive:!0}:void 0)}A&&t.dom.addEventListener("input",(()=>null)),ge(t)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&ge(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Si),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let t in this._props)e[t]=this._props[t];e.state=this.state;for(let i in t)e[i]=t[i];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var i;let r=this.state,n=!1,s=!1;t.storedMarks&&this.composing&&($e(this),s=!0),this.state=t;let l=r.plugins!=t.plugins||this._props.plugins!=e.plugins;if(l||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=Oi(this);(function(t,e){let i=0,r=0;for(let r in t){if(t[r]!=e[r])return!0;i++}for(let t in e)r++;return i!=r})(t,this.nodeViews)&&(this.nodeViews=t,n=!0)}(l||e.handleDOMEvents!=this._props.handleDOMEvents)&&ge(this),this.editable=xi(this),Di(this);let o=oi(this),h=vi(this),f=r.plugins==t.plugins||r.doc.eq(t.doc)?t.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=n||!this.docView.matchesNode(t.doc,h,o);!u&&t.selection.eq(r.selection)||(s=!0);let c="preserve"==f&&s&&null==this.dom.style.overflowAnchor&&function(t){let e,i,r=t.dom.getBoundingClientRect(),n=Math.max(0,r.top);for(let s=(r.left+r.right)/2,l=n+1;l<Math.min(innerHeight,r.bottom);l+=5){let r=t.root.elementFromPoint(s,l);if(!r||r==t.dom||!t.dom.contains(r))continue;let o=r.getBoundingClientRect();if(o.top>=n-20){e=r,i=o.top;break}}return{refDOM:e,refTop:i,stack:V(t.dom)}}(this);if(s){this.domObserver.stop();let e=u&&(T||E)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&function(t,e){let i=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(i)!=e.$anchor.start(i)}(r.selection,t.selection);if(u){let i=E?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Ie(this)),!n&&this.docView.update(t.doc,h,o,this)||(this.docView.updateOuterDeco(h),this.docView.destroy(),this.docView=pt(t.doc,h,o,this.dom,this)),!i||this.trackWrites&&this.dom.contains(this.trackWrites)||(e=!0)}let i=this.input.mouseDown;e||!(i&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),i=t.domSelectionRange();return p(e.node,e.offset,i.anchorNode,i.anchorOffset)}(this)&&i.delaySelUpdate())?Rt(this,e):(Ft(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(i=this.dragging)||void 0===i?void 0:i.node)&&!r.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==f?this.dom.scrollTop=0:"to selection"==f?this.scrollToSelection():c&&function({refDOM:t,refTop:e,stack:i}){let r=t?t.getBoundingClientRect().top:0;z(i,0==r?0:r-e)}(c)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",(t=>t(this))));else if(this.state.selection instanceof t){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&j(this,t.getBoundingClientRect(),e)}else j(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let i=this.pluginViews[e];i.update&&i.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let e=this.directPlugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let e=this.state.plugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}}}updateDraggedNode(e,i){let r=e.node,n=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{let t=r.from+(this.state.doc.content.size-i.doc.content.size);(t>0&&t<this.state.doc.content.size&&this.state.doc.nodeAt(t))==r.node&&(n=t)}this.dragging=new He(e.slice,e.move,n<0?void 0:t.create(this.state.doc,n))}someProp(t,e){let i,r=this._props&&this._props[t];if(null!=r&&(i=e?e(r):r))return i;for(let r=0;r<this.directPlugins.length;r++){let n=this.directPlugins[r].props[t];if(null!=n&&(i=e?e(n):n))return i}let n=this.state.plugins;if(n)for(let r=0;r<n.length;r++){let s=n[r].props[t];if(null!=s&&(i=e?e(s):s))return i}}hasFocus(){if(T){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if("false"==t.contentEditable)return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(G)return t.focus(G);let e=V(t);t.focus(null==G?{get preventScroll(){return G={preventScroll:!0},!0}}:void 0),G||(G=!1,z(e,0))}(this.dom),Rt(this),this.domObserver.start()}get root(){let t=this._root;if(null==t)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return t||document}updateRoot(){this._root=null}posAtCoords(t){return Q(this,t)}coordsAtPos(t,e=1){return tt(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,i=-1){let r=this.docView.posFromDOM(t,e,i);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(t,e){return ht(this,e||this.state,t)}pasteHTML(t,e){return Le(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Le(this,t,null,!0,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return ee(this,t)}destroy(){this.docView&&(!function(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],oi(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,a=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return function(t,e){we(t,e)||!ae[e.type]||!t.editable&&e.type in de||ae[e.type](t,e)}(this,t)}domSelectionRange(){let t=this.domSelection();return t?A&&11===this.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return pi(t,i)}let i;function r(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),i?pi(t,i):null}(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function vi(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(i=>{if("function"==typeof i&&(i=i(t.state)),i)for(let t in i)"class"==t?e.class+=" "+i[t]:"style"==t?e.style=(e.style?e.style+";":"")+i[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(i[t]))})),e.translate||(e.translate="no"),[Je.node(0,t.state.doc.content.size,e)]}function Di(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Je.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function xi(t){return!t.someProp("editable",(e=>!1===e(t.state)))}function Oi(t){let e=Object.create(null);function i(t){for(let i in t)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=t[i])}return t.someProp("nodeViews",i),t.someProp("markViews",i),e}function Si(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}yi.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};export{Xe as D,yi as E,Je as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){this.content=t}function e(t,r,s){for(let h=0;;h++){if(h==t.childCount||h==r.childCount)return t.childCount==r.childCount?null:s;let l=t.child(h),o=r.child(h);if(l!=o){if(!l.sameMarkup(o))return s;if(l.isText&&l.text!=o.text){let t=l.text,e=o.text,r=0;for(;t[r]==e[r];r++)s++;return r&&r<t.length&&r<e.length&&n(t.charCodeAt(r-1))&&i(t.charCodeAt(r))&&s--,s}if(l.content.size||o.content.size){let t=e(l.content,o.content,s+1);if(null!=t)return t}s+=l.nodeSize}else s+=l.nodeSize}}function r(t,e,s,h){for(let l=t.childCount,o=e.childCount;;){if(0==l||0==o)return l==o?null:{a:s,b:h};let u=t.child(--l),f=e.child(--o),a=u.nodeSize;if(u!=f){if(!u.sameMarkup(f))return{a:s,b:h};if(u.isText&&u.text!=f.text){let t=u.text,e=f.text,r=t.length,l=e.length;for(;r>0&&l>0&&t[r-1]==e[l-1];)r--,l--,s--,h--;return r&&l&&r<t.length&&n(t.charCodeAt(r-1))&&i(t.charCodeAt(r))&&(s++,h++),{a:s,b:h}}if(u.content.size||f.content.size){let t=r(u.content,f.content,s-1,h-1);if(t)return t}s-=a,h-=a}else s-=a,h-=a}}function i(t){return t>=56320&&t<57344}function n(t){return t>=55296&&t<56320}t.prototype={constructor:t,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(e,r,i){var n=i&&i!=e?this.remove(i):this,s=n.find(e),h=n.content.slice();return-1==s?h.push(i||e,r):(h[s+1]=r,i&&(h[s]=i)),new t(h)},remove:function(e){var r=this.find(e);if(-1==r)return this;var i=this.content.slice();return i.splice(r,2),new t(i)},addToStart:function(e,r){return new t([e,r].concat(this.remove(e).content))},addToEnd:function(e,r){var i=this.remove(e).content.slice();return i.push(e,r),new t(i)},addBefore:function(e,r,i){var n=this.remove(r),s=n.content.slice(),h=n.find(e);return s.splice(-1==h?s.length:h,0,r,i),new t(s)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(e){return(e=t.from(e)).size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=t.from(e)).size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var r=this;e=t.from(e);for(var i=0;i<e.content.length;i+=2)r=r.remove(e.content[i]);return r},toObject:function(){var t={};return this.forEach((function(e,r){t[e]=r})),t},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var r=[];if(e)for(var i in e)r.push(i,e[i]);return new t(r)};class s{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,r,i=0,n){for(let s=0,h=0;h<e;s++){let l=this.content[s],o=h+l.nodeSize;if(o>t&&!1!==r(l,i+h,n||null,s)&&l.content.size){let n=h+1;l.nodesBetween(Math.max(0,t-n),Math.min(l.content.size,e-n),r,i+n)}h=o}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,r,i){let n="",s=!0;return this.nodesBetween(t,e,((h,l)=>{let o=h.isText?h.text.slice(Math.max(t,l)-l,e-l):h.isLeaf?i?"function"==typeof i?i(h):i:h.type.spec.leafText?h.type.spec.leafText(h):"":"";h.isBlock&&(h.isLeaf&&o||h.isTextblock)&&r&&(s?s=!1:n+=r),n+=o}),0),n}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,r=t.firstChild,i=this.content.slice(),n=0;for(e.isText&&e.sameMarkup(r)&&(i[i.length-1]=e.withText(e.text+r.text),n=1);n<t.content.length;n++)i.push(t.content[n]);return new s(i,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let r=[],i=0;if(e>t)for(let n=0,s=0;s<e;n++){let h=this.content[n],l=s+h.nodeSize;l>t&&((s<t||l>e)&&(h=h.isText?h.cut(Math.max(0,t-s),Math.min(h.text.length,e-s)):h.cut(Math.max(0,t-s-1),Math.min(h.content.size,e-s-1))),r.push(h),i+=h.nodeSize),s=l}return new s(r,i)}cutByIndex(t,e){return t==e?s.empty:0==t&&e==this.content.length?this:new s(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let i=this.content.slice(),n=this.size+e.nodeSize-r.nodeSize;return i[t]=e,new s(i,n)}addToStart(t){return new s([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new s(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,r=0;e<this.content.length;e++){let i=this.content[e];t(i,r,e),r+=i.nodeSize}}findDiffStart(t,r=0){return e(this,t,r)}findDiffEnd(t,e=this.size,i=t.size){return r(this,t,e,i)}findIndex(t){if(0==t)return l(0,t);if(t==this.size)return l(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,r=0;;e++){let i=r+this.child(e).nodeSize;if(i>=t)return i==t?l(e+1,i):l(e,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return s.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return s.fromArray(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return s.empty;let e,r=0;for(let i=0;i<t.length;i++){let n=t[i];r+=n.nodeSize,i&&n.isText&&t[i-1].sameMarkup(n)?(e||(e=t.slice(0,i)),e[e.length-1]=n.withText(e[e.length-1].text+n.text)):e&&e.push(n)}return new s(e||t,r)}static from(t){if(!t)return s.empty;if(t instanceof s)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new s([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}s.empty=new s([],0);const h={index:0,offset:0};function l(t,e){return h.index=t,h.offset=e,h}function o(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let r=Array.isArray(t);if(Array.isArray(e)!=r)return!1;if(r){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!o(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!o(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}class u{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,r=!1;for(let i=0;i<t.length;i++){let n=t[i];if(this.eq(n))return t;if(this.type.excludes(n.type))e||(e=t.slice(0,i));else{if(n.type.excludes(this.type))return t;!r&&n.type.rank>this.type.rank&&(e||(e=t.slice(0,i)),e.push(this),r=!0),e&&e.push(n)}}return e||(e=t.slice()),r||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&o(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[e.type];if(!r)throw new RangeError(`There is no mark type ${e.type} in this schema`);let i=r.create(e.attrs);return r.checkAttrs(i.attrs),i}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(e[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return u.none;if(t instanceof u)return[t];let e=t.slice();return e.sort(((t,e)=>t.type.rank-e.type.rank)),e}}u.none=[];class f extends Error{}class a{constructor(t,e,r){this.content=t,this.openStart=e,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let r=d(this.content,t+this.openStart,e,this.openStart+1,this.openEnd+1);return r&&new a(r,this.openStart,this.openEnd)}removeBetween(t,e){return new a(c(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return a.empty;let r=e.openStart||0,i=e.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new a(s.fromJSON(t,e.content),r,i)}static maxOpen(t,e=!0){let r=0,i=0;for(let i=t.firstChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.firstChild)r++;for(let r=t.lastChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.lastChild)i++;return new a(t,r,i)}}function c(t,e,r){let{index:i,offset:n}=t.findIndex(e),s=t.maybeChild(i),{index:h,offset:l}=t.findIndex(r);if(n==e||s.isText){if(l!=r&&!t.child(h).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(r))}if(i!=h)throw new RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(c(s.content,e-n-1,r-n-1)))}function d(t,e,r,i,n,s){let{index:h,offset:l}=t.findIndex(e),o=t.maybeChild(h);if(l==e||o.isText)return s&&i<=0&&n<=0&&!s.canReplace(h,h,r)?null:t.cut(0,e).append(r).append(t.cut(e));let u=d(o.content,e-l-1,r,0==h?i-1:0,h==t.childCount-1?n-1:0,o);return u&&t.replaceChild(h,o.copy(u))}function w(t,e,r){if(r.openStart>t.depth)throw new f("Inserted content deeper than insertion position");if(t.depth-r.openStart!=e.depth-r.openEnd)throw new f("Inconsistent open depths");return p(t,e,r,0)}function p(t,e,r,i){let n=t.index(i),h=t.node(i);if(n==e.index(i)&&i<t.depth-r.openStart){let s=p(t,e,r,i+1);return h.copy(h.content.replaceChild(n,s))}if(r.content.size){if(r.openStart||r.openEnd||t.depth!=i||e.depth!=i){let{start:n,end:l}=function(t,e){let r=e.depth-t.openStart,i=e.node(r).copy(t.content);for(let t=r-1;t>=0;t--)i=e.node(t).copy(s.from(i));return{start:i.resolveNoCache(t.openStart+r),end:i.resolveNoCache(i.content.size-t.openEnd-r)}}(r,t);return b(h,v(t,n,l,e,i))}{let i=t.parent,n=i.content;return b(i,n.cut(0,t.parentOffset).append(r.content).append(n.cut(e.parentOffset)))}}return b(h,k(t,e,i))}function g(t,e){if(!e.type.compatibleContent(t.type))throw new f("Cannot join "+e.type.name+" onto "+t.type.name)}function m(t,e,r){let i=t.node(r);return g(i,e.node(r)),i}function y(t,e){let r=e.length-1;r>=0&&t.isText&&t.sameMarkup(e[r])?e[r]=t.withText(e[r].text+t.text):e.push(t)}function x(t,e,r,i){let n=(e||t).node(r),s=0,h=e?e.index(r):n.childCount;t&&(s=t.index(r),t.depth>r?s++:t.textOffset&&(y(t.nodeAfter,i),s++));for(let t=s;t<h;t++)y(n.child(t),i);e&&e.depth==r&&e.textOffset&&y(e.nodeBefore,i)}function b(t,e){if(!t.type.validContent(e))throw new f("Invalid content for node "+t.type.name);return t.copy(e)}function v(t,e,r,i,n){let h=t.depth>n&&m(t,e,n+1),l=i.depth>n&&m(r,i,n+1),o=[];return x(null,t,n,o),h&&l&&e.index(n)==r.index(n)?(g(h,l),y(b(h,v(t,e,r,i,n+1)),o)):(h&&y(b(h,k(t,e,n+1)),o),x(e,r,n,o),l&&y(b(l,k(r,i,n+1)),o)),x(i,null,n,o),new s(o)}function k(t,e,r){let i=[];if(x(null,t,r,i),t.depth>r){y(b(m(t,e,r+1),k(t,e,r+1)),i)}return x(e,null,r,i),new s(i)}a.empty=new a(s.empty,0,0);class E{constructor(t,e,r){this.pos=t,this.path=e,this.parentOffset=r,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(e);return r?t.child(e).cut(r):i}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let r=this.path[3*e],i=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)i+=r.child(e).nodeSize;return i}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return u.none;if(this.textOffset)return t.child(e).marks;let r=t.maybeChild(e-1),i=t.maybeChild(e);if(!r){let t=r;r=i,i=t}let n=r.marks;for(var s=0;s<n.length;s++)!1!==n[s].type.spec.inclusive||i&&n[s].isInSet(i.marks)||(n=n[s--].removeFromSet(n));return n}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let r=e.marks,i=t.parent.maybeChild(t.index());for(var n=0;n<r.length;n++)!1!==r[n].type.spec.inclusive||i&&r[n].isInSet(i.marks)||(r=r[n--].removeFromSet(r));return r}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new M(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let r=[],i=0,n=e;for(let e=t;;){let{index:t,offset:s}=e.content.findIndex(n),h=n-s;if(r.push(e,t,i+s),!h)break;if(e=e.child(t),e.isText)break;n=h-1,i+=s+1}return new E(e,r,n)}static resolveCached(t,e){let r=O.get(t);if(r)for(let t=0;t<r.elts.length;t++){let i=r.elts[t];if(i.pos==e)return i}else O.set(t,r=new R);let i=r.elts[r.i]=E.resolve(t,e);return r.i=(r.i+1)%S,i}}class R{constructor(){this.elts=[],this.i=0}}const S=12,O=new WeakMap;class M{constructor(t,e,r){this.$from=t,this.$to=e,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const A=Object.create(null);class I{constructor(t,e,r,i=u.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||s.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,r,i=0){this.content.nodesBetween(t,e,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,r,i){return this.content.textBetween(t,e,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,r){return this.type==t&&o(this.attrs,e||t.defaultAttrs||A)&&u.sameSet(this.marks,r||u.none)}copy(t=null){return t==this.content?this:new I(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new I(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,r=!1){if(t==e)return a.empty;let i=this.resolve(t),n=this.resolve(e),s=r?0:i.sharedDepth(e),h=i.start(s),l=i.node(s).content.cut(i.pos-h,n.pos-h);return new a(l,i.depth-s,n.depth-s)}replace(t,e,r){return w(this.resolve(t),this.resolve(e),r)}nodeAt(t){for(let e=this;;){let{index:r,offset:i}=e.content.findIndex(t);if(e=e.maybeChild(r),!e)return null;if(i==t||e.isText)return e;t-=i+1}}childAfter(t){let{index:e,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:r}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(e),index:e,offset:r};let i=this.content.child(e-1);return{node:i,index:e-1,offset:r-i.nodeSize}}resolve(t){return E.resolveCached(this,t)}resolveNoCache(t){return E.resolve(this,t)}rangeHasMark(t,e,r){let i=!1;return e>t&&this.nodesBetween(t,e,(t=>(r.isInSet(t.marks)&&(i=!0),!i))),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),C(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,r=s.empty,i=0,n=r.childCount){let h=this.contentMatchAt(t).matchFragment(r,i,n),l=h&&h.matchFragment(this.content,e);if(!l||!l.validEnd)return!1;for(let t=i;t<n;t++)if(!this.type.allowsMarks(r.child(t).marks))return!1;return!0}canReplaceWith(t,e,r,i){if(i&&!this.type.allowsMarks(i))return!1;let n=this.contentMatchAt(t).matchType(r),s=n&&n.matchFragment(this.content,e);return!!s&&s.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=u.none;for(let e=0;e<this.marks.length;e++){let r=this.marks[e];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!u.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let r;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,r)}let i=s.fromJSON(t,e.content),n=t.nodeType(e.type).create(e.attrs,i,r);return n.type.checkAttrs(n.attrs),n}}I.prototype.text=void 0;class N extends I{constructor(t,e,r,i){if(super(t,e,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):C(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new N(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new N(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function C(t,e){for(let r=t.length-1;r>=0;r--)e=t[r].type.name+"("+e+")";return e}class T{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let r=new j(t,e);if(null==r.next)return T.empty;let i=$(r);r.next&&r.err("Unexpected trailing text");let n=function(t){let e=Object.create(null);return r(z(t,0));function r(i){let n=[];i.forEach((e=>{t[e].forEach((({term:e,to:r})=>{if(!e)return;let i;for(let t=0;t<n.length;t++)n[t][0]==e&&(i=n[t][1]);z(t,r).forEach((t=>{i||n.push([e,i=[]]),-1==i.indexOf(t)&&i.push(t)}))}))}));let s=e[i.join(",")]=new T(i.indexOf(t.length-1)>-1);for(let t=0;t<n.length;t++){let i=n[t][1].sort(q);s.next.push({type:n[t][0],next:e[i.join(",")]||r(i)})}return s}}(function(t){let e=[[]];return n(s(t,0),r()),e;function r(){return e.push([])-1}function i(t,r,i){let n={term:i,to:r};return e[t].push(n),n}function n(t,e){t.forEach((t=>t.to=e))}function s(t,e){if("choice"==t.type)return t.exprs.reduce(((t,r)=>t.concat(s(r,e))),[]);if("seq"!=t.type){if("star"==t.type){let h=r();return i(e,h),n(s(t.expr,h),h),[i(h)]}if("plus"==t.type){let h=r();return n(s(t.expr,e),h),n(s(t.expr,h),h),[i(h)]}if("opt"==t.type)return[i(e)].concat(s(t.expr,e));if("range"==t.type){let h=e;for(let e=0;e<t.min;e++){let e=r();n(s(t.expr,h),e),h=e}if(-1==t.max)n(s(t.expr,h),h);else for(let e=t.min;e<t.max;e++){let e=r();i(h,e),n(s(t.expr,h),e),h=e}return[i(h)]}if("name"==t.type)return[i(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let i=0;;i++){let h=s(t.exprs[i],e);if(i==t.exprs.length-1)return h;n(h,e=r())}}}(i));return function(t,e){for(let r=0,i=[t];r<i.length;r++){let t=i[r],n=!t.validEnd,s=[];for(let e=0;e<t.next.length;e++){let{type:r,next:h}=t.next[e];s.push(r.name),!n||r.isText||r.hasRequiredAttrs()||(n=!1),-1==i.indexOf(h)&&i.push(h)}n&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(n,r),n}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,r=t.childCount){let i=this;for(let n=e;i&&n<r;n++)i=i.matchType(t.child(n).type);return i}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let r=0;r<t.next.length;r++)if(this.next[e].type==t.next[r].type)return!0;return!1}fillBefore(t,e=!1,r=0){let i=[this];return function n(h,l){let o=h.matchFragment(t,r);if(o&&(!e||o.validEnd))return s.from(l.map((t=>t.createAndFill())));for(let t=0;t<h.next.length;t++){let{type:e,next:r}=h.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==i.indexOf(r)){i.push(r);let t=n(r,l.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),n=i.match;if(n.matchType(t)){let t=[];for(let e=i;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<n.next.length;t++){let{type:s,next:h}=n.next[t];s.isLeaf||s.hasRequiredAttrs()||s.name in e||i.type&&!h.validEnd||(r.push({match:s.contentMatch,type:s,via:i}),e[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(r){t.push(r);for(let i=0;i<r.next.length;i++)-1==t.indexOf(r.next[i].next)&&e(r.next[i].next)}(this),t.map(((e,r)=>{let i=r+(e.validEnd?"*":" ")+" ";for(let r=0;r<e.next.length;r++)i+=(r?", ":"")+e.next[r].type.name+"->"+t.indexOf(e.next[r].next);return i})).join("\n")}}T.empty=new T(!0);class j{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function $(t){let e=[];do{e.push(B(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function B(t){let e=[];do{e.push(J(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function J(t){let e=function(t){if(t.eat("(")){let e=$(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let r=t.nodeTypes,i=r[e];if(i)return[i];let n=[];for(let t in r){let i=r[t];i.isInGroup(e)&&n.push(i)}0==n.length&&t.err("No node type or group '"+e+"' found");return n}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=D(t,e)}return e}function F(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function D(t,e){let r=F(t),i=r;return t.eat(",")&&(i="}"!=t.next?F(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:r,max:i,expr:e}}function q(t,e){return e-t}function z(t,e){let r=[];return function e(i){let n=t[i];if(1==n.length&&!n[0].term)return e(n[0].to);r.push(i);for(let t=0;t<n.length;t++){let{term:i,to:s}=n[t];i||-1!=r.indexOf(s)||e(s)}}(e),r.sort(q)}function U(t){let e=Object.create(null);for(let r in t){let i=t[r];if(!i.hasDefault)return null;e[r]=i.default}return e}function W(t,e){let r=Object.create(null);for(let i in t){let n=e&&e[i];if(void 0===n){let e=t[i];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+i);n=e.default}r[i]=n}return r}function P(t,e,r,i){for(let n in e)if(!(n in t))throw new RangeError(`Unsupported attribute ${n} for ${r} of type ${i}`);for(let r in t)t[r].validate&&t[r].validate(e[r])}function L(t,e){let r=Object.create(null);if(e)for(let i in e)r[i]=new G(t,i,e[i]);return r}class _{constructor(t,e,r){this.name=t,this.schema=e,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=L(t,r.attrs),this.defaultAttrs=U(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==T.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:W(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new I(this,this.computeAttrs(t),s.from(e),u.setFrom(r))}createChecked(t=null,e,r){return e=s.from(e),this.checkContent(e),new I(this,this.computeAttrs(t),e,u.setFrom(r))}createAndFill(t=null,e,r){if(t=this.computeAttrs(t),(e=s.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let i=this.contentMatch.matchFragment(e),n=i&&i.fillBefore(s.empty,!0);return n?new I(this,t,e.append(n),u.setFrom(r)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){P(this.attrs,t,"node",this.name)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?e&&e.push(t[r]):e||(e=t.slice(0,r));return e?e.length?e:u.none:t}static compile(t,e){let r=Object.create(null);t.forEach(((t,i)=>r[t]=new _(t,e,i)));let i=e.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let t in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}class G{constructor(t,e,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(t,e,r){let i=r.split("|");return r=>{let n=null===r?"null":typeof r;if(i.indexOf(n)<0)throw new RangeError(`Expected value of type ${i} for attribute ${e} on type ${t}, got ${n}`)}}(t,e,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class H{constructor(t,e,r,i){this.name=t,this.rank=e,this.schema=r,this.spec=i,this.attrs=L(t,i.attrs),this.excluded=null;let n=U(this.attrs);this.instance=n?new u(this,n):null}create(t=null){return!t&&this.instance?this.instance:new u(this,W(this.attrs,t))}static compile(t,e){let r=Object.create(null),i=0;return t.forEach(((t,n)=>r[t]=new H(t,i++,e,n))),r}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){P(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class K{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let r=this.spec={};for(let t in e)r[t]=e[t];r.nodes=t.from(e.nodes),r.marks=t.from(e.marks||{}),this.nodes=_.compile(this.spec.nodes,this),this.marks=H.compile(this.spec.marks,this);let i=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],r=e.spec.content||"",n=e.spec.marks;if(e.contentMatch=i[r]||(i[r]=T.parse(r,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==n?null:n?Q(this,n.split(" ")):""!=n&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],r=e.spec.excludes;e.excluded=null==r?[e]:""==r?[]:Q(this,r.split(" "))}this.nodeFromJSON=t=>I.fromJSON(this,t),this.markFromJSON=t=>u.fromJSON(this,t),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,r,i){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof _))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,r,i)}text(t,e){let r=this.nodes.text;return new N(r,r.defaultAttrs,t,u.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function Q(t,e){let r=[];for(let i=0;i<e.length;i++){let n=e[i],s=t.marks[n],h=s;if(s)r.push(s);else for(let e in t.marks){let i=t.marks[e];("_"==n||i.spec.group&&i.spec.group.split(" ").indexOf(n)>-1)&&r.push(h=i)}if(!h)throw new SyntaxError("Unknown mark type: '"+e[i]+"'")}return r}class V{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let r=this.matchedStyles=[];e.forEach((t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];r.indexOf(e)<0&&r.push(e),this.styles.push(t)}})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let r=t.nodes[e.node];return r.contentMatch.matchType(r)}))}parse(t,e={}){let r=new rt(this,e,!1);return r.addAll(t,u.none,e.from,e.to),r.finish()}parseSlice(t,e={}){let r=new rt(this,e,!0);return r.addAll(t,u.none,e.from,e.to),a.maxOpen(r.finish())}matchTag(t,e,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let r=this.tags[i];if(it(t,r.tag)&&(void 0===r.namespace||t.namespaceURI==r.namespace)&&(!r.context||e.matchesContext(r.context))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}matchStyle(t,e,r,i){for(let n=i?this.styles.indexOf(i)+1:0;n<this.styles.length;n++){let i=this.styles[n],s=i.style;if(!(0!=s.indexOf(t)||i.context&&!r.matchesContext(i.context)||s.length>t.length&&(61!=s.charCodeAt(t.length)||s.slice(t.length+1)!=e))){if(i.getAttrs){let t=i.getAttrs(e);if(!1===t)continue;i.attrs=t||void 0}return i}}}static schemaRules(t){let e=[];function r(t){let r=null==t.priority?50:t.priority,i=0;for(;i<e.length;i++){let t=e[i];if((null==t.priority?50:t.priority)<r)break}e.splice(i,0,t)}for(let e in t.marks){let i=t.marks[e].spec.parseDOM;i&&i.forEach((t=>{r(t=nt(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let i=t.nodes[e].spec.parseDOM;i&&i.forEach((t=>{r(t=nt(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new V(t,V.schemaRules(t)))}}const X={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Y={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Z={ol:!0,ul:!0};function tt(t,e,r){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&r}class et{constructor(t,e,r,i,n,s){this.type=t,this.attrs=e,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=u.none,this.match=n||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(s.from(t));if(!e){let e,r=this.type.contentMatch;return(e=r.findWrapping(t.type))?(this.match=r,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let r=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-t[0].length))}}let e=s.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(s.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!X.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class rt{constructor(t,e,r){this.parser=t,this.options=e,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i,n=e.topNode,s=tt(null,e.preserveWhitespace,0)|(r?4:0);i=n?new et(n.type,n.attrs,u.none,!0,e.topMatch||n.type.contentMatch,s):new et(r?null:t.schema.topNodeType,null,u.none,!0,null,s),this.nodes=[i],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let r=t.nodeValue,i=this.top,n=2&i.options?"full":this.localPreserveWS||(1&i.options)>0,{schema:s}=this.parser;if("full"===n||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(n)if("full"===n)r=r.replace(/\r\n?/g,"\n");else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let t=r.split(/\r?\n|\r/);for(let r=0;r<t.length;r++)r&&this.insertNode(s.linebreakReplacement.create(),e,!0),t[r]&&this.insertNode(s.text(t[r]),e,!/\S/.test(t[r]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let e=i.content[i.content.length-1],n=t.previousSibling;(!e||n&&"BR"==n.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),e,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,e,r){let i=this.localPreserveWS,n=this.top;("PRE"==t.tagName||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s,h=t.nodeName.toLowerCase();Z.hasOwnProperty(h)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,r=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&Z.hasOwnProperty(t)&&r?(r.appendChild(e),e=r):"li"==t?r=e:t&&(r=null)}}(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(s=this.parser.matchTag(t,this,r));t:if(l?l.ignore:Y.hasOwnProperty(h))this.findInside(t),this.ignoreFallback(t,e);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let r,i=this.needsBlock;if(X.hasOwnProperty(h))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),r=!0,n.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);break t}let s=l&&l.skip?e:this.readStyles(t,e);s&&this.addAll(t,s),r&&this.sync(n),this.needsBlock=i}else{let r=this.readStyles(t,e);r&&this.addElementByRule(t,l,r,!1===l.consuming?s:void 0)}this.localPreserveWS=i}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e,!0)}readStyles(t,e){let r=t.style;if(r&&r.length)for(let t=0;t<this.parser.matchedStyles.length;t++){let i=this.parser.matchedStyles[t],n=r.getPropertyValue(i);if(n)for(let t;;){let r=this.parser.matchStyle(i,n,this,t);if(!r)break;if(r.ignore)return null;if(e=r.clearMark?e.filter((t=>!r.clearMark(t))):e.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;t=r}}return e}addElementByRule(t,e,r,i){let n,s;if(e.node)if(s=this.parser.schema.nodes[e.node],s.isLeaf)this.insertNode(s.create(e.attrs),r,"BR"==t.nodeName)||this.leafFallback(t,r);else{let t=this.enter(s,e.attrs||null,r,e.preserveWhitespace);t&&(n=!0,r=t)}else{let t=this.parser.schema.marks[e.mark];r=r.concat(t.create(e.attrs))}let h=this.top;if(s&&s.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t,r,!1)));else{let i=t;"string"==typeof e.contentElement?i=t.querySelector(e.contentElement):"function"==typeof e.contentElement?i=e.contentElement(t):e.contentElement&&(i=e.contentElement),this.findAround(t,i,!0),this.addAll(i,r),this.findAround(t,i,!1)}n&&this.sync(h)&&this.open--}addAll(t,e,r,i){let n=r||0;for(let s=r?t.childNodes[r]:t.firstChild,h=null==i?null:t.childNodes[i];s!=h;s=s.nextSibling,++n)this.findAtPoint(t,n),this.addDOM(s,e);this.findAtPoint(t,n)}findPlace(t,e,r){let i,n;for(let e=this.open,s=0;e>=0;e--){let h=this.nodes[e],l=h.findWrapping(t);if(l&&(!i||i.length>l.length+s)&&(i=l,n=h,!l.length))break;if(h.solid){if(r)break;s+=2}}if(!i)return null;this.sync(n);for(let t=0;t<i.length;t++)e=this.enterInner(i[t],null,e,!1);return e}insertNode(t,e,r){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&(e=this.enterInner(t,null,e))}let i=this.findPlace(t,e,r);if(i){this.closeExtra();let e=this.top;e.match&&(e.match=e.match.matchType(t.type));let r=u.none;for(let n of i.concat(t.marks))(e.type?e.type.allowsMarkType(n.type):st(n.type,t.type))&&(r=n.addToSet(r));return e.content.push(t.mark(r)),!0}return!1}enter(t,e,r,i){let n=this.findPlace(t.create(e),r,!1);return n&&(n=this.enterInner(t,e,r,!0,i)),n}enterInner(t,e,r,i=!1,n){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let h=tt(t,n,s.options);4&s.options&&0==s.content.length&&(h|=4);let l=u.none;return r=r.filter((e=>!(s.type?s.type.allowsMarkType(e.type):st(e.type,t))||(l=e.addToSet(l),!1))),this.nodes.push(new et(t,e,l,i,null,h)),this.open++,r}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=1)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let r=this.nodes[e].content;for(let e=r.length-1;e>=0;e--)t+=r[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==e&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,r){if(t!=e&&this.find)for(let i=0;i<this.find.length;i++)if(null==this.find[i].pos&&1==t.nodeType&&t.contains(this.find[i].node)){e.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),r=this.options.context,i=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),n=-(r?r.depth+1:0)+(i?0:1),s=(t,h)=>{for(;t>=0;t--){let l=e[t];if(""==l){if(t==e.length-1||0==t)continue;for(;h>=n;h--)if(s(t-1,h))return!0;return!1}{let t=h>0||0==h&&i?this.nodes[h].type:r&&h>=n?r.node(h-n).type:null;if(!t||t.name!=l&&!t.isInGroup(l))return!1;h--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function it(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function nt(t){let e={};for(let r in t)e[r]=t[r];return e}function st(t,e){let r=e.schema.nodes;for(let i in r){let n=r[i];if(!n.allowsMarkType(t))continue;let s=[],h=t=>{s.push(t);for(let r=0;r<t.edgeCount;r++){let{type:i,next:n}=t.edge(r);if(i==e)return!0;if(s.indexOf(n)<0&&h(n))return!0}};if(h(n.contentMatch))return!0}}class ht{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},r){r||(r=ot(e).createDocumentFragment());let i=r,n=[];return t.forEach((t=>{if(n.length||t.marks.length){let r=0,s=0;for(;r<n.length&&s<t.marks.length;){let e=t.marks[s];if(this.marks[e.type.name]){if(!e.eq(n[r][0])||!1===e.type.spec.spanning)break;r++,s++}else s++}for(;r<n.length;)i=n.pop()[1];for(;s<t.marks.length;){let r=t.marks[s++],h=this.serializeMark(r,t.isInline,e);h&&(n.push([r,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(t,e))})),r}serializeNodeInner(t,e){if(t.isText)return ot(e).createTextNode(t.text);let{dom:r,contentDOM:i}=at(ot(e),this.nodes[t.type.name](t),null,t.attrs);if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,i)}return r}serializeNode(t,e={}){let r=this.serializeNodeInner(t,e);for(let i=t.marks.length-1;i>=0;i--){let n=this.serializeMark(t.marks[i],t.isInline,e);n&&((n.contentDOM||n.dom).appendChild(r),r=n.dom)}return r}serializeMark(t,e,r={}){let i=this.marks[t.type.name];return i&&at(ot(r),i(t,e),null,t.attrs)}static renderSpec(t,e,r=null,i){return"string"==typeof e?{dom:t.createTextNode(e)}:at(t,e,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new ht(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=lt(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return lt(t.marks)}}function lt(t){let e={};for(let r in t){let i=t[r].spec.toDOM;i&&(e[r]=i)}return e}function ot(t){return t.document||window.document}const ut=new WeakMap;function ft(t){let e=ut.get(t);return void 0===e&&ut.set(t,e=function(t){let e=null;function r(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])e||(e=[]),e.push(t);else for(let e=0;e<t.length;e++)r(t[e]);else for(let e in t)r(t[e])}return r(t),e}(t)),e}function at(t,e,r,i){if(1==e.nodeType)return{dom:e};if(e.dom&&1==e.dom.nodeType)return e;let n,s=e[0];if("string"!=typeof s)throw new RangeError("Invalid array passed to renderSpec");if(i&&(n=ft(i))&&n.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let h,l=s.indexOf(" ");l>0&&(r=s.slice(0,l),s=s.slice(l+1));let o=r?t.createElementNS(r,s):t.createElement(s),u=e[1],f=1;if(u&&"object"==typeof u&&null==u.nodeType&&!Array.isArray(u)){f=2;for(let t in u)if(null!=u[t]){let e=t.indexOf(" ");e>0?o.setAttributeNS(t.slice(0,e),t.slice(e+1),u[t]):"style"==t&&o.style?o.style.cssText=u[t]:o.setAttribute(t,u[t])}}for(let n=f;n<e.length;n++){let s=e[n];if(0===s){if(n<e.length-1||n>f)throw new RangeError("Content hole must be the only child of its parent node");return{dom:o,contentDOM:o}}if("string"==typeof s)o.appendChild(t.createTextNode(s));else{let{dom:e,contentDOM:n}=at(t,s,r,i);if(o.appendChild(e),n){if(h)throw new RangeError("Multiple content holes");h=n}}}return{dom:o,contentDOM:h}}export{V as D,s as F,u as M,I as N,t as O,f as R,a as S,ht as a,H as b,M as c,K as d};
|