@vonage/vivid 4.31.0 → 5.1.0
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/{shared/definition2.cjs → accordion/definition.cjs} +20 -20
- package/{shared/definition2.js → accordion/definition.js} +5 -7
- package/accordion/index.cjs +5 -5
- package/accordion/index.js +129 -3
- package/accordion-item/definition.cjs +145 -0
- package/accordion-item/definition.js +139 -0
- package/accordion-item/index.cjs +1 -5
- package/accordion-item/index.js +2 -3
- package/{shared/definition3.cjs → action-group/definition.cjs} +12 -9
- package/{shared/definition3.js → action-group/definition.js} +5 -4
- package/action-group/index.cjs +6 -5
- package/action-group/index.js +49 -3
- package/{shared/definition4.cjs → alert/definition.cjs} +33 -31
- package/{shared/definition4.js → alert/definition.js} +11 -11
- package/alert/index.cjs +30 -5
- package/alert/index.js +158 -3
- package/{shared/definition5.cjs → audio-player/definition.cjs} +58 -57
- package/{shared/definition5.js → audio-player/definition.js} +11 -12
- package/audio-player/index.cjs +68 -4
- package/audio-player/index.js +309 -2
- package/{shared/definition6.cjs → avatar/definition.cjs} +28 -26
- package/{shared/definition6.js → avatar/definition.js} +7 -7
- package/avatar/index.cjs +18 -5
- package/avatar/index.js +93 -3
- package/{shared/definition7.cjs → badge/definition.cjs} +18 -16
- package/{shared/definition7.js → badge/definition.js} +6 -6
- package/badge/index.cjs +4 -5
- package/badge/index.js +66 -3
- package/{shared/definition8.cjs → banner/definition.cjs} +26 -25
- package/{shared/definition8.js → banner/definition.js} +10 -11
- package/banner/index.cjs +29 -4
- package/banner/index.js +128 -2
- package/{shared/definition10.cjs → breadcrumb/definition.cjs} +11 -9
- package/{shared/definition10.js → breadcrumb/definition.js} +5 -5
- package/breadcrumb/index.cjs +12 -5
- package/breadcrumb/index.js +69 -3
- package/{shared/definition9.cjs → breadcrumb-item/definition.cjs} +18 -15
- package/{shared/definition9.js → breadcrumb-item/definition.js} +7 -7
- package/breadcrumb-item/index.cjs +5 -5
- package/breadcrumb-item/index.js +33 -3
- package/bundled/_has.cjs +1 -0
- package/bundled/_has.js +34 -0
- package/bundled/affix.cjs +13 -0
- package/bundled/affix.js +63 -0
- package/bundled/anchored.cjs +4 -0
- package/bundled/anchored.js +67 -0
- package/bundled/aria.cjs +1 -0
- package/bundled/aria.js +7 -0
- package/bundled/attribute-binding-behaviour.cjs +1 -0
- package/bundled/attribute-binding-behaviour.js +27 -0
- package/bundled/base-progress.cjs +1 -0
- package/bundled/base-progress.js +57 -0
- package/bundled/breadcrumb-item.cjs +1 -0
- package/bundled/breadcrumb-item.js +21 -0
- package/bundled/button.cjs +1 -0
- package/bundled/button.js +106 -0
- package/bundled/calendar-event.cjs +1 -0
- package/bundled/calendar-event.js +34 -0
- package/bundled/calendar-picker.template.cjs +148 -0
- package/bundled/calendar-picker.template.js +3371 -0
- package/bundled/char-count.cjs +13 -0
- package/bundled/char-count.js +54 -0
- package/bundled/children.cjs +1 -0
- package/bundled/children.js +38 -0
- package/bundled/class-names.cjs +1 -0
- package/bundled/class-names.js +9 -0
- package/bundled/definition.cjs +39 -0
- package/bundled/definition.js +122 -0
- package/bundled/definition10.cjs +19 -0
- package/bundled/definition10.js +73 -0
- package/bundled/definition11.cjs +10 -0
- package/bundled/definition11.js +44 -0
- package/bundled/definition12.cjs +1 -0
- package/bundled/definition12.js +20 -0
- package/bundled/definition13.cjs +73 -0
- package/bundled/definition13.js +359 -0
- package/bundled/definition14.cjs +5 -0
- package/bundled/definition14.js +29 -0
- package/bundled/definition15.cjs +30 -0
- package/bundled/definition15.js +80 -0
- package/bundled/definition16.cjs +19 -0
- package/bundled/definition16.js +103 -0
- package/bundled/definition17.cjs +13 -0
- package/bundled/definition17.js +137 -0
- package/bundled/definition18.cjs +12 -0
- package/bundled/definition18.js +94 -0
- package/bundled/definition19.cjs +67 -0
- package/bundled/definition19.js +666 -0
- package/bundled/definition2.cjs +20 -0
- package/bundled/definition2.js +180 -0
- package/bundled/definition20.cjs +20 -0
- package/bundled/definition20.js +106 -0
- package/bundled/definition21.cjs +5 -0
- package/bundled/definition21.js +19 -0
- package/bundled/definition22.cjs +24 -0
- package/bundled/definition22.js +151 -0
- package/bundled/definition3.cjs +29 -0
- package/bundled/definition3.js +195 -0
- package/bundled/definition4.cjs +6 -0
- package/bundled/definition4.js +42 -0
- package/bundled/definition5.cjs +1 -0
- package/bundled/definition5.js +345 -0
- package/bundled/definition6.cjs +31 -0
- package/bundled/definition6.js +265 -0
- package/bundled/definition7.cjs +30 -0
- package/bundled/definition7.js +288 -0
- package/bundled/definition8.cjs +19 -0
- package/bundled/definition8.js +145 -0
- package/bundled/definition9.cjs +14 -0
- package/bundled/definition9.js +1406 -0
- package/bundled/delegates-aria.cjs +1 -0
- package/bundled/delegates-aria.js +77 -0
- package/bundled/divider.cjs +1 -0
- package/bundled/divider.js +34 -0
- package/bundled/dom.cjs +1 -0
- package/bundled/dom.js +6 -0
- package/bundled/enums.cjs +1 -0
- package/bundled/enums.js +9 -0
- package/bundled/form-associated.cjs +1 -0
- package/bundled/form-associated.js +320 -0
- package/bundled/form-element.cjs +1 -0
- package/bundled/form-element.js +56 -0
- package/bundled/host-semantics.cjs +1 -0
- package/bundled/host-semantics.js +57 -0
- package/bundled/index.cjs +1 -0
- package/bundled/index.js +6 -0
- package/bundled/key-codes.cjs +1 -0
- package/bundled/key-codes.js +16 -0
- package/bundled/linkable.cjs +15 -0
- package/bundled/linkable.js +49 -0
- package/bundled/listbox.cjs +1 -0
- package/bundled/listbox.js +345 -0
- package/bundled/localized.cjs +1 -0
- package/bundled/localized.js +459 -0
- package/bundled/mixins.cjs +33 -0
- package/bundled/mixins.js +226 -0
- package/bundled/numbers.cjs +1 -0
- package/bundled/numbers.js +14 -0
- package/bundled/option.cjs +1 -0
- package/bundled/option.js +158 -0
- package/bundled/picker-field.template.cjs +62 -0
- package/bundled/picker-field.template.js +234 -0
- package/bundled/playbackRates.cjs +1 -0
- package/bundled/playbackRates.js +11 -0
- package/bundled/ref.cjs +1 -0
- package/bundled/ref.js +32 -0
- package/bundled/repeat.cjs +1 -0
- package/bundled/repeat.js +341 -0
- package/bundled/scrollIntoView.cjs +1 -0
- package/bundled/scrollIntoView.js +33 -0
- package/bundled/single-date-picker.cjs +1 -0
- package/bundled/single-date-picker.js +39 -0
- package/bundled/single-value-picker.cjs +1 -0
- package/bundled/single-value-picker.js +87 -0
- package/bundled/slider.template.cjs +41 -0
- package/bundled/slider.template.js +100 -0
- package/bundled/slotted.cjs +1 -0
- package/bundled/slotted.js +81 -0
- package/bundled/strings.cjs +1 -0
- package/bundled/strings.js +7 -0
- package/bundled/text-field.cjs +1 -0
- package/bundled/text-field.js +4 -0
- package/bundled/time-selection-picker.template.cjs +46 -0
- package/bundled/time-selection-picker.template.js +575 -0
- package/bundled/vivid-element.cjs +1 -0
- package/bundled/vivid-element.js +1761 -0
- package/bundled/when.cjs +1 -0
- package/bundled/when.js +11 -0
- package/bundled/with-contextual-help.cjs +1 -0
- package/bundled/with-contextual-help.js +22 -0
- package/bundled/with-error-text.cjs +1 -0
- package/bundled/with-error-text.js +39 -0
- package/bundled/with-success-text.cjs +1 -0
- package/bundled/with-success-text.js +16 -0
- package/button/definition.cjs +14 -0
- package/button/definition.js +4 -0
- package/button/index.cjs +1 -5
- package/button/index.js +2 -3
- package/{shared/definition13.cjs → calendar/definition.cjs} +27 -449
- package/{shared/definition13.js → calendar/definition.js} +7 -431
- package/calendar/index.cjs +53 -5
- package/calendar/index.js +431 -3
- package/{shared/definition12.cjs → calendar-event/definition.cjs} +12 -9
- package/{shared/definition12.js → calendar-event/definition.js} +6 -6
- package/calendar-event/index.cjs +9 -5
- package/calendar-event/index.js +43 -3
- package/card/definition.cjs +186 -0
- package/{shared/definition14.js → card/definition.js} +10 -11
- package/card/index.cjs +47 -5
- package/card/index.js +163 -3
- package/{shared/definition15.cjs → checkbox/definition.cjs} +35 -30
- package/{shared/definition15.js → checkbox/definition.js} +17 -14
- package/checkbox/index.cjs +1 -5
- package/checkbox/index.js +2 -3
- package/{shared/definition16.cjs → combobox/definition.cjs} +50 -52
- package/{shared/definition16.js → combobox/definition.js} +19 -23
- package/combobox/index.cjs +65 -5
- package/combobox/index.js +512 -3
- package/contextual-help/definition.cjs +62 -0
- package/contextual-help/definition.js +57 -0
- package/contextual-help/index.cjs +1 -0
- package/contextual-help/index.js +2 -0
- package/custom-elements.json +2735 -711
- package/{shared/definition17.cjs → data-grid/definition.cjs} +169 -196
- package/{shared/definition17.js → data-grid/definition.js} +71 -100
- package/data-grid/index.cjs +81 -5
- package/data-grid/index.js +1011 -3
- package/{shared/definition18.cjs → date-picker/definition.cjs} +20 -17
- package/{shared/definition18.js → date-picker/definition.js} +12 -11
- package/date-picker/index.cjs +1 -5
- package/date-picker/index.js +115 -3
- package/{shared/definition19.cjs → date-range-picker/definition.cjs} +26 -23
- package/{shared/definition19.js → date-range-picker/definition.js} +10 -9
- package/date-range-picker/index.cjs +1 -5
- package/date-range-picker/index.js +335 -3
- package/{shared/definition20.cjs → date-time-picker/definition.cjs} +27 -24
- package/{shared/definition20.js → date-time-picker/definition.js} +13 -12
- package/date-time-picker/index.cjs +8 -5
- package/date-time-picker/index.js +216 -3
- package/{shared/definition21.cjs → dial-pad/definition.cjs} +39 -40
- package/{shared/definition21.js → dial-pad/definition.js} +9 -12
- package/dial-pad/index.cjs +54 -5
- package/dial-pad/index.js +214 -3
- package/{shared/definition22.cjs → dialog/definition.cjs} +48 -47
- package/{shared/definition22.js → dialog/definition.js} +10 -11
- package/dialog/index.cjs +44 -5
- package/dialog/index.js +257 -3
- package/{shared/definition23.cjs → divider/definition.cjs} +10 -6
- package/{shared/definition23.js → divider/definition.js} +6 -5
- package/divider/index.cjs +1 -5
- package/divider/index.js +2 -3
- package/elevation/definition.cjs +11 -0
- package/elevation/definition.js +2 -0
- package/elevation/index.cjs +1 -5
- package/elevation/index.js +2 -3
- package/empty-state/definition.cjs +81 -0
- package/empty-state/definition.js +75 -0
- package/empty-state/index.cjs +14 -5
- package/empty-state/index.js +64 -3
- package/fab/definition.cjs +105 -0
- package/fab/definition.js +99 -0
- package/fab/index.cjs +20 -5
- package/fab/index.js +86 -3
- package/file-picker/definition.cjs +510 -0
- package/file-picker/definition.js +504 -0
- package/file-picker/index.cjs +58 -5
- package/file-picker/index.js +381 -3
- package/{shared/definition27.cjs → header/definition.cjs} +14 -11
- package/{shared/definition27.js → header/definition.js} +6 -5
- package/header/index.cjs +19 -5
- package/header/index.js +57 -3
- package/{shared/definition28.cjs → icon/definition.cjs} +25 -149
- package/{shared/definition28.js → icon/definition.js} +6 -132
- package/icon/index.cjs +1 -5
- package/icon/index.js +2 -3
- package/index.cjs +268 -264
- package/index.js +72 -71
- package/{shared/definition29.cjs → layout/definition.cjs} +13 -10
- package/{shared/definition29.js → layout/definition.js} +4 -3
- package/layout/index.cjs +3 -5
- package/layout/index.js +52 -3
- package/lib/accordion-item/accordion-item.d.ts +42 -2
- package/lib/action-group/action-group.d.ts +42 -2
- package/lib/alert/alert.d.ts +84 -4
- package/lib/audio-player/audio-player.d.ts +42 -2
- package/lib/avatar/avatar.d.ts +42 -2
- package/lib/badge/badge.d.ts +42 -2
- package/lib/banner/banner.d.ts +126 -6
- package/lib/breadcrumb/breadcrumb.d.ts +42 -2
- package/lib/breadcrumb-item/breadcrumb-item.d.ts +42 -2
- package/lib/button/button.d.ts +127 -6
- package/lib/calendar-event/calendar-event.d.ts +42 -2
- package/lib/card/card.d.ts +42 -2
- package/lib/checkbox/checkbox.d.ts +252 -13
- package/lib/combobox/combobox.d.ts +252 -12
- package/lib/components.d.ts +1 -0
- package/lib/contextual-help/contextual-help.d.ts +5 -0
- package/lib/contextual-help/contextual-help.template.d.ts +3 -0
- package/lib/contextual-help/definition.d.ts +1 -0
- package/lib/data-grid/data-grid-cell.d.ts +418 -3
- package/lib/data-grid/data-grid-row.d.ts +379 -1
- package/lib/date-picker/date-picker.d.ts +374 -54
- package/lib/date-range-picker/date-range-picker.d.ts +188 -28
- package/lib/date-time-picker/date-time-picker.d.ts +376 -56
- package/lib/dial-pad/dial-pad.d.ts +42 -2
- package/lib/dialog/dialog.d.ts +84 -4
- package/lib/divider/divider.d.ts +42 -2
- package/lib/fab/fab.d.ts +43 -2
- package/lib/file-picker/accept.d.ts +1 -0
- package/lib/file-picker/data-transfer.d.ts +1 -0
- package/lib/file-picker/file-picker.d.ts +259 -31
- package/lib/file-picker/locale.d.ts +1 -0
- package/lib/header/header.d.ts +42 -2
- package/lib/menu/menu.d.ts +84 -4
- package/lib/menu-item/menu-item.d.ts +84 -4
- package/lib/nav/nav.d.ts +42 -2
- package/lib/nav-disclosure/nav-disclosure.d.ts +84 -4
- package/lib/nav-item/nav-item.d.ts +84 -4
- package/lib/note/note.d.ts +42 -2
- package/lib/number-field/number-field.d.ts +840 -104
- package/lib/option/option.d.ts +85 -4
- package/lib/pagination/pagination.d.ts +42 -2
- package/lib/progress/progress.d.ts +42 -2
- package/lib/progress-ring/progress-ring.d.ts +42 -2
- package/lib/radio/radio.d.ts +126 -7
- package/lib/radio-group/radio-group.d.ts +42 -2
- package/lib/range-slider/range-slider.d.ts +126 -6
- package/lib/rich-text-editor/menubar/menubar.d.ts +42 -2
- package/lib/rich-text-editor/rich-text-editor.d.ts +42 -2
- package/lib/searchable-select/option-tag.d.ts +42 -2
- package/lib/searchable-select/searchable-select.d.ts +336 -16
- package/lib/select/select.d.ts +294 -14
- package/lib/selectable-box/selectable-box.d.ts +42 -3
- package/lib/simple-color-picker/definition.d.ts +4 -0
- package/lib/simple-color-picker/locale.d.ts +4 -0
- package/lib/simple-color-picker/simple-color-picker.d.ts +1600 -0
- package/lib/simple-color-picker/simple-color-picker.template.d.ts +3 -0
- package/lib/slider/slider.d.ts +126 -6
- package/lib/split-button/split-button.d.ts +128 -6
- package/lib/switch/switch.d.ts +84 -4
- package/lib/tab/tab.d.ts +126 -6
- package/lib/tab-panel/tab-panel.d.ts +42 -2
- package/lib/tag/tag.d.ts +126 -6
- package/lib/tag-group/tag-group.d.ts +42 -2
- package/lib/tag-name-map.d.ts +2 -1
- package/lib/text-area/text-area.d.ts +787 -91
- package/lib/text-field/text-field.d.ts +840 -104
- package/lib/time-picker/time-picker.d.ts +188 -28
- package/lib/toggletip/toggletip.d.ts +84 -4
- package/lib/tooltip/tooltip.d.ts +42 -2
- package/lib/tree-item/tree-item.d.ts +84 -4
- package/lib/tree-view/tree-view.d.ts +42 -2
- package/lib/video-player/video-player.d.ts +42 -2
- package/locales/de-DE.cjs +13 -1
- package/locales/de-DE.js +13 -1
- package/locales/en-GB.cjs +13 -1
- package/locales/en-GB.js +13 -1
- package/locales/en-US.cjs +13 -1
- package/locales/en-US.js +13 -1
- package/locales/ja-JP.cjs +13 -1
- package/locales/ja-JP.js +13 -1
- package/locales/zh-CN.cjs +13 -1
- package/locales/zh-CN.js +13 -1
- package/{shared/definition31.cjs → menu/definition.cjs} +46 -46
- package/{shared/definition31.js → menu/definition.js} +16 -18
- package/menu/index.cjs +1 -5
- package/menu/index.js +2 -3
- package/menu-item/definition.cjs +14 -0
- package/menu-item/definition.js +3 -0
- package/menu-item/index.cjs +1 -5
- package/menu-item/index.js +2 -3
- package/{shared/definition34.cjs → nav/definition.cjs} +7 -4
- package/{shared/definition34.js → nav/definition.js} +4 -3
- package/nav/index.cjs +5 -5
- package/nav/index.js +13 -3
- package/nav-disclosure/definition.cjs +122 -0
- package/nav-disclosure/definition.js +116 -0
- package/nav-disclosure/index.cjs +16 -5
- package/nav-disclosure/index.js +96 -3
- package/{shared/definition33.cjs → nav-item/definition.cjs} +19 -16
- package/{shared/definition33.js → nav-item/definition.js} +9 -8
- package/nav-item/index.cjs +2 -5
- package/nav-item/index.js +59 -3
- package/{shared/definition35.cjs → note/definition.cjs} +15 -13
- package/{shared/definition35.js → note/definition.js} +6 -6
- package/note/index.cjs +9 -5
- package/note/index.js +44 -3
- package/number-field/definition.cjs +438 -0
- package/{shared/definition36.js → number-field/definition.js} +31 -27
- package/number-field/index.cjs +60 -5
- package/number-field/index.js +369 -3
- package/option/definition.cjs +84 -0
- package/option/definition.js +78 -0
- package/option/index.cjs +1 -5
- package/option/index.js +2 -3
- package/package.json +15 -4
- package/{shared/definition38.cjs → pagination/definition.cjs} +31 -33
- package/{shared/definition38.js → pagination/definition.js} +7 -11
- package/pagination/index.cjs +43 -5
- package/pagination/index.js +194 -3
- package/popup/definition.cjs +13 -0
- package/popup/definition.js +4 -0
- package/popup/index.cjs +1 -5
- package/popup/index.js +2 -3
- package/{shared/definition40.cjs → progress/definition.cjs} +17 -15
- package/{shared/definition40.js → progress/definition.js} +6 -6
- package/progress/index.cjs +17 -5
- package/progress/index.js +69 -3
- package/{shared/definition39.cjs → progress-ring/definition.cjs} +17 -15
- package/{shared/definition39.js → progress-ring/definition.js} +7 -7
- package/progress-ring/index.cjs +1 -5
- package/progress-ring/index.js +2 -3
- package/{shared/definition42.cjs → radio/definition.cjs} +20 -23
- package/{shared/definition42.js → radio/definition.js} +8 -13
- package/radio/index.cjs +1 -5
- package/radio/index.js +2 -3
- package/{shared/definition41.cjs → radio-group/definition.cjs} +31 -30
- package/{shared/definition41.js → radio-group/definition.js} +8 -9
- package/radio-group/index.cjs +23 -5
- package/radio-group/index.js +255 -3
- package/{shared/definition43.cjs → range-slider/definition.cjs} +62 -61
- package/{shared/definition43.js → range-slider/definition.js} +13 -14
- package/range-slider/index.cjs +68 -5
- package/range-slider/index.js +456 -3
- package/rich-text-editor/definition.cjs +1206 -0
- package/rich-text-editor/definition.js +1200 -0
- package/rich-text-editor/index.cjs +133 -4
- package/rich-text-editor/index.js +10386 -2
- package/{shared/definition45.cjs → searchable-select/definition.cjs} +119 -116
- package/{shared/definition45.js → searchable-select/definition.js} +25 -24
- package/searchable-select/index.cjs +164 -5
- package/searchable-select/index.js +1025 -3
- package/{shared/definition46.cjs → select/definition.cjs} +80 -83
- package/{shared/definition46.js → select/definition.js} +19 -24
- package/select/index.cjs +1 -5
- package/select/index.js +2 -3
- package/{shared/definition47.cjs → selectable-box/definition.cjs} +26 -32
- package/{shared/definition47.js → selectable-box/definition.js} +9 -17
- package/selectable-box/index.cjs +28 -5
- package/selectable-box/index.js +136 -3
- package/shared/aria/aria-mixin.d.ts +43 -3
- package/shared/aria/attribute-removal.d.ts +3 -0
- package/shared/aria/delegate-aria-behavior.d.ts +0 -3
- package/shared/aria/delegates-aria.d.ts +42 -2
- package/shared/aria/host-semantics.d.ts +42 -2
- package/shared/color-picker/index.d.ts +2 -0
- package/shared/color-picker/types.d.ts +4 -0
- package/shared/color-picker/utils.d.ts +3 -0
- package/shared/feedback/feedback-message.d.ts +42 -2
- package/shared/feedback/mixins.d.ts +84 -4
- package/shared/foundation/button/button.d.ts +84 -4
- package/shared/foundation/form-associated/form-associated.d.ts +84 -4
- package/shared/foundation/vivid-element/vivid-element.d.ts +43 -3
- package/shared/localization/Locale.d.ts +2 -0
- package/shared/patterns/affix.d.ts +84 -4
- package/shared/patterns/anchored.d.ts +84 -4
- package/shared/patterns/char-count/char-count.d.ts +42 -2
- package/shared/patterns/form-elements/form-element.d.ts +84 -4
- package/shared/patterns/form-elements/with-contextual-help.d.ts +1238 -0
- package/shared/patterns/form-elements/with-error-text.d.ts +126 -6
- package/shared/patterns/form-elements/with-success-text.d.ts +42 -2
- package/shared/patterns/linkable.d.ts +42 -2
- package/shared/patterns/localized.d.ts +42 -2
- package/shared/patterns/trapped-focus.d.ts +42 -2
- package/shared/picker-field/mixins/calendar-picker.d.ts +94 -14
- package/shared/picker-field/mixins/calendar-picker.template.d.ts +94 -14
- package/shared/picker-field/mixins/inline-time-picker/inline-time-picker.d.ts +42 -2
- package/shared/picker-field/mixins/min-max-calendar-picker.d.ts +188 -28
- package/shared/picker-field/mixins/single-date-picker.d.ts +280 -40
- package/shared/picker-field/mixins/single-value-picker.d.ts +92 -12
- package/shared/picker-field/mixins/time-selection-picker.d.ts +188 -28
- package/shared/picker-field/mixins/time-selection-picker.template.d.ts +188 -28
- package/shared/picker-field/picker-field.d.ts +252 -12
- package/{shared/definition48.cjs → side-drawer/definition.cjs} +16 -14
- package/{shared/definition48.js → side-drawer/definition.js} +5 -5
- package/side-drawer/index.cjs +17 -3
- package/side-drawer/index.js +100 -2
- package/simple-color-picker/definition.cjs +398 -0
- package/simple-color-picker/definition.js +392 -0
- package/simple-color-picker/index.cjs +31 -0
- package/simple-color-picker/index.js +250 -0
- package/{shared/definition49.cjs → slider/definition.cjs} +46 -53
- package/{shared/definition49.js → slider/definition.js} +11 -20
- package/slider/index.cjs +1 -5
- package/slider/index.js +2 -3
- package/split-button/definition.cjs +176 -0
- package/split-button/definition.js +170 -0
- package/split-button/index.cjs +26 -5
- package/split-button/index.js +149 -3
- package/styles/core/all.css +1 -1
- package/styles/core/theme.css +1 -1
- package/styles/core/typography.css +1 -1
- package/styles/tokens/theme-dark.css +4 -4
- package/styles/tokens/theme-light.css +4 -4
- package/styles/tokens/vivid-2-compat.css +1 -1
- package/{shared/definition51.cjs → switch/definition.cjs} +20 -19
- package/{shared/definition51.js → switch/definition.js} +8 -9
- package/switch/index.cjs +16 -5
- package/switch/index.js +102 -3
- package/tab/definition.cjs +127 -0
- package/tab/definition.js +121 -0
- package/tab/index.cjs +1 -5
- package/tab/index.js +2 -3
- package/{shared/definition52.cjs → tab-panel/definition.cjs} +7 -4
- package/{shared/definition52.js → tab-panel/definition.js} +4 -3
- package/tab-panel/index.cjs +1 -5
- package/tab-panel/index.js +2 -3
- package/{shared/definition54.cjs → tabs/definition.cjs} +47 -40
- package/{shared/definition54.js → tabs/definition.js} +19 -14
- package/tabs/index.cjs +31 -5
- package/tabs/index.js +321 -3
- package/tag/definition.cjs +156 -0
- package/tag/definition.js +150 -0
- package/tag/index.cjs +19 -5
- package/tag/index.js +118 -3
- package/{shared/definition55.cjs → tag-group/definition.cjs} +9 -6
- package/{shared/definition55.js → tag-group/definition.js} +5 -4
- package/tag-group/index.cjs +8 -5
- package/tag-group/index.js +26 -3
- package/text-area/definition.cjs +355 -0
- package/text-area/definition.js +349 -0
- package/text-area/index.cjs +41 -5
- package/text-area/index.js +293 -3
- package/{shared/definition58.cjs → text-field/definition.cjs} +70 -52
- package/{shared/definition58.js → text-field/definition.js} +40 -24
- package/text-field/index.cjs +1 -5
- package/text-field/index.js +2 -3
- package/time-picker/definition.cjs +43 -0
- package/{shared/definition59.js → time-picker/definition.js} +9 -8
- package/time-picker/index.cjs +1 -5
- package/time-picker/index.js +29 -3
- package/{shared/definition60.cjs → toggletip/definition.cjs} +20 -18
- package/{shared/definition60.js → toggletip/definition.js} +8 -8
- package/toggletip/index.cjs +1 -5
- package/toggletip/index.js +2 -3
- package/{shared/definition61.cjs → tooltip/definition.cjs} +16 -13
- package/{shared/definition61.js → tooltip/definition.js} +7 -6
- package/tooltip/index.cjs +1 -5
- package/tooltip/index.js +2 -3
- package/tree-item/definition.cjs +13 -0
- package/tree-item/definition.js +3 -0
- package/tree-item/index.cjs +1 -5
- package/tree-item/index.js +2 -3
- package/{shared/definition63.cjs → tree-view/definition.cjs} +42 -44
- package/{shared/definition63.js → tree-view/definition.js} +7 -11
- package/tree-view/index.cjs +13 -5
- package/tree-view/index.js +171 -3
- package/{shared → unbundled}/affix.cjs +10 -11
- package/{shared → unbundled}/affix.js +2 -3
- package/{shared → unbundled}/anchored.cjs +7 -8
- package/{shared → unbundled}/anchored.js +1 -2
- package/{shared → unbundled}/attribute-binding-behaviour.cjs +3 -3
- package/{shared → unbundled}/attribute-binding-behaviour.js +1 -1
- package/{shared → unbundled}/base-progress.cjs +6 -5
- package/{shared → unbundled}/base-progress.js +2 -1
- package/{shared → unbundled}/breadcrumb-item.cjs +3 -2
- package/{shared → unbundled}/breadcrumb-item.js +2 -1
- package/{shared → unbundled}/button.cjs +10 -9
- package/{shared → unbundled}/button.js +2 -1
- package/{shared → unbundled}/calendar-event.cjs +8 -7
- package/{shared → unbundled}/calendar-event.js +2 -1
- package/unbundled/calendar-picker.template.cjs +917 -0
- package/unbundled/calendar-picker.template.js +906 -0
- package/{shared → unbundled}/char-count.cjs +6 -7
- package/{shared → unbundled}/char-count.js +2 -3
- package/unbundled/definition.cjs +225 -0
- package/unbundled/definition.js +220 -0
- package/{shared/definition30.cjs → unbundled/definition2.cjs} +49 -46
- package/{shared/definition30.js → unbundled/definition2.js} +14 -11
- package/unbundled/definition3.cjs +207 -0
- package/{shared/definition62.js → unbundled/definition3.js} +6 -10
- package/unbundled/definition4.cjs +298 -0
- package/unbundled/definition4.js +293 -0
- package/{shared/definition65.cjs → unbundled/definition5.cjs} +7 -6
- package/{shared/definition65.js → unbundled/definition5.js} +3 -2
- package/{shared → unbundled}/delegates-aria.cjs +8 -28
- package/{shared → unbundled}/delegates-aria.js +6 -26
- package/{shared → unbundled}/divider.cjs +13 -7
- package/{shared → unbundled}/divider.js +11 -5
- package/{shared → unbundled}/form-associated.cjs +13 -13
- package/{shared → unbundled}/form-associated.js +2 -2
- package/{shared → unbundled}/form-element.cjs +3 -3
- package/{shared → unbundled}/form-element.js +1 -1
- package/{shared → unbundled}/host-semantics.cjs +2 -1
- package/{shared → unbundled}/host-semantics.js +2 -1
- package/unbundled/key-codes.cjs +10 -0
- package/unbundled/key-codes.js +7 -0
- package/{shared → unbundled}/linkable.cjs +11 -12
- package/{shared → unbundled}/linkable.js +1 -2
- package/{shared → unbundled}/listbox.cjs +22 -38
- package/{shared → unbundled}/listbox.js +4 -20
- package/{shared → unbundled}/localized.cjs +2 -2
- package/{shared → unbundled}/localized.js +1 -1
- package/{shared → unbundled}/mixins.cjs +27 -83
- package/{shared → unbundled}/mixins.js +6 -62
- package/{shared → unbundled}/option.cjs +42 -17
- package/{shared → unbundled}/option.js +29 -4
- package/{shared → unbundled}/picker-field.template.cjs +21 -21
- package/{shared → unbundled}/picker-field.template.js +7 -7
- package/{shared → unbundled}/slider.template.cjs +15 -19
- package/{shared → unbundled}/slider.template.js +3 -7
- package/unbundled/text-field.cjs +5 -0
- package/unbundled/text-field.js +3 -0
- package/{shared → unbundled}/time-selection-picker.template.cjs +28 -30
- package/{shared → unbundled}/time-selection-picker.template.js +4 -6
- package/unbundled/vivid-element.cjs +283 -0
- package/unbundled/vivid-element.js +274 -0
- package/unbundled/with-contextual-help.cjs +29 -0
- package/unbundled/with-contextual-help.js +27 -0
- package/{shared → unbundled}/with-error-text.cjs +2 -2
- package/{shared → unbundled}/with-error-text.js +1 -1
- package/{shared → unbundled}/with-success-text.cjs +2 -2
- package/{shared → unbundled}/with-success-text.js +1 -1
- package/video-player/definition.cjs +536 -0
- package/video-player/definition.js +530 -0
- package/video-player/index.cjs +536 -3
- package/video-player/index.js +35912 -2
- package/{shared/definition66.cjs → visually-hidden/definition.cjs} +6 -3
- package/{shared/definition66.js → visually-hidden/definition.js} +3 -2
- package/visually-hidden/index.cjs +1 -5
- package/visually-hidden/index.js +2 -3
- package/vivid.api.json +716 -914
- package/shared/_has.cjs +0 -58
- package/shared/_has.js +0 -54
- package/shared/aria.cjs +0 -11
- package/shared/aria.js +0 -9
- package/shared/calendar-picker.template.cjs +0 -6377
- package/shared/calendar-picker.template.js +0 -6366
- package/shared/children.cjs +0 -61
- package/shared/children.js +0 -59
- package/shared/class-names.cjs +0 -17
- package/shared/class-names.js +0 -15
- package/shared/definition.cjs +0 -145
- package/shared/definition.js +0 -141
- package/shared/definition11.cjs +0 -220
- package/shared/definition11.js +0 -215
- package/shared/definition14.cjs +0 -185
- package/shared/definition24.cjs +0 -80
- package/shared/definition24.js +0 -76
- package/shared/definition25.cjs +0 -90
- package/shared/definition25.js +0 -86
- package/shared/definition26.cjs +0 -2514
- package/shared/definition26.js +0 -2510
- package/shared/definition32.cjs +0 -120
- package/shared/definition32.js +0 -116
- package/shared/definition36.cjs +0 -432
- package/shared/definition37.cjs +0 -71
- package/shared/definition37.js +0 -68
- package/shared/definition44.cjs +0 -14666
- package/shared/definition44.js +0 -14662
- package/shared/definition50.cjs +0 -148
- package/shared/definition50.js +0 -144
- package/shared/definition53.cjs +0 -124
- package/shared/definition53.js +0 -120
- package/shared/definition56.cjs +0 -154
- package/shared/definition56.js +0 -150
- package/shared/definition57.cjs +0 -335
- package/shared/definition57.js +0 -331
- package/shared/definition59.cjs +0 -39
- package/shared/definition62.cjs +0 -211
- package/shared/definition64.cjs +0 -69579
- package/shared/definition64.js +0 -69575
- package/shared/definition67.cjs +0 -2227
- package/shared/definition67.js +0 -2222
- package/shared/dom.cjs +0 -10
- package/shared/dom.js +0 -8
- package/shared/key-codes.cjs +0 -32
- package/shared/key-codes.js +0 -18
- package/shared/numbers.cjs +0 -38
- package/shared/numbers.js +0 -34
- package/shared/ref.cjs +0 -43
- package/shared/ref.js +0 -41
- package/shared/repeat.cjs +0 -767
- package/shared/repeat.js +0 -764
- package/shared/slotted.cjs +0 -123
- package/shared/slotted.js +0 -119
- package/shared/strings.cjs +0 -11
- package/shared/strings.js +0 -9
- package/shared/text-field.cjs +0 -5
- package/shared/text-field.js +0 -3
- package/shared/vivid-element.cjs +0 -2771
- package/shared/vivid-element.js +0 -2748
- package/shared/when.cjs +0 -31
- package/shared/when.js +0 -29
- /package/{shared → unbundled}/enums.cjs +0 -0
- /package/{shared → unbundled}/enums.js +0 -0
- /package/{shared → unbundled}/index.cjs +0 -0
- /package/{shared → unbundled}/index.js +0 -0
- /package/{shared → unbundled}/playbackRates.cjs +0 -0
- /package/{shared → unbundled}/playbackRates.js +0 -0
- /package/{shared → unbundled}/scrollIntoView.cjs +0 -0
- /package/{shared → unbundled}/scrollIntoView.js +0 -0
- /package/{shared → unbundled}/single-date-picker.cjs +0 -0
- /package/{shared → unbundled}/single-date-picker.js +0 -0
- /package/{shared → unbundled}/single-value-picker.cjs +0 -0
- /package/{shared → unbundled}/single-value-picker.js +0 -0
|
@@ -1,5 +1,134 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";const O=require("../bundled/vivid-element.cjs"),Zt=require("../bundled/definition3.cjs"),Br=require("../bundled/definition14.cjs"),ys=require("../bundled/definition10.cjs"),ft=require("../bundled/definition18.cjs"),Fr=require("../bundled/definition6.cjs"),Vr=require("../bundled/definition7.cjs"),Lr=require("../bundled/definition19.cjs"),$r=require("../bundled/divider.cjs"),xs=require("../bundled/option.cjs"),Qt=require("../bundled/repeat.cjs"),gn=require("../bundled/class-names.cjs"),qr=require("../bundled/localized.cjs"),Wr=require("../bundled/definition2.cjs"),bs=require("../bundled/when.cjs"),ks='@charset "UTF-8";.ProseMirror li{position:relative}.ProseMirror-hideselection *::selection{background:transparent}.ProseMirror-hideselection *::-moz-selection{background:transparent}.ProseMirror-hideselection{caret-color:transparent}.ProseMirror [draggable][contenteditable=false]{user-select:text}.ProseMirror-selectednode{outline:2px solid #8cf}li.ProseMirror-selectednode{outline:none}li.ProseMirror-selectednode:after{content:"";position:absolute;inset:-2px -2px -2px -32px;border:2px solid #8cf;pointer-events:none}img.ProseMirror-separator{display:inline!important;border:none!important;margin:0!important}.ProseMirror-textblock-dropdown{min-width:3em}.ProseMirror-menu{margin:0 -4px;line-height:1}.ProseMirror-tooltip .ProseMirror-menu{width:-webkit-fit-content;width:fit-content;white-space:pre}.ProseMirror-menuitem{margin-right:3px;display:inline-block}.ProseMirror-menuseparator{border-right:1px solid #ddd;margin-right:3px}.ProseMirror-menu-dropdown,.ProseMirror-menu-dropdown-menu{font-size:90%;white-space:nowrap}.ProseMirror-menu-dropdown{vertical-align:1px;cursor:pointer;position:relative;padding-right:15px}.ProseMirror-menu-dropdown-wrap{padding:1px 0 1px 4px;display:inline-block;position:relative}.ProseMirror-menu-dropdown:after{content:"";border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid currentColor;opacity:.6;position:absolute;right:4px;top:calc(50% - 2px)}.ProseMirror-menu-dropdown-menu,.ProseMirror-menu-submenu{position:absolute;background:#fff;color:#666;border:1px solid #aaa;padding:2px}.ProseMirror-menu-dropdown-menu{z-index:15;min-width:6em}.ProseMirror-menu-dropdown-item{cursor:pointer;padding:2px 8px 2px 4px}@media (hover: hover){.ProseMirror-menu-dropdown-item:hover{background:#f2f2f2}}.ProseMirror-menu-submenu-wrap{position:relative;margin-right:-4px}.ProseMirror-menu-submenu-label:after{content:"";border-top:4px solid transparent;border-bottom:4px solid transparent;border-left:4px solid currentColor;opacity:.6;position:absolute;right:4px;top:calc(50% - 4px)}.ProseMirror-menu-submenu{display:none;min-width:4em;left:100%;top:-3px}.ProseMirror-menu-active{background:#eee;border-radius:4px}.ProseMirror-menu-disabled{opacity:.3}.ProseMirror-menu-submenu-wrap:hover .ProseMirror-menu-submenu,.ProseMirror-menu-submenu-wrap-active .ProseMirror-menu-submenu{display:block}.ProseMirror-menubar{border-top-left-radius:inherit;border-top-right-radius:inherit;position:relative;min-height:1em;color:#666;padding:1px 6px;top:0;left:0;right:0;border-bottom:1px solid silver;background:#fff;z-index:10;-moz-box-sizing:border-box;box-sizing:border-box;overflow:visible}.ProseMirror-icon{display:inline-block;line-height:.8;vertical-align:-2px;padding:2px 8px;cursor:pointer}.ProseMirror-menu-disabled.ProseMirror-icon{cursor:default}.ProseMirror-icon svg{fill:currentColor;height:1em}.ProseMirror-icon span{vertical-align:text-top}.ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}.ProseMirror-gapcursor:after{content:"";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}.ProseMirror-focused .ProseMirror-gapcursor{display:block}.ProseMirror-example-setup-style hr{padding:2px 10px;border:none;margin:1em 0}.ProseMirror-example-setup-style hr:after{content:"";display:block;height:1px;background-color:silver;line-height:2px}.ProseMirror ul,.ProseMirror ol{padding-left:30px}.ProseMirror blockquote{padding-left:1em;border-left:3px solid #eee;margin-left:0;margin-right:0}.ProseMirror-example-setup-style img{cursor:default}.ProseMirror-prompt{background:#fff;padding:5px 10px 5px 15px;border:1px solid silver;position:fixed;border-radius:3px;z-index:11;box-shadow:-.5px 2px 5px #0003}.ProseMirror-prompt h5{margin:0;font-weight:400;font-size:100%;color:#444}.ProseMirror-prompt input[type=text],.ProseMirror-prompt textarea{background:#eee;border:none;outline:none}.ProseMirror-prompt input[type=text]{padding:0 4px}.ProseMirror-prompt-close{position:absolute;left:2px;top:1px;color:#666;border:none;background:transparent;padding:0}.ProseMirror-prompt-close:after{content:"✕";font-size:12px}.ProseMirror-invalid{background:#ffc;border:1px solid #cc7;border-radius:4px;padding:5px 10px;position:absolute;min-width:10em}.ProseMirror-prompt-buttons{margin-top:5px;display:none}.placeholder:before{position:absolute;color:var(--vvd-color-neutral-600);content:attr(data-placeholder);font:var(--vvd-typography-base);pointer-events:none}.editor{box-sizing:border-box;background:var(--vvd-color-canvas);background-clip:padding-box;color:var(--vvd-color-canvas-text)}.ProseMirror{position:relative;box-sizing:border-box;padding:10px 16px;block-size:120px;font:var(--vvd-typography-base);font-feature-settings:"liga" 0;font-variant-ligatures:none;line-height:1.2;outline:none;overflow-y:auto;white-space:break-spaces;word-wrap:break-word}.ProseMirror pre{white-space:pre-wrap}.ProseMirror p{margin-bottom:1em}.ProseMirror p:first-child,.ProseMirror h1:first-child,.ProseMirror h2:first-child,.ProseMirror h3:first-child,.ProseMirror h4:first-child,.ProseMirror h5:first-child,.ProseMirror h6:first-child{margin-top:10px}h2{font:var(--vvd-typography-heading-4)}h3{font:var(--vvd-typography-base-extended)}p{font:var(--vvd-typography-base)}:host{display:block}#editor{--scrollbar-track-color: transparent;--scrollbar-thumb-color: color-mix(in srgb, var(--vvd-color-neutral-950), transparent 70%)}#editor{scrollbar-color:var(--scrollbar-thumb-color) var(--scrollbar-track-color);scrollbar-width:thin}#editor ::-webkit-scrollbar{width:4px}#editor ::-webkit-scrollbar-track{background:var(--scrollbar-track-color)}#editor ::-webkit-scrollbar-thumb{border:0;border-radius:4px;background-color:var(--scrollbar-fallback-track-color, var(--scrollbar-thumb-color))}#editor{position:relative;display:flex;flex-direction:column;block-size:100%;overflow-y:auto}[contenteditable=true]{overflow:unset;block-size:unset}#attachments-wrapper{order:1}#attachments-wrapper .divider{padding:0 12px}.hidden{display:none}.drag-overlay{position:absolute;z-index:10;display:none;align-items:center;justify-content:center;border:1px dashed var(--vvd-color-cta-400);border-radius:8px;background:var(--vvd-color-cta-100);font:var(--vvd-typography-base);inset:0;opacity:.8;pointer-events:none;transition:opacity .2s}.drag-over .drag-overlay{display:flex}';function It(r,e,t){return r.$emit(e,t,{bubbles:!1,composed:!1}),!0}const Jr=[{text:"Bold",icon:"bold-line",value:"bold"},{text:"Italic",icon:"italic-line",value:"italics"},{text:"Underline",icon:"underline-line",value:"underline"},{text:"Strikethrough",icon:"strikethrough-line",value:"strikethrough"},{text:"Monospace",icon:"monospace-line",value:"monospace"}],Ss=[{text:"Extra Large",value:"extra-large"},{text:"Large",value:"large"},{text:"Normal",value:"normal"},{text:"Small",value:"small"}],Ms=r=>{const e=r;if(!e||!e.detail||e.detail.textBlockType===void 0)return;e.target.shadowRoot.querySelector("#text-block").setAttribute("current-value",e.detail.textBlockType)},Cs=r=>{const e=r;if(!e||!e.detail)return;const n=e.target.shadowRoot.querySelectorAll("#text-decoration .selection-button");n.forEach(i=>i.removeAttribute("active")),e.detail.textDecoration!==void 0&&Jr.forEach((i,s)=>{e.detail.textDecoration.indexOf(i.value)>=0&&n[s].toggleAttribute("active",!0)})},Os=r=>{const e=r;if(!e||!e.detail)return;const t=e.target,n=e.detail.textSize??"normal";t.shadowRoot.querySelectorAll(".menubar-selector-menuitem").forEach(s=>{s.toggleAttribute("checked",s.getAttribute("value")===n)})},Kr={textBlock:{registerStateProperty:function(r){r.addEventListener("text-styles-changed",Ms)},render:function(r){const e=r.tagFor(Lr.Select),t=r.tagFor(xs.ListboxOption),n=r.tagFor(ft.Tooltip);return O.html`
|
|
2
|
+
<${n} text="${(i,{parent:s})=>s.locale.richTextEditor.textBlockType}" placement="top">
|
|
3
|
+
<${e}
|
|
4
|
+
scale="condensed"
|
|
5
|
+
shape="rounded"
|
|
6
|
+
appearance="ghost"
|
|
7
|
+
slot="anchor"
|
|
8
|
+
trigger="auto"
|
|
9
|
+
id="text-block"
|
|
10
|
+
aria-label="Text Block"
|
|
11
|
+
placement="bottom-end"
|
|
12
|
+
value="${(i,{parent:s})=>s.textBlockType}"
|
|
13
|
+
@change="${(i,{parent:s,event:o})=>It(s,"text-block-selected",o.target.value)}"
|
|
14
|
+
>
|
|
15
|
+
<${t}
|
|
16
|
+
text="Title"
|
|
17
|
+
value="title"
|
|
18
|
+
internal-part
|
|
19
|
+
class="title"
|
|
20
|
+
connotation="cta"
|
|
21
|
+
></${t}>
|
|
22
|
+
<${t}
|
|
23
|
+
text="Subtitle"
|
|
24
|
+
value="subtitle"
|
|
25
|
+
internal-part
|
|
26
|
+
class="subtitle"
|
|
27
|
+
connotation="cta"
|
|
28
|
+
></${t}>
|
|
29
|
+
<${t}
|
|
30
|
+
text="Body"
|
|
31
|
+
value="body"
|
|
32
|
+
internal-part
|
|
33
|
+
class="body"
|
|
34
|
+
connotation="cta"
|
|
35
|
+
></${t}>
|
|
36
|
+
</${e}>
|
|
37
|
+
</${n}>
|
|
38
|
+
`}},textDecoration:{registerStateProperty:function(r){r.addEventListener("text-styles-changed",Cs)},render:function(r){const e=r.tagFor(Zt.Button),t=r.tagFor(ft.Tooltip);return O.html`
|
|
39
|
+
<span id="text-decoration">
|
|
40
|
+
${Qt.repeat(n=>Jr,O.html`
|
|
41
|
+
<${t} text="${(n,{parentContext:{parent:i}})=>i.locale.richTextEditor[n.value]}" placement="top">
|
|
42
|
+
<${e}
|
|
43
|
+
class="selection-button"
|
|
44
|
+
slot="anchor"
|
|
45
|
+
aria-label="${(n,{parentContext:{parent:i}})=>i.locale.richTextEditor[n.value]}"
|
|
46
|
+
size="super-condensed"
|
|
47
|
+
appearance="ghost-light"
|
|
48
|
+
shape="rounded"
|
|
49
|
+
icon="${n=>n.icon}"
|
|
50
|
+
@click="${(n,i)=>It(i.parentContext.parent,"text-decoration-selected",n.value)}"')}"
|
|
51
|
+
></${e}>
|
|
52
|
+
</${t}>
|
|
53
|
+
`)}
|
|
54
|
+
</span>
|
|
55
|
+
`}},textSize:{registerStateProperty:function(r){r.addEventListener("text-styles-changed",Os)},render:function(r){const e=r.tagFor(Fr.Menu),t=r.tagFor(Zt.Button),n=r.tagFor(ft.Tooltip),i=r.tagFor(Vr.MenuItem);return O.html`
|
|
56
|
+
<${e}
|
|
57
|
+
auto-dismiss
|
|
58
|
+
trigger="auto"
|
|
59
|
+
id="text-size"
|
|
60
|
+
aria-label="Text Size"
|
|
61
|
+
placement="bottom-end"
|
|
62
|
+
>
|
|
63
|
+
<${n} slot="anchor" text="${(s,{parent:o})=>o.locale.richTextEditor.textSize}" placement="top">
|
|
64
|
+
<${t}
|
|
65
|
+
slot="anchor"
|
|
66
|
+
aria-label="Open text size menu"
|
|
67
|
+
size="super-condensed"
|
|
68
|
+
appearance="ghost-light"
|
|
69
|
+
shape="pill"
|
|
70
|
+
icon="text-size-line"
|
|
71
|
+
></${t}>
|
|
72
|
+
</${n}>
|
|
73
|
+
${Qt.repeat(s=>Ss,O.html`
|
|
74
|
+
<${i}
|
|
75
|
+
check-appearance="tick-only"
|
|
76
|
+
control-type="checkbox"
|
|
77
|
+
text="${s=>s.text}"
|
|
78
|
+
value="${s=>s.value}"
|
|
79
|
+
internal-part
|
|
80
|
+
class="menubar-selector-menuitem"
|
|
81
|
+
connotation="cta"
|
|
82
|
+
@click="${(s,o)=>It(o.parentContext.parent,"text-size-selected",s.value)}"
|
|
83
|
+
></${i}>
|
|
84
|
+
`)}
|
|
85
|
+
</${e}>
|
|
86
|
+
`}},divider:{render:function(r){const e=r.tagFor($r.Divider);return O.html`
|
|
87
|
+
<${e} class="divider" orientation="vertical"></${e}>
|
|
88
|
+
`}}};var ws=Object.defineProperty,Ts=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=o(e,t,i)||i);return i&&ws(e,t,i),i};class Hr extends qr.Localized(O.VividElement){get#t(){return this.parentElement}#e=()=>{this.dispatchEvent(new CustomEvent("text-styles-changed",{detail:this.#t?.selectionStyles}))};connectedCallback(){super.connectedCallback(),this.#t.addEventListener("selection-changed",this.#e),this.#t.addEventListener("change",this.#e)}disconnectedCallback(){super.disconnectedCallback(),this.#t?.removeEventListener("selection-changed",this.#e),this.#t?.removeEventListener("change",this.#e)}}Ts([O.attr({attribute:"menu-items"})],Hr.prototype,"menuItems");const Ns=r=>gn.classNames("control",["hide-menubar",Ur(r).length===0]),Ds=["textBlock","textDecoration","textSize","divider"];function Es(r){return Kr[r].registerStateProperty}function As(r){return Kr[r].render}function Ur({menuItems:r}){return r?r.split(" ").filter(e=>Ds.includes(e)):[]}function vs(r){return()=>O.html`${Qt.repeat(Ur,O.html`${(e,{parent:t})=>(Es(e)?.(t),As(e)(r))}`)}`}const Ps=r=>O.html`<template class="${Ns}">
|
|
89
|
+
${vs(r)}
|
|
90
|
+
</template>`,Rs=":host{display:flex;align-items:center;background-color:var(--vvd-color-neutral-50);gap:4px}:host .hide-menubar{display:none}.title{--_text-primary-custom-size: var(--vvd-typography-heading-4)}.subtitle{--_text-primary-custom-size: var(--vvd-typography-base-extended)}.body{--_text-primary-custom-size: var(--vvd-typography-base)}.divider{height:28px}#text-block{width:104px}",Is=O.defineVividComponent("menubar",Hr,Ps,[Zt.buttonDefinition,Lr.selectDefinition,ys.listboxOptionDefinition,Br.dividerDefinition,ft.tooltipDefinition,Fr.menuDefinition,Vr.menuItemDefinition],{styles:Rs,shadowOptions:{delegatesFocus:!0}});function A(r){this.content=r}A.prototype={constructor:A,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new A(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new A(t)},addToStart:function(r,e){return new A([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new A(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new A(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=A.from(r),r.size?new A(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=A.from(r),r.size?new A(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=A.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};A.from=function(r){if(r instanceof A)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new A(e)};function _r(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=_r(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function jr(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,n-=a;continue}if(!o.sameMarkup(l))return{a:t,b:n};if(o.isText&&o.text!=l.text){let c=0,h=Math.min(o.text.length,l.text.length);for(;c<h&&o.text[o.text.length-c-1]==l.text[l.text.length-c-1];)c++,t--,n--;return{a:t,b:n}}if(o.content.size||l.content.size){let c=jr(o.content,l.content,t-1,n-1);if(c)return c}t-=a,n-=a}}class y{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&n(a,i+l,s||null,o)!==!1&&a.content.size){let h=l+1;a.nodesBetween(Math.max(0,e-h),Math.min(a.content.size,t-h),n,i+h)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new y(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),n.push(l),i+=l.nodeSize),o=a}return new y(n,i)}cutByIndex(e,t){return e==t?y.empty:e==0&&t==this.content.length?this:new y(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new y(i,s)}addToStart(e){return new y([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new y(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return _r(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return jr(this,e,t,n)}findIndex(e){if(e==0)return ct(0,e);if(e==this.size)return ct(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?ct(t+1,s):ct(t,n);n=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return y.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new y(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return y.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new y(t||e,n)}static from(e){if(!e)return y.empty;if(e instanceof y)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new y([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}y.empty=new y([],0);const zt={index:0,offset:0};function ct(r,e){return zt.index=r,zt.offset=e,zt}function gt(r,e){if(r===e)return!0;if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!gt(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!gt(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}class w{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&>(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return w.none;if(e instanceof w)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}}w.none=[];class yt extends Error{}class x{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=Yr(this.content,e+this.openStart,t);return n&&new x(n,this.openStart,this.openEnd)}removeBetween(e,t){return new x(Gr(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return x.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new x(y.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new x(e,n,i)}}x.empty=new x(y.empty,0,0);function Gr(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:l}=r.findIndex(t);if(i==e||s.isText){if(l!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Gr(s.content,e-i-1,t-i-1)))}function Yr(r,e,t,n){let{index:i,offset:s}=r.findIndex(e),o=r.maybeChild(i);if(s==e||o.isText)return r.cut(0,e).append(t).append(r.cut(e));let l=Yr(o.content,e-s-1,t);return l&&r.replaceChild(i,o.copy(l))}function zs(r,e,t){if(t.openStart>r.depth)throw new yt("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new yt("Inconsistent open depths");return Xr(r,e,t,0)}function Xr(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Xr(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,l=o.content;return Ce(o,l.cut(0,r.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=Bs(t,r);return Ce(s,Qr(r,o,l,e,n))}else return Ce(s,xt(r,e,n))}function Zr(r,e){if(!e.type.compatibleContent(r.type))throw new yt("Cannot join "+e.type.name+" onto "+r.type.name)}function en(r,e,t){let n=r.node(t);return Zr(n,e.node(t)),n}function Me(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function je(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(Me(r.nodeAfter,n),s++));for(let l=s;l<o;l++)Me(i.child(l),n);e&&e.depth==t&&e.textOffset&&Me(e.nodeBefore,n)}function Ce(r,e){return r.type.checkContent(e),r.copy(e)}function Qr(r,e,t,n,i){let s=r.depth>i&&en(r,e,i+1),o=n.depth>i&&en(t,n,i+1),l=[];return je(null,r,i,l),s&&o&&e.index(i)==t.index(i)?(Zr(s,o),Me(Ce(s,Qr(r,e,t,n,i+1)),l)):(s&&Me(Ce(s,xt(r,e,i+1)),l),je(e,t,i,l),o&&Me(Ce(o,xt(t,n,i+1)),l)),je(n,null,i,l),new y(l)}function xt(r,e,t){let n=[];if(je(null,r,t,n),r.depth>t){let i=en(r,e,t+1);Me(Ce(i,xt(r,e,t+1)),n)}return je(e,null,t,n),new y(n)}function Bs(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(y.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class Xe{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return w.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let l=n;n=i,i=l}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Ls(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(n.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new Xe(t,n,s)}static resolveCached(e,t){let n=zn.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else zn.set(e,n=new Fs);let i=n.elts[n.i]=Xe.resolve(e,t);return n.i=(n.i+1)%Vs,i}}class Fs{constructor(){this.elts=[],this.i=0}}const Vs=12,zn=new WeakMap;class Ls{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const $s=Object.create(null);class Z{constructor(e,t,n,i=w.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||y.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,i=0){this.content.nodesBetween(e,t,n,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,i){return this.content.textBetween(e,t,n,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&>(this.attrs,t||e.defaultAttrs||$s)&&w.sameSet(this.marks,n||w.none)}copy(e=null){return e==this.content?this:new Z(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Z(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return x.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new x(c,i.depth-o,s.depth-o)}replace(e,t,n){return zs(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return Xe.resolveCached(this,e)}resolveNoCache(e){return Xe.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.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 e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ei(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=y.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=w.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!w.sameSet(e,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 e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=y.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}}Z.prototype.text=void 0;class bt extends Z{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ei(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new bt(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new bt(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ei(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class Te{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new qs(e,t);if(n.next==null)return Te.empty;let i=ti(n);n.next&&n.err("Unexpected trailing text");let s=js(_s(i));return Gs(s,n),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let i=[this];function s(o,l){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return y.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:h,next:f}=o.next[c];if(!(h.isText||h.hasRequiredAttrs())&&i.indexOf(f)==-1){i.push(f);let u=s(f,l.concat(h));if(u)return u}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(n.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
|
|
91
|
+
`)}}Te.empty=new Te(!0);class qs{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function ti(r){let e=[];do e.push(Ws(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Ws(r){let e=[];do e.push(Js(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Js(r){let e=Us(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=Ks(r,e);else break;return e}function Bn(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function Ks(r,e){let t=Bn(r),n=t;return r.eat(",")&&(r.next!="}"?n=Bn(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function Hs(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function Us(r){if(r.eat("(")){let e=ti(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=Hs(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function _s(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return n(l,a),i(s(o.expr,a),a),[n(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[n(a)]}else{if(o.type=="opt")return[n(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let h=t();i(s(o.expr,a),h),a=h}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let h=t();n(a,h),i(s(o.expr,a),h),a=h}return[n(a)]}else{if(o.type=="name")return[n(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ni(r,e){return e-r}function Fn(r,e){let t=[];return n(e),t.sort(ni);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&n(a)}}}function js(r){let e=Object.create(null);return t(Fn(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let h=0;h<i.length;h++)i[h][0]==l&&(c=i[h][1]);Fn(r,a).forEach(h=>{c||i.push([l,c=[]]),c.indexOf(h)==-1&&c.push(h)})})});let s=e[n.join(",")]=new Te(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(ni);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function Gs(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),n.indexOf(c)==-1&&n.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ri(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function ii(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function si(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${i}`);for(let i in r){let s=r[i];s.validate&&s.validate(e[i])}}function oi(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Xs(r,n,e[n]);return t}let Vn=class li{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=oi(e,n.attrs),this.defaultAttrs=ri(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Te.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ii(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Z(this,this.computeAttrs(e),y.from(t),w.setFrom(n))}createChecked(e=null,t,n){return t=y.from(t),this.checkContent(t),new Z(this,this.computeAttrs(e),t,w.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=y.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(y.empty,!0);return s?new Z(this,e,t.append(s),w.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){si(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:w.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new li(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function Ys(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class Xs{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Ys(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Nt{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=oi(e,i.attrs),this.excluded=null;let s=ri(this.attrs);this.instance=s?new w(this,s):null}create(e=null){return!e&&this.instance?this.instance:new w(this,ii(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new Nt(s,i++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){si(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ai{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=A.from(e.nodes),t.marks=A.from(e.marks||{}),this.nodes=Vn.compile(this.spec.nodes,this),this.marks=Nt.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=Te.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?Ln(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:Ln(this,o.split(" "))}this.nodeFromJSON=i=>Z.fromJSON(this,i),this.markFromJSON=i=>w.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Vn){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new bt(n,n.defaultAttrs,e,w.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Ln(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let l in r.marks){let a=r.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Zs(r){return r.tag!=null}function Qs(r){return r.style!=null}class Fe{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>{if(Zs(i))this.tags.push(i);else if(Qs(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new qn(this,t,!1);return n.addAll(e,w.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new qn(this,t,!0);return n.addAll(e,w.none,t.from,t.to),x.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(no(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Wn(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Wn(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Fe(e,Fe.schemaRules(e)))}}const ci={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},eo={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hi={ol:!0,ul:!0},Ze=1,tn=2,dt=4;function $n(r,e,t){return e!=null?(e?Ze:0)|(e==="full"?tn:0):r&&r.whitespace=="pre"?Ze|tn:t&-5}class ht{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=w.none,this.match=s||(o&dt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(y.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ze)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=y.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(y.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ci.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class qn{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=$n(null,t.preserveWhitespace,0)|(n?dt:0);i?s=new ht(i.type,i.attrs,w.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new ht(null,null,w.none,!0,null,o):s=new ht(e.schema.topNodeType,null,w.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,s=i.options&tn?"full":this.localPreserveWS||(i.options&Ze)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)s!=="full"?n=n.replace(/\r?\n|\r/g," "):n=n.replace(/\r\n?/g,`
|
|
92
|
+
`);else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;hi.hasOwnProperty(o)&&this.parser.normalizeLists&&to(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,n));e:if(a?a.ignore:eo.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,h=this.needsBlock;if(ci.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),c&&this.sync(s),this.needsBlock=h}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
93
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let a=this.enter(o,t.attrs||null,n,t.preserveWhitespace);a&&(s=!0,n=a)}else{let a=this.parser.schema.marks[t.mark];n=n.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,n,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,n),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(n)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=w.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Jn(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=$n(e,s,o.options);o.options&dt&&o.content.length==0&&(l|=dt);let a=w.none;return n=n.filter(c=>(o.type?o.type.allowsMarkType(c.type):Jn(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new ht(e,t,a,i,null,l)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ze)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let i=n.length-1;i>=0;i--)e+=n[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let h=a>0||a==0&&i?this.nodes[a].type:n&&a>=s?n.node(a-s).type:null;if(!h||h.name!=c&&!h.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];if(n.isTextblock&&n.defaultAttrs)return n}}}function to(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&hi.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function no(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function Wn(r){let e={};for(let t in r)e[t]=r[t];return e}function Jn(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:h}=l.edge(a);if(c==e||s.indexOf(h)<0&&o(h))return!0}};if(o(i.contentMatch))return!0}}class Je{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=Bt(t).createDocumentFragment());let i=n,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let l=0,a=0;for(;l<s.length&&a<o.marks.length;){let c=o.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(s[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)i=s.pop()[1];for(;a<o.marks.length;){let c=o.marks[a++],h=this.serializeMark(c,o.isInline,t);h&&(s.push([c,i]),i.appendChild(h.dom),i=h.contentDOM||h.dom)}}i.appendChild(this.serializeNodeInner(o,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:i}=ut(Bt(t),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,i)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(n),n=s.dom)}return n}serializeMark(e,t,n={}){let i=this.marks[e.type.name];return i&&ut(Bt(n),i(e,t),null,e.attrs)}static renderSpec(e,t,n=null,i){return ut(e,t,n,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Je(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Kn(e.nodes);return t.text||(t.text=n=>n.text),t}static marksFromSchema(e){return Kn(e.marks)}}function Kn(r){let e={};for(let t in r){let n=r[t].spec.toDOM;n&&(e[t]=n)}return e}function Bt(r){return r.document||window.document}const Hn=new WeakMap;function ro(r){let e=Hn.get(r);return e===void 0&&Hn.set(r,e=io(r)),e}function io(r){let e=null;function t(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")e||(e=[]),e.push(n);else for(let i=0;i<n.length;i++)t(n[i]);else for(let i in n)t(n[i])}return t(r),e}function ut(r,e,t,n){if(typeof e=="string")return{dom:r.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(s=ro(n))&&s.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 o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?r.createElementNS(t,i):r.createElement(i),c=e[1],h=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){h=2;for(let f in c)if(c[f]!=null){let u=f.indexOf(" ");u>0?a.setAttributeNS(f.slice(0,u),f.slice(u+1),c[f]):f=="style"&&a.style?a.style.cssText=c[f]:a.setAttribute(f,c[f])}}for(let f=h;f<e.length;f++){let u=e[f];if(u===0){if(f<e.length-1||f>h)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:p,contentDOM:d}=ut(r,u,t,n);if(a.appendChild(p),d){if(l)throw new RangeError("Multiple content holes");l=d}}}return{dom:a,contentDOM:l}}const fi=65535,di=Math.pow(2,16);function so(r,e){return r+e*di}function Un(r){return r&fi}function oo(r){return(r-(r&fi))/di}const ui=1,pi=2,pt=4,mi=8;class nn{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&mi)>0}get deletedBefore(){return(this.delInfo&(ui|pt))>0}get deletedAfter(){return(this.delInfo&(pi|pt))>0}get deletedAcross(){return(this.delInfo&pt)>0}}class W{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&W.empty)return W.empty}recover(e){let t=0,n=Un(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+oo(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],h=this.ranges[l+o],f=a+c;if(e<=f){let u=c?e==a?-1:e==f?1:t:t,p=a+i+(u<0?0:h);if(n)return p;let d=e==(t<0?a:f)?null:so(l/3,e-a),m=e==a?pi:e==f?ui:pt;return(t<0?e!=a:e!=f)&&(m|=mi),new nn(p,m,d)}i+=h-c}return n?e+i:new nn(e+i,0,null)}touches(e,t){let n=0,i=Un(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?n:0);if(a>e)break;let c=this.ranges[l+s],h=a+c;if(e<=h&&l==i*3)return!0;n+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],h=this.ranges[i+n];e(l,l+c,a,a+h),s+=h-c}}invert(){return new W(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?W.empty:new W(e<0?[0,-e,0]:[0,0,e])}}W.empty=new W([]);class kt{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new kt(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new kt;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return n?e:new nn(e,i,null)}}const Ft=Object.create(null);class B{getMap(){return W.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=Ft[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in Ft)throw new RangeError("Duplicate use of step JSON ID "+e);return Ft[e]=t,t.prototype.jsonID=e,t}}class T{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new T(e,null)}static fail(e){return new T(null,e)}static fromReplace(e,t,n,i){try{return T.ok(e.replace(t,n,i))}catch(s){if(s instanceof yt)return T.fail(s.message);throw s}}}function yn(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(yn(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return y.fromArray(n)}class he extends B{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),i=n.node(n.sharedDepth(this.to)),s=new x(yn(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return T.fromReplace(e,this.from,this.to,s)}invert(){return new X(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new he(t.pos,n.pos,this.mark)}merge(e){return e instanceof he&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new he(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new he(t.from,t.to,e.markFromJSON(t.mark))}}B.jsonID("addMark",he);class X extends B{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new x(yn(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return T.fromReplace(e,this.from,this.to,n)}invert(){return new he(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new X(t.pos,n.pos,this.mark)}merge(e){return e instanceof X&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new X(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new X(t.from,t.to,e.markFromJSON(t.mark))}}B.jsonID("removeMark",X);class fe extends B{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return T.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return T.fromReplace(e,this.pos,this.pos+1,new x(y.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new fe(this.pos,t.marks[i]);return new fe(this.pos,this.mark)}}return new Ne(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new fe(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new fe(t.pos,e.markFromJSON(t.mark))}}B.jsonID("addNodeMark",fe);class Ne extends B{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return T.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return T.fromReplace(e,this.pos,this.pos+1,new x(y.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new fe(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ne(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ne(t.pos,e.markFromJSON(t.mark))}}B.jsonID("removeNodeMark",Ne);class I extends B{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&rn(e,this.from,this.to)?T.fail("Structure replace would overwrite content"):T.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new W([this.from,this.to-this.from,this.slice.size])}invert(e){return new I(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new I(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof I)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?x.empty:new x(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new I(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?x.empty:new x(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new I(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new I(t.from,t.to,x.fromJSON(e,t.slice),!!t.structure)}}B.jsonID("replace",I);class J extends B{constructor(e,t,n,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(rn(e,this.from,this.gapFrom)||rn(e,this.gapTo,this.to)))return T.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return T.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?T.fromReplace(e,this.from,this.to,n):T.fail("Content does not fit in gap")}getMap(){return new W([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new J(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new J(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new J(t.from,t.to,t.gapFrom,t.gapTo,x.fromJSON(e,t.slice),t.insert,!!t.structure)}}B.jsonID("replaceAround",J);function rn(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function lo(r,e,t,n){let i=[],s=[],o,l;r.doc.nodesBetween(e,t,(a,c,h)=>{if(!a.isInline)return;let f=a.marks;if(!n.isInSet(f)&&h.type.allowsMarkType(n.type)){let u=Math.max(c,e),p=Math.min(c+a.nodeSize,t),d=n.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(d)||(o&&o.to==u&&o.mark.eq(f[m])?o.to=p:i.push(o=new X(u,p,f[m])));l&&l.to==u?l.to=p:s.push(l=new he(u,p,n))}}),i.forEach(a=>r.step(a)),s.forEach(a=>r.step(a))}function ao(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(n instanceof Nt){let c=o.marks,h;for(;h=n.isInSet(c);)(a||(a=[])).push(h),c=h.removeFromSet(c)}else n?n.isInSet(o.marks)&&(a=[n]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let h=0;h<a.length;h++){let f=a[h],u;for(let p=0;p<i.length;p++){let d=i[p];d.step==s-1&&f.eq(i[p].style)&&(u=d)}u?(u.to=c,u.step=s):i.push({style:f,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>r.step(new X(o.from,o.to,o.style)))}function xn(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),h=l+c.nodeSize,f=n.matchType(c.type);if(!f)o.push(new I(l,h,x.empty));else{n=f;for(let u=0;u<c.marks.length;u++)t.allowsMarkType(c.marks[u].type)||r.step(new X(l,h,c.marks[u]));if(i&&c.isText&&t.whitespace!="pre"){let u,p=/\r?\n|\r/g,d;for(;u=p.exec(c.text);)d||(d=new x(y.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new I(l+u.index,l+u.index+u[0].length,d))}}l=h}if(!n.validEnd){let a=n.fillBefore(y.empty,!0);r.replace(l,l,new x(a,0,0))}for(let a=o.length-1;a>=0;a--)r.step(o[a])}function co(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function bn(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth;;--n){let i=r.$from.node(n),s=r.$from.index(n),o=r.$to.indexAfter(n);if(n<r.depth&&i.canReplace(s,o,t))return n;if(n==0||i.type.spec.isolating||!co(i,s,o))break}return null}function ho(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),l=i.after(s+1),a=o,c=l,h=y.empty,f=0;for(let d=s,m=!1;d>t;d--)m||n.index(d)>0?(m=!0,h=y.from(n.node(d).copy(h)),f++):a--;let u=y.empty,p=0;for(let d=s,m=!1;d>t;d--)m||i.after(d+1)<i.end(d)?(m=!0,u=y.from(i.node(d).copy(u)),p++):c++;r.step(new J(a,c,o,l,new x(h.append(u),f,p),h.size-f,!0))}function fo(r,e,t){let n=y.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let l=t[o].type.contentMatch.matchFragment(n);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=y.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new J(i,s,i,s,new x(n,0,0),t.length,!0))}function uo(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,a)&&po(r.doc,r.mapping.slice(s).map(l),n)){let c=null;if(n.schema.linebreakReplacement){let p=n.whitespace=="pre",d=!!n.contentMatch.matchType(n.schema.linebreakReplacement);p&&!d?c=!1:!p&&d&&(c=!0)}c===!1&&yi(r,o,l,s),xn(r,r.mapping.slice(s).map(l,1),n,void 0,c===null);let h=r.mapping.slice(s),f=h.map(l,1),u=h.map(l+o.nodeSize,1);return r.step(new J(f,u,f+1,u-1,new x(y.from(n.create(a,null,o.marks)),0,0),1,!0)),c===!0&&gi(r,o,l,s),!1}})}function gi(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function yi(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
|
|
94
|
+
`))}})}function po(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function mo(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new J(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new x(y.from(o),0,0),1,!0))}function mt(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,h=t-2;c>s;c--,h--){let f=i.node(c),u=i.index(c);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(u,f.childCount),d=n&&n[h+1];d&&(p=p.replaceChild(0,d.type.create(d.attrs)));let m=n&&n[h]||f;if(!f.canReplace(u+1,f.childCount)||!m.type.validContent(p))return!1}let l=i.indexAfter(s),a=n&&n[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function go(r,e,t=1,n){let i=r.doc.resolve(e),s=y.empty,o=y.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=y.from(i.node(l).copy(s));let h=n&&n[c];o=y.from(h?h.type.create(h.attrs,o):i.node(l).copy(o))}r.step(new I(e,e,new x(s.append(o),t,t),!0))}function xi(r,e){let t=r.resolve(e),n=t.index();return xo(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function yo(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:n}=r.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==n?r.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!r.type.allowsMarks(s.marks))return!1}return t.validEnd}function xo(r,e){return!!(r&&e&&!r.isLeaf&&yo(r,e))}function bo(r,e,t){let n=null,{linebreakReplacement:i}=r.doc.type.schema,s=r.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let h=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);h&&!f?n=!1:!h&&f&&(n=!0)}let l=r.steps.length;if(n===!1){let h=r.doc.resolve(e+t);yi(r,h.node(),h.before(),l)}o.inlineContent&&xn(r,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let a=r.mapping.slice(l),c=a.map(e-t);if(r.step(new I(c,a.map(e+t,-1),x.empty,!0)),n===!0){let h=r.doc.resolve(c);gi(r,h.node(),h.before(),r.steps.length)}return r}function ko(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function So(r,e,t){let n=r.resolve(e);if(!t.content.size)return e;let i=t.content;for(let s=0;s<t.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let o=n.depth;o>=0;o--){let l=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,a=n.index(o)+(l>0?1:0),c=n.node(o),h=!1;if(s==1)h=c.canReplace(a,a,i);else{let f=c.contentMatchAt(a).findWrapping(i.firstChild.type);h=f&&c.canReplaceWith(a,a,f[0])}if(h)return l==0?n.pos:l<0?n.before(o+1):n.after(o+1)}return null}function kn(r,e,t=e,n=x.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return bi(i,s,n)?new I(e,t,n):new Mo(i,s,n).fit()}function bi(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class Mo{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=y.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=y.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new x(s,o,l);return e>-1?new J(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new I(n.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=Vt(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],h,f=null;if(t==1&&(o?c.matchType(o.type)||(f=c.fillBefore(y.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:l,parent:s,inject:f};if(t==2&&o&&(h=c.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:l,parent:s,wrap:h};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=Vt(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new x(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=Vt(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new x(He(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new x(He(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=n?n.content:o.content,a=o.openStart-e,c=0,h=[],{match:f,type:u}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)h.push(i.child(m));f=f.matchFragment(i)}let p=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),g=f.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(f=g,h.push(ki(m.mark(u.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?p:-1)))}let d=c==l.childCount;d||(p=-1),this.placed=Ue(this.placed,t,y.from(h)),this.frontier[t].match=f,d&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<p;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=d?e==0?x.empty:new x(He(o.content,e-1,1),e-1,p<0?o.openEnd:e-1):new x(He(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Lt(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=Lt(e,t,i,n,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],h=Lt(e,l,c,a,!0);if(!h||h.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ue(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ue(this.placed,this.depth,y.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(y.empty,!0);t.childCount&&(this.placed=Ue(this.placed,this.frontier.length,t))}}function He(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.firstChild.copy(He(r.firstChild.content,e-1,t)))}function Ue(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(Ue(r.lastChild.content,e-1,t)))}function Vt(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function ki(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,ki(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(y.empty,!0)))),r.copy(n)}function Lt(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=n.fillBefore(s.content,!0,o);return l&&!Co(t,s.content,o)?l:null}function Co(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function Oo(r){return r.spec.defining||r.spec.definingForContent}function wo(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(bi(i,s,n))return r.step(new I(e,t,n));let o=Mi(i,r.doc.resolve(t));o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let u=i.depth,p=i.pos-1;u>0;u--,p--){let d=i.node(u).type.spec;if(d.defining||d.definingAsContext||d.isolating)break;o.indexOf(u)>-1?l=u:i.before(u)==p&&o.splice(1,0,-u)}let a=o.indexOf(l),c=[],h=n.openStart;for(let u=n.content,p=0;;p++){let d=u.firstChild;if(c.push(d),p==n.openStart)break;u=d.content}for(let u=h-1;u>=0;u--){let p=c[u],d=Oo(p.type);if(d&&!p.sameMarkup(i.node(Math.abs(l)-1)))h=u;else if(d||!p.type.isTextblock)break}for(let u=n.openStart;u>=0;u--){let p=(u+h+1)%(n.openStart+1),d=c[p];if(d)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],b=!0;g<0&&(b=!1,g=-g);let N=i.node(g-1),H=i.index(g-1);if(N.canReplaceWith(H,H,d.type,d.marks))return r.replace(i.before(g),b?s.after(g):t,new x(Si(n.content,0,n.openStart,p),p,n.openEnd))}}let f=r.steps.length;for(let u=o.length-1;u>=0&&(r.replace(e,t,n),!(r.steps.length>f));u--){let p=o[u];p<0||(e=i.before(p),t=s.after(p))}}function Si(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(Si(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(y.empty,!0))}return r}function To(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=ko(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new x(y.from(n),0,0))}function No(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t),s=Mi(n,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||n.node(l).type.contentMatch.validEnd)return r.delete(n.start(l),i.end(l));if(l>0&&(a||n.node(l-1).canReplace(n.index(l-1),i.indexAfter(l-1))))return r.delete(n.before(l),i.after(l))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return r.delete(n.before(o),t);r.delete(e,t)}function Mi(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class ze extends B{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return T.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return T.fromReplace(e,this.pos,this.pos+1,new x(y.from(i),0,t.isLeaf?0:1))}getMap(){return W.empty}invert(e){return new ze(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ze(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ze(t.pos,t.attr,t.value)}}B.jsonID("attr",ze);class Qe extends B{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return T.ok(n)}getMap(){return W.empty}invert(e){return new Qe(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qe(t.attr,t.value)}}B.jsonID("docAttr",Qe);let Ve=class extends Error{};Ve=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t};Ve.prototype=Object.create(Error.prototype);Ve.prototype.constructor=Ve;Ve.prototype.name="TransformError";class Do{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new kt}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ve(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=x.empty){let i=kn(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new x(y.from(n),0,0))}delete(e,t){return this.replace(e,t,x.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return wo(this,e,t,n),this}replaceRangeWith(e,t,n){return To(this,e,t,n),this}deleteRange(e,t){return No(this,e,t),this}lift(e,t){return ho(this,e,t),this}join(e,t=1){return bo(this,e,t),this}wrap(e,t){return fo(this,e,t),this}setBlockType(e,t=e,n,i=null){return uo(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return mo(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new ze(e,t,n)),this}setDocAttribute(e,t){return this.step(new Qe(e,t)),this}addNodeMark(e,t){return this.step(new fe(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof w)t.isInSet(n.marks)&&this.step(new Ne(e,t));else{let i=n.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new Ne(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,n){return go(this,e,t,n),this}addMark(e,t,n){return lo(this,e,t,n),this}removeMark(e,t,n){return ao(this,e,t,n),this}clearIncompatible(e,t,n){return xn(this,e,t,n),this}}const $t=Object.create(null);class C{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Eo(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=x.empty){let n=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],h=e.mapping.slice(s);e.replaceRange(h.map(a.pos),h.map(c.pos),l?x.empty:t),l==0&&Gn(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(n),c=a.map(o.pos),h=a.map(l.pos);s?e.deleteRange(c,h):(e.replaceRangeWith(c,h,t),Gn(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new M(e):Pe(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?Pe(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):Pe(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new K(e.node(0))}static atStart(e){return Pe(e,e,0,0,1)||new K(e)}static atEnd(e){return Pe(e,e,e.content.size,e.childCount,-1)||new K(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=$t[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in $t)throw new RangeError("Duplicate use of selection JSON ID "+e);return $t[e]=t,t.prototype.jsonID=e,t}getBookmark(){return M.between(this.$anchor,this.$head).getBookmark()}}C.prototype.visible=!0;class Eo{constructor(e,t){this.$from=e,this.$to=t}}let _n=!1;function jn(r){!_n&&!r.parent.inlineContent&&(_n=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class M extends C{constructor(e,t=e){jn(e),jn(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return C.near(n);let i=e.resolve(t.map(this.anchor));return new M(i.parent.inlineContent?i:n,n)}replace(e,t=x.empty){if(super.replace(e,t),t==x.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof M&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Dt(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new M(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=C.findFrom(t,n,!0)||C.findFrom(t,-n,!0);if(s)t=s.$head;else return C.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(C.findFrom(e,-n,!0)||C.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new M(e,t)}}C.jsonID("text",M);class Dt{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Dt(e.map(this.anchor),e.map(this.head))}resolve(e){return M.between(e.resolve(this.anchor),e.resolve(this.head))}}class k extends C{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?C.near(s):new k(s)}content(){return new x(y.from(this.node),0,0)}eq(e){return e instanceof k&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Sn(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new k(e.resolve(t.anchor))}static create(e,t){return new k(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}k.prototype.visible=!1;C.jsonID("node",k);class Sn{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Dt(n,n):new Sn(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&k.isSelectable(n)?new k(t):C.near(t)}}class K extends C{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=x.empty){if(t==x.empty){e.delete(0,e.doc.content.size);let n=C.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new K(e)}map(e){return new K(e)}eq(e){return e instanceof K}getBookmark(){return Ao}}C.jsonID("all",K);const Ao={map(){return this},resolve(r){return new K(r)}};function Pe(r,e,t,n,i,s=!1){if(e.inlineContent)return M.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&k.isSelectable(l))return k.create(r,t-(i<0?l.nodeSize:0))}else{let a=Pe(r,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function Gn(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof I||i instanceof J))return;let s=r.mapping.maps[n],o;s.forEach((l,a,c,h)=>{o==null&&(o=h)}),r.setSelection(C.near(r.doc.resolve(o),t))}const Yn=1,Xn=2,Zn=4;class vo extends Do{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Yn)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Yn)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Xn,this}ensureMarks(e){return w.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Xn)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||w.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(n==null&&(n=t),n=n??t,!e)return this.deleteRange(t,n);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=n==t?o.marks():o.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,i.text(e,s)),this.selection.empty||this.setSelection(C.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Zn,this}get scrolledIntoView(){return(this.updated&Zn)>0}}function Qn(r,e){return!e||!r?r:r.bind(e)}class _e{constructor(e,t,n){this.name=e,this.init=Qn(t.init,n),this.apply=Qn(t.apply,n)}}const Po=[new _e("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new _e("selection",{init(r,e){return r.selection||C.atStart(e.doc)},apply(r){return r.selection}}),new _e("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new _e("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}})];class qt{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Po.slice(),t&&t.forEach(n=>{if(this.pluginsByKey[n.key])throw new RangeError("Adding different instances of a keyed plugin ("+n.key+")");this.plugins.push(n),this.pluginsByKey[n.key]=n,n.spec.state&&this.fields.push(new _e(n.key,n.spec.state,n))})}}class Ie{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let i=this.config.plugins[n];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let l=this.config.plugins[o];if(l.spec.appendTransaction){let a=i?i[o].n:0,c=i?i[o].state:this,h=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,c,n);if(h&&n.filterTransaction(h,o)){if(h.setMeta("appendedTransaction",e),!i){i=[];for(let f=0;f<this.config.plugins.length;f++)i.push(f<o?{state:n,n:t.length}:{state:this,n:0})}t.push(h),n=n.applyInner(h),s=!0}i&&(i[o]={state:n,n:t.length})}}if(!s)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ie(this.config),n=this.config.fields;for(let i=0;i<n.length;i++){let s=n[i];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new vo(this)}static create(e){let t=new qt(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new Ie(t);for(let i=0;i<t.fields.length;i++)n[t.fields[i].name]=t.fields[i].init(e,n);return n}reconfigure(e){let t=new qt(this.schema,e.plugins),n=t.fields,i=new Ie(t);for(let s=0;s<n.length;s++){let o=n[s].name;i[o]=this.hasOwnProperty(o)?this[o]:n[s].init(e,i)}return i}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(n=>n.toJSON())),e&&typeof e=="object")for(let n in e){if(n=="doc"||n=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[n],s=i.spec.state;s&&s.toJSON&&(t[n]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new qt(e.schema,e.plugins),s=new Ie(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Z.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=C.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let l in n){let a=n[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}}function Ci(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=Ci(i,e,{})),t[n]=i}return t}class Mn{constructor(e){this.spec=e,this.props={},e.props&&Ci(e.props,this,this.props),this.key=e.key?e.key.key:Oi("plugin")}getState(e){return e[this.key]}}const Wt=Object.create(null);function Oi(r){return r in Wt?r+"$"+ ++Wt[r]:(Wt[r]=0,r+"$")}class Ro{constructor(e="key"){this.key=Oi(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const v=function(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e},Le=function(r){let e=r.assignedSlot||r.parentNode;return e&&e.nodeType==11?e.host:e};let sn=null;const ne=function(r,e,t){let n=sn||(sn=document.createRange());return n.setEnd(r,t??r.nodeValue.length),n.setStart(r,e||0),n},Io=function(){sn=null},De=function(r,e,t,n){return t&&(er(r,e,t,n,-1)||er(r,e,t,n,1))},zo=/^(img|br|input|textarea|hr)$/i;function er(r,e,t,n,i){for(var s;;){if(r==t&&e==n)return!0;if(e==(i<0?0:_(r))){let o=r.parentNode;if(!o||o.nodeType!=1||rt(r)||zo.test(r.nodeName)||r.contentEditable=="false")return!1;e=v(r)+(i<0?0:1),r=o}else if(r.nodeType==1){let o=r.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else r=o,e=i<0?_(r):0}else return!1}}function _(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Bo(r,e){for(;;){if(r.nodeType==3&&e)return r;if(r.nodeType==1&&e>0){if(r.contentEditable=="false")return null;r=r.childNodes[e-1],e=_(r)}else if(r.parentNode&&!rt(r))e=v(r),r=r.parentNode;else return null}}function Fo(r,e){for(;;){if(r.nodeType==3&&e<r.nodeValue.length)return r;if(r.nodeType==1&&e<r.childNodes.length){if(r.contentEditable=="false")return null;r=r.childNodes[e],e=0}else if(r.parentNode&&!rt(r))e=v(r)+1,r=r.parentNode;else return null}}function Vo(r,e,t){for(let n=e==0,i=e==_(r);n||i;){if(r==t)return!0;let s=v(r);if(r=r.parentNode,!r)return!1;n=n&&s==0,i=i&&s==_(r)}}function rt(r){let e;for(let t=r;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==r||e.contentDOM==r)}const Et=function(r){return r.focusNode&&De(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)};function be(r,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=r,t.key=t.code=e,t}function Lo(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function $o(r,e,t){if(r.caretPositionFromPoint)try{let n=r.caretPositionFromPoint(e,t);if(n)return{node:n.offsetNode,offset:Math.min(_(n.offsetNode),n.offset)}}catch{}if(r.caretRangeFromPoint){let n=r.caretRangeFromPoint(e,t);if(n)return{node:n.startContainer,offset:Math.min(_(n.startContainer),n.startOffset)}}}const Q=typeof navigator<"u"?navigator:null,tr=typeof document<"u"?document:null,ye=Q&&Q.userAgent||"",on=/Edge\/(\d+)/.exec(ye),wi=/MSIE \d/.exec(ye),ln=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ye),q=!!(wi||ln||on),ue=wi?document.documentMode:ln?+ln[1]:on?+on[1]:0,Y=!q&&/gecko\/(\d+)/i.test(ye);Y&&+(/Firefox\/(\d+)/.exec(ye)||[0,0])[1];const an=!q&&/Chrome\/(\d+)/.exec(ye),z=!!an,Ti=an?+an[1]:0,F=!q&&!!Q&&/Apple Computer/.test(Q.vendor),$e=F&&(/Mobile\/\w+/.test(ye)||!!Q&&Q.maxTouchPoints>2),U=$e||(Q?/Mac/.test(Q.platform):!1),qo=Q?/Win/.test(Q.platform):!1,ie=/Android \d/.test(ye),it=!!tr&&"webkitFontSmoothing"in tr.documentElement.style,Wo=it?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Jo(r){let e=r.defaultView&&r.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:r.documentElement.clientWidth,top:0,bottom:r.documentElement.clientHeight}}function te(r,e){return typeof r=="number"?r:r[e]}function Ko(r){let e=r.getBoundingClientRect(),t=e.width/r.offsetWidth||1,n=e.height/r.offsetHeight||1;return{left:e.left,right:e.left+r.clientWidth*t,top:e.top,bottom:e.top+r.clientHeight*n}}function nr(r,e,t){let n=r.someProp("scrollThreshold")||0,i=r.someProp("scrollMargin")||5,s=r.dom.ownerDocument;for(let o=t||r.dom;o;){if(o.nodeType!=1){o=Le(o);continue}let l=o,a=l==s.body,c=a?Jo(s):Ko(l),h=0,f=0;if(e.top<c.top+te(n,"top")?f=-(c.top-e.top+te(i,"top")):e.bottom>c.bottom-te(n,"bottom")&&(f=e.bottom-e.top>c.bottom-c.top?e.top+te(i,"top")-c.top:e.bottom-c.bottom+te(i,"bottom")),e.left<c.left+te(n,"left")?h=-(c.left-e.left+te(i,"left")):e.right>c.right-te(n,"right")&&(h=e.right-c.right+te(i,"right")),h||f)if(a)s.defaultView.scrollBy(h,f);else{let p=l.scrollLeft,d=l.scrollTop;f&&(l.scrollTop+=f),h&&(l.scrollLeft+=h);let m=l.scrollLeft-p,g=l.scrollTop-d;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let u=a?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u=="absolute"?o.offsetParent:Le(o)}}function Ho(r){let e=r.dom.getBoundingClientRect(),t=Math.max(0,e.top),n,i;for(let s=(e.left+e.right)/2,o=t+1;o<Math.min(innerHeight,e.bottom);o+=5){let l=r.root.elementFromPoint(s,o);if(!l||l==r.dom||!r.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){n=l,i=a.top;break}}return{refDOM:n,refTop:i,stack:Ni(r.dom)}}function Ni(r){let e=[],t=r.ownerDocument;for(let n=r;n&&(e.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),r!=t);n=Le(n));return e}function Uo({refDOM:r,refTop:e,stack:t}){let n=r?r.getBoundingClientRect().top:0;Di(t,n==0?0:n-e)}function Di(r,e){for(let t=0;t<r.length;t++){let{dom:n,top:i,left:s}=r[t];n.scrollTop!=i+e&&(n.scrollTop=i+e),n.scrollLeft!=s&&(n.scrollLeft=s)}}let Ae=null;function _o(r){if(r.setActive)return r.setActive();if(Ae)return r.focus(Ae);let e=Ni(r);r.focus(Ae==null?{get preventScroll(){return Ae={preventScroll:!0},!0}}:void 0),Ae||(Ae=!1,Di(e,0))}function Ei(r,e){let t,n=2e8,i,s=0,o=e.top,l=e.top,a,c;for(let h=r.firstChild,f=0;h;h=h.nextSibling,f++){let u;if(h.nodeType==1)u=h.getClientRects();else if(h.nodeType==3)u=ne(h).getClientRects();else continue;for(let p=0;p<u.length;p++){let d=u[p];if(d.top<=o&&d.bottom>=l){o=Math.max(d.bottom,o),l=Math.min(d.top,l);let m=d.left>e.left?d.left-e.left:d.right<e.left?e.left-d.right:0;if(m<n){t=h,n=m,i=m&&t.nodeType==3?{left:d.right<e.left?d.right:d.left,top:e.top}:e,h.nodeType==1&&m&&(s=f+(e.left>=(d.left+d.right)/2?1:0));continue}}else d.top>e.top&&!a&&d.left<=e.left&&d.right>=e.left&&(a=h,c={left:Math.max(d.left,Math.min(d.right,e.left)),top:d.top});!t&&(e.left>=d.right&&e.top>=d.top||e.left>=d.left&&e.top>=d.bottom)&&(s=f+1)}}return!t&&a&&(t=a,i=c,n=0),t&&t.nodeType==3?jo(t,i):!t||n&&t.nodeType==1?{node:r,offset:s}:Ei(t,i)}function jo(r,e){let t=r.nodeValue.length,n=document.createRange();for(let i=0;i<t;i++){n.setEnd(r,i+1),n.setStart(r,i);let s=le(n,1);if(s.top!=s.bottom&&Cn(e,s))return{node:r,offset:i+(e.left>=(s.left+s.right)/2?1:0)}}return{node:r,offset:0}}function Cn(r,e){return r.left>=e.left-1&&r.left<=e.right+1&&r.top>=e.top-1&&r.top<=e.bottom+1}function Go(r,e){let t=r.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<r.getBoundingClientRect().left?t:r}function Yo(r,e,t){let{node:n,offset:i}=Ei(e,t),s=-1;if(n.nodeType==1&&!n.firstChild){let o=n.getBoundingClientRect();s=o.left!=o.right&&t.left>(o.left+o.right)/2?1:-1}return r.docView.posFromDOM(n,i,s)}function Xo(r,e,t,n){let i=-1;for(let s=e,o=!1;s!=r.dom;){let l=r.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!o&&a.left>n.left||a.top>n.top?i=l.posBefore:(!o&&a.right<n.left||a.bottom<n.top)&&(i=l.posAfter),o=!0),!l.contentDOM&&i<0&&!l.node.isText))return(l.node.isBlock?n.top<(a.top+a.bottom)/2:n.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;s=l.dom.parentNode}return i>-1?i:r.docView.posFromDOM(e,t,-1)}function Ai(r,e,t){let n=r.childNodes.length;if(n&&t.top<t.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(e.top-t.top)/(t.bottom-t.top))-2)),s=i;;){let o=r.childNodes[s];if(o.nodeType==1){let l=o.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(Cn(e,c))return Ai(o,e,c)}}if((s=(s+1)%n)==i)break}return r}function Zo(r,e){let t=r.dom.ownerDocument,n,i=0,s=$o(t,e.left,e.top);s&&({node:n,offset:i}=s);let o=(r.root.elementFromPoint?r.root:t).elementFromPoint(e.left,e.top),l;if(!o||!r.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=r.dom.getBoundingClientRect();if(!Cn(e,c)||(o=Ai(r.dom,e,c),!o))return null}if(F)for(let c=o;n&&c;c=Le(c))c.draggable&&(n=void 0);if(o=Go(o,e),n){if(Y&&n.nodeType==1&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let h=n.childNodes[i],f;h.nodeName=="IMG"&&(f=h.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&i++}let c;it&&i&&n.nodeType==1&&(c=n.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,n==r.dom&&i==n.childNodes.length-1&&n.lastChild.nodeType==1&&e.top>n.lastChild.getBoundingClientRect().bottom?l=r.state.doc.content.size:(i==0||n.nodeType!=1||n.childNodes[i-1].nodeName!="BR")&&(l=Xo(r,n,i,e))}l==null&&(l=Yo(r,o,e));let a=r.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function rr(r){return r.top<r.bottom||r.left<r.right}function le(r,e){let t=r.getClientRects();if(t.length){let n=t[e<0?0:t.length-1];if(rr(n))return n}return Array.prototype.find.call(t,rr)||r.getBoundingClientRect()}const Qo=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function vi(r,e,t){let{node:n,offset:i,atom:s}=r.docView.domFromPos(e,t<0?-1:1),o=it||Y;if(n.nodeType==3)if(o&&(Qo.test(n.nodeValue)||(t<0?!i:i==n.nodeValue.length))){let a=le(ne(n,i,i),t);if(Y&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let c=le(ne(n,i-1,i-1),-1);if(c.top==a.top){let h=le(ne(n,i,i+1),-1);if(h.top!=a.top)return Ke(h,h.left<c.left)}}return a}else{let a=i,c=i,h=t<0?1:-1;return t<0&&!i?(c++,h=-1):t>=0&&i==n.nodeValue.length?(a--,h=1):t<0?a--:c++,Ke(le(ne(n,a,c),h),h<0)}if(!r.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==_(n))){let a=n.childNodes[i-1];if(a.nodeType==1)return Jt(a.getBoundingClientRect(),!1)}if(s==null&&i<_(n)){let a=n.childNodes[i];if(a.nodeType==1)return Jt(a.getBoundingClientRect(),!0)}return Jt(n.getBoundingClientRect(),t>=0)}if(s==null&&i&&(t<0||i==_(n))){let a=n.childNodes[i-1],c=a.nodeType==3?ne(a,_(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Ke(le(c,1),!1)}if(s==null&&i<_(n)){let a=n.childNodes[i];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?a.nodeType==3?ne(a,0,o?0:1):a.nodeType==1?a:null:null;if(c)return Ke(le(c,-1),!0)}return Ke(le(n.nodeType==3?ne(n):n,-t),t>=0)}function Ke(r,e){if(r.width==0)return r;let t=e?r.left:r.right;return{top:r.top,bottom:r.bottom,left:t,right:t}}function Jt(r,e){if(r.height==0)return r;let t=e?r.top:r.bottom;return{top:t,bottom:t,left:r.left,right:r.right}}function Pi(r,e,t){let n=r.state,i=r.root.activeElement;n!=e&&r.updateState(e),i!=r.dom&&r.focus();try{return t()}finally{n!=e&&r.updateState(n),i!=r.dom&&i&&i.focus()}}function el(r,e,t){let n=e.selection,i=t=="up"?n.$from:n.$to;return Pi(r,e,()=>{let{node:s}=r.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=r.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=vi(r,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=ne(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let h=a[c];if(h.bottom>h.top+1&&(t=="up"?o.top-h.top>(h.bottom-o.top)*2:h.bottom-o.bottom>(o.bottom-h.top)*2))return!1}}return!0})}const tl=/[\u0590-\u08ac]/;function nl(r,e,t){let{$head:n}=e.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=!i,o=i==n.parent.content.size,l=r.domSelection();return l?!tl.test(n.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:Pi(r,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:h,anchorOffset:f}=r.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",t,"character");let p=n.depth?r.docView.domAfterPos(n.before()):r.dom,{focusNode:d,focusOffset:m}=r.domSelectionRange(),g=d&&!p.contains(d.nodeType==1?d:d.parentNode)||a==d&&c==m;try{l.collapse(h,f),a&&(a!=h||c!=f)&&l.extend&&l.extend(a,c)}catch{}return u!=null&&(l.caretBidiLevel=u),g}):n.pos==n.start()||n.pos==n.end()}let ir=null,sr=null,or=!1;function rl(r,e,t){return ir==e&&sr==t?or:(ir=e,sr=t,or=t=="up"||t=="down"?el(r,e,t):nl(r,e,t))}const G=0,lr=1,ke=2,ee=3;class st{constructor(e,t,n,i){this.parent=e,this.children=t,this.dom=n,this.contentDOM=i,this.dirty=G,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let i=this.children[t];if(i==e)return n;n+=i.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(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let s,o;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=t>v(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??n>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(n&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))n=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let i=this.children[t],s=n+i.size;if(n==e&&s!=n){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let l=i.children[o];if(l.size){i=l;break}}return i}if(e<s)return i.descAt(e-n-i.border);n=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,i=0;for(let s=0;n<this.children.length;n++){let o=this.children[n],l=s+o.size;if(l>e||o instanceof Ii){i=e-s;break}s=l}if(i)return this.children[n].domFromPos(i-this.children[n].border,t);for(let s;n&&!(s=this.children[n-1]).size&&s instanceof Ri&&s.side>=0;n--);if(t<=0){let s,o=!0;for(;s=n?this.children[n-1]:null,!(!s||s.dom.parentNode==this.contentDOM);n--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?v(s.dom)+1:0}}else{let s,o=!0;for(;s=n<this.children.length?this.children[n]:null,!(!s||s.dom.parentNode==this.contentDOM);n++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?v(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=n,l=0;;l++){let a=this.children[l],c=o+a.size;if(i==-1&&e<=c){let h=o+a.border;if(e>=h&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,h);e=o;for(let f=l;f>0;f--){let u=this.children[f-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){i=v(u.dom)+1;break}e-=u.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let h=l+1;h<this.children.length;h++){let f=this.children[h];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=v(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:e,to:t,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(t.nodeType!=1||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,i=!1){let s=Math.min(e,t),o=Math.max(e,t);for(let p=0,d=0;p<this.children.length;p++){let m=this.children[p],g=d+m.size;if(s>d&&o<g)return m.setSelection(e-d-m.border,t-d-m.border,n,i);d=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),h=n.domSelectionRange(),f=!1;if((Y||F)&&e==t){let{node:p,offset:d}=l;if(p.nodeType==3){if(f=!!(d&&p.nodeValue[d-1]==`
|
|
95
|
+
`),f&&d==p.nodeValue.length)for(let m=p,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(l=a={node:g.parentNode,offset:v(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=p.childNodes[d-1];f=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Y&&h.focusNode&&h.focusNode!=a.node&&h.focusNode.nodeType==1){let p=h.focusNode.childNodes[h.focusOffset];p&&p.contentEditable=="false"&&(i=!0)}if(!(i||f&&F)&&De(l.node,l.offset,h.anchorNode,h.anchorOffset)&&De(a.node,a.offset,h.focusNode,h.focusOffset))return;let u=!1;if((c.extend||e==t)&&!f){c.collapse(l.node,l.offset);try{e!=t&&c.extend(a.node,a.offset),u=!0}catch{}}if(!u){if(e>t){let d=l;l=a,a=d}let p=document.createRange();p.setEnd(a.node,a.offset),p.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,i=0;i<this.children.length;i++){let s=this.children[i],o=n+s.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let l=n+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==n||t==o?ke:lr,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ee:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ke:ee}n=o}this.dirty=ke}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?ke:lr;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Ri extends st{constructor(e,t,n,i){let s,o=t.type.toDOM;if(typeof o=="function"&&(o=o(n,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==G&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||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 il extends st{constructor(e,t,n,i){super(e,[],t,null),this.textDOM=n,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ee extends st{constructor(e,t,n,i,s){super(e,[],n,i),this.mark=t,this.spec=s}static create(e,t,n,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,n);return(!o||!o.dom)&&(o=Je.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Ee(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ee||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ee&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=G){let n=this.parent;for(;!n.node;)n=n.parent;n.dirty<this.dirty&&(n.dirty=this.dirty),this.dirty=G}}slice(e,t,n){let i=Ee.create(this.parent,this.mark,!0,n),s=this.children,o=this.size;t<o&&(s=hn(s,t,o,n)),e>0&&(s=hn(s,0,e,n));for(let l=0;l<s.length;l++)s[l].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class pe extends st{constructor(e,t,n,i,s,o,l,a,c){super(e,[],s,o),this.node=t,this.outerDeco=n,this.innerDeco=i,this.nodeDOM=l}static create(e,t,n,i,s,o){let l=s.nodeViews[t.type.name],a,c=l&&l(t,s,()=>{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},n,i),h=c&&c.dom,f=c&&c.contentDOM;if(t.isText){if(!h)h=document.createTextNode(t.text);else if(h.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else h||({dom:h,contentDOM:f}=Je.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&h.nodeName!="BR"&&(h.hasAttribute("contenteditable")||(h.contentEditable="false"),t.type.spec.draggable&&(h.draggable=!0));let u=h;return h=Fi(h,n,t),c?a=new sl(e,t,n,i,h,f||null,u,c,s,o+1):t.isText?new At(e,t,n,i,h,u,s):new pe(e,t,n,i,h,f||null,u,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>y.empty)}return e}matchesNode(e,t,n){return this.dirty==G&&e.eq(this.node)&&St(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new ll(this,o&&o.node,e);hl(this.node,this.innerDeco,(c,h,f)=>{c.spec.marks?a.syncToMarks(c.spec.marks,n,e):c.type.side>=0&&!f&&a.syncToMarks(h==this.node.childCount?w.none:this.node.child(h).marks,n,e),a.placeWidget(c,e,i)},(c,h,f,u)=>{a.syncToMarks(c.marks,n,e);let p;a.findNodeMatch(c,h,f,u)||l&&e.state.selection.from>i&&e.state.selection.to<i+c.nodeSize&&(p=a.findIndexWithChild(s.node))>-1&&a.updateNodeAt(c,h,f,p,e)||a.updateNextNode(c,h,f,e,u,i)||a.addNode(c,h,f,e,i),i+=c.nodeSize}),a.syncToMarks([],n,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ke)&&(o&&this.protectLocalComposition(e,o),zi(this.contentDOM,this.children,e),$e&&fl(this.dom))}localCompositionInfo(e,t){let{from:n,to:i}=e.state.selection;if(!(e.state.selection instanceof M)||n<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=dl(this.node.content,o,n-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new il(this,s,t,i);e.input.compositionNodes.push(o),this.children=hn(this.children,n,n+i.length,e,o)}update(e,t,n,i){return this.dirty==ee||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,i),!0)}updateInner(e,t,n,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=G}updateOuterDeco(e){if(St(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Bi(this.dom,this.nodeDOM,cn(this.outerDeco,this.node,t),cn(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ar(r,e,t,n,i){Fi(n,e,r);let s=new pe(void 0,r,e,t,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class At extends pe{constructor(e,t,n,i,s,o,l){super(e,t,n,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,i){return this.dirty==ee||this.dirty!=G&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=G||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=G,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,n){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new At(this.parent,i,this.outerDeco,this.innerDeco,s,s,n)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ee)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ii extends st{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==G&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class sl extends pe{constructor(e,t,n,i,s,o,l,a,c,h){super(e,t,n,i,s,o,l,c,h),this.spec=a}update(e,t,n,i){if(this.dirty==ee)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,n);return s&&this.updateInner(e,t,n,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,n,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,i){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function zi(r,e,t){let n=r.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],l=o.dom;if(l.parentNode==r){for(;l!=n;)n=cr(n),i=!0;n=n.nextSibling}else i=!0,r.insertBefore(l,n);if(o instanceof Ee){let a=n?n.previousSibling:r.lastChild;zi(o.contentDOM,o.children,t),n=a?a.nextSibling:r.firstChild}}for(;n;)n=cr(n),i=!0;i&&t.trackWrites==r&&(t.trackWrites=null)}const Ge=function(r){r&&(this.nodeName=r)};Ge.prototype=Object.create(null);const Se=[new Ge];function cn(r,e,t){if(r.length==0)return Se;let n=t?Se[0]:new Ge,i=[n];for(let s=0;s<r.length;s++){let o=r[s].type.attrs;if(o){o.nodeName&&i.push(n=new Ge(o.nodeName));for(let l in o){let a=o[l];a!=null&&(t&&i.length==1&&i.push(n=new Ge(e.isInline?"span":"div")),l=="class"?n.class=(n.class?n.class+" ":"")+a:l=="style"?n.style=(n.style?n.style+";":"")+a:l!="nodeName"&&(n[l]=a))}}}return i}function Bi(r,e,t,n){if(t==Se&&n==Se)return e;let i=e;for(let s=0;s<n.length;s++){let o=n[s],l=t[s];if(s){let a;l&&l.nodeName==o.nodeName&&i!=r&&(a=i.parentNode)&&a.nodeName.toLowerCase()==o.nodeName||(a=document.createElement(o.nodeName),a.pmIsDeco=!0,a.appendChild(i),l=Se[0]),i=a}ol(i,l||Se[0],o)}return i}function ol(r,e,t){for(let n in e)n!="class"&&n!="style"&&n!="nodeName"&&!(n in t)&&r.removeAttribute(n);for(let n in t)n!="class"&&n!="style"&&n!="nodeName"&&t[n]!=e[n]&&r.setAttribute(n,t[n]);if(e.class!=t.class){let n=e.class?e.class.split(" ").filter(Boolean):[],i=t.class?t.class.split(" ").filter(Boolean):[];for(let s=0;s<n.length;s++)i.indexOf(n[s])==-1&&r.classList.remove(n[s]);for(let s=0;s<i.length;s++)n.indexOf(i[s])==-1&&r.classList.add(i[s]);r.classList.length==0&&r.removeAttribute("class")}if(e.style!=t.style){if(e.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=n.exec(e.style);)r.style.removeProperty(i[1])}t.style&&(r.style.cssText+=t.style)}}function Fi(r,e,t){return Bi(r,r,Se,cn(e,t,r.nodeType!=1))}function St(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].type.eq(e[t].type))return!1;return!0}function cr(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class ll{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=al(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let i=0,s=this.stack.length>>1,o=Math.min(s,e.length);for(;i<o&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=G,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let l=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let c=this.top.children[a];if(c.matchesMark(e[s])&&!this.isLocked(c.dom)){l=a;break}}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=Ee.create(this.top,e[s],t,n);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,n,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,t,n)&&!this.preMatch.matched.has(c)){s=l;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,t,n,i,s){let o=this.top.children[i];return o.dirty==ee&&o.dom==o.contentDOM&&(o.dirty=ke),o.update(e,t,n,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let n=e.pmViewDesc;if(n){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==n)return i}return-1}e=t}}updateNextNode(e,t,n,i,s,o){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof pe){let c=this.preMatch.matched.get(a);if(c!=null&&c!=s)return!1;let h=a.dom,f,u=this.isLocked(h)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=ee&&St(t,a.outerDeco));if(!u&&a.update(e,t,n,i))return this.destroyBetween(this.index,l),a.dom!=h&&(this.changed=!0),this.index++,!0;if(!u&&(f=this.recreateWrapper(a,e,t,n,i,o)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=ke,f.updateChildren(i,o+1),f.dirty=G),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,i,s,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!St(n,e.outerDeco)||!i.eq(e.innerDeco))return null;let l=pe.create(this.top,t,n,i,s,o);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,n,i,s){let o=pe.create(this.top,e,t,n,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new Ri(this.top,e,t,n);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ee;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof At)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((F||z)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);e=="IMG"&&(n.className="ProseMirror-separator",n.alt=""),e=="BR"&&(n.className="ProseMirror-trailingBreak");let i=new Ii(this.top,[],n,null);t!=this.top?t.children.push(i):t.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function al(r,e){let t=e,n=t.children.length,i=r.childCount,s=new Map,o=[];e:for(;i>0;){let l;for(;;)if(n){let c=t.children[n-1];if(c instanceof Ee)t=c,n=c.children.length;else{l=c,n--;break}}else{if(t==e)break e;n=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=r.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function cl(r,e){return r.type.side-e.type.side}function hl(r,e,t,n){let i=e.locals(r),s=0;if(i.length==0){for(let c=0;c<r.childCount;c++){let h=r.child(c);n(h,i,e.forChild(s,h),c),s+=h.nodeSize}return}let o=0,l=[],a=null;for(let c=0;;){let h,f;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(h?(f||(f=[h])).push(g):h=g)}if(h)if(f){f.sort(cl);for(let g=0;g<f.length;g++)t(f[g],c,!!a)}else t(h,c,!!a);let u,p;if(a)p=-1,u=a,a=null;else if(c<r.childCount)p=c,u=r.child(c++);else break;for(let g=0;g<l.length;g++)l[g].to<=s&&l.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)l.push(i[o++]);let d=s+u.nodeSize;if(u.isText){let g=d;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<l.length;b++)l[b].to<g&&(g=l[b].to);g<d&&(a=u.cut(g-s),u=u.cut(0,g-s),d=g,p=-1)}else for(;o<i.length&&i[o].to<d;)o++;let m=u.isInline&&!u.isLeaf?l.filter(g=>!g.inline):l.slice();n(u,m,e.forChild(s,u),p),s=d}}function fl(r){if(r.nodeName=="UL"||r.nodeName=="OL"){let e=r.style.cssText;r.style.cssText=e+"; list-style: square !important",window.getComputedStyle(r).listStyle,r.style.cssText=e}}function dl(r,e,t,n){for(let i=0,s=0;i<r.childCount&&s<=n;){let o=r.child(i++),l=s;if(s+=o.nodeSize,!o.isText)continue;let a=o.text;for(;i<r.childCount;){let c=r.child(i++);if(s+=c.nodeSize,!c.isText)break;a+=c.text}if(s>=t){if(s>=n&&a.slice(n-e.length-l,n-l)==e)return n-e.length;let c=l<n?a.lastIndexOf(e,n-l-1):-1;if(c>=0&&c+e.length+l>=t)return l+c;if(t==n&&a.length>=n+e.length-l&&a.slice(n-l,n-l+e.length)==e)return n}}return-1}function hn(r,e,t,n,i){let s=[];for(let o=0,l=0;o<r.length;o++){let a=r[o],c=l,h=l+=a.size;c>=t||h<=e?s.push(a):(c<e&&s.push(a.slice(0,e-c,n)),i&&(s.push(i),i=void 0),h>t&&s.push(a.slice(t-c,a.size,n)))}return s}function On(r,e=null){let t=r.domSelectionRange(),n=r.state.doc;if(!t.focusNode)return null;let i=r.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=r.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=n.resolve(o),a,c;if(Et(t)){for(a=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&k.isSelectable(f)&&i.parent&&!(f.isInline&&Vo(t.focusNode,t.focusOffset,i.dom))){let u=i.posBefore;c=new k(o==u?l:n.resolve(u))}}else{if(t instanceof r.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=o,u=o;for(let p=0;p<t.rangeCount;p++){let d=t.getRangeAt(p);f=Math.min(f,r.docView.posFromDOM(d.startContainer,d.startOffset,1)),u=Math.max(u,r.docView.posFromDOM(d.endContainer,d.endOffset,-1))}if(f<0)return null;[a,o]=u==r.state.selection.anchor?[u,f]:[f,u],l=n.resolve(o)}else a=r.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let h=n.resolve(a);if(!c){let f=e=="pointer"||r.state.selection.head<l.pos&&!s?1:-1;c=wn(r,h,l,f)}return c}function Vi(r){return r.editable?r.hasFocus():$i(r)&&document.activeElement&&document.activeElement.contains(r.dom)}function se(r,e=!1){let t=r.state.selection;if(Li(r,t),!!Vi(r)){if(!e&&r.input.mouseDown&&r.input.mouseDown.allowDefault&&z){let n=r.domSelectionRange(),i=r.domObserver.currentSelection;if(n.anchorNode&&i.anchorNode&&De(n.anchorNode,n.anchorOffset,i.anchorNode,i.anchorOffset)){r.input.mouseDown.delayedSelectionSync=!0,r.domObserver.setCurSelection();return}}if(r.domObserver.disconnectSelection(),r.cursorWrapper)pl(r);else{let{anchor:n,head:i}=t,s,o;hr&&!(t instanceof M)&&(t.$from.parent.inlineContent||(s=fr(r,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(o=fr(r,t.to))),r.docView.setSelection(n,i,r,e),hr&&(s&&dr(s),o&&dr(o)),t.visible?r.dom.classList.remove("ProseMirror-hideselection"):(r.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&ul(r))}r.domObserver.setCurSelection(),r.domObserver.connectSelection()}}const hr=F||z&&Ti<63;function fr(r,e){let{node:t,offset:n}=r.docView.domFromPos(e,0),i=n<t.childNodes.length?t.childNodes[n]:null,s=n?t.childNodes[n-1]:null;if(F&&i&&i.contentEditable=="false")return Kt(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Kt(i);if(s)return Kt(s)}}function Kt(r){return r.contentEditable="true",F&&r.draggable&&(r.draggable=!1,r.wasDraggable=!0),r}function dr(r){r.contentEditable="false",r.wasDraggable&&(r.draggable=!0,r.wasDraggable=null)}function ul(r){let e=r.dom.ownerDocument;e.removeEventListener("selectionchange",r.input.hideSelectionGuard);let t=r.domSelectionRange(),n=t.anchorNode,i=t.anchorOffset;e.addEventListener("selectionchange",r.input.hideSelectionGuard=()=>{(t.anchorNode!=n||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",r.input.hideSelectionGuard),setTimeout(()=>{(!Vi(r)||r.state.selection.visible)&&r.dom.classList.remove("ProseMirror-hideselection")},20))})}function pl(r){let e=r.domSelection(),t=document.createRange();if(!e)return;let n=r.cursorWrapper.dom,i=n.nodeName=="IMG";i?t.setStart(n.parentNode,v(n)+1):t.setStart(n,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!r.state.selection.visible&&q&&ue<=11&&(n.disabled=!0,n.disabled=!1)}function Li(r,e){if(e instanceof k){let t=r.docView.descAt(e.from);t!=r.lastSelectedViewDesc&&(ur(r),t&&t.selectNode(),r.lastSelectedViewDesc=t)}else ur(r)}function ur(r){r.lastSelectedViewDesc&&(r.lastSelectedViewDesc.parent&&r.lastSelectedViewDesc.deselectNode(),r.lastSelectedViewDesc=void 0)}function wn(r,e,t,n){return r.someProp("createSelectionBetween",i=>i(r,e,t))||M.between(e,t,n)}function pr(r){return r.editable&&!r.hasFocus()?!1:$i(r)}function $i(r){let e=r.domSelectionRange();if(!e.anchorNode)return!1;try{return r.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(r.editable||r.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function ml(r){let e=r.docView.domFromPos(r.state.selection.anchor,0),t=r.domSelectionRange();return De(e.node,e.offset,t.anchorNode,t.anchorOffset)}function fn(r,e){let{$anchor:t,$head:n}=r.selection,i=e>0?t.max(n):t.min(n),s=i.parent.inlineContent?i.depth?r.doc.resolve(e>0?i.after():i.before()):null:i;return s&&C.findFrom(s,e)}function ae(r,e){return r.dispatch(r.state.tr.setSelection(e).scrollIntoView()),!0}function mr(r,e,t){let n=r.state.selection;if(n instanceof M)if(t.indexOf("s")>-1){let{$head:i}=n,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=r.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return ae(r,new M(n.$anchor,o))}else if(n.empty){if(r.endOfTextblock(e>0?"forward":"backward")){let i=fn(r.state,e);return i&&i instanceof k?ae(r,i):!1}else if(!(U&&t.indexOf("m")>-1)){let i=n.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=r.docView.descAt(l))&&!o.contentDOM?k.isSelectable(s)?ae(r,new k(e<0?r.state.doc.resolve(i.pos-s.nodeSize):i)):it?ae(r,new M(r.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(n instanceof k&&n.node.isInline)return ae(r,new M(e>0?n.$to:n.$from));{let i=fn(r.state,e);return i?ae(r,i):!1}}}function Mt(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ye(r,e){let t=r.pmViewDesc;return t&&t.size==0&&(e<0||r.nextSibling||r.nodeName!="BR")}function ve(r,e){return e<0?gl(r):yl(r)}function gl(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i,s,o=!1;for(Y&&t.nodeType==1&&n<Mt(t)&&Ye(t.childNodes[n],-1)&&(o=!0);;)if(n>0){if(t.nodeType!=1)break;{let l=t.childNodes[n-1];if(Ye(l,-1))i=t,s=--n;else if(l.nodeType==3)t=l,n=t.nodeValue.length;else break}}else{if(qi(t))break;{let l=t.previousSibling;for(;l&&Ye(l,-1);)i=t.parentNode,s=v(l),l=l.previousSibling;if(l)t=l,n=Mt(t);else{if(t=t.parentNode,t==r.dom)break;n=0}}}o?dn(r,t,n):i&&dn(r,i,s)}function yl(r){let e=r.domSelectionRange(),t=e.focusNode,n=e.focusOffset;if(!t)return;let i=Mt(t),s,o;for(;;)if(n<i){if(t.nodeType!=1)break;let l=t.childNodes[n];if(Ye(l,1))s=t,o=++n;else break}else{if(qi(t))break;{let l=t.nextSibling;for(;l&&Ye(l,1);)s=l.parentNode,o=v(l)+1,l=l.nextSibling;if(l)t=l,n=0,i=Mt(t);else{if(t=t.parentNode,t==r.dom)break;n=i=0}}}s&&dn(r,s,o)}function qi(r){let e=r.pmViewDesc;return e&&e.node&&e.node.isBlock}function xl(r,e){for(;r&&e==r.childNodes.length&&!rt(r);)e=v(r)+1,r=r.parentNode;for(;r&&e<r.childNodes.length;){let t=r.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=0}}function bl(r,e){for(;r&&!e&&!rt(r);)e=v(r),r=r.parentNode;for(;r&&e;){let t=r.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;r=t,e=r.childNodes.length}}function dn(r,e,t){if(e.nodeType!=3){let s,o;(o=xl(e,t))?(e=o,t=0):(s=bl(e,t))&&(e=s,t=s.nodeValue.length)}let n=r.domSelection();if(!n)return;if(Et(n)){let s=document.createRange();s.setEnd(e,t),s.setStart(e,t),n.removeAllRanges(),n.addRange(s)}else n.extend&&n.extend(e,t);r.domObserver.setCurSelection();let{state:i}=r;setTimeout(()=>{r.state==i&&se(r)},50)}function gr(r,e){let t=r.state.doc.resolve(e);if(!(z||qo)&&t.parent.inlineContent){let i=r.coordsAtPos(e);if(e>t.start()){let s=r.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<t.end()){let s=r.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(r.dom).direction=="rtl"?"rtl":"ltr"}function yr(r,e,t){let n=r.state.selection;if(n instanceof M&&!n.empty||t.indexOf("s")>-1||U&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=n;if(!i.parent.inlineContent||r.endOfTextblock(e<0?"up":"down")){let o=fn(r.state,e);if(o&&o instanceof k)return ae(r,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=n instanceof K?C.near(o,e):C.findFrom(o,e);return l?ae(r,l):!1}return!1}function xr(r,e){if(!(r.state.selection instanceof M))return!0;let{$head:t,$anchor:n,empty:i}=r.state.selection;if(!t.sameParent(n))return!0;if(!i)return!1;if(r.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=r.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),r.dispatch(o),!0}return!1}function br(r,e,t){r.domObserver.stop(),e.contentEditable=t,r.domObserver.start()}function kl(r){if(!F||r.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=r.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let n=e.firstChild;br(r,n,"true"),setTimeout(()=>br(r,n,"false"),20)}return!1}function Sl(r){let e="";return r.ctrlKey&&(e+="c"),r.metaKey&&(e+="m"),r.altKey&&(e+="a"),r.shiftKey&&(e+="s"),e}function Ml(r,e){let t=e.keyCode,n=Sl(e);if(t==8||U&&t==72&&n=="c")return xr(r,-1)||ve(r,-1);if(t==46&&!e.shiftKey||U&&t==68&&n=="c")return xr(r,1)||ve(r,1);if(t==13||t==27)return!0;if(t==37||U&&t==66&&n=="c"){let i=t==37?gr(r,r.state.selection.from)=="ltr"?-1:1:-1;return mr(r,i,n)||ve(r,i)}else if(t==39||U&&t==70&&n=="c"){let i=t==39?gr(r,r.state.selection.from)=="ltr"?1:-1:1;return mr(r,i,n)||ve(r,i)}else{if(t==38||U&&t==80&&n=="c")return yr(r,-1,n)||ve(r,-1);if(t==40||U&&t==78&&n=="c")return kl(r)||yr(r,1,n)||ve(r,1);if(n==(U?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Tn(r,e){r.someProp("transformCopied",p=>{e=p(e,r)});let t=[],{content:n,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&n.childCount==1&&n.firstChild.childCount==1;){i--,s--;let p=n.firstChild;t.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),n=p.content}let o=r.someProp("clipboardSerializer")||Je.fromSchema(r.state.schema),l=_i(),a=l.createElement("div");a.appendChild(o.serializeFragment(n,{document:l}));let c=a.firstChild,h,f=0;for(;c&&c.nodeType==1&&(h=Ui[c.nodeName.toLowerCase()]);){for(let p=h.length-1;p>=0;p--){let d=l.createElement(h[p]);for(;a.firstChild;)d.appendChild(a.firstChild);a.appendChild(d),f++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${f?` -${f}`:""} ${JSON.stringify(t)}`);let u=r.someProp("clipboardTextSerializer",p=>p(e,r))||e.content.textBetween(0,e.content.size,`
|
|
2
96
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
definition.registerRichTextEditor();
|
|
97
|
+
`);return{dom:a,text:u,slice:e}}function Wi(r,e,t,n,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(n||s||!t);if(a){if(r.someProp("transformPastedText",u=>{e=u(e,s||n,r)}),s)return e?new x(y.from(r.state.schema.text(e.replace(/\r\n?/g,`
|
|
98
|
+
`))),0,0):x.empty;let f=r.someProp("clipboardTextParser",u=>u(e,i,n,r));if(f)l=f;else{let u=i.marks(),{schema:p}=r.state,d=Je.fromSchema(p);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(d.serializeNode(p.text(m,u)))})}}else r.someProp("transformPastedHTML",f=>{t=f(t,r)}),o=Tl(t),it&&Nl(o);let c=o&&o.querySelector("[data-pm-slice]"),h=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let f=+h[3];f>0;f--){let u=o.firstChild;for(;u&&u.nodeType!=1;)u=u.nextSibling;if(!u)break;o=u}if(l||(l=(r.someProp("clipboardParser")||r.someProp("domParser")||Fe.fromSchema(r.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||h),context:i,ruleFromNode(u){return u.nodeName=="BR"&&!u.nextSibling&&u.parentNode&&!Cl.test(u.parentNode.nodeName)?{ignore:!0}:null}})),h)l=Dl(kr(l,+h[1],+h[2]),h[4]);else if(l=x.maxOpen(Ol(l.content,i),!0),l.openStart||l.openEnd){let f=0,u=0;for(let p=l.content.firstChild;f<l.openStart&&!p.type.spec.isolating;f++,p=p.firstChild);for(let p=l.content.lastChild;u<l.openEnd&&!p.type.spec.isolating;u++,p=p.lastChild);l=kr(l,f,u)}return r.someProp("transformPasted",f=>{l=f(l,r)}),l}const Cl=/^(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 Ol(r,e){if(r.childCount<2)return r;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(r.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Ki(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=Hi(o[o.length-1],s.length));let h=Ji(l,a);o.push(h),i=i.matchType(h.type),s=a}}),o)return y.from(o)}return r}function Ji(r,e,t=0){for(let n=e.length-1;n>=t;n--)r=e[n].create(null,y.from(r));return r}function Ki(r,e,t,n,i){if(i<r.length&&i<e.length&&r[i]==e[i]){let s=Ki(r,e,t,n.lastChild,i+1);if(s)return n.copy(n.content.replaceChild(n.childCount-1,s));if(n.contentMatchAt(n.childCount).matchType(i==r.length-1?t.type:r[i+1]))return n.copy(n.content.append(y.from(Ji(t,r,i+1))))}}function Hi(r,e){if(e==0)return r;let t=r.content.replaceChild(r.childCount-1,Hi(r.lastChild,e-1)),n=r.contentMatchAt(r.childCount).fillBefore(y.empty,!0);return r.copy(t.append(n))}function un(r,e,t,n,i,s){let o=e<0?r.firstChild:r.lastChild,l=o.content;return r.childCount>1&&(s=0),i<n-1&&(l=un(l,e,t,n,i+1,s)),i>=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(y.empty,!0))),r.replaceChild(e<0?0:r.childCount-1,o.copy(l))}function kr(r,e,t){return e<r.openStart&&(r=new x(un(r.content,-1,e,r.openStart,0,r.openEnd),e,r.openEnd)),t<r.openEnd&&(r=new x(un(r.content,1,t,r.openEnd,0,0),r.openStart,t)),r}const Ui={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Sr=null;function _i(){return Sr||(Sr=document.implementation.createHTMLDocument("title"))}let Ht=null;function wl(r){let e=window.trustedTypes;return e?(Ht||(Ht=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),Ht.createHTML(r)):r}function Tl(r){let e=/^(\s*<meta [^>]*>)*/.exec(r);e&&(r=r.slice(e[0].length));let t=_i().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(r),i;if((i=n&&Ui[n[1].toLowerCase()])&&(r=i.map(s=>"<"+s+">").join("")+r+i.map(s=>"</"+s+">").reverse().join("")),t.innerHTML=wl(r),i)for(let s=0;s<i.length;s++)t=t.querySelector(i[s])||t;return t}function Nl(r){let e=r.querySelectorAll(z?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let n=e[t];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(r.ownerDocument.createTextNode(" "),n)}}function Dl(r,e){if(!r.size)return r;let t=r.content.firstChild.type.schema,n;try{n=JSON.parse(e)}catch{return r}let{content:i,openStart:s,openEnd:o}=r;for(let l=n.length-2;l>=0;l-=2){let a=t.nodes[n[l]];if(!a||a.hasRequiredAttrs())break;i=y.from(a.create(n[l+1],i)),s++,o++}return new x(i,s,o)}const V={},L={},El={touchstart:!0,touchmove:!0};class Al{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.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function vl(r){for(let e in V){let t=V[e];r.dom.addEventListener(e,r.input.eventHandlers[e]=n=>{Rl(r,n)&&!Nn(r,n)&&(r.editable||!(n.type in L))&&t(r,n)},El[e]?{passive:!0}:void 0)}F&&r.dom.addEventListener("input",()=>null),pn(r)}function de(r,e){r.input.lastSelectionOrigin=e,r.input.lastSelectionTime=Date.now()}function Pl(r){r.domObserver.stop();for(let e in r.input.eventHandlers)r.dom.removeEventListener(e,r.input.eventHandlers[e]);clearTimeout(r.input.composingTimeout),clearTimeout(r.input.lastIOSEnterFallbackTimeout)}function pn(r){r.someProp("handleDOMEvents",e=>{for(let t in e)r.input.eventHandlers[t]||r.dom.addEventListener(t,r.input.eventHandlers[t]=n=>Nn(r,n))})}function Nn(r,e){return r.someProp("handleDOMEvents",t=>{let n=t[e.type];return n?n(r,e)||e.defaultPrevented:!1})}function Rl(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=r.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function Il(r,e){!Nn(r,e)&&V[e.type]&&(r.editable||!(e.type in L))&&V[e.type](r,e)}L.keydown=(r,e)=>{let t=e;if(r.input.shiftKey=t.keyCode==16||t.shiftKey,!Gi(r,t)&&(r.input.lastKeyCode=t.keyCode,r.input.lastKeyCodeTime=Date.now(),!(ie&&z&&t.keyCode==13)))if(t.keyCode!=229&&r.domObserver.forceFlush(),$e&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let n=Date.now();r.input.lastIOSEnter=n,r.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{r.input.lastIOSEnter==n&&(r.someProp("handleKeyDown",i=>i(r,be(13,"Enter"))),r.input.lastIOSEnter=0)},200)}else r.someProp("handleKeyDown",n=>n(r,t))||Ml(r,t)?t.preventDefault():de(r,"key")};L.keyup=(r,e)=>{e.keyCode==16&&(r.input.shiftKey=!1)};L.keypress=(r,e)=>{let t=e;if(Gi(r,t)||!t.charCode||t.ctrlKey&&!t.altKey||U&&t.metaKey)return;if(r.someProp("handleKeyPress",i=>i(r,t))){t.preventDefault();return}let n=r.state.selection;if(!(n instanceof M)||!n.$from.sameParent(n.$to)){let i=String.fromCharCode(t.charCode),s=()=>r.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!r.someProp("handleTextInput",o=>o(r,n.$from.pos,n.$to.pos,i,s))&&r.dispatch(s()),t.preventDefault()}};function vt(r){return{left:r.clientX,top:r.clientY}}function zl(r,e){let t=e.x-r.clientX,n=e.y-r.clientY;return t*t+n*n<100}function Dn(r,e,t,n,i){if(n==-1)return!1;let s=r.state.doc.resolve(n);for(let o=s.depth+1;o>0;o--)if(r.someProp(e,l=>o>s.depth?l(r,t,s.nodeAfter,s.before(o),i,!0):l(r,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function Be(r,e,t){if(r.focused||r.focus(),r.state.selection.eq(e))return;let n=r.state.tr.setSelection(e);n.setMeta("pointer",!0),r.dispatch(n)}function Bl(r,e){if(e==-1)return!1;let t=r.state.doc.resolve(e),n=t.nodeAfter;return n&&n.isAtom&&k.isSelectable(n)?(Be(r,new k(t)),!0):!1}function Fl(r,e){if(e==-1)return!1;let t=r.state.selection,n,i;t instanceof k&&(n=t.node);let s=r.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(k.isSelectable(l)){n&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(Be(r,k.create(r.state.doc,i)),!0):!1}function Vl(r,e,t,n,i){return Dn(r,"handleClickOn",e,t,n)||r.someProp("handleClick",s=>s(r,e,n))||(i?Fl(r,t):Bl(r,t))}function Ll(r,e,t,n){return Dn(r,"handleDoubleClickOn",e,t,n)||r.someProp("handleDoubleClick",i=>i(r,e,n))}function $l(r,e,t,n){return Dn(r,"handleTripleClickOn",e,t,n)||r.someProp("handleTripleClick",i=>i(r,e,n))||ql(r,t,n)}function ql(r,e,t){if(t.button!=0)return!1;let n=r.state.doc;if(e==-1)return n.inlineContent?(Be(r,M.create(n,0,n.content.size)),!0):!1;let i=n.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)Be(r,M.create(n,l+1,l+1+o.content.size));else if(k.isSelectable(o))Be(r,k.create(n,l));else continue;return!0}}function En(r){return Ct(r)}const ji=U?"metaKey":"ctrlKey";V.mousedown=(r,e)=>{let t=e;r.input.shiftKey=t.shiftKey;let n=En(r),i=Date.now(),s="singleClick";i-r.input.lastClick.time<500&&zl(t,r.input.lastClick)&&!t[ji]&&r.input.lastClick.button==t.button&&(r.input.lastClick.type=="singleClick"?s="doubleClick":r.input.lastClick.type=="doubleClick"&&(s="tripleClick")),r.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s,button:t.button};let o=r.posAtCoords(vt(t));o&&(s=="singleClick"?(r.input.mouseDown&&r.input.mouseDown.done(),r.input.mouseDown=new Wl(r,o,t,!!n)):(s=="doubleClick"?Ll:$l)(r,o.pos,o.inside,t)?t.preventDefault():de(r,"pointer"))};class Wl{constructor(e,t,n,i){this.view=e,this.pos=t,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[ji],this.allowDefault=n.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let h=e.state.doc.resolve(t.pos);s=h.parent,o=h.depth?h.before():0}const l=i?null:n.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(n.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof k&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Y&&!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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),de(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),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(()=>se(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(vt(e))),this.updateAllowDefault(e),this.allowDefault||!t?de(this.view,"pointer"):Vl(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||F&&this.mightDrag&&!this.mightDrag.node.isAtom||z&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Be(this.view,C.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):de(this.view,"pointer")}move(e){this.updateAllowDefault(e),de(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}V.touchstart=r=>{r.input.lastTouch=Date.now(),En(r),de(r,"pointer")};V.touchmove=r=>{r.input.lastTouch=Date.now(),de(r,"pointer")};V.contextmenu=r=>En(r);function Gi(r,e){return r.composing?!0:F&&Math.abs(e.timeStamp-r.input.compositionEndedAt)<500?(r.input.compositionEndedAt=-2e8,!0):!1}const Jl=ie?5e3:-1;L.compositionstart=L.compositionupdate=r=>{if(!r.composing){r.domObserver.flush();let{state:e}=r,t=e.selection.$to;if(e.selection instanceof M&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)))r.markCursor=r.state.storedMarks||t.marks(),Ct(r,!0),r.markCursor=null;else if(Ct(r,!e.selection.empty),Y&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let n=r.domSelectionRange();for(let i=n.focusNode,s=n.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=r.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}r.input.composing=!0}Yi(r,Jl)};L.compositionend=(r,e)=>{r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=e.timeStamp,r.input.compositionPendingChanges=r.domObserver.pendingRecords().length?r.input.compositionID:0,r.input.compositionNode=null,r.input.compositionPendingChanges&&Promise.resolve().then(()=>r.domObserver.flush()),r.input.compositionID++,Yi(r,20))};function Yi(r,e){clearTimeout(r.input.composingTimeout),e>-1&&(r.input.composingTimeout=setTimeout(()=>Ct(r),e))}function Xi(r){for(r.composing&&(r.input.composing=!1,r.input.compositionEndedAt=Hl());r.input.compositionNodes.length>0;)r.input.compositionNodes.pop().markParentsDirty()}function Kl(r){let e=r.domSelectionRange();if(!e.focusNode)return null;let t=Bo(e.focusNode,e.focusOffset),n=Fo(e.focusNode,e.focusOffset);if(t&&n&&t!=n){let i=n.pmViewDesc,s=r.domObserver.lastChangedTextNode;if(t==s||n==s)return s;if(!i||!i.isText(n.nodeValue))return n;if(r.input.compositionNode==n){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return n}}return t||n}function Hl(){let r=document.createEvent("Event");return r.initEvent("event",!0,!0),r.timeStamp}function Ct(r,e=!1){if(!(ie&&r.domObserver.flushingSoon>=0)){if(r.domObserver.forceFlush(),Xi(r),e||r.docView&&r.docView.dirty){let t=On(r),n=r.state.selection;return t&&!t.eq(n)?r.dispatch(r.state.tr.setSelection(t)):(r.markCursor||e)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?r.dispatch(r.state.tr.deleteSelection()):r.updateState(r.state),!0}return!1}}function Ul(r,e){if(!r.dom.parentNode)return;let t=r.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(e),r.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),r.focus()},50)}const et=q&&ue<15||$e&&Wo<604;V.copy=L.cut=(r,e)=>{let t=e,n=r.state.selection,i=t.type=="cut";if(n.empty)return;let s=et?null:t.clipboardData,o=n.content(),{dom:l,text:a}=Tn(r,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):Ul(r,l),i&&r.dispatch(r.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function _l(r){return r.openStart==0&&r.openEnd==0&&r.content.childCount==1?r.content.firstChild:null}function jl(r,e){if(!r.dom.parentNode)return;let t=r.input.shiftKey||r.state.selection.$from.parent.type.spec.code,n=r.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=r.input.shiftKey&&r.input.lastKeyCode!=45;setTimeout(()=>{r.focus(),n.parentNode&&n.parentNode.removeChild(n),t?tt(r,n.value,null,i,e):tt(r,n.textContent,n.innerHTML,i,e)},50)}function tt(r,e,t,n,i){let s=Wi(r,e,t,n,r.state.selection.$from);if(r.someProp("handlePaste",a=>a(r,i,s||x.empty)))return!0;if(!s)return!1;let o=_l(s),l=o?r.state.tr.replaceSelectionWith(o,n):r.state.tr.replaceSelection(s);return r.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Zi(r){let e=r.getData("text/plain")||r.getData("Text");if(e)return e;let t=r.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}L.paste=(r,e)=>{let t=e;if(r.composing&&!ie)return;let n=et?null:t.clipboardData,i=r.input.shiftKey&&r.input.lastKeyCode!=45;n&&tt(r,Zi(n),n.getData("text/html"),i,t)?t.preventDefault():jl(r,t)};class Qi{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const Gl=U?"altKey":"ctrlKey";function es(r,e){let t=r.someProp("dragCopies",n=>!n(e));return t??!e[Gl]}V.dragstart=(r,e)=>{let t=e,n=r.input.mouseDown;if(n&&n.done(),!t.dataTransfer)return;let i=r.state.selection,s=i.empty?null:r.posAtCoords(vt(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof k?i.to-1:i.to))){if(n&&n.mightDrag)o=k.create(r.state.doc,n.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=r.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=r.docView&&(o=k.create(r.state.doc,f.posBefore))}}let l=(o||r.state.selection).content(),{dom:a,text:c,slice:h}=Tn(r,l);(!t.dataTransfer.files.length||!z||Ti>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(et?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",et||t.dataTransfer.setData("text/plain",c),r.dragging=new Qi(h,es(r,t),o)};V.dragend=r=>{let e=r.dragging;window.setTimeout(()=>{r.dragging==e&&(r.dragging=null)},50)};L.dragover=L.dragenter=(r,e)=>e.preventDefault();L.drop=(r,e)=>{let t=e,n=r.dragging;if(r.dragging=null,!t.dataTransfer)return;let i=r.posAtCoords(vt(t));if(!i)return;let s=r.state.doc.resolve(i.pos),o=n&&n.slice;o?r.someProp("transformPasted",d=>{o=d(o,r)}):o=Wi(r,Zi(t.dataTransfer),et?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(n&&es(r,t));if(r.someProp("handleDrop",d=>d(r,t,o||x.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?So(r.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=r.state.tr;if(l){let{node:d}=n;d?d.replace(c):c.deleteSelection()}let h=c.mapping.map(a),f=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,u=c.doc;if(f?c.replaceRangeWith(h,h,o.content.firstChild):c.replaceRange(h,h,o),c.doc.eq(u))return;let p=c.doc.resolve(h);if(f&&k.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new k(p));else{let d=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,b,N)=>d=N),c.setSelection(wn(r,p,c.doc.resolve(d)))}r.focus(),r.dispatch(c.setMeta("uiEvent","drop"))};V.focus=r=>{r.input.lastFocus=Date.now(),r.focused||(r.domObserver.stop(),r.dom.classList.add("ProseMirror-focused"),r.domObserver.start(),r.focused=!0,setTimeout(()=>{r.docView&&r.hasFocus()&&!r.domObserver.currentSelection.eq(r.domSelectionRange())&&se(r)},20))};V.blur=(r,e)=>{let t=e;r.focused&&(r.domObserver.stop(),r.dom.classList.remove("ProseMirror-focused"),r.domObserver.start(),t.relatedTarget&&r.dom.contains(t.relatedTarget)&&r.domObserver.currentSelection.clear(),r.focused=!1)};V.beforeinput=(r,e)=>{if(z&&ie&&e.inputType=="deleteContentBackward"){r.domObserver.flushSoon();let{domChangeCount:n}=r.input;setTimeout(()=>{if(r.input.domChangeCount!=n||(r.dom.blur(),r.focus(),r.someProp("handleKeyDown",s=>s(r,be(8,"Backspace")))))return;let{$cursor:i}=r.state.selection;i&&i.pos>0&&r.dispatch(r.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let r in L)V[r]=L[r];function nt(r,e){if(r==e)return!0;for(let t in r)if(r[t]!==e[t])return!1;for(let t in e)if(!(t in r))return!1;return!0}class Ot{constructor(e,t){this.toDOM=e,this.spec=t||Oe,this.side=this.spec.side||0}map(e,t,n,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new j(s-n,s-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Ot&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&nt(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class me{constructor(e,t){this.attrs=e,this.spec=t||Oe}map(e,t,n,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-n;return s>=o?null:new j(s,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof me&&nt(this.attrs,e.attrs)&&nt(this.spec,e.spec)}static is(e){return e.type instanceof me}destroy(){}}class An{constructor(e,t){this.attrs=e,this.spec=t||Oe}map(e,t,n,i){let s=e.mapResult(t.from+i,1);if(s.deleted)return null;let o=e.mapResult(t.to+i,-1);return o.deleted||o.pos<=s.pos?null:new j(s.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:i}=e.content.findIndex(t.from),s;return i==t.from&&!(s=e.child(n)).isText&&i+s.nodeSize==t.to}eq(e){return this==e||e instanceof An&&nt(this.attrs,e.attrs)&&nt(this.spec,e.spec)}destroy(){}}class j{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new j(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new j(e,e,new Ot(t,n))}static inline(e,t,n,i){return new j(e,t,new me(n,i))}static node(e,t,n,i){return new j(e,t,new An(n,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof me}get widget(){return this.type instanceof Ot}}const Re=[],Oe={};class D{constructor(e,t){this.local=e.length?e:Re,this.children=t.length?t:Re}static create(e,t){return t.length?wt(t,e,0,Oe):R}find(e,t,n){let i=[];return this.findInner(e??0,t??1e9,i,0,n),i}findInner(e,t,n,i,s){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=t&&l.to>=e&&(!s||s(l.spec))&&n.push(l.copy(l.from+i,l.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,n,i+l,s)}}map(e,t,n){return this==R||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Oe)}mapInner(e,t,n,i,s){let o;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,n,i);a&&a.type.valid(t,a)?(o||(o=[])).push(a):s.onRemove&&s.onRemove(this.local[l].spec)}return this.children.length?Yl(this.children,o||[],e,t,n,i,s):o?new D(o.sort(we),Re):R}add(e,t){return t.length?this==R?D.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let i,s=0;e.forEach((l,a)=>{let c=a+n,h;if(h=ns(t,l,c)){for(i||(i=this.children.slice());s<i.length&&i[s]<a;)s+=3;i[s]==a?i[s+2]=i[s+2].addInner(l,h,c+1):i.splice(s,0,a,a+l.nodeSize,wt(h,l,c+1,Oe)),s+=3}});let o=ts(s?rs(t):t,-n);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||o.splice(l--,1);return new D(o.length?this.local.concat(o).sort(we):this.local,i||this.children)}remove(e){return e.length==0||this==R?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,i=this.local;for(let s=0;s<n.length;s+=3){let o,l=n[s]+t,a=n[s+1]+t;for(let h=0,f;h<e.length;h++)(f=e[h])&&f.from>l&&f.to<a&&(e[h]=null,(o||(o=[])).push(f));if(!o)continue;n==this.children&&(n=this.children.slice());let c=n[s+2].removeInner(o,l+1);c!=R?n[s+2]=c:(n.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let l=0;l<i.length;l++)i[l].eq(o,t)&&(i==this.local&&(i=this.local.slice()),i.splice(l--,1))}return n==this.children&&i==this.local?this:i.length||n.length?new D(i,n):R}forChild(e,t){if(this==R)return this;if(t.isLeaf)return D.empty;let n,i;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(n=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<o&&a.to>s&&a.type instanceof me){let c=Math.max(s,a.from)-s,h=Math.min(o,a.to)-s;c<h&&(i||(i=[])).push(a.copy(c,h))}}if(i){let l=new D(i.sort(we),Re);return n?new ce([l,n]):l}return n||R}eq(e){if(this==e)return!0;if(!(e instanceof D)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return vn(this.localsInner(e))}localsInner(e){if(this==R)return Re;if(e.inlineContent||!this.local.some(me.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof me||t.push(this.local[n]);return t}forEachSet(e){e(this)}}D.empty=new D([],[]);D.removeOverlap=vn;const R=D.empty;class ce{constructor(e){this.members=e}map(e,t){const n=this.members.map(i=>i.map(e,t,Oe));return ce.from(n)}forChild(e,t){if(t.isLeaf)return D.empty;let n=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,t);s!=R&&(s instanceof ce?n=n.concat(s.members):n.push(s))}return ce.from(n)}eq(e){if(!(e instanceof ce)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!t)t=s;else{n&&(t=t.slice(),n=!1);for(let o=0;o<s.length;o++)t.push(s[o])}}return t?vn(n?t:t.sort(we)):Re}static from(e){switch(e.length){case 0:return R;case 1:return e[0];default:return new ce(e.every(t=>t instanceof D)?e:e.reduce((t,n)=>t.concat(n instanceof D?n:n.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Yl(r,e,t,n,i,s,o){let l=r.slice();for(let c=0,h=s;c<t.maps.length;c++){let f=0;t.maps[c].forEach((u,p,d,m)=>{let g=m-d-(p-u);for(let b=0;b<l.length;b+=3){let N=l[b+1];if(N<0||u>N+h-f)continue;let H=l[b]+h-f;p>=H?l[b+1]=u<=H?-2:-1:u>=h&&g&&(l[b]+=g,l[b+1]+=g)}f+=g}),h=t.maps[c].map(h,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let h=t.map(r[c]+s),f=h-i;if(f<0||f>=n.content.size){a=!0;continue}let u=t.map(r[c+1]+s,-1),p=u-i,{index:d,offset:m}=n.content.findIndex(f),g=n.maybeChild(d);if(g&&m==f&&m+g.nodeSize==p){let b=l[c+2].mapInner(t,g,h+1,r[c]+s+1,o);b!=R?(l[c]=f,l[c+1]=p,l[c+2]=b):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=Xl(l,r,e,t,i,s,o),h=wt(c,n,0,o);e=h.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,u=0;f<h.children.length;f+=3){let p=h.children[f];for(;u<l.length&&l[u]<p;)u+=3;l.splice(u,0,h.children[f],h.children[f+1],h.children[f+2])}}return new D(e.sort(we),l)}function ts(r,e){if(!e||!r.length)return r;let t=[];for(let n=0;n<r.length;n++){let i=r[n];t.push(new j(i.from+e,i.to+e,i.type))}return t}function Xl(r,e,t,n,i,s,o){function l(a,c){for(let h=0;h<a.local.length;h++){let f=a.local[h].map(n,i,c);f?t.push(f):o.onRemove&&o.onRemove(a.local[h].spec)}for(let h=0;h<a.children.length;h+=3)l(a.children[h+2],a.children[h]+c+1)}for(let a=0;a<r.length;a+=3)r[a+1]==-1&&l(r[a+2],e[a]+s+1);return t}function ns(r,e,t){if(e.isLeaf)return null;let n=t+e.nodeSize,i=null;for(let s=0,o;s<r.length;s++)(o=r[s])&&o.from>t&&o.to<n&&((i||(i=[])).push(o),r[s]=null);return i}function rs(r){let e=[];for(let t=0;t<r.length;t++)r[t]!=null&&e.push(r[t]);return e}function wt(r,e,t,n){let i=[],s=!1;e.forEach((l,a)=>{let c=ns(r,l,a+t);if(c){s=!0;let h=wt(c,l,t+a+1,n);h!=R&&i.push(a,a+l.nodeSize,h)}});let o=ts(s?rs(r):r,-t).sort(we);for(let l=0;l<o.length;l++)o[l].type.valid(e,o[l])||(n.onRemove&&n.onRemove(o[l].spec),o.splice(l--,1));return o.length||i.length?new D(o,i):R}function we(r,e){return r.from-e.from||r.to-e.to}function vn(r){let e=r;for(let t=0;t<e.length-1;t++){let n=e[t];if(n.from!=n.to)for(let i=t+1;i<e.length;i++){let s=e[i];if(s.from==n.from){s.to!=n.to&&(e==r&&(e=r.slice()),e[i]=s.copy(s.from,n.to),Mr(e,i+1,s.copy(n.to,s.to)));continue}else{s.from<n.to&&(e==r&&(e=r.slice()),e[t]=n.copy(n.from,s.from),Mr(e,i,n.copy(s.from,n.to)));break}}}return e}function Mr(r,e,t){for(;e<r.length&&we(t,r[e])>0;)e++;r.splice(e,0,t)}function Ut(r){let e=[];return r.someProp("decorations",t=>{let n=t(r.state);n&&n!=R&&e.push(n)}),r.cursorWrapper&&e.push(D.create(r.state.doc,[r.cursorWrapper.deco])),ce.from(e)}const Zl={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ql=q&&ue<=11;class ea{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class ta{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ea,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(n=>{for(let i=0;i<n.length;i++)this.queue.push(n[i]);q&&ue<=11&&n.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),Ql&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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,Zl)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);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(pr(this.view)){if(this.suppressingSelectionUpdates)return se(this.view);if(q&&ue<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&De(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let s=e.focusNode;s;s=Le(s))t.add(s);for(let s=e.anchorNode;s;s=Le(s))if(t.has(s)){n=s;break}let i=n&&this.view.docView.nearestDesc(n);if(i&&i.ignoreMutation({type:"selection",target:n.nodeType==3?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&pr(e)&&!this.ignoreSelectionChange(n),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let h=0;h<t.length;h++){let f=this.registerMutation(t[h],a);f&&(s=s<0?f.from:Math.min(f.from,s),o=o<0?f.to:Math.max(f.to,o),f.typeOver&&(l=!0))}if(Y&&a.length){let h=a.filter(f=>f.nodeName=="BR");if(h.length==2){let[f,u]=h;f.parentNode&&f.parentNode.parentNode==u.parentNode?u.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let u of h){let p=u.parentNode;p&&p.nodeName=="LI"&&(!f||ia(e,f)!=p)&&u.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Et(n)&&(c=On(e))&&c.eq(C.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,se(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),na(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||se(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(n==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if(e.type=="childList"){for(let h=0;h<e.addedNodes.length;h++){let f=e.addedNodes[h];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let i=e.previousSibling,s=e.nextSibling;if(q&&ue<=11&&e.addedNodes.length)for(let h=0;h<e.addedNodes.length;h++){let{previousSibling:f,nextSibling:u}=e.addedNodes[h];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f),(!u||Array.prototype.indexOf.call(e.addedNodes,u)<0)&&(s=u)}let o=i&&i.parentNode==e.target?v(i)+1:0,l=n.localPosFromDOM(e.target,o,-1),a=s&&s.parentNode==e.target?v(s):e.target.childNodes.length,c=n.localPosFromDOM(e.target,a,1);return{from:l,to:c}}else return e.type=="attributes"?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Cr=new WeakMap,Or=!1;function na(r){if(!Cr.has(r)&&(Cr.set(r,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(r.dom).whiteSpace)!==-1)){if(r.requiresGeckoHackNode=Y,Or)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."),Or=!0}}function wr(r,e){let t=e.startContainer,n=e.startOffset,i=e.endContainer,s=e.endOffset,o=r.domAtPos(r.state.selection.anchor);return De(o.node,o.offset,i,s)&&([t,n,i,s]=[i,s,t,n]),{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}}function ra(r,e){if(e.getComposedRanges){let i=e.getComposedRanges(r.root)[0];if(i)return wr(r,i)}let t;function n(i){i.preventDefault(),i.stopImmediatePropagation(),t=i.getTargetRanges()[0]}return r.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),r.dom.removeEventListener("beforeinput",n,!0),t?wr(r,t):null}function ia(r,e){for(let t=e.parentNode;t&&t!=r.dom;t=t.parentNode){let n=r.docView.nearestDesc(t,!0);if(n&&n.node.isBlock)return t}return null}function sa(r,e,t){let{node:n,fromOffset:i,toOffset:s,from:o,to:l}=r.docView.parseRange(e,t),a=r.domSelectionRange(),c,h=a.anchorNode;if(h&&r.dom.contains(h.nodeType==1?h:h.parentNode)&&(c=[{node:h,offset:a.anchorOffset}],Et(a)||c.push({node:a.focusNode,offset:a.focusOffset})),z&&r.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=n.childNodes[g-1],N=b.pmViewDesc;if(b.nodeName=="BR"&&!N){s=g;break}if(!N||N.size)break}let f=r.state.doc,u=r.someProp("domParser")||Fe.fromSchema(r.state.schema),p=f.resolve(o),d=null,m=u.parse(n,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:oa,context:p});if(c&&c[0].pos!=null){let g=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=g),d={anchor:g+o,head:b+o}}return{doc:m,sel:d,from:o,to:l}}function oa(r){let e=r.pmViewDesc;if(e)return e.parseRule();if(r.nodeName=="BR"&&r.parentNode){if(F&&/^(ul|ol)$/i.test(r.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(r.parentNode.lastChild==r||F&&/^(tr|table)$/i.test(r.parentNode.nodeName))return{ignore:!0}}else if(r.nodeName=="IMG"&&r.getAttribute("mark-placeholder"))return{ignore:!0};return null}const la=/^(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 aa(r,e,t,n,i){let s=r.input.compositionPendingChanges||(r.composing?r.input.compositionID:0);if(r.input.compositionPendingChanges=0,e<0){let S=r.input.lastSelectionTime>Date.now()-50?r.input.lastSelectionOrigin:null,E=On(r,S);if(E&&!r.state.selection.eq(E)){if(z&&ie&&r.input.lastKeyCode===13&&Date.now()-100<r.input.lastKeyCodeTime&&r.someProp("handleKeyDown",gs=>gs(r,be(13,"Enter"))))return;let $=r.state.tr.setSelection(E);S=="pointer"?$.setMeta("pointer",!0):S=="key"&&$.scrollIntoView(),s&&$.setMeta("composition",s),r.dispatch($)}return}let o=r.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=r.state.doc.resolve(t).after(l+1);let a=r.state.selection,c=sa(r,e,t),h=r.state.doc,f=h.slice(c.from,c.to),u,p;r.input.lastKeyCode===8&&Date.now()-100<r.input.lastKeyCodeTime?(u=r.state.selection.to,p="end"):(u=r.state.selection.from,p="start"),r.input.lastKeyCode=null;let d=fa(f.content,c.doc.content,c.from,u,p);if(d&&r.input.domChangeCount++,($e&&r.input.lastIOSEnter>Date.now()-225||ie)&&i.some(S=>S.nodeType==1&&!la.test(S.nodeName))&&(!d||d.endA>=d.endB)&&r.someProp("handleKeyDown",S=>S(r,be(13,"Enter")))){r.input.lastIOSEnter=0;return}if(!d)if(n&&a instanceof M&&!a.empty&&a.$head.sameParent(a.$anchor)&&!r.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))d={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let S=Tr(r,r.state.doc,c.sel);if(S&&!S.eq(r.state.selection)){let E=r.state.tr.setSelection(S);s&&E.setMeta("composition",s),r.dispatch(E)}}return}r.state.selection.from<r.state.selection.to&&d.start==d.endB&&r.state.selection instanceof M&&(d.start>r.state.selection.from&&d.start<=r.state.selection.from+2&&r.state.selection.from>=c.from?d.start=r.state.selection.from:d.endA<r.state.selection.to&&d.endA>=r.state.selection.to-2&&r.state.selection.to<=c.to&&(d.endB+=r.state.selection.to-d.endA,d.endA=r.state.selection.to)),q&&ue<=11&&d.endB==d.start+1&&d.endA==d.start&&d.start>c.from&&c.doc.textBetween(d.start-c.from-1,d.start-c.from+1)==" "&&(d.start--,d.endA--,d.endB--);let m=c.doc.resolveNoCache(d.start-c.from),g=c.doc.resolveNoCache(d.endB-c.from),b=h.resolve(d.start),N=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=d.endA,H;if(($e&&r.input.lastIOSEnter>Date.now()-225&&(!N||i.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!N&&m.pos<c.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,g.pos,"",""))&&(H=C.findFrom(c.doc.resolve(m.pos+1),1,!0))&&H.head>m.pos)&&r.someProp("handleKeyDown",S=>S(r,be(13,"Enter")))){r.input.lastIOSEnter=0;return}if(r.state.selection.anchor>d.start&&ha(h,d.start,d.endA,m,g)&&r.someProp("handleKeyDown",S=>S(r,be(8,"Backspace")))){ie&&z&&r.domObserver.suppressSelectionUpdates();return}z&&d.endB==d.start&&(r.input.lastChromeDelete=Date.now()),ie&&!N&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==d.endA&&(d.endB-=2,g=c.doc.resolveNoCache(d.endB-c.from),setTimeout(()=>{r.someProp("handleKeyDown",function(S){return S(r,be(13,"Enter"))})},20));let oe=d.start,xe=d.endA,lt=S=>{let E=S||r.state.tr.replace(oe,xe,c.doc.slice(d.start-c.from,d.endB-c.from));if(c.sel){let $=Tr(r,E.doc,c.sel);$&&!(z&&r.composing&&$.empty&&(d.start!=d.endB||r.input.lastChromeDelete<Date.now()-100)&&($.head==oe||$.head==E.mapping.map(xe)-1)||q&&$.empty&&$.head==oe)&&E.setSelection($)}return s&&E.setMeta("composition",s),E.scrollIntoView()},at;if(N){if(m.pos==g.pos){q&&ue<=11&&m.parentOffset==0&&(r.domObserver.suppressSelectionUpdates(),setTimeout(()=>se(r),20));let S=lt(r.state.tr.delete(oe,xe)),E=h.resolve(d.start).marksAcross(h.resolve(d.endA));E&&S.ensureMarks(E),r.dispatch(S)}else if(d.endA==d.endB&&(at=ca(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,d.endA-b.start())))){let S=lt(r.state.tr);at.type=="add"?S.addMark(oe,xe,at.mark):S.removeMark(oe,xe,at.mark),r.dispatch(S)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let S=m.parent.textBetween(m.parentOffset,g.parentOffset),E=()=>lt(r.state.tr.insertText(S,oe,xe));r.someProp("handleTextInput",$=>$(r,oe,xe,S,E))||r.dispatch(E())}}else r.dispatch(lt())}function Tr(r,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:wn(r,e.resolve(t.anchor),e.resolve(t.head))}function ca(r,e){let t=r.firstChild.marks,n=e.firstChild.marks,i=t,s=n,o,l,a;for(let h=0;h<n.length;h++)i=n[h].removeFromSet(i);for(let h=0;h<t.length;h++)s=t[h].removeFromSet(s);if(i.length==1&&s.length==0)l=i[0],o="add",a=h=>h.mark(l.addToSet(h.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=h=>h.mark(l.removeFromSet(h.marks));else return null;let c=[];for(let h=0;h<e.childCount;h++)c.push(a(e.child(h)));if(y.from(c).eq(r))return{mark:l,type:o}}function ha(r,e,t,n,i){if(t-e<=i.pos-n.pos||_t(n,!0,!1)<i.pos)return!1;let s=r.resolve(e);if(!n.parent.isTextblock){let l=s.nodeAfter;return l!=null&&t==e+l.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=r.resolve(_t(s,!0,!0));return!o.parent.isTextblock||o.pos>t||_t(o,!0,!1)<t?!1:n.parent.content.cut(n.parentOffset).eq(o.parent.content)}function _t(r,e,t){let n=r.depth,i=e?r.end():r.pos;for(;n>0&&(e||r.indexAfter(n)==r.node(n).childCount);)n--,i++,e=!1;if(t){let s=r.node(n).maybeChild(r.indexAfter(n));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function fa(r,e,t,n,i){let s=r.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=r.findDiffEnd(e,t+r.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));n-=o+a-s}if(o<s&&r.size<e.size){let a=n<=s&&n>=o?s-n:0;s-=a,s&&s<e.size&&Nr(e.textBetween(s-1,s+1))&&(s+=a?1:-1),l=s+(l-o),o=s}else if(l<s){let a=n<=s&&n>=l?s-n:0;s-=a,s&&s<r.size&&Nr(r.textBetween(s-1,s+1))&&(s+=a?1:-1),o=s+(o-l),l=s}return{start:s,endA:o,endB:l}}function Nr(r){if(r.length!=2)return!1;let e=r.charCodeAt(0),t=r.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class is{constructor(e,t){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 Al,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Pr),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ar(this),Er(this),this.nodeViews=vr(this),this.docView=ar(this.state.doc,Dr(this),Ut(this),this.dom,this),this.domObserver=new ta(this,(n,i,s,o)=>aa(this,n,i,s,o)),this.domObserver.start(),vl(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&pn(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Pr),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Xi(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let p=vr(this);ua(p,this.nodeViews)&&(this.nodeViews=p,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&pn(this),this.editable=Ar(this),Er(this);let a=Ut(this),c=Dr(this),h=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=s||!this.docView.matchesNode(e.doc,c,a);(f||!e.selection.eq(i.selection))&&(o=!0);let u=h=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Ho(this);if(o){this.domObserver.stop();let p=f&&(q||z)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&da(i.selection,e.selection);if(f){let d=z?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Kl(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ar(e.doc,c,a,this.dom,this)),d&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&ml(this))?se(this,p):(Li(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((n=this.dragging)===null||n===void 0)&&n.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),h=="reset"?this.dom.scrollTop=0:h=="to selection"?this.scrollToSelection():u&&Uo(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof k){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&nr(this,t.getBoundingClientRect(),e)}else nr(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let n=this.directPlugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let n=this.state.plugins[t];n.spec.view&&this.pluginViews.push(n.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,t){let n=e.node,i=-1;if(this.state.doc.nodeAt(n.from)==n.node)i=n.from;else{let s=n.from+(this.state.doc.content.size-t.doc.content.size);(s>0&&this.state.doc.nodeAt(s))==n.node&&(i=s)}this.dragging=new Qi(e.slice,e.move,i<0?void 0:k.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],i;if(n!=null&&(i=t?t(n):n))return i;for(let o=0;o<this.directPlugins.length;o++){let l=this.directPlugins[o].props[e];if(l!=null&&(i=t?t(l):l))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let l=s[o].props[e];if(l!=null&&(i=t?t(l):l))return i}}hasFocus(){if(q){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&_o(this.dom),se(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Zo(this,e)}coordsAtPos(e,t=1){return vi(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let i=this.docView.posFromDOM(e,t,n);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return rl(this,t||this.state,e)}pasteHTML(e,t){return tt(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return tt(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Tn(this,e)}destroy(){this.docView&&(Pl(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ut(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Io())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Il(this,e)}domSelectionRange(){let e=this.domSelection();return e?F&&this.root.nodeType===11&&Lo(this.dom.ownerDocument)==this.dom&&ra(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}is.prototype.dispatch=function(r){let e=this._props.dispatchTransaction;e?e.call(this,r):this.updateState(this.state.apply(r))};function Dr(r){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(r.editable),r.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(r.state)),t)for(let n in t)n=="class"?e.class+=" "+t[n]:n=="style"?e.style=(e.style?e.style+";":"")+t[n]:!e[n]&&n!="contenteditable"&&n!="nodeName"&&(e[n]=String(t[n]))}),e.translate||(e.translate="no"),[j.node(0,r.state.doc.content.size,e)]}function Er(r){if(r.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),r.cursorWrapper={dom:e,deco:j.widget(r.state.selection.from,e,{raw:!0,marks:r.markCursor})}}else r.cursorWrapper=null}function Ar(r){return!r.someProp("editable",e=>e(r.state)===!1)}function da(r,e){let t=Math.min(r.$anchor.sharedDepth(r.head),e.$anchor.sharedDepth(e.head));return r.$anchor.start(t)!=e.$anchor.start(t)}function vr(r){let e=Object.create(null);function t(n){for(let i in n)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=n[i])}return r.someProp("nodeViews",t),r.someProp("markViews",t),e}function ua(r,e){let t=0,n=0;for(let i in r){if(r[i]!=e[i])return!0;t++}for(let i in e)n++;return t!=n}function Pr(r){if(r.spec.state||r.spec.filterTransaction||r.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ge={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Tt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pa=typeof navigator<"u"&&/Mac/.test(navigator.platform),ma=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var P=0;P<10;P++)ge[48+P]=ge[96+P]=String(P);for(var P=1;P<=24;P++)ge[P+111]="F"+P;for(var P=65;P<=90;P++)ge[P]=String.fromCharCode(P+32),Tt[P]=String.fromCharCode(P);for(var jt in ge)Tt.hasOwnProperty(jt)||(Tt[jt]=ge[jt]);function ga(r){var e=pa&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||ma&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Tt:ge)[r.keyCode]||r.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const ya=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),xa=typeof navigator<"u"&&/Win/.test(navigator.platform);function ba(r){let e=r.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let n,i,s,o;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))ya?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+a)}return n&&(t="Alt-"+t),i&&(t="Ctrl-"+t),o&&(t="Meta-"+t),s&&(t="Shift-"+t),t}function ka(r){let e=Object.create(null);for(let t in r)e[ba(t)]=r[t];return e}function Gt(r,e,t=!0){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t&&e.shiftKey&&(r="Shift-"+r),r}function ss(r){return new Mn({props:{handleKeyDown:Sa(r)}})}function Sa(r){let e=ka(r);return function(t,n){let i=ga(n),s,o=e[Gt(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(i.length==1&&i!=" "){if(n.shiftKey){let l=e[Gt(i,n,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(xa&&n.ctrlKey&&n.altKey)&&(s=ge[n.keyCode])&&s!=i){let l=e[Gt(s,n)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}const ls=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function Ma(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Ca=(r,e,t)=>{let n=Ma(r,t);if(!n)return!1;let i=as(n);if(!i){let o=n.blockRange(),l=o&&bn(o);return l==null?!1:(e&&e(r.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(hs(r,i,e,-1))return!0;if(n.parent.content.size==0&&(qe(s,"end")||k.isSelectable(s)))for(let o=n.depth;;o--){let l=kn(r.doc,n.before(o),n.after(o),x.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=r.tr.step(l);a.setSelection(qe(s,"end")?C.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):k.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1};function qe(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const Oa=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=as(n)}let o=s&&s.nodeBefore;return!o||!k.isSelectable(o)?!1:(e&&e(r.tr.setSelection(k.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function as(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function wa(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const Ta=(r,e,t)=>{let n=wa(r,t);if(!n)return!1;let i=cs(n);if(!i)return!1;let s=i.nodeAfter;if(hs(r,i,e,1))return!0;if(n.parent.content.size==0&&(qe(s,"start")||k.isSelectable(s))){let o=kn(r.doc,n.before(),n.after(),x.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=r.tr.step(o);l.setSelection(qe(s,"start")?C.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):k.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Na=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=cs(n)}let o=s&&s.nodeAfter;return!o||!k.isSelectable(o)?!1:(e&&e(r.tr.setSelection(k.create(r.doc,s.pos)).scrollIntoView()),!0)};function cs(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const Da=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
|
|
99
|
+
`).scrollIntoView()),!0)};function Pn(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const Ea=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Pn(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=r.tr.replaceWith(l,l,o.createAndFill());a.setSelection(C.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Aa=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof K||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=Pn(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,l=r.tr.insert(o,s.createAndFill());l.setSelection(M.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},va=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(mt(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&bn(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function Pa(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof k&&e.selection.node.isBlock)return!n.parentOffset||!mt(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let p=n.depth;;p--)if(n.node(p).isBlock){a=n.end(p)==n.pos+(n.depth-p),c=n.start(p)==n.pos-(n.depth-p),l=Pn(n.node(p-1).contentMatchAt(n.indexAfter(p-1))),s.unshift(a&&l?{type:l}:null),o=p;break}else{if(p==1)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof M||e.selection instanceof K)&&h.deleteSelection();let f=h.mapping.map(n.pos),u=mt(h.doc,f,s.length,s);if(u||(s[0]=l?{type:l}:null,u=mt(h.doc,f,s.length,s)),!u)return!1;if(h.split(f,s.length,s),!a&&c&&n.node(o).type!=l){let p=h.mapping.map(n.before(o)),d=h.doc.resolve(p);l&&n.node(o-1).canReplaceWith(d.index(),d.index()+1,l)&&h.setNodeMarkup(h.mapping.map(n.before(o)),l)}return t&&t(h.scrollIntoView()),!0}}const Ra=Pa(),Ia=(r,e)=>(e&&e(r.tr.setSelection(new K(r.doc))),!0);function za(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||xi(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function hs(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&za(r,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let p=e.pos+s.nodeSize,d=y.empty;for(let b=o.length-1;b>=0;b--)d=y.from(o[b].create(null,d));d=y.from(i.copy(d));let m=r.tr.step(new J(e.pos-1,p,e.pos,p,new x(d,1,0),o.length,!0)),g=m.doc.resolve(p+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&xi(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let h=s.type.spec.isolating||n>0&&a?null:C.findFrom(e,1),f=h&&h.$from.blockRange(h.$to),u=f&&bn(f);if(u!=null&&u>=e.depth)return t&&t(r.tr.lift(f,u).scrollIntoView()),!0;if(c&&qe(s,"start",!0)&&qe(i,"end")){let p=i,d=[];for(;d.push(p),!p.isTextblock;)p=p.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(t){let b=y.empty;for(let H=d.length-1;H>=0;H--)b=y.from(d[H].copy(b));let N=r.tr.step(new J(e.pos-d.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new x(b,d.length,0),0,!0));t(N.scrollIntoView())}return!0}}return!1}function fs(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(M.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const Ba=fs(-1),Fa=fs(1);function Va(r,e,t,n){for(let i=0;i<e.length;i++){let{$from:s,$to:o}=e[i],l=s.depth==0?r.inlineContent&&r.type.allowsMarkType(t):!1;if(r.nodesBetween(s.pos,o.pos,(a,c)=>{if(l)return!1;l=a.inlineContent&&a.type.allowsMarkType(t)}),l)return!0}return!1}function La(r,e=null,t){return function(n,i){let{empty:s,$cursor:o,ranges:l}=n.selection;if(s&&!o||!Va(n.doc,l,r))return!1;if(i)if(o)r.isInSet(n.storedMarks||o.marks())?i(n.tr.removeStoredMark(r)):i(n.tr.addStoredMark(r.create(e)));else{let a,c=n.tr;a=!l.some(h=>n.doc.rangeHasMark(h.$from.pos,h.$to.pos,r));for(let h=0;h<l.length;h++){let{$from:f,$to:u}=l[h];if(!a)c.removeMark(f.pos,u.pos,r);else{let p=f.pos,d=u.pos,m=f.nodeAfter,g=u.nodeBefore,b=m&&m.isText?/^\s*/.exec(m.text)[0].length:0,N=g&&g.isText?/\s*$/.exec(g.text)[0].length:0;p+b<d&&(p+=b,d-=N),c.addMark(p,d,r.create(e))}}i(c.scrollIntoView())}return!0}}function Rn(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}let Yt=Rn(ls,Ca,Oa),Rr=Rn(ls,Ta,Na);const re={Enter:Rn(Da,Aa,va,Ra),"Mod-Enter":Ea,Backspace:Yt,"Mod-Backspace":Yt,"Shift-Backspace":Yt,Delete:Rr,"Mod-Delete":Rr,"Mod-a":Ia},ds={"Ctrl-h":re.Backspace,"Alt-Backspace":re["Mod-Backspace"],"Ctrl-d":re.Delete,"Ctrl-Alt-Backspace":re["Mod-Delete"],"Alt-Delete":re["Mod-Delete"],"Alt-d":re["Mod-Delete"],"Ctrl-a":Ba,"Ctrl-e":Fa};for(let r in re)ds[r]=re[r];const $a=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1,qa=$a?ds:re,Wa=["p",0],Ja=["blockquote",0],Ka=["hr"],Ha=["pre",["code",0]],Ua=["br"],_a={doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return Wa}},blockquote:{content:"block+",group:"block",defining:!0,parseDOM:[{tag:"blockquote"}],toDOM(){return Ja}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return Ka}},heading:{attrs:{level:{default:1,validate:"number"}},content:"inline*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(r){return["h"+r.attrs.level,0]}},code_block:{content:"text*",marks:"",group:"block",code:!0,defining:!0,parseDOM:[{tag:"pre",preserveWhitespace:"full"}],toDOM(){return Ha}},text:{group:"inline"},image:{inline:!0,attrs:{src:{validate:"string"},alt:{default:null,validate:"string|null"},title:{default:null,validate:"string|null"}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(r){return{src:r.getAttribute("src"),title:r.getAttribute("title"),alt:r.getAttribute("alt")}}}],toDOM(r){let{src:e,alt:t,title:n}=r.attrs;return["img",{src:e,alt:t,title:n}]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return Ua}}},ja=["em",0],Ga=["strong",0],Ya=["code",0],Xa={link:{attrs:{href:{validate:"string"},title:{default:null,validate:"string|null"}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(r){return{href:r.getAttribute("href"),title:r.getAttribute("title")}}}],toDOM(r){let{href:e,title:t}=r.attrs;return["a",{href:e,title:t},0]}},em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:r=>r.type.name=="em"}],toDOM(){return ja}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:r=>r.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:r=>r.type.name=="strong"},{style:"font-weight",getAttrs:r=>/^(bold(er)?|[5-9]\d{2,})$/.test(r)&&null}],toDOM(){return Ga}},code:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return Ya}}},Ir=new ai({nodes:_a,marks:Xa}),mn={"extra-large":"var(--vvd-typography-heading-4)",large:"var(--vvd-typography-base-extended)",normal:"var(--vvd-typography-base)",small:"var(--vvd-typography-base-condensed)"},Za=Object.fromEntries(Object.entries(mn).map(([r,e])=>[e,r])),Qa={u:{parseDOM:[{tag:"u"}],toDOM(){return["u",0]}},s:{parseDOM:[{tag:"s"},{tag:"del"}],toDOM(){return["s",0]}},tt:{parseDOM:[{tag:"tt"},{tag:"code"}],toDOM(){return["tt",0]}},textSize:{attrs:{size:{default:"normal"}},parseDOM:[{tag:"span[style*='font']",getAttrs:r=>{const t=r.getAttribute("style").match(/font:\s*([^;]+)/)?.[1]?.trim(),n=Za[t];return n?{size:n}:!1}}],toDOM(r){const e=r.attrs.size;return["span",{style:`font: ${mn[e]||mn.normal};`},0]}}},us=(r="vwc")=>new ai({nodes:{...Ir.spec.nodes.toObject(),imageError:{inline:!0,group:"inline",atom:!0,attrs:{alt:{default:""},icon:{default:""},errorMessage:{default:"Failed to attach"},fileName:{default:""}},toDOM(e){return[`${r}-text-editor-image-placeholder`,{alt:e.attrs.alt,icon:e.attrs.icon,"error-message":e.attrs.errorMessage,"file-name":e.attrs.fileName}]},parseDOM:[{tag:`${r}-text-editor-image-placeholder`,getAttrs(e){return{alt:e.getAttribute("alt"),icon:e.getAttribute("icon"),errorMessage:e.getAttribute("error-message"),fileName:e.getAttribute("file-name")}}}]}},marks:{...Ir.spec.marks.toObject(),...Qa}});us();const ec={start:-1,end:-1};class tc{static get h2(){return{type:"heading",attrs:{level:2}}}static get h3(){return{type:"heading",attrs:{level:3}}}static get p(){return{type:"paragraph",attrs:{}}}}function Xt(r,e){r.textBlockType&&r.textBlockType!==e||r.textBlockType===""?r.textBlockType="":r.textBlockType=e}function nc(){return ss({"Shift-Enter":(r,e)=>{const{schema:t}=r,n=t.nodes.hard_break,{$from:i,$to:s}=r.selection;if(i.sameParent(s))e&&e(r.tr.replaceSelectionWith(n.create()).scrollIntoView());else if(e){const o=r.tr,l=r.doc.resolve(s.end());o.delete(l.start(),s.pos),o.delete(i.pos,l.start()-1),o.insert(i.pos,n.create());const a=M.create(o.doc,i.pos+1);o.setSelection(a),e(o.scrollIntoView())}return!0},Enter:(r,e)=>{const{schema:t}=r,n=t.nodes.paragraph,{$from:i,empty:s}=r.selection;if(!s||i.parent.type!==n)return!1;const o=r.tr,l=i.marks();if(o.split(i.pos),l.length>0){const a=i.pos+1,h=t.text("",l);o.insert(a,h),o.setSelection(M.create(o.doc,a+1))}return e&&e(o.scrollIntoView()),!0}})}function rc(r){return new Mn({view:()=>({update:(e,t)=>{const{from:n,to:i}=e.state.selection,{from:s,to:o}=t.selection;(n!==s||i!==o)&&r({start:n,end:i})}})})}function ic({to:r,from:e}){return{start:e,end:r}}function sc(r,e,t="Image loading failed"){return r.nodes.imageError.create({alt:`inline image from file ${e.name}`,fileName:e.name,icon:e.type.split("/")[1],errorMessage:t})}const oc=r=>r.type.name==="paragraph"&&r.nodeSize===2,lc="Start typing...",ps=new Ro("placeholderPlugin"),zr=(r=lc)=>new Mn({key:ps,props:{decorations(e){const{$from:t}=e.selection,n=[];if(e.doc.childCount===1&&oc(t.parent)){const i=j.node(t.before(),t.after(),{"data-placeholder":r,class:"placeholder"});n.push(i)}return D.create(e.doc,n)}}});class ac{#t=!1;#e;#n(){if(!this.#e)throw new Error("ProseMirror was not initiated. Please use the `init` method first.")}#s=()=>{this.#l("selection-changed")};#o=e=>{e.stopPropagation(),this.#t=!0,this.#l("input")};#r=()=>{if(!this.#t){this.#t=!1;return}this.#l("change")};#i="vwc";init(e,t="vwc"){if(this.#i=t,!(e instanceof HTMLElement))throw new Error("ProseMirror Facade init accepts a valid HTMLElement as its first parameter");const n=[zr(),rc(this.#s),nc(),ss(qa)],i=Ie.create({schema:us(this.#i),plugins:n});this.#e=new is(e,{state:i}),this.#e.dom.addEventListener("input",this.#o),this.#e.dom.addEventListener("blur",this.#r)}updatePlaceholder(e){this.#n();const{state:t}=this.#e,n=t.plugins.filter(o=>o!==ps.get(t)),i=zr(e),s=t.reconfigure({plugins:[...n,i]});this.#e.updateState(s)}replaceContent(e){this.#n();const n=Fe.fromSchema(this.#e.state.schema).parse(new window.DOMParser().parseFromString(e,"text/html").body),i=this.#e.state.tr.replaceWith(0,this.#e.state.doc.content.size,n.content);this.#e.dispatch(i)}selection(e){if(this.#e&&e){const t=this.#e.state.tr.setSelection(M.create(this.#e.state.doc,e.start,e.end));this.#e.dispatch(t)}return this.#e?ic(this.#e.state.selection):ec}#a=document.createElement("div");addEventListener(e,t){this.#a.addEventListener(e,t)}#l=(e,t)=>{this.#a.dispatchEvent(new CustomEvent(e,{detail:t}))};setSelectionTag(e){this.#n();const t=tc[e]??{type:e},{state:n,dispatch:i}=this.#e,{from:s,to:o}=n.selection,l=n.tr;n.doc.nodesBetween(s,o,a=>{const c=n.schema.nodes[t.type];if(!c)throw new Error("Node type tag does not exist in the schema");a.type!==c&&l.setBlockType(s,o,c,t.attrs)}),i(l)}setSelectionDecoration(e){this.#n();const t={bold:"strong",italics:"em",underline:"u",strikethrough:"s",monospace:"tt"},{state:n,dispatch:i}=this.#e,s=e,o=n.schema.marks[t[s]];if(!o)throw new Error(`${e} is not a supported decoration`);La(o)(n,i),this.#t=!0,this.#r()}#c(){const{state:e}=this.#e,{from:t,to:n}=e.selection,i={};return e.doc.nodesBetween(t,n,s=>{s.type.name==="heading"&&s.attrs.level===2?Xt(i,"title"):s.type.name==="heading"&&s.attrs.level===3?Xt(i,"subtitle"):s.type.name==="paragraph"&&Xt(i,"body")}),i.textBlockType}#h(){const{state:e}=this.#e,{from:t,to:n,empty:i}=e.selection,s=[];if(i){const o=e.doc.resolve(t).marks();e.schema.marks.strong&&o.some(l=>l.type===e.schema.marks.strong)&&s.push("bold"),e.schema.marks.em&&o.some(l=>l.type===e.schema.marks.em)&&s.push("italics"),e.schema.marks.u&&o.some(l=>l.type===e.schema.marks.u)&&s.push("underline"),e.schema.marks.s&&o.some(l=>l.type===e.schema.marks.s)&&s.push("strikethrough"),e.schema.marks.tt&&o.some(l=>l.type===e.schema.marks.tt)&&s.push("monospace")}else e.schema.marks.strong&&e.doc.rangeHasMark(t,n,e.schema.marks.strong)&&s.push("bold"),e.schema.marks.em&&e.doc.rangeHasMark(t,n,e.schema.marks.em)&&s.push("italics"),e.schema.marks.u&&e.doc.rangeHasMark(t,n,e.schema.marks.u)&&s.push("underline"),e.schema.marks.s&&e.doc.rangeHasMark(t,n,e.schema.marks.s)&&s.push("strikethrough"),e.schema.marks.tt&&e.doc.rangeHasMark(t,n,e.schema.marks.tt)&&s.push("monospace");return s.length?s:void 0}#f(){const{state:e}=this.#e,{from:t,to:n,empty:i}=e.selection,s="normal";if(i){const l=e.doc.resolve(t).marks().find(a=>a.type===e.schema.marks.textSize);return l?l.attrs.size:s}else{let o=null,l=!1;return e.doc.nodesBetween(t,n,a=>{if(a.isText){const c=a.marks.find(h=>h.type===e.schema.marks.textSize);if(c){if(o===null)o=c.attrs.size;else if(o!==c.attrs.size)return l=!0,!1}else if(o!==null)return l=!0,!1}return!0}),l?"":o!==null?o:s}}getSelectionStyles(){this.#n();const e={};return e.textBlockType=this.#c(),e.textDecoration=this.#h(),e.textSize=this.#f(),e}setTextSize(e="normal"){this.#n();const{state:t,dispatch:n}=this.#e,{schema:i,selection:s,tr:o}=t,{from:l,to:a}=s,c=i.marks.textSize;o.removeMark(l,a,c),o.addMark(l,a,c.create({size:e})),n(o.scrollIntoView()),this.#t=!0,this.#r()}getValue(){return this.#e.dom.innerHTML}async addInlineImage({file:e,position:t,alt:n,error:i}){this.#n();const s=new FileReader,o=await new Promise((d,m)=>{s.onload=()=>d(s.result),s.onerror=m,s.readAsDataURL(e)}),{state:l,dispatch:a}=this.#e,{schema:c}=l,h=n??`inline image from file ${e.name}`,f=i?sc(c,e,i):c.nodes.image.create({src:o,alt:h});let u=t;typeof u!="number"&&(u=l.selection.from);const p=l.tr.insert(u,f);a(p.scrollIntoView())}}var cc=Object.defineProperty,In=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=o(e,t,i)||i);return i&&cc(e,t,i),i};const hc={title:"h2",subtitle:"h3",body:"p"};class Pt extends qr.Localized(O.VividElement){constructor(){super(),this.selectionStart=null,this.#n=()=>{try{this.#t?.selection({start:this.selectionStart,end:this.selectionEnd?this.selectionEnd:this.selectionStart})}catch(e){console.warn(e.message)}},this.selectionEnd=null,this.#s=()=>{if(!this.#t.selection())return;const{start:e,end:t}=this.#t.selection();this.selectionStart=e,this.selectionEnd=t,this.$emit("selection-changed")},this.#o=()=>{this.$emit("change")},this.#r=()=>{this.$emit("input")}}get value(){return this.#t?.getValue()}set value(e){this.#t&&this.#t.replaceContent(e)}#t;get#e(){return this.shadowRoot.querySelector("#editor")}selectionStartChanged(){!this.selectionStart||this.selectionEnd&&this.selectionStart>this.selectionEnd||this.#n()}#n;selectionEndChanged(){this.selectionEnd&&!this.selectionStart&&(this.selectionStart=1),this.#n()}placeholderChanged(){this.#t?.updatePlaceholder(this.placeholder)}#s;#o;#r;connectedCallback(){super.connectedCallback(),this.#t||(this.#t=new ac,this.#t.init(this.#e),this.#t.addEventListener("selection-changed",this.#s),this.#t.addEventListener("change",this.#o),this.#t.addEventListener("input",this.#r)),this.placeholderChanged()}setTextBlock(e){try{this.#t?.setSelectionTag(hc[e])}catch{console.warn(`Invalid text block: ${e}`)}}setSelectionDecoration(e){try{this.#t?.setSelectionDecoration(e)}catch{console.warn(`Invalid decoration: ${e}`)}}setSelectionTextSize(e){this.#t?.setTextSize(e)}get selectionStyles(){return this.#t?this.#t.getSelectionStyles():{}}focus(){super.focus(),setTimeout(()=>{this.#i.focus()},0)}get#i(){return this.#e.querySelector('[contenteditable="true"]')}scrollToAttachments(e=0){O.DOM.queueUpdate(()=>{this.#e.scrollTop=this.#i.getBoundingClientRect().height-this.#e.getBoundingClientRect().height+e})}async addInlineImage(e){try{await this.#t.addInlineImage(e)}catch(t){console.warn(t.message)}}}In([O.attr({converter:O.nullableNumberConverter,attribute:"selection-start"})],Pt.prototype,"selectionStart");In([O.attr({converter:O.nullableNumberConverter,attribute:"selection-end"})],Pt.prototype,"selectionEnd");In([O.attr],Pt.prototype,"placeholder");const fc=r=>gn.classNames("control"),dc="menubar",We=r=>r.parentElement;function uc(r){We(r.target).setTextBlock(r.detail),We(r.target).focus()}function pc(r){We(r.target).setSelectionDecoration(r.detail),We(r.target).focus()}function mc(r){We(r.target).setSelectionTextSize(r.detail),We(r.target).focus()}function gc(r,{event:e}){const t=e.target;t.parentElement?.classList.toggle("hidden",t.assignedElements().length<1)}function yc(r,{event:e}){const n=e.target.assignedElements({flatten:!0}),i=n.find(s=>s.tagName.toLowerCase().endsWith(dc));n.forEach(s=>{s===i?s.style.removeProperty("display"):s.style.display="none"}),i&&(i.addEventListener("text-block-selected",uc),i.addEventListener("text-decoration-selected",pc),i.addEventListener("text-size-selected",mc))}function xc(r,{event:e}){r.dispatchEvent(new CustomEvent("file-drop",{detail:e.dataTransfer.files})),ms(r,{event:e})}function bc(r,{event:e}){e.currentTarget.classList.toggle("drag-over",!0)}function ms(r,{event:e}){const t=e.currentTarget;t.contains(e.relatedTarget)||t.classList.remove("drag-over")}const kc=r=>{const e=r.tagFor($r.Divider);return O.html`<template class="${fc}">
|
|
100
|
+
<div id="editor"
|
|
101
|
+
class="editor"
|
|
102
|
+
@drop="${xc}"
|
|
103
|
+
@dragenter="${bc}"
|
|
104
|
+
@dragleave="${ms}"
|
|
105
|
+
>
|
|
106
|
+
<div class="drag-overlay">
|
|
107
|
+
${t=>t.locale.richTextEditor.dragAndDropFilesHere}
|
|
108
|
+
</div>
|
|
109
|
+
<div id="attachments-wrapper" class="hidden">
|
|
110
|
+
<${e} class="divider"></${e}>
|
|
111
|
+
<slot name="attachments"
|
|
112
|
+
@slotchange="${gc}">
|
|
113
|
+
</slot>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
<slot name="menu-bar"
|
|
117
|
+
@slotchange="${yc}"></slot>
|
|
118
|
+
</template>`},Sc=":host{white-space:normal}.image-placeholder{display:flex;width:250px;height:64px;box-sizing:border-box;align-items:center;padding:16px;border:1px solid var(--vvd-color-neutral-200);border-radius:12px;background-color:var(--vvd-color-canvas);gap:16px}.icon{display:flex;width:40px;height:40px;box-sizing:border-box;flex-shrink:0;align-items:center;justify-content:center;border-radius:8px;background-color:color-mix(in srgb,var(--vvd-color-neutral-950),transparent 90%);color:var(--vvd-color-neutral-600)}.info{display:flex;flex-direction:column;min-inline-size:0}.filename{display:flex;overflow:hidden;width:100%;max-width:220px;color:var(--vvd-color-canvas-text);font:var(--vvd-typography-base-condensed-bold);white-space:nowrap}.name{overflow:hidden;flex:1 1 auto;text-overflow:ellipsis}.suffix{flex:0 0 auto;margin-left:4px}.error{display:flex;align-items:center;color:var(--vvd-color-alert-600);font:var(--vvd-typography-base-condensed);gap:6px}";var Mc=Object.defineProperty,Rt=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,o;s>=0;s--)(o=r[s])&&(i=o(e,t,i)||i);return i&&Mc(e,t,i),i};class ot extends O.VividElement{}Rt([O.attr({attribute:"file-name"})],ot.prototype,"fileName");Rt([O.attr({attribute:"size"})],ot.prototype,"size");Rt([O.attr({attribute:"error-message"})],ot.prototype,"errorMessage");Rt([O.attr({attribute:"icon"})],ot.prototype,"icon");const Cc=r=>gn.classNames("base"),Oc=({icon:r})=>r?`file-${r}-solid`:"clear-file-solid",wc=r=>r.fileName?.split(".").pop()||"",Tc=r=>r.fileName?.replace(/\.[^/.]+$/,"")||"",Nc=r=>{const e=r.tagFor(Wr.Icon);return O.html`<template class="${Cc}">
|
|
119
|
+
<div class="image-placeholder">
|
|
120
|
+
<div class="icon">
|
|
121
|
+
<${e} name="${Oc}" size="-5"></${e}>
|
|
122
|
+
</div>
|
|
123
|
+
<div class="info">
|
|
124
|
+
<div class="filename" title="${t=>t.fileName}">
|
|
125
|
+
<div class="name">${Tc}</div>
|
|
126
|
+
<div class="suffix">${wc}</div>
|
|
127
|
+
</div>
|
|
128
|
+
${bs.when(t=>t.errorMessage,O.html`<div class="error">
|
|
129
|
+
<span class="error-icon"><${e} name="error-solid" size="-6"></${e}></span>
|
|
130
|
+
<span class="error-text">${t=>t.errorMessage}</span>
|
|
131
|
+
</div>`)}
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
</template>`},Dc=O.defineVividComponent("text-editor-image-placeholder",ot,Nc,[Wr.iconDefinition],{styles:Sc,shadowOptions:{delegatesFocus:!0}}),Ec=O.defineVividComponent("rich-text-editor",Pt,kc,[Is,Br.dividerDefinition,Dc],{styles:ks,shadowOptions:{delegatesFocus:!0}}),Ac=O.createRegisterFunction(Ec);Ac();
|