@madie/madie-design-system 1.2.78 → 1.2.80
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/components/MadieDeleteDialog/index.jsx +2 -2
- package/components/RichTextEditor/index.jsx +1 -1
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/coverage/clover.xml +0 -771
- package/coverage/coverage-final.json +0 -40
- package/coverage/lcov-report/InputLabel/index.html +0 -116
- package/coverage/lcov-report/InputLabel/index.jsx.html +0 -244
- package/coverage/lcov-report/MadieTooltip/index.html +0 -131
- package/coverage/lcov-report/MadieTooltip/index.jsx.html +0 -229
- package/coverage/lcov-report/MadieTooltip/index.scss.html +0 -274
- package/coverage/lcov-report/MadieTooltipIcon/index.html +0 -116
- package/coverage/lcov-report/MadieTooltipIcon/index.jsx.html +0 -178
- package/coverage/lcov-report/TextField/index.html +0 -116
- package/coverage/lcov-report/TextField/index.jsx.html +0 -556
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -626
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/react/components/Accordion/index.html +0 -116
- package/coverage/lcov-report/react/components/Accordion/index.jsx.html +0 -370
- package/coverage/lcov-report/react/components/Alert/index.html +0 -116
- package/coverage/lcov-report/react/components/Alert/index.js.html +0 -250
- package/coverage/lcov-report/react/components/AutoComplete/AutoComplete.jsx.html +0 -868
- package/coverage/lcov-report/react/components/AutoComplete/index.html +0 -116
- package/coverage/lcov-report/react/components/Breadcrumb/index.html +0 -116
- package/coverage/lcov-report/react/components/Breadcrumb/index.js.html +0 -361
- package/coverage/lcov-report/react/components/Button/index.html +0 -116
- package/coverage/lcov-report/react/components/Button/index.js.html +0 -385
- package/coverage/lcov-report/react/components/DateField/DateField.jsx.html +0 -469
- package/coverage/lcov-report/react/components/DateField/index.html +0 -116
- package/coverage/lcov-report/react/components/DateTimeField/DateTimeField.jsx.html +0 -397
- package/coverage/lcov-report/react/components/DateTimeField/index.html +0 -116
- package/coverage/lcov-report/react/components/Dropdown/index.html +0 -116
- package/coverage/lcov-report/react/components/Dropdown/index.js.html +0 -340
- package/coverage/lcov-report/react/components/Error/Collapsible.jsx.html +0 -364
- package/coverage/lcov-report/react/components/Error/ErrorUI.jsx.html +0 -178
- package/coverage/lcov-report/react/components/Error/error.js.html +0 -163
- package/coverage/lcov-report/react/components/Error/index.html +0 -146
- package/coverage/lcov-report/react/components/Footer/FooterUI.jsx.html +0 -496
- package/coverage/lcov-report/react/components/Footer/LegacyFooterUI.jsx.html +0 -697
- package/coverage/lcov-report/react/components/Footer/footer.js.html +0 -175
- package/coverage/lcov-report/react/components/Footer/index.html +0 -146
- package/coverage/lcov-report/react/components/FormControlLabel/index.html +0 -116
- package/coverage/lcov-report/react/components/FormControlLabel/index.jsx.html +0 -154
- package/coverage/lcov-report/react/components/Infotip/Infotip.jsx.html +0 -310
- package/coverage/lcov-report/react/components/Infotip/InfotipIcon.jsx.html +0 -208
- package/coverage/lcov-report/react/components/Infotip/index.html +0 -146
- package/coverage/lcov-report/react/components/Infotip/index.js.html +0 -94
- package/coverage/lcov-report/react/components/InputLabel/index.html +0 -116
- package/coverage/lcov-report/react/components/InputLabel/index.jsx.html +0 -244
- package/coverage/lcov-report/react/components/Instant/index.html +0 -116
- package/coverage/lcov-report/react/components/Instant/index.jsx.html +0 -886
- package/coverage/lcov-report/react/components/Link/index.html +0 -116
- package/coverage/lcov-report/react/components/Link/index.js.html +0 -268
- package/coverage/lcov-report/react/components/MadieAlert/index.html +0 -116
- package/coverage/lcov-report/react/components/MadieAlert/index.jsx.html +0 -1291
- package/coverage/lcov-report/react/components/MadieConfirmDialog/index.html +0 -116
- package/coverage/lcov-report/react/components/MadieConfirmDialog/index.jsx.html +0 -277
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.html +0 -116
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.jsx.html +0 -253
- package/coverage/lcov-report/react/components/MadieDialog/index.html +0 -116
- package/coverage/lcov-report/react/components/MadieDialog/index.jsx.html +0 -1165
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.html +0 -116
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.jsx.html +0 -232
- package/coverage/lcov-report/react/components/MadieSpinner/index.html +0 -116
- package/coverage/lcov-report/react/components/MadieSpinner/index.jsx.html +0 -190
- package/coverage/lcov-report/react/components/MadieTooltip/index.html +0 -116
- package/coverage/lcov-report/react/components/MadieTooltip/index.jsx.html +0 -232
- package/coverage/lcov-report/react/components/MadieTooltip/index.scss.html +0 -274
- package/coverage/lcov-report/react/components/MadieTooltipIcon/index.html +0 -116
- package/coverage/lcov-report/react/components/MadieTooltipIcon/index.jsx.html +0 -178
- package/coverage/lcov-report/react/components/Modal/Modal.jsx.html +0 -553
- package/coverage/lcov-report/react/components/Modal/index.html +0 -131
- package/coverage/lcov-report/react/components/Modal/index.jsx.html +0 -139
- package/coverage/lcov-report/react/components/NumberInput/index.html +0 -116
- package/coverage/lcov-report/react/components/NumberInput/index.jsx.html +0 -310
- package/coverage/lcov-report/react/components/Pagination/index.html +0 -116
- package/coverage/lcov-report/react/components/Pagination/index.jsx.html +0 -736
- package/coverage/lcov-report/react/components/Popover/index.html +0 -116
- package/coverage/lcov-report/react/components/Popover/index.js.html +0 -481
- package/coverage/lcov-report/react/components/RadioButton/RadioButton.jsx.html +0 -490
- package/coverage/lcov-report/react/components/RadioButton/index.html +0 -116
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.html +0 -116
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.jsx.html +0 -346
- package/coverage/lcov-report/react/components/RichTextEditor/index.html +0 -116
- package/coverage/lcov-report/react/components/RichTextEditor/index.jsx.html +0 -922
- package/coverage/lcov-report/react/components/Search/index.html +0 -116
- package/coverage/lcov-report/react/components/Search/index.js.html +0 -343
- package/coverage/lcov-report/react/components/Select/index.html +0 -116
- package/coverage/lcov-report/react/components/Select/index.jsx.html +0 -658
- package/coverage/lcov-report/react/components/Tabs/Tab.js.html +0 -325
- package/coverage/lcov-report/react/components/Tabs/TabPanel.js.html +0 -208
- package/coverage/lcov-report/react/components/Tabs/index.html +0 -146
- package/coverage/lcov-report/react/components/Tabs/index.js.html +0 -433
- package/coverage/lcov-report/react/components/TextArea/index.html +0 -116
- package/coverage/lcov-report/react/components/TextArea/index.jsx.html +0 -520
- package/coverage/lcov-report/react/components/TextField/index.html +0 -116
- package/coverage/lcov-report/react/components/TextField/index.jsx.html +0 -748
- package/coverage/lcov-report/react/components/TextInput/index.html +0 -116
- package/coverage/lcov-report/react/components/TextInput/index.js.html +0 -496
- package/coverage/lcov-report/react/components/TimeField/TimeField.jsx.html +0 -388
- package/coverage/lcov-report/react/components/TimeField/index.html +0 -116
- package/coverage/lcov-report/react/components/Toast/index.html +0 -116
- package/coverage/lcov-report/react/components/Toast/index.jsx.html +0 -436
- package/coverage/lcov-report/react/components/Tooltip/Tooltip.jsx.html +0 -349
- package/coverage/lcov-report/react/components/Tooltip/index.html +0 -146
- package/coverage/lcov-report/react/components/Tooltip/index.js.html +0 -94
- package/coverage/lcov-report/react/components/Tooltip/position.js.html +0 -313
- package/coverage/lcov-report/react/components/TruncateText/index.html +0 -116
- package/coverage/lcov-report/react/components/TruncateText/index.js.html +0 -241
- package/coverage/lcov-report/react/components/index.html +0 -116
- package/coverage/lcov-report/react/components/index.js.html +0 -547
- package/coverage/lcov-report/react/index.html +0 -116
- package/coverage/lcov-report/react/index.js.html +0 -127
- package/coverage/lcov-report/react/lib/Chevron.jsx.html +0 -181
- package/coverage/lcov-report/react/lib/SvgComponents.jsx.html +0 -1777
- package/coverage/lcov-report/react/lib/index.html +0 -131
- package/coverage/lcov-report/react/themes/actionCenterTheme.js.html +0 -175
- package/coverage/lcov-report/react/themes/index.html +0 -116
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -1705
- package/storybook-static/1606.9527419c.iframe.bundle.js +0 -76
- package/storybook-static/1606.9527419c.iframe.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/1606.9527419c.iframe.bundle.js.map +0 -1
- package/storybook-static/1822.72412063.iframe.bundle.js +0 -2
- package/storybook-static/1822.72412063.iframe.bundle.js.LICENSE.txt +0 -5
- package/storybook-static/2247.8b06a622.iframe.bundle.js +0 -87
- package/storybook-static/2247.8b06a622.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/2247.8b06a622.iframe.bundle.js.map +0 -1
- package/storybook-static/2360.690c5cd8.iframe.bundle.js +0 -1
- package/storybook-static/2505.5a3351ca.iframe.bundle.js +0 -2
- package/storybook-static/2505.5a3351ca.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/2543.64e1c8c6.iframe.bundle.js +0 -2
- package/storybook-static/2543.64e1c8c6.iframe.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/2763.e9244c7e.iframe.bundle.js +0 -1
- package/storybook-static/3009.7080427c.iframe.bundle.js +0 -1
- package/storybook-static/312.98473fc0.iframe.bundle.js +0 -2
- package/storybook-static/312.98473fc0.iframe.bundle.js.LICENSE.txt +0 -17
- package/storybook-static/3264.1483ccad.iframe.bundle.js +0 -1
- package/storybook-static/3461.b9b84310.iframe.bundle.js +0 -29
- package/storybook-static/3461.b9b84310.iframe.bundle.js.map +0 -1
- package/storybook-static/4246.3dee0bc1.iframe.bundle.js +0 -1
- package/storybook-static/4683.334f6a20.iframe.bundle.js +0 -1
- package/storybook-static/4753.b31cfa9b.iframe.bundle.js +0 -1
- package/storybook-static/4788.aa09e5f9.iframe.bundle.js +0 -1
- package/storybook-static/5043.53f3bb0c.iframe.bundle.js +0 -2
- package/storybook-static/5043.53f3bb0c.iframe.bundle.js.LICENSE.txt +0 -1
- package/storybook-static/5467.8b66ac25.iframe.bundle.js +0 -1
- package/storybook-static/6357.6600668a.iframe.bundle.js +0 -1
- package/storybook-static/651.1fcfd284.iframe.bundle.js +0 -1
- package/storybook-static/6520.84e91a57.iframe.bundle.js +0 -2
- package/storybook-static/6520.84e91a57.iframe.bundle.js.LICENSE.txt +0 -19
- package/storybook-static/6958.8a916fa2.iframe.bundle.js +0 -1
- package/storybook-static/7599.3f695d6a.iframe.bundle.js +0 -1
- package/storybook-static/7648.6ac96dea.iframe.bundle.js +0 -1
- package/storybook-static/7737.8a6a8e54.iframe.bundle.js +0 -1
- package/storybook-static/8255.e2a8ed59.iframe.bundle.js +0 -2
- package/storybook-static/8255.e2a8ed59.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/8735.566590af.iframe.bundle.js +0 -2
- package/storybook-static/8735.566590af.iframe.bundle.js.LICENSE.txt +0 -29
- package/storybook-static/9010.9ac07800.iframe.bundle.js +0 -1
- package/storybook-static/9060.b9282f66.iframe.bundle.js +0 -1
- package/storybook-static/9249.28266e92.iframe.bundle.js +0 -1
- package/storybook-static/9859.25828a48.iframe.bundle.js +0 -2
- package/storybook-static/9859.25828a48.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/Accordion-Accordion-stories.dbeb9f2a.iframe.bundle.js +0 -2
- package/storybook-static/Accordion-Accordion-stories.dbeb9f2a.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/AutoComplete-AutoComplete-stories.3fa69ad4.iframe.bundle.js +0 -1
- package/storybook-static/Button-Button-stories.c56437c4.iframe.bundle.js +0 -1
- package/storybook-static/DateField-DateField-stories.9e1b9e5c.iframe.bundle.js +0 -1
- package/storybook-static/DateTimeField-DateTimeField-stories.4d184efd.iframe.bundle.js +0 -1
- package/storybook-static/Instant-Instant-stories.cdd1bf7f.iframe.bundle.js +0 -1
- package/storybook-static/MadieAlert-MadieAlert-stories.b0a784a8.iframe.bundle.js +0 -1
- package/storybook-static/MadieConfirmDialog-MadieConfirmDialog-stories.2629a704.iframe.bundle.js +0 -1
- package/storybook-static/MadieDeleteDialog-MadieDeleteDialog-stories.0f91e77f.iframe.bundle.js +0 -1
- package/storybook-static/MadieDialog-MadieDialog-stories.1e63ebb3.iframe.bundle.js +0 -1
- package/storybook-static/MadieDiscardDialog-MadieDiscardDialog-stories.4632ec72.iframe.bundle.js +0 -1
- package/storybook-static/MadieSpinner-MadieSpinner-stories.6c47900d.iframe.bundle.js +0 -30
- package/storybook-static/MadieSpinner-MadieSpinner-stories.6c47900d.iframe.bundle.js.LICENSE.txt +0 -8
- package/storybook-static/MadieSpinner-MadieSpinner-stories.6c47900d.iframe.bundle.js.map +0 -1
- package/storybook-static/MadieTooltip-MadieTooltip-stories.0c8fb8f7.iframe.bundle.js +0 -2
- package/storybook-static/MadieTooltip-MadieTooltip-stories.0c8fb8f7.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/MadieTooltipIcon-MadieTooltipIcon-stories.b33f0165.iframe.bundle.js +0 -2
- package/storybook-static/MadieTooltipIcon-MadieTooltipIcon-stories.b33f0165.iframe.bundle.js.LICENSE.txt +0 -9
- package/storybook-static/Modal-Modal-stories.1c8c1dcd.iframe.bundle.js +0 -2
- package/storybook-static/Modal-Modal-stories.1c8c1dcd.iframe.bundle.js.LICENSE.txt +0 -19
- package/storybook-static/NumberInput-NumberInput-stories.b642f330.iframe.bundle.js +0 -1
- package/storybook-static/Pagination-Pagination-stories.dc63a146.iframe.bundle.js +0 -1
- package/storybook-static/Popover-Popover-stories.680cce19.iframe.bundle.js +0 -1
- package/storybook-static/RadioButton-RadioButton-stories.5daa020f.iframe.bundle.js +0 -1
- package/storybook-static/ReadOnlyTextField-ReadOnlyTextField-stories.281af1c9.iframe.bundle.js +0 -1
- package/storybook-static/RichTextEditor-RichTextEditor-stories.f2f6efd0.iframe.bundle.js +0 -1
- package/storybook-static/Search-Search-stories.ce9d2b51.iframe.bundle.js +0 -1
- package/storybook-static/Select-Select-stories.1ba58501.iframe.bundle.js +0 -1
- package/storybook-static/Tabs-Tabs-stories.e9bf42ff.iframe.bundle.js +0 -1
- package/storybook-static/TextArea-TextArea-stories.9bb45748.iframe.bundle.js +0 -1
- package/storybook-static/TextField-TextField-stories.e5c08a5e.iframe.bundle.js +0 -1
- package/storybook-static/TimeField-TimeField-stories.760f9db5.iframe.bundle.js +0 -1
- package/storybook-static/Toast-Toast-stories.160e8bf1.iframe.bundle.js +0 -1
- package/storybook-static/TruncateText-TruncateText-stories.2da57e6a.iframe.bundle.js +0 -1
- package/storybook-static/favicon.svg +0 -1
- package/storybook-static/iframe.html +0 -531
- package/storybook-static/index.html +0 -152
- package/storybook-static/index.json +0 -1
- package/storybook-static/main.18ce3a87.iframe.bundle.js +0 -1
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +0 -1
- package/storybook-static/runtime~main.6bbd8126.iframe.bundle.js +0 -1
- package/storybook-static/sb-addons/docs-2/manager-bundle.js +0 -151
- package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +0 -188
- package/storybook-static/sb-common-assets/favicon.svg +0 -1
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +0 -797
- package/storybook-static/sb-manager/globals-runtime.js +0 -69459
- package/storybook-static/sb-manager/globals.js +0 -34
- package/storybook-static/sb-manager/runtime.js +0 -13003
- package/storybook-static/sb-preview/globals.js +0 -25
- package/storybook-static/sb-preview/runtime.js +0 -43237
- package/storybook-static/static/media/FontAwesome.91f80bba.otf +0 -0
- package/storybook-static/static/media/Rubik-Bold.31bbd4d2.ttf +0 -0
- package/storybook-static/static/media/Rubik-Light.c90e2014.ttf +0 -0
- package/storybook-static/static/media/Rubik-Medium.5daa89aa.ttf +0 -0
- package/storybook-static/static/media/Rubik-Regular.cdf97d58.ttf +0 -0
- package/storybook-static/static/media/bitter-bold.24bf01e4.woff2 +0 -0
- package/storybook-static/static/media/bitter-italic.34644574.woff2 +0 -0
- package/storybook-static/static/media/bitter-regular.f4e2f1f1.woff2 +0 -0
- package/storybook-static/static/media/fontawesome-webfont.1e59d233.ttf +0 -0
- package/storybook-static/static/media/fontawesome-webfont.20fd1704.woff2 +0 -0
- package/storybook-static/static/media/fontawesome-webfont.8b43027f.eot +0 -0
- package/storybook-static/static/media/fontawesome-webfont.c1e38fd9.svg +0 -2671
- package/storybook-static/static/media/fontawesome-webfont.f691f37e.woff +0 -0
- package/storybook-static/static/media/opensans-bold-webfont.92e570c6.woff2 +0 -0
- package/storybook-static/static/media/opensans-italic-webfont.72daa33a.woff2 +0 -0
- package/storybook-static/static/media/opensans-regular-webfont.ca4dd835.woff2 +0 -0
- package/storybook-static/static/media/opensans-semibold-webfont.17ded75f.woff2 +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 5043.53f3bb0c.iframe.bundle.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunk_madie_madie_design_system=self.webpackChunk_madie_madie_design_system||[]).push([[5043],{"./node_modules/@mui/icons-material/esm/FormatBold.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@mui/material/esm/utils/createSvgIcon.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__=(0,_utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__.A)((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42M10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5"}),"FormatBold")},"./node_modules/@mui/icons-material/esm/FormatItalic.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@mui/material/esm/utils/createSvgIcon.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__=(0,_utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__.A)((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"}),"FormatItalic")},"./node_modules/@mui/icons-material/esm/FormatListBulleted.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@mui/material/esm/utils/createSvgIcon.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__=(0,_utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__.A)((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5m0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5m0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5M7 19h14v-2H7zm0-6h14v-2H7zm0-8v2h14V5z"}),"FormatListBulleted")},"./node_modules/@mui/icons-material/esm/FormatListNumbered.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@mui/material/esm/utils/createSvgIcon.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__=(0,_utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__.A)((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M2 17h2v.5H3v1h1v.5H2v1h3v-4H2zm1-9h1V4H2v1h1zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2zm5-6v2h14V5zm0 14h14v-2H7zm0-6h14v-2H7z"}),"FormatListNumbered")},"./node_modules/@mui/icons-material/esm/FormatUnderlined.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@mui/material/esm/utils/createSvgIcon.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__=(0,_utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__.A)((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6m-7 2v2h14v-2z"}),"FormatUnderlined")},"./node_modules/@mui/icons-material/esm/StrikethroughS.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@mui/material/esm/utils/createSvgIcon.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__=(0,_utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__.A)((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M6.85 7.08C6.85 4.37 9.45 3 12.24 3c1.64 0 3 .49 3.9 1.28.77.65 1.46 1.73 1.46 3.24h-3.01c0-.31-.05-.59-.15-.85-.29-.86-1.2-1.28-2.25-1.28-1.86 0-2.34 1.02-2.34 1.7 0 .48.25.88.74 1.21.38.25.77.48 1.41.7H7.39c-.21-.34-.54-.89-.54-1.92M21 12v-2H3v2h9.62c1.15.45 1.96.75 1.96 1.97 0 1-.81 1.67-2.28 1.67-1.54 0-2.93-.54-2.93-2.51H6.4c0 .55.08 1.13.24 1.58.81 2.29 3.29 3.3 5.67 3.3 2.27 0 5.3-.89 5.3-4.05 0-.3-.01-1.16-.48-1.94H21z"}),"StrikethroughS")},"./node_modules/@mui/icons-material/esm/TableChart.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/@mui/material/esm/utils/createSvgIcon.js"),react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/jsx-runtime.js");const __WEBPACK_DEFAULT_EXPORT__=(0,_utils_createSvgIcon_js__WEBPACK_IMPORTED_MODULE_1__.A)((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("path",{d:"M10 10.02h5V21h-5zM17 21h3c1.1 0 2-.9 2-2v-9h-5zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2M3 19c0 1.1.9 2 2 2h3V10H3z"}),"TableChart")},"./node_modules/@tiptap/core/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{KE:()=>Editor,YY:()=>Extension,CU:()=>Mark,bP:()=>Node,gk:()=>callOrReturn,AB:()=>canInsertNode,eL:()=>findParentNodeClosestToPos,iI:()=>getExtensionField,BQ:()=>isNodeSelection,OX:()=>markInputRule,Zc:()=>markPasteRule,KV:()=>mergeAttributes,jT:()=>nodeInputRule,JJ:()=>textblockTypeInputRule,tG:()=>wrappingInputRule});var dist=__webpack_require__("./node_modules/prosemirror-state/dist/index.js"),prosemirror_view_dist=__webpack_require__("./node_modules/prosemirror-view/dist/index.js"),prosemirror_keymap_dist=__webpack_require__("./node_modules/prosemirror-keymap/dist/index.js"),prosemirror_model_dist=__webpack_require__("./node_modules/prosemirror-model/dist/index.js"),prosemirror_transform_dist=__webpack_require__("./node_modules/prosemirror-transform/dist/index.js");const deleteSelection=(state,dispatch)=>!state.selection.empty&&(dispatch&&dispatch(state.tr.deleteSelection().scrollIntoView()),!0);function atBlockStart(state,view){let{$cursor}=state.selection;return!$cursor||(view?!view.endOfTextblock("backward",state):$cursor.parentOffset>0)?null:$cursor}const joinBackward=(state,dispatch,view)=>{let $cursor=atBlockStart(state,view);if(!$cursor)return!1;let $cut=findCutBefore($cursor);if(!$cut){let range=$cursor.blockRange(),target=range&&(0,prosemirror_transform_dist.jP)(range);return null!=target&&(dispatch&&dispatch(state.tr.lift(range,target).scrollIntoView()),!0)}let before=$cut.nodeBefore;if(deleteBarrier(state,$cut,dispatch,-1))return!0;if(0==$cursor.parent.content.size&&(textblockAt(before,"end")||dist.nh.isSelectable(before)))for(let depth=$cursor.depth;;depth--){let delStep=(0,prosemirror_transform_dist.$L)(state.doc,$cursor.before(depth),$cursor.after(depth),prosemirror_model_dist.Ji.empty);if(delStep&&delStep.slice.size<delStep.to-delStep.from){if(dispatch){let tr=state.tr.step(delStep);tr.setSelection(textblockAt(before,"end")?dist.LN.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos,-1)),-1):dist.nh.create(tr.doc,$cut.pos-before.nodeSize)),dispatch(tr.scrollIntoView())}return!0}if(1==depth||$cursor.node(depth-1).childCount>1)break}return!(!before.isAtom||$cut.depth!=$cursor.depth-1)&&(dispatch&&dispatch(state.tr.delete($cut.pos-before.nodeSize,$cut.pos).scrollIntoView()),!0)};function joinTextblocksAround(state,$cut,dispatch){let beforeText=$cut.nodeBefore,beforePos=$cut.pos-1;for(;!beforeText.isTextblock;beforePos--){if(beforeText.type.spec.isolating)return!1;let child=beforeText.lastChild;if(!child)return!1;beforeText=child}let afterText=$cut.nodeAfter,afterPos=$cut.pos+1;for(;!afterText.isTextblock;afterPos++){if(afterText.type.spec.isolating)return!1;let child=afterText.firstChild;if(!child)return!1;afterText=child}let step=(0,prosemirror_transform_dist.$L)(state.doc,beforePos,afterPos,prosemirror_model_dist.Ji.empty);if(!step||step.from!=beforePos||step instanceof prosemirror_transform_dist.Ln&&step.slice.size>=afterPos-beforePos)return!1;if(dispatch){let tr=state.tr.step(step);tr.setSelection(dist.U3.create(tr.doc,beforePos)),dispatch(tr.scrollIntoView())}return!0}function textblockAt(node,side,only=!1){for(let scan=node;scan;scan="start"==side?scan.firstChild:scan.lastChild){if(scan.isTextblock)return!0;if(only&&1!=scan.childCount)return!1}return!1}const selectNodeBackward=(state,dispatch,view)=>{let{$head,empty}=state.selection,$cut=$head;if(!empty)return!1;if($head.parent.isTextblock){if(view?!view.endOfTextblock("backward",state):$head.parentOffset>0)return!1;$cut=findCutBefore($head)}let node=$cut&&$cut.nodeBefore;return!(!node||!dist.nh.isSelectable(node))&&(dispatch&&dispatch(state.tr.setSelection(dist.nh.create(state.doc,$cut.pos-node.nodeSize)).scrollIntoView()),!0)};function findCutBefore($pos){if(!$pos.parent.type.spec.isolating)for(let i=$pos.depth-1;i>=0;i--){if($pos.index(i)>0)return $pos.doc.resolve($pos.before(i+1));if($pos.node(i).type.spec.isolating)break}return null}function atBlockEnd(state,view){let{$cursor}=state.selection;return!$cursor||(view?!view.endOfTextblock("forward",state):$cursor.parentOffset<$cursor.parent.content.size)?null:$cursor}const joinForward=(state,dispatch,view)=>{let $cursor=atBlockEnd(state,view);if(!$cursor)return!1;let $cut=findCutAfter($cursor);if(!$cut)return!1;let after=$cut.nodeAfter;if(deleteBarrier(state,$cut,dispatch,1))return!0;if(0==$cursor.parent.content.size&&(textblockAt(after,"start")||dist.nh.isSelectable(after))){let delStep=(0,prosemirror_transform_dist.$L)(state.doc,$cursor.before(),$cursor.after(),prosemirror_model_dist.Ji.empty);if(delStep&&delStep.slice.size<delStep.to-delStep.from){if(dispatch){let tr=state.tr.step(delStep);tr.setSelection(textblockAt(after,"start")?dist.LN.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)),1):dist.nh.create(tr.doc,tr.mapping.map($cut.pos))),dispatch(tr.scrollIntoView())}return!0}}return!(!after.isAtom||$cut.depth!=$cursor.depth-1)&&(dispatch&&dispatch(state.tr.delete($cut.pos,$cut.pos+after.nodeSize).scrollIntoView()),!0)},selectNodeForward=(state,dispatch,view)=>{let{$head,empty}=state.selection,$cut=$head;if(!empty)return!1;if($head.parent.isTextblock){if(view?!view.endOfTextblock("forward",state):$head.parentOffset<$head.parent.content.size)return!1;$cut=findCutAfter($head)}let node=$cut&&$cut.nodeAfter;return!(!node||!dist.nh.isSelectable(node))&&(dispatch&&dispatch(state.tr.setSelection(dist.nh.create(state.doc,$cut.pos)).scrollIntoView()),!0)};function findCutAfter($pos){if(!$pos.parent.type.spec.isolating)for(let i=$pos.depth-1;i>=0;i--){let parent=$pos.node(i);if($pos.index(i)+1<parent.childCount)return $pos.doc.resolve($pos.after(i+1));if(parent.type.spec.isolating)break}return null}const newlineInCode=(state,dispatch)=>{let{$head,$anchor}=state.selection;return!(!$head.parent.type.spec.code||!$head.sameParent($anchor))&&(dispatch&&dispatch(state.tr.insertText("\n").scrollIntoView()),!0)};function defaultBlockAt(match){for(let i=0;i<match.edgeCount;i++){let{type}=match.edge(i);if(type.isTextblock&&!type.hasRequiredAttrs())return type}return null}const exitCode=(state,dispatch)=>{let{$head,$anchor}=state.selection;if(!$head.parent.type.spec.code||!$head.sameParent($anchor))return!1;let above=$head.node(-1),after=$head.indexAfter(-1),type=defaultBlockAt(above.contentMatchAt(after));if(!type||!above.canReplaceWith(after,after,type))return!1;if(dispatch){let pos=$head.after(),tr=state.tr.replaceWith(pos,pos,type.createAndFill());tr.setSelection(dist.LN.near(tr.doc.resolve(pos),1)),dispatch(tr.scrollIntoView())}return!0},createParagraphNear=(state,dispatch)=>{let sel=state.selection,{$from,$to}=sel;if(sel instanceof dist.i5||$from.parent.inlineContent||$to.parent.inlineContent)return!1;let type=defaultBlockAt($to.parent.contentMatchAt($to.indexAfter()));if(!type||!type.isTextblock)return!1;if(dispatch){let side=(!$from.parentOffset&&$to.index()<$to.parent.childCount?$from:$to).pos,tr=state.tr.insert(side,type.createAndFill());tr.setSelection(dist.U3.create(tr.doc,side+1)),dispatch(tr.scrollIntoView())}return!0},liftEmptyBlock=(state,dispatch)=>{let{$cursor}=state.selection;if(!$cursor||$cursor.parent.content.size)return!1;if($cursor.depth>1&&$cursor.after()!=$cursor.end(-1)){let before=$cursor.before();if((0,prosemirror_transform_dist.zy)(state.doc,before))return dispatch&&dispatch(state.tr.split(before).scrollIntoView()),!0}let range=$cursor.blockRange(),target=range&&(0,prosemirror_transform_dist.jP)(range);return null!=target&&(dispatch&&dispatch(state.tr.lift(range,target).scrollIntoView()),!0)};const splitBlock=function splitBlockAs(splitNode){return(state,dispatch)=>{let{$from,$to}=state.selection;if(state.selection instanceof dist.nh&&state.selection.node.isBlock)return!(!$from.parentOffset||!(0,prosemirror_transform_dist.zy)(state.doc,$from.pos))&&(dispatch&&dispatch(state.tr.split($from.pos).scrollIntoView()),!0);if(!$from.depth)return!1;let splitDepth,deflt,types=[],atEnd=!1,atStart=!1;for(let d=$from.depth;;d--){if($from.node(d).isBlock){atEnd=$from.end(d)==$from.pos+($from.depth-d),atStart=$from.start(d)==$from.pos-($from.depth-d),deflt=defaultBlockAt($from.node(d-1).contentMatchAt($from.indexAfter(d-1)));let splitType=splitNode&&splitNode($to.parent,atEnd,$from);types.unshift(splitType||(atEnd&&deflt?{type:deflt}:null)),splitDepth=d;break}if(1==d)return!1;types.unshift(null)}let tr=state.tr;(state.selection instanceof dist.U3||state.selection instanceof dist.i5)&&tr.deleteSelection();let splitPos=tr.mapping.map($from.pos),can=(0,prosemirror_transform_dist.zy)(tr.doc,splitPos,types.length,types);if(can||(types[0]=deflt?{type:deflt}:null,can=(0,prosemirror_transform_dist.zy)(tr.doc,splitPos,types.length,types)),!can)return!1;if(tr.split(splitPos,types.length,types),!atEnd&&atStart&&$from.node(splitDepth).type!=deflt){let first=tr.mapping.map($from.before(splitDepth)),$first=tr.doc.resolve(first);deflt&&$from.node(splitDepth-1).canReplaceWith($first.index(),$first.index()+1,deflt)&&tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)),deflt)}return dispatch&&dispatch(tr.scrollIntoView()),!0}}();function deleteBarrier(state,$cut,dispatch,dir){let conn,match,before=$cut.nodeBefore,after=$cut.nodeAfter,isolated=before.type.spec.isolating||after.type.spec.isolating;if(!isolated&&function joinMaybeClear(state,$pos,dispatch){let before=$pos.nodeBefore,after=$pos.nodeAfter,index=$pos.index();return!(!(before&&after&&before.type.compatibleContent(after.type))||(!before.content.size&&$pos.parent.canReplace(index-1,index)?(dispatch&&dispatch(state.tr.delete($pos.pos-before.nodeSize,$pos.pos).scrollIntoView()),0):!$pos.parent.canReplace(index,index+1)||!after.isTextblock&&!(0,prosemirror_transform_dist.n9)(state.doc,$pos.pos)||(dispatch&&dispatch(state.tr.join($pos.pos).scrollIntoView()),0)))}(state,$cut,dispatch))return!0;let canDelAfter=!isolated&&$cut.parent.canReplace($cut.index(),$cut.index()+1);if(canDelAfter&&(conn=(match=before.contentMatchAt(before.childCount)).findWrapping(after.type))&&match.matchType(conn[0]||after.type).validEnd){if(dispatch){let end=$cut.pos+after.nodeSize,wrap=prosemirror_model_dist.FK.empty;for(let i=conn.length-1;i>=0;i--)wrap=prosemirror_model_dist.FK.from(conn[i].create(null,wrap));wrap=prosemirror_model_dist.FK.from(before.copy(wrap));let tr=state.tr.step(new prosemirror_transform_dist.Wg($cut.pos-1,end,$cut.pos,end,new prosemirror_model_dist.Ji(wrap,1,0),conn.length,!0)),$joinAt=tr.doc.resolve(end+2*conn.length);$joinAt.nodeAfter&&$joinAt.nodeAfter.type==before.type&&(0,prosemirror_transform_dist.n9)(tr.doc,$joinAt.pos)&&tr.join($joinAt.pos),dispatch(tr.scrollIntoView())}return!0}let selAfter=after.type.spec.isolating||dir>0&&isolated?null:dist.LN.findFrom($cut,1),range=selAfter&&selAfter.$from.blockRange(selAfter.$to),target=range&&(0,prosemirror_transform_dist.jP)(range);if(null!=target&&target>=$cut.depth)return dispatch&&dispatch(state.tr.lift(range,target).scrollIntoView()),!0;if(canDelAfter&&textblockAt(after,"start",!0)&&textblockAt(before,"end")){let at=before,wrap=[];for(;wrap.push(at),!at.isTextblock;)at=at.lastChild;let afterText=after,afterDepth=1;for(;!afterText.isTextblock;afterText=afterText.firstChild)afterDepth++;if(at.canReplace(at.childCount,at.childCount,afterText.content)){if(dispatch){let end=prosemirror_model_dist.FK.empty;for(let i=wrap.length-1;i>=0;i--)end=prosemirror_model_dist.FK.from(wrap[i].copy(end));dispatch(state.tr.step(new prosemirror_transform_dist.Wg($cut.pos-wrap.length,$cut.pos+after.nodeSize,$cut.pos+afterDepth,$cut.pos+after.nodeSize-afterDepth,new prosemirror_model_dist.Ji(end,wrap.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function selectTextblockSide(side){return function(state,dispatch){let sel=state.selection,$pos=side<0?sel.$from:sel.$to,depth=$pos.depth;for(;$pos.node(depth).isInline;){if(!depth)return!1;depth--}return!!$pos.node(depth).isTextblock&&(dispatch&&dispatch(state.tr.setSelection(dist.U3.create(state.doc,side<0?$pos.start(depth):$pos.end(depth)))),!0)}}const selectTextblockStart=selectTextblockSide(-1),selectTextblockEnd=selectTextblockSide(1);function setBlockType(nodeType,attrs=null){return function(state,dispatch){let applicable=!1;for(let i=0;i<state.selection.ranges.length&&!applicable;i++){let{$from:{pos:from},$to:{pos:to}}=state.selection.ranges[i];state.doc.nodesBetween(from,to,(node,pos)=>{if(applicable)return!1;if(node.isTextblock&&!node.hasMarkup(nodeType,attrs))if(node.type==nodeType)applicable=!0;else{let $pos=state.doc.resolve(pos),index=$pos.index();applicable=$pos.parent.canReplaceWith(index,index+1,nodeType)}})}if(!applicable)return!1;if(dispatch){let tr=state.tr;for(let i=0;i<state.selection.ranges.length;i++){let{$from:{pos:from},$to:{pos:to}}=state.selection.ranges[i];tr.setBlockType(from,to,nodeType,attrs)}dispatch(tr.scrollIntoView())}return!0}}function chainCommands(...commands){return function(state,dispatch,view){for(let i=0;i<commands.length;i++)if(commands[i](state,dispatch,view))return!0;return!1}}let backspace=chainCommands(deleteSelection,joinBackward,selectNodeBackward),del=chainCommands(deleteSelection,joinForward,selectNodeForward);const pcBaseKeymap={Enter:chainCommands(newlineInCode,createParagraphNear,liftEmptyBlock,splitBlock),"Mod-Enter":exitCode,Backspace:backspace,"Mod-Backspace":backspace,"Shift-Backspace":backspace,Delete:del,"Mod-Delete":del,"Mod-a":(state,dispatch)=>(dispatch&&dispatch(state.tr.setSelection(new dist.i5(state.doc))),!0)},macBaseKeymap={"Ctrl-h":pcBaseKeymap.Backspace,"Alt-Backspace":pcBaseKeymap["Mod-Backspace"],"Ctrl-d":pcBaseKeymap.Delete,"Ctrl-Alt-Backspace":pcBaseKeymap["Mod-Delete"],"Alt-Delete":pcBaseKeymap["Mod-Delete"],"Alt-d":pcBaseKeymap["Mod-Delete"],"Ctrl-a":selectTextblockStart,"Ctrl-e":selectTextblockEnd};for(let key in pcBaseKeymap)macBaseKeymap[key]=pcBaseKeymap[key];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&os.platform();function wrapInList(listType,attrs=null){return function(state,dispatch){let{$from,$to}=state.selection,range=$from.blockRange($to);if(!range)return!1;let tr=dispatch?state.tr:null;return!!function wrapRangeInList(tr,range,listType,attrs=null){let doJoin=!1,outerRange=range,doc=range.$from.doc;if(range.depth>=2&&range.$from.node(range.depth-1).type.compatibleContent(listType)&&0==range.startIndex){if(0==range.$from.index(range.depth-1))return!1;let $insert=doc.resolve(range.start-2);outerRange=new prosemirror_model_dist.u$($insert,$insert,range.depth),range.endIndex<range.parent.childCount&&(range=new prosemirror_model_dist.u$(range.$from,doc.resolve(range.$to.end(range.depth)),range.depth)),doJoin=!0}let wrap=(0,prosemirror_transform_dist.oM)(outerRange,listType,attrs,range);if(!wrap)return!1;tr&&function doWrapInList(tr,range,wrappers,joinBefore,listType){let content=prosemirror_model_dist.FK.empty;for(let i=wrappers.length-1;i>=0;i--)content=prosemirror_model_dist.FK.from(wrappers[i].type.create(wrappers[i].attrs,content));tr.step(new prosemirror_transform_dist.Wg(range.start-(joinBefore?2:0),range.end,range.start,range.end,new prosemirror_model_dist.Ji(content,0,0),wrappers.length,!0));let found=0;for(let i=0;i<wrappers.length;i++)wrappers[i].type==listType&&(found=i+1);let splitDepth=wrappers.length-found,splitPos=range.start+wrappers.length-(joinBefore?2:0),parent=range.parent;for(let i=range.startIndex,e=range.endIndex,first=!0;i<e;i++,first=!1)!first&&(0,prosemirror_transform_dist.zy)(tr.doc,splitPos,splitDepth)&&(tr.split(splitPos,splitDepth),splitPos+=2*splitDepth),splitPos+=parent.child(i).nodeSize;return tr}(tr,range,wrap,doJoin,listType);return!0}(tr,range,listType,attrs)&&(dispatch&&dispatch(tr.scrollIntoView()),!0)}}function liftListItem(itemType){return function(state,dispatch){let{$from,$to}=state.selection,range=$from.blockRange($to,node=>node.childCount>0&&node.firstChild.type==itemType);return!!range&&(!dispatch||($from.node(range.depth-1).type==itemType?function liftToOuterList(state,dispatch,itemType,range){let tr=state.tr,end=range.end,endOfList=range.$to.end(range.depth);end<endOfList&&(tr.step(new prosemirror_transform_dist.Wg(end-1,endOfList,end,endOfList,new prosemirror_model_dist.Ji(prosemirror_model_dist.FK.from(itemType.create(null,range.parent.copy())),1,0),1,!0)),range=new prosemirror_model_dist.u$(tr.doc.resolve(range.$from.pos),tr.doc.resolve(endOfList),range.depth));const target=(0,prosemirror_transform_dist.jP)(range);if(null==target)return!1;tr.lift(range,target);let $after=tr.doc.resolve(tr.mapping.map(end,-1)-1);(0,prosemirror_transform_dist.n9)(tr.doc,$after.pos)&&$after.nodeBefore.type==$after.nodeAfter.type&&tr.join($after.pos);return dispatch(tr.scrollIntoView()),!0}(state,dispatch,itemType,range):function liftOutOfList(state,dispatch,range){let tr=state.tr,list=range.parent;for(let pos=range.end,i=range.endIndex-1,e=range.startIndex;i>e;i--)pos-=list.child(i).nodeSize,tr.delete(pos-1,pos+1);let $start=tr.doc.resolve(range.start),item=$start.nodeAfter;if(tr.mapping.map(range.end)!=range.start+$start.nodeAfter.nodeSize)return!1;let atStart=0==range.startIndex,atEnd=range.endIndex==list.childCount,parent=$start.node(-1),indexBefore=$start.index(-1);if(!parent.canReplace(indexBefore+(atStart?0:1),indexBefore+1,item.content.append(atEnd?prosemirror_model_dist.FK.empty:prosemirror_model_dist.FK.from(list))))return!1;let start=$start.pos,end=start+item.nodeSize;return tr.step(new prosemirror_transform_dist.Wg(start-(atStart?1:0),end+(atEnd?1:0),start+1,end-1,new prosemirror_model_dist.Ji((atStart?prosemirror_model_dist.FK.empty:prosemirror_model_dist.FK.from(list.copy(prosemirror_model_dist.FK.empty))).append(atEnd?prosemirror_model_dist.FK.empty:prosemirror_model_dist.FK.from(list.copy(prosemirror_model_dist.FK.empty))),atStart?0:1,atEnd?0:1),atStart?0:1)),dispatch(tr.scrollIntoView()),!0}(state,dispatch,range)))}}function createChainableState(config){const{state,transaction}=config;let{selection}=transaction,{doc}=transaction,{storedMarks}=transaction;return{...state,apply:state.apply.bind(state),applyTransaction:state.applyTransaction.bind(state),plugins:state.plugins,schema:state.schema,reconfigure:state.reconfigure.bind(state),toJSON:state.toJSON.bind(state),get storedMarks(){return storedMarks},get selection(){return selection},get doc(){return doc},get tr(){return selection=transaction.selection,doc=transaction.doc,storedMarks=transaction.storedMarks,transaction}}}class CommandManager{constructor(props){this.editor=props.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=props.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands,editor,state}=this,{view}=editor,{tr}=state,props=this.buildProps(tr);return Object.fromEntries(Object.entries(rawCommands).map(([name,command])=>[name,(...args)=>{const callback=command(...args)(props);return tr.getMeta("preventDispatch")||this.hasCustomState||view.dispatch(tr),callback}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(startTr,shouldDispatch=!0){const{rawCommands,editor,state}=this,{view}=editor,callbacks=[],hasStartTransaction=!!startTr,tr=startTr||state.tr,chain={...Object.fromEntries(Object.entries(rawCommands).map(([name,command])=>[name,(...args)=>{const props=this.buildProps(tr,shouldDispatch),callback=command(...args)(props);return callbacks.push(callback),chain}])),run:()=>(hasStartTransaction||!shouldDispatch||tr.getMeta("preventDispatch")||this.hasCustomState||view.dispatch(tr),callbacks.every(callback=>!0===callback))};return chain}createCan(startTr){const{rawCommands,state}=this,tr=startTr||state.tr,props=this.buildProps(tr,false),formattedCommands=Object.fromEntries(Object.entries(rawCommands).map(([name,command])=>[name,(...args)=>command(...args)({...props,dispatch:void 0})]));return{...formattedCommands,chain:()=>this.createChain(tr,false)}}buildProps(tr,shouldDispatch=!0){const{rawCommands,editor,state}=this,{view}=editor,props={tr,editor,view,state:createChainableState({state,transaction:tr}),dispatch:shouldDispatch?()=>{}:void 0,chain:()=>this.createChain(tr,shouldDispatch),can:()=>this.createCan(tr),get commands(){return Object.fromEntries(Object.entries(rawCommands).map(([name,command])=>[name,(...args)=>command(...args)(props)]))}};return props}}class EventEmitter{constructor(){this.callbacks={}}on(event,fn){return this.callbacks[event]||(this.callbacks[event]=[]),this.callbacks[event].push(fn),this}emit(event,...args){const callbacks=this.callbacks[event];return callbacks&&callbacks.forEach(callback=>callback.apply(this,args)),this}off(event,fn){const callbacks=this.callbacks[event];return callbacks&&(fn?this.callbacks[event]=callbacks.filter(callback=>callback!==fn):delete this.callbacks[event]),this}once(event,fn){const onceFn=(...args)=>{this.off(event,onceFn),fn.apply(this,args)};return this.on(event,onceFn)}removeAllListeners(){this.callbacks={}}}function getExtensionField(extension,field,context){if(void 0===extension.config[field]&&extension.parent)return getExtensionField(extension.parent,field,context);if("function"==typeof extension.config[field]){return extension.config[field].bind({...context,parent:extension.parent?getExtensionField(extension.parent,field,context):null})}return extension.config[field]}function splitExtensions(extensions){return{baseExtensions:extensions.filter(extension=>"extension"===extension.type),nodeExtensions:extensions.filter(extension=>"node"===extension.type),markExtensions:extensions.filter(extension=>"mark"===extension.type)}}function getAttributesFromExtensions(extensions){const extensionAttributes=[],{nodeExtensions,markExtensions}=splitExtensions(extensions),nodeAndMarkExtensions=[...nodeExtensions,...markExtensions],defaultAttribute={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return extensions.forEach(extension=>{const addGlobalAttributes=getExtensionField(extension,"addGlobalAttributes",{name:extension.name,options:extension.options,storage:extension.storage,extensions:nodeAndMarkExtensions});if(!addGlobalAttributes)return;addGlobalAttributes().forEach(globalAttribute=>{globalAttribute.types.forEach(type=>{Object.entries(globalAttribute.attributes).forEach(([name,attribute])=>{extensionAttributes.push({type,name,attribute:{...defaultAttribute,...attribute}})})})})}),nodeAndMarkExtensions.forEach(extension=>{const context={name:extension.name,options:extension.options,storage:extension.storage},addAttributes=getExtensionField(extension,"addAttributes",context);if(!addAttributes)return;const attributes=addAttributes();Object.entries(attributes).forEach(([name,attribute])=>{const mergedAttr={...defaultAttribute,...attribute};"function"==typeof(null==mergedAttr?void 0:mergedAttr.default)&&(mergedAttr.default=mergedAttr.default()),(null==mergedAttr?void 0:mergedAttr.isRequired)&&void 0===(null==mergedAttr?void 0:mergedAttr.default)&&delete mergedAttr.default,extensionAttributes.push({type:extension.name,name,attribute:mergedAttr})})}),extensionAttributes}function getNodeType(nameOrType,schema){if("string"==typeof nameOrType){if(!schema.nodes[nameOrType])throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);return schema.nodes[nameOrType]}return nameOrType}function mergeAttributes(...objects){return objects.filter(item=>!!item).reduce((items,item)=>{const mergedAttributes={...items};return Object.entries(item).forEach(([key,value])=>{if(mergedAttributes[key])if("class"===key){const valueClasses=value?String(value).split(" "):[],existingClasses=mergedAttributes[key]?mergedAttributes[key].split(" "):[],insertClasses=valueClasses.filter(valueClass=>!existingClasses.includes(valueClass));mergedAttributes[key]=[...existingClasses,...insertClasses].join(" ")}else if("style"===key){const newStyles=value?value.split(";").map(style=>style.trim()).filter(Boolean):[],existingStyles=mergedAttributes[key]?mergedAttributes[key].split(";").map(style=>style.trim()).filter(Boolean):[],styleMap=new Map;existingStyles.forEach(style=>{const[property,val]=style.split(":").map(part=>part.trim());styleMap.set(property,val)}),newStyles.forEach(style=>{const[property,val]=style.split(":").map(part=>part.trim());styleMap.set(property,val)}),mergedAttributes[key]=Array.from(styleMap.entries()).map(([property,val])=>`${property}: ${val}`).join("; ")}else mergedAttributes[key]=value;else mergedAttributes[key]=value}),mergedAttributes},{})}function getRenderedAttributes(nodeOrMark,extensionAttributes){return extensionAttributes.filter(attribute=>attribute.type===nodeOrMark.type.name).filter(item=>item.attribute.rendered).map(item=>item.attribute.renderHTML?item.attribute.renderHTML(nodeOrMark.attrs)||{}:{[item.name]:nodeOrMark.attrs[item.name]}).reduce((attributes,attribute)=>mergeAttributes(attributes,attribute),{})}function isFunction(value){return"function"==typeof value}function callOrReturn(value,context=void 0,...props){return isFunction(value)?context?value.bind(context)(...props):value(...props):value}function injectExtensionAttributesToParseRule(parseRule,extensionAttributes){return"style"in parseRule?parseRule:{...parseRule,getAttrs:node=>{const oldAttributes=parseRule.getAttrs?parseRule.getAttrs(node):parseRule.attrs;if(!1===oldAttributes)return!1;const newAttributes=extensionAttributes.reduce((items,item)=>{const value=item.attribute.parseHTML?item.attribute.parseHTML(node):function fromString(value){return"string"!=typeof value?value:value.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(value):"true"===value||"false"!==value&&value}(node.getAttribute(item.name));return null==value?items:{...items,[item.name]:value}},{});return{...oldAttributes,...newAttributes}}}}function cleanUpSchemaItem(data){return Object.fromEntries(Object.entries(data).filter(([key,value])=>("attrs"!==key||!function isEmptyObject(value={}){return 0===Object.keys(value).length&&value.constructor===Object}(value))&&null!=value))}function getSchemaByResolvedExtensions(extensions,editor){var _a;const allAttributes=getAttributesFromExtensions(extensions),{nodeExtensions,markExtensions}=splitExtensions(extensions),topNode=null===(_a=nodeExtensions.find(extension=>getExtensionField(extension,"topNode")))||void 0===_a?void 0:_a.name,nodes=Object.fromEntries(nodeExtensions.map(extension=>{const extensionAttributes=allAttributes.filter(attribute=>attribute.type===extension.name),context={name:extension.name,options:extension.options,storage:extension.storage,editor},schema=cleanUpSchemaItem({...extensions.reduce((fields,e)=>{const extendNodeSchema=getExtensionField(e,"extendNodeSchema",context);return{...fields,...extendNodeSchema?extendNodeSchema(extension):{}}},{}),content:callOrReturn(getExtensionField(extension,"content",context)),marks:callOrReturn(getExtensionField(extension,"marks",context)),group:callOrReturn(getExtensionField(extension,"group",context)),inline:callOrReturn(getExtensionField(extension,"inline",context)),atom:callOrReturn(getExtensionField(extension,"atom",context)),selectable:callOrReturn(getExtensionField(extension,"selectable",context)),draggable:callOrReturn(getExtensionField(extension,"draggable",context)),code:callOrReturn(getExtensionField(extension,"code",context)),whitespace:callOrReturn(getExtensionField(extension,"whitespace",context)),linebreakReplacement:callOrReturn(getExtensionField(extension,"linebreakReplacement",context)),defining:callOrReturn(getExtensionField(extension,"defining",context)),isolating:callOrReturn(getExtensionField(extension,"isolating",context)),attrs:Object.fromEntries(extensionAttributes.map(extensionAttribute=>{var _a;return[extensionAttribute.name,{default:null===(_a=null==extensionAttribute?void 0:extensionAttribute.attribute)||void 0===_a?void 0:_a.default}]}))}),parseHTML=callOrReturn(getExtensionField(extension,"parseHTML",context));parseHTML&&(schema.parseDOM=parseHTML.map(parseRule=>injectExtensionAttributesToParseRule(parseRule,extensionAttributes)));const renderHTML=getExtensionField(extension,"renderHTML",context);renderHTML&&(schema.toDOM=node=>renderHTML({node,HTMLAttributes:getRenderedAttributes(node,extensionAttributes)}));const renderText=getExtensionField(extension,"renderText",context);return renderText&&(schema.toText=renderText),[extension.name,schema]})),marks=Object.fromEntries(markExtensions.map(extension=>{const extensionAttributes=allAttributes.filter(attribute=>attribute.type===extension.name),context={name:extension.name,options:extension.options,storage:extension.storage,editor},schema=cleanUpSchemaItem({...extensions.reduce((fields,e)=>{const extendMarkSchema=getExtensionField(e,"extendMarkSchema",context);return{...fields,...extendMarkSchema?extendMarkSchema(extension):{}}},{}),inclusive:callOrReturn(getExtensionField(extension,"inclusive",context)),excludes:callOrReturn(getExtensionField(extension,"excludes",context)),group:callOrReturn(getExtensionField(extension,"group",context)),spanning:callOrReturn(getExtensionField(extension,"spanning",context)),code:callOrReturn(getExtensionField(extension,"code",context)),attrs:Object.fromEntries(extensionAttributes.map(extensionAttribute=>{var _a;return[extensionAttribute.name,{default:null===(_a=null==extensionAttribute?void 0:extensionAttribute.attribute)||void 0===_a?void 0:_a.default}]}))}),parseHTML=callOrReturn(getExtensionField(extension,"parseHTML",context));parseHTML&&(schema.parseDOM=parseHTML.map(parseRule=>injectExtensionAttributesToParseRule(parseRule,extensionAttributes)));const renderHTML=getExtensionField(extension,"renderHTML",context);return renderHTML&&(schema.toDOM=mark=>renderHTML({mark,HTMLAttributes:getRenderedAttributes(mark,extensionAttributes)})),[extension.name,schema]}));return new prosemirror_model_dist.Sj({topNode,nodes,marks})}function getSchemaTypeByName(name,schema){return schema.nodes[name]||schema.marks[name]||null}function isExtensionRulesEnabled(extension,enabled){return Array.isArray(enabled)?enabled.some(enabledExtension=>("string"==typeof enabledExtension?enabledExtension:enabledExtension.name)===extension.name):enabled}function getHTMLFromFragment(fragment,schema){const documentFragment=prosemirror_model_dist.ZF.fromSchema(schema).serializeFragment(fragment),container=document.implementation.createHTMLDocument().createElement("div");return container.appendChild(documentFragment),container.innerHTML}function isRegExp(value){return"[object RegExp]"===Object.prototype.toString.call(value)}class InputRule{constructor(config){this.find=config.find,this.handler=config.handler}}function run$1(config){var _a;const{editor,from,to,text,rules,plugin}=config,{view}=editor;if(view.composing)return!1;const $from=view.state.doc.resolve(from);if($from.parent.type.spec.code||(null===(_a=$from.nodeBefore||$from.nodeAfter)||void 0===_a?void 0:_a.marks.find(mark=>mark.type.spec.code)))return!1;let matched=!1;const textBefore=(($from,maxMatch=500)=>{let textBefore="";const sliceEndPos=$from.parentOffset;return $from.parent.nodesBetween(Math.max(0,sliceEndPos-maxMatch),sliceEndPos,(node,pos,parent,index)=>{var _a,_b;const chunk=(null===(_b=(_a=node.type.spec).toText)||void 0===_b?void 0:_b.call(_a,{node,pos,parent,index}))||node.textContent||"%leaf%";textBefore+=node.isAtom&&!node.isText?chunk:chunk.slice(0,Math.max(0,sliceEndPos-pos))}),textBefore})($from)+text;return rules.forEach(rule=>{if(matched)return;const match=((text,find)=>{if(isRegExp(find))return find.exec(text);const inputRuleMatch=find(text);if(!inputRuleMatch)return null;const result=[inputRuleMatch.text];return result.index=inputRuleMatch.index,result.input=text,result.data=inputRuleMatch.data,inputRuleMatch.replaceWith&&(inputRuleMatch.text.includes(inputRuleMatch.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),result.push(inputRuleMatch.replaceWith)),result})(textBefore,rule.find);if(!match)return;const tr=view.state.tr,state=createChainableState({state:view.state,transaction:tr}),range={from:from-(match[0].length-text.length),to},{commands,chain,can}=new CommandManager({editor,state});null!==rule.handler({state,range,match,commands,chain,can})&&tr.steps.length&&(tr.setMeta(plugin,{transform:tr,from,to,text}),view.dispatch(tr),matched=!0)}),matched}function inputRulesPlugin(props){const{editor,rules}=props,plugin=new dist.k_({state:{init:()=>null,apply(tr,prev,state){const stored=tr.getMeta(plugin);if(stored)return stored;const simulatedInputMeta=tr.getMeta("applyInputRules");return!!simulatedInputMeta&&setTimeout(()=>{let{text}=simulatedInputMeta;"string"==typeof text||(text=getHTMLFromFragment(prosemirror_model_dist.FK.from(text),state.schema));const{from}=simulatedInputMeta,to=from+text.length;run$1({editor,from,to,text,rules,plugin})}),tr.selectionSet||tr.docChanged?null:prev}},props:{handleTextInput:(view,from,to,text)=>run$1({editor,from,to,text,rules,plugin}),handleDOMEvents:{compositionend:view=>(setTimeout(()=>{const{$cursor}=view.state.selection;$cursor&&run$1({editor,from:$cursor.pos,to:$cursor.pos,text:"",rules,plugin})}),!1)},handleKeyDown(view,event){if("Enter"!==event.key)return!1;const{$cursor}=view.state.selection;return!!$cursor&&run$1({editor,from:$cursor.pos,to:$cursor.pos,text:"\n",rules,plugin})}},isInputRules:!0});return plugin}function isPlainObject(value){return"Object"===function getType(value){return Object.prototype.toString.call(value).slice(8,-1)}(value)&&(value.constructor===Object&&Object.getPrototypeOf(value)===Object.prototype)}function mergeDeep(target,source){const output={...target};return isPlainObject(target)&&isPlainObject(source)&&Object.keys(source).forEach(key=>{isPlainObject(source[key])&&isPlainObject(target[key])?output[key]=mergeDeep(target[key],source[key]):output[key]=source[key]}),output}class Mark{constructor(config={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...config},this.name=this.config.name,config.defaultOptions&&Object.keys(config.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=callOrReturn(getExtensionField(this,"addOptions",{name:this.name}))),this.storage=callOrReturn(getExtensionField(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(config={}){return new Mark(config)}configure(options={}){const extension=this.extend({...this.config,addOptions:()=>mergeDeep(this.options,options)});return extension.name=this.name,extension.parent=this.parent,extension}extend(extendedConfig={}){const extension=new Mark(extendedConfig);return extension.parent=this,this.child=extension,extension.name=extendedConfig.name?extendedConfig.name:extension.parent.name,extendedConfig.defaultOptions&&Object.keys(extendedConfig.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`),extension.options=callOrReturn(getExtensionField(extension,"addOptions",{name:extension.name})),extension.storage=callOrReturn(getExtensionField(extension,"addStorage",{name:extension.name,options:extension.options})),extension}static handleExit({editor,mark}){const{tr}=editor.state,currentPos=editor.state.selection.$from;if(currentPos.pos===currentPos.end()){const currentMarks=currentPos.marks();if(!!!currentMarks.find(m=>(null==m?void 0:m.type.name)===mark.name))return!1;const removeMark=currentMarks.find(m=>(null==m?void 0:m.type.name)===mark.name);return removeMark&&tr.removeStoredMark(removeMark),tr.insertText(" ",currentPos.pos),editor.view.dispatch(tr),!0}return!1}}class PasteRule{constructor(config){this.find=config.find,this.handler=config.handler}}function run(config){const{editor,state,from,to,rule,pasteEvent,dropEvent}=config,{commands,chain,can}=new CommandManager({editor,state}),handlers=[];state.doc.nodesBetween(from,to,(node,pos)=>{if(!node.isTextblock||node.type.spec.code)return;const resolvedFrom=Math.max(from,pos),resolvedTo=Math.min(to,pos+node.content.size);((text,find,event)=>{if(isRegExp(find))return[...text.matchAll(find)];const matches=find(text,event);return matches?matches.map(pasteRuleMatch=>{const result=[pasteRuleMatch.text];return result.index=pasteRuleMatch.index,result.input=text,result.data=pasteRuleMatch.data,pasteRuleMatch.replaceWith&&(pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),result.push(pasteRuleMatch.replaceWith)),result}):[]})(node.textBetween(resolvedFrom-pos,resolvedTo-pos,void 0,""),rule.find,pasteEvent).forEach(match=>{if(void 0===match.index)return;const start=resolvedFrom+match.index+1,end=start+match[0].length,range={from:state.tr.mapping.map(start),to:state.tr.mapping.map(end)},handler=rule.handler({state,range,match,commands,chain,can,pasteEvent,dropEvent});handlers.push(handler)})});return handlers.every(handler=>null!==handler)}let tiptapDragFromOtherEditor=null;function pasteRulesPlugin(props){const{editor,rules}=props;let dropEvent,dragSourceElement=null,isPastedFromProseMirror=!1,isDroppedFromProseMirror=!1,pasteEvent="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{dropEvent="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{dropEvent=null}const processEvent=({state,from,to,rule,pasteEvt})=>{const tr=state.tr,chainableState=createChainableState({state,transaction:tr});if(run({editor,state:chainableState,from:Math.max(from-1,0),to:to.b-1,rule,pasteEvent:pasteEvt,dropEvent})&&tr.steps.length){try{dropEvent="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{dropEvent=null}return pasteEvent="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,tr}};return rules.map(rule=>new dist.k_({view(view){const handleDragstart=event=>{var _a;dragSourceElement=(null===(_a=view.dom.parentElement)||void 0===_a?void 0:_a.contains(event.target))?view.dom.parentElement:null,dragSourceElement&&(tiptapDragFromOtherEditor=editor)},handleDragend=()=>{tiptapDragFromOtherEditor&&(tiptapDragFromOtherEditor=null)};return window.addEventListener("dragstart",handleDragstart),window.addEventListener("dragend",handleDragend),{destroy(){window.removeEventListener("dragstart",handleDragstart),window.removeEventListener("dragend",handleDragend)}}},props:{handleDOMEvents:{drop:(view,event)=>{if(isDroppedFromProseMirror=dragSourceElement===view.dom.parentElement,dropEvent=event,!isDroppedFromProseMirror){const dragFromOtherEditor=tiptapDragFromOtherEditor;(null==dragFromOtherEditor?void 0:dragFromOtherEditor.isEditable)&&setTimeout(()=>{const selection=dragFromOtherEditor.state.selection;selection&&dragFromOtherEditor.commands.deleteRange({from:selection.from,to:selection.to})},10)}return!1},paste:(_view,event)=>{var _a;const html=null===(_a=event.clipboardData)||void 0===_a?void 0:_a.getData("text/html");return pasteEvent=event,isPastedFromProseMirror=!!(null==html?void 0:html.includes("data-pm-slice")),!1}}},appendTransaction:(transactions,oldState,state)=>{const transaction=transactions[0],isPaste="paste"===transaction.getMeta("uiEvent")&&!isPastedFromProseMirror,isDrop="drop"===transaction.getMeta("uiEvent")&&!isDroppedFromProseMirror,simulatedPasteMeta=transaction.getMeta("applyPasteRules"),isSimulatedPaste=!!simulatedPasteMeta;if(!isPaste&&!isDrop&&!isSimulatedPaste)return;if(isSimulatedPaste){let{text}=simulatedPasteMeta;"string"==typeof text||(text=getHTMLFromFragment(prosemirror_model_dist.FK.from(text),state.schema));const{from}=simulatedPasteMeta,to=from+text.length,pasteEvt=(text=>{var _a;const event=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(_a=event.clipboardData)||void 0===_a||_a.setData("text/html",text),event})(text);return processEvent({rule,state,from,to:{b:to},pasteEvt})}const from=oldState.doc.content.findDiffStart(state.doc.content),to=oldState.doc.content.findDiffEnd(state.doc.content);return function isNumber(value){return"number"==typeof value}(from)&&to&&from!==to.b?processEvent({rule,state,from,to,pasteEvt:pasteEvent}):void 0}}))}class ExtensionManager{constructor(extensions,editor){this.splittableMarks=[],this.editor=editor,this.extensions=ExtensionManager.resolve(extensions),this.schema=getSchemaByResolvedExtensions(this.extensions,editor),this.setupExtensions()}static resolve(extensions){const resolvedExtensions=ExtensionManager.sort(ExtensionManager.flatten(extensions)),duplicatedNames=function findDuplicates(items){const filtered=items.filter((el,index)=>items.indexOf(el)!==index);return Array.from(new Set(filtered))}(resolvedExtensions.map(extension=>extension.name));return duplicatedNames.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map(item=>`'${item}'`).join(", ")}]. This can lead to issues.`),resolvedExtensions}static flatten(extensions){return extensions.map(extension=>{const addExtensions=getExtensionField(extension,"addExtensions",{name:extension.name,options:extension.options,storage:extension.storage});return addExtensions?[extension,...this.flatten(addExtensions())]:extension}).flat(10)}static sort(extensions){return extensions.sort((a,b)=>{const priorityA=getExtensionField(a,"priority")||100,priorityB=getExtensionField(b,"priority")||100;return priorityA>priorityB?-1:priorityA<priorityB?1:0})}get commands(){return this.extensions.reduce((commands,extension)=>{const addCommands=getExtensionField(extension,"addCommands",{name:extension.name,options:extension.options,storage:extension.storage,editor:this.editor,type:getSchemaTypeByName(extension.name,this.schema)});return addCommands?{...commands,...addCommands()}:commands},{})}get plugins(){const{editor}=this,extensions=ExtensionManager.sort([...this.extensions].reverse()),inputRules=[],pasteRules=[],allPlugins=extensions.map(extension=>{const context={name:extension.name,options:extension.options,storage:extension.storage,editor,type:getSchemaTypeByName(extension.name,this.schema)},plugins=[],addKeyboardShortcuts=getExtensionField(extension,"addKeyboardShortcuts",context);let defaultBindings={};if("mark"===extension.type&&getExtensionField(extension,"exitable",context)&&(defaultBindings.ArrowRight=()=>Mark.handleExit({editor,mark:extension})),addKeyboardShortcuts){const bindings=Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut,method])=>[shortcut,()=>method({editor})]));defaultBindings={...defaultBindings,...bindings}}const keyMapPlugin=(0,prosemirror_keymap_dist.w)(defaultBindings);plugins.push(keyMapPlugin);const addInputRules=getExtensionField(extension,"addInputRules",context);isExtensionRulesEnabled(extension,editor.options.enableInputRules)&&addInputRules&&inputRules.push(...addInputRules());const addPasteRules=getExtensionField(extension,"addPasteRules",context);isExtensionRulesEnabled(extension,editor.options.enablePasteRules)&&addPasteRules&&pasteRules.push(...addPasteRules());const addProseMirrorPlugins=getExtensionField(extension,"addProseMirrorPlugins",context);if(addProseMirrorPlugins){const proseMirrorPlugins=addProseMirrorPlugins();plugins.push(...proseMirrorPlugins)}return plugins}).flat();return[inputRulesPlugin({editor,rules:inputRules}),...pasteRulesPlugin({editor,rules:pasteRules}),...allPlugins]}get attributes(){return getAttributesFromExtensions(this.extensions)}get nodeViews(){const{editor}=this,{nodeExtensions}=splitExtensions(this.extensions);return Object.fromEntries(nodeExtensions.filter(extension=>!!getExtensionField(extension,"addNodeView")).map(extension=>{const extensionAttributes=this.attributes.filter(attribute=>attribute.type===extension.name),context={name:extension.name,options:extension.options,storage:extension.storage,editor,type:getNodeType(extension.name,this.schema)},addNodeView=getExtensionField(extension,"addNodeView",context);if(!addNodeView)return[];return[extension.name,(node,view,getPos,decorations,innerDecorations)=>{const HTMLAttributes=getRenderedAttributes(node,extensionAttributes);return addNodeView()({node,view,getPos,decorations,innerDecorations,editor,extension,HTMLAttributes})}]}))}setupExtensions(){this.extensions.forEach(extension=>{var _a;this.editor.extensionStorage[extension.name]=extension.storage;const context={name:extension.name,options:extension.options,storage:extension.storage,editor:this.editor,type:getSchemaTypeByName(extension.name,this.schema)};if("mark"===extension.type){(null===(_a=callOrReturn(getExtensionField(extension,"keepOnSplit",context)))||void 0===_a||_a)&&this.splittableMarks.push(extension.name)}const onBeforeCreate=getExtensionField(extension,"onBeforeCreate",context),onCreate=getExtensionField(extension,"onCreate",context),onUpdate=getExtensionField(extension,"onUpdate",context),onSelectionUpdate=getExtensionField(extension,"onSelectionUpdate",context),onTransaction=getExtensionField(extension,"onTransaction",context),onFocus=getExtensionField(extension,"onFocus",context),onBlur=getExtensionField(extension,"onBlur",context),onDestroy=getExtensionField(extension,"onDestroy",context);onBeforeCreate&&this.editor.on("beforeCreate",onBeforeCreate),onCreate&&this.editor.on("create",onCreate),onUpdate&&this.editor.on("update",onUpdate),onSelectionUpdate&&this.editor.on("selectionUpdate",onSelectionUpdate),onTransaction&&this.editor.on("transaction",onTransaction),onFocus&&this.editor.on("focus",onFocus),onBlur&&this.editor.on("blur",onBlur),onDestroy&&this.editor.on("destroy",onDestroy)})}}class Extension{constructor(config={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...config},this.name=this.config.name,config.defaultOptions&&Object.keys(config.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=callOrReturn(getExtensionField(this,"addOptions",{name:this.name}))),this.storage=callOrReturn(getExtensionField(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(config={}){return new Extension(config)}configure(options={}){const extension=this.extend({...this.config,addOptions:()=>mergeDeep(this.options,options)});return extension.name=this.name,extension.parent=this.parent,extension}extend(extendedConfig={}){const extension=new Extension({...this.config,...extendedConfig});return extension.parent=this,this.child=extension,extension.name=extendedConfig.name?extendedConfig.name:extension.parent.name,extendedConfig.defaultOptions&&Object.keys(extendedConfig.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`),extension.options=callOrReturn(getExtensionField(extension,"addOptions",{name:extension.name})),extension.storage=callOrReturn(getExtensionField(extension,"addStorage",{name:extension.name,options:extension.options})),extension}}function getTextBetween(startNode,range,options){const{from,to}=range,{blockSeparator="\n\n",textSerializers={}}=options||{};let text="";return startNode.nodesBetween(from,to,(node,pos,parent,index)=>{var _a;node.isBlock&&pos>from&&(text+=blockSeparator);const textSerializer=null==textSerializers?void 0:textSerializers[node.type.name];if(textSerializer)return parent&&(text+=textSerializer({node,pos,parent,index,range})),!1;node.isText&&(text+=null===(_a=null==node?void 0:node.text)||void 0===_a?void 0:_a.slice(Math.max(from,pos)-pos,to-pos))}),text}function getTextSerializersFromSchema(schema){return Object.fromEntries(Object.entries(schema.nodes).filter(([,node])=>node.spec.toText).map(([name,node])=>[name,node.spec.toText]))}const ClipboardTextSerializer=Extension.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new dist.k_({key:new dist.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor}=this,{state,schema}=editor,{doc,selection}=state,{ranges}=selection,from=Math.min(...ranges.map(range=>range.$from.pos)),to=Math.max(...ranges.map(range=>range.$to.pos)),textSerializers=getTextSerializersFromSchema(schema);return getTextBetween(doc,{from,to},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers})}}})]}});function objectIncludes(object1,object2,options={strict:!0}){const keys=Object.keys(object2);return!keys.length||keys.every(key=>options.strict?object2[key]===object1[key]:isRegExp(object2[key])?object2[key].test(object1[key]):object2[key]===object1[key])}function findMarkInSet(marks,type,attributes={}){return marks.find(item=>item.type===type&&objectIncludes(Object.fromEntries(Object.keys(attributes).map(k=>[k,item.attrs[k]])),attributes))}function isMarkInSet(marks,type,attributes={}){return!!findMarkInSet(marks,type,attributes)}function getMarkRange($pos,type,attributes){var _a;if(!$pos||!type)return;let start=$pos.parent.childAfter($pos.parentOffset);if(start.node&&start.node.marks.some(mark=>mark.type===type)||(start=$pos.parent.childBefore($pos.parentOffset)),!start.node||!start.node.marks.some(mark=>mark.type===type))return;attributes=attributes||(null===(_a=start.node.marks[0])||void 0===_a?void 0:_a.attrs);if(!findMarkInSet([...start.node.marks],type,attributes))return;let startIndex=start.index,startPos=$pos.start()+start.offset,endIndex=startIndex+1,endPos=startPos+start.node.nodeSize;for(;startIndex>0&&isMarkInSet([...$pos.parent.child(startIndex-1).marks],type,attributes);)startIndex-=1,startPos-=$pos.parent.child(startIndex).nodeSize;for(;endIndex<$pos.parent.childCount&&isMarkInSet([...$pos.parent.child(endIndex).marks],type,attributes);)endPos+=$pos.parent.child(endIndex).nodeSize,endIndex+=1;return{from:startPos,to:endPos}}function getMarkType(nameOrType,schema){if("string"==typeof nameOrType){if(!schema.marks[nameOrType])throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);return schema.marks[nameOrType]}return nameOrType}function isTextSelection(value){return value instanceof dist.U3}function minMax(value=0,min=0,max=0){return Math.min(Math.max(value,min),max)}function resolveFocusPosition(doc,position=null){if(!position)return null;const selectionAtStart=dist.LN.atStart(doc),selectionAtEnd=dist.LN.atEnd(doc);if("start"===position||!0===position)return selectionAtStart;if("end"===position)return selectionAtEnd;const minPos=selectionAtStart.from,maxPos=selectionAtEnd.to;return"all"===position?dist.U3.create(doc,minMax(0,minPos,maxPos),minMax(doc.content.size,minPos,maxPos)):dist.U3.create(doc,minMax(position,minPos,maxPos),minMax(position,minPos,maxPos))}function isAndroid(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function isiOS(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const removeWhitespaces=node=>{const children=node.childNodes;for(let i=children.length-1;i>=0;i-=1){const child=children[i];3===child.nodeType&&child.nodeValue&&/^(\n\s\s|\n)$/.test(child.nodeValue)?node.removeChild(child):1===child.nodeType&&removeWhitespaces(child)}return node};function elementFromString(value){const wrappedValue=`<body>${value}</body>`,html=(new window.DOMParser).parseFromString(wrappedValue,"text/html").body;return removeWhitespaces(html)}function createNodeFromContent(content,schema,options){if(content instanceof prosemirror_model_dist.bP||content instanceof prosemirror_model_dist.FK)return content;options={slice:!0,parseOptions:{},...options};const isTextContent="string"==typeof content;if("object"==typeof content&&null!==content)try{if(Array.isArray(content)&&content.length>0)return prosemirror_model_dist.FK.fromArray(content.map(item=>schema.nodeFromJSON(item)));const node=schema.nodeFromJSON(content);return options.errorOnInvalidContent&&node.check(),node}catch(error){if(options.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:error});return console.warn("[tiptap warn]: Invalid content.","Passed value:",content,"Error:",error),createNodeFromContent("",schema,options)}if(isTextContent){if(options.errorOnInvalidContent){let hasInvalidContent=!1,invalidContent="";const contentCheckSchema=new prosemirror_model_dist.Sj({topNode:schema.spec.topNode,marks:schema.spec.marks,nodes:schema.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(hasInvalidContent=!0,invalidContent="string"==typeof e?e:e.outerHTML,null)}]}})});if(options.slice?prosemirror_model_dist.S4.fromSchema(contentCheckSchema).parseSlice(elementFromString(content),options.parseOptions):prosemirror_model_dist.S4.fromSchema(contentCheckSchema).parse(elementFromString(content),options.parseOptions),options.errorOnInvalidContent&&hasInvalidContent)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${invalidContent}`)})}const parser=prosemirror_model_dist.S4.fromSchema(schema);return options.slice?parser.parseSlice(elementFromString(content),options.parseOptions).content:parser.parse(elementFromString(content),options.parseOptions)}return createNodeFromContent("",schema,options)}function isMacOS(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function isNodeActive(state,typeOrName,attributes={}){const{from,to,empty}=state.selection,type=typeOrName?getNodeType(typeOrName,state.schema):null,nodeRanges=[];state.doc.nodesBetween(from,to,(node,pos)=>{if(node.isText)return;const relativeFrom=Math.max(from,pos),relativeTo=Math.min(to,pos+node.nodeSize);nodeRanges.push({node,from:relativeFrom,to:relativeTo})});const selectionRange=to-from,matchedNodeRanges=nodeRanges.filter(nodeRange=>!type||type.name===nodeRange.node.type.name).filter(nodeRange=>objectIncludes(nodeRange.node.attrs,attributes,{strict:!1}));if(empty)return!!matchedNodeRanges.length;return matchedNodeRanges.reduce((sum,nodeRange)=>sum+nodeRange.to-nodeRange.from,0)>=selectionRange}function getSchemaTypeNameByName(name,schema){return schema.nodes[name]?"node":schema.marks[name]?"mark":null}function deleteProps(obj,propOrProps){const props="string"==typeof propOrProps?[propOrProps]:propOrProps;return Object.keys(obj).reduce((newObj,prop)=>(props.includes(prop)||(newObj[prop]=obj[prop]),newObj),{})}function createDocument(content,schema,parseOptions={},options={}){return createNodeFromContent(content,schema,{slice:!1,parseOptions,errorOnInvalidContent:options.errorOnInvalidContent})}function getMarkAttributes(state,typeOrName){const type=getMarkType(typeOrName,state.schema),{from,to,empty}=state.selection,marks=[];empty?(state.storedMarks&&marks.push(...state.storedMarks),marks.push(...state.selection.$head.marks())):state.doc.nodesBetween(from,to,node=>{marks.push(...node.marks)});const mark=marks.find(markItem=>markItem.type.name===type.name);return mark?{...mark.attrs}:{}}function findParentNodeClosestToPos($pos,predicate){for(let i=$pos.depth;i>0;i-=1){const node=$pos.node(i);if(predicate(node))return{pos:i>0?$pos.before(i):0,start:$pos.start(i),depth:i,node}}}function findParentNode(predicate){return selection=>findParentNodeClosestToPos(selection.$from,predicate)}function getText(node,options){return getTextBetween(node,{from:0,to:node.content.size},options)}function getAttributes(state,typeOrName){const schemaType=getSchemaTypeNameByName("string"==typeof typeOrName?typeOrName:typeOrName.name,state.schema);return"node"===schemaType?function getNodeAttributes(state,typeOrName){const type=getNodeType(typeOrName,state.schema),{from,to}=state.selection,nodes=[];state.doc.nodesBetween(from,to,node=>{nodes.push(node)});const node=nodes.reverse().find(nodeItem=>nodeItem.type.name===type.name);return node?{...node.attrs}:{}}(state,typeOrName):"mark"===schemaType?getMarkAttributes(state,typeOrName):{}}function getMarksBetween(from,to,doc){const marks=[];return from===to?doc.resolve(from).marks().forEach(mark=>{const range=getMarkRange(doc.resolve(from),mark.type);range&&marks.push({mark,...range})}):doc.nodesBetween(from,to,(node,pos)=>{node&&void 0!==(null==node?void 0:node.nodeSize)&&marks.push(...node.marks.map(mark=>({from:pos,to:pos+node.nodeSize,mark})))}),marks}function getSplittedAttributes(extensionAttributes,typeName,attributes){return Object.fromEntries(Object.entries(attributes).filter(([name])=>{const extensionAttribute=extensionAttributes.find(item=>item.type===typeName&&item.name===name);return!!extensionAttribute&&extensionAttribute.attribute.keepOnSplit}))}function isMarkActive(state,typeOrName,attributes={}){const{empty,ranges}=state.selection,type=typeOrName?getMarkType(typeOrName,state.schema):null;if(empty)return!!(state.storedMarks||state.selection.$from.marks()).filter(mark=>!type||type.name===mark.type.name).find(mark=>objectIncludes(mark.attrs,attributes,{strict:!1}));let selectionRange=0;const markRanges=[];if(ranges.forEach(({$from,$to})=>{const from=$from.pos,to=$to.pos;state.doc.nodesBetween(from,to,(node,pos)=>{if(!node.isText&&!node.marks.length)return;const relativeFrom=Math.max(from,pos),relativeTo=Math.min(to,pos+node.nodeSize);selectionRange+=relativeTo-relativeFrom,markRanges.push(...node.marks.map(mark=>({mark,from:relativeFrom,to:relativeTo})))})}),0===selectionRange)return!1;const matchedRange=markRanges.filter(markRange=>!type||type.name===markRange.mark.type.name).filter(markRange=>objectIncludes(markRange.mark.attrs,attributes,{strict:!1})).reduce((sum,markRange)=>sum+markRange.to-markRange.from,0),excludedRange=markRanges.filter(markRange=>!type||markRange.mark.type!==type&&markRange.mark.type.excludes(type)).reduce((sum,markRange)=>sum+markRange.to-markRange.from,0);return(matchedRange>0?matchedRange+excludedRange:matchedRange)>=selectionRange}function isList(name,extensions){const{nodeExtensions}=splitExtensions(extensions),extension=nodeExtensions.find(item=>item.name===name);if(!extension)return!1;const group=callOrReturn(getExtensionField(extension,"group",{name:extension.name,options:extension.options,storage:extension.storage}));return"string"==typeof group&&group.split(" ").includes("list")}function isNodeEmpty(node,{checkChildren=!0,ignoreWhitespace=!1}={}){var _a;if(ignoreWhitespace){if("hardBreak"===node.type.name)return!0;if(node.isText)return/^\s*$/m.test(null!==(_a=node.text)&&void 0!==_a?_a:"")}if(node.isText)return!node.text;if(node.isAtom||node.isLeaf)return!1;if(0===node.content.childCount)return!0;if(checkChildren){let isContentEmpty=!0;return node.content.forEach(childNode=>{!1!==isContentEmpty&&(isNodeEmpty(childNode,{ignoreWhitespace,checkChildren})||(isContentEmpty=!1))}),isContentEmpty}return!1}function isNodeSelection(value){return value instanceof dist.nh}function ensureMarks(state,splittableMarks){const marks=state.storedMarks||state.selection.$to.parentOffset&&state.selection.$from.marks();if(marks){const filteredMarks=marks.filter(mark=>null==splittableMarks?void 0:splittableMarks.includes(mark.type.name));state.tr.ensureMarks(filteredMarks)}}const joinListBackwards=(tr,listType)=>{const list=findParentNode(node=>node.type===listType)(tr.selection);if(!list)return!0;const before=tr.doc.resolve(Math.max(0,list.pos-1)).before(list.depth);if(void 0===before)return!0;const nodeBefore=tr.doc.nodeAt(before);return list.node.type!==(null==nodeBefore?void 0:nodeBefore.type)||!(0,prosemirror_transform_dist.n9)(tr.doc,list.pos)||(tr.join(list.pos),!0)},joinListForwards=(tr,listType)=>{const list=findParentNode(node=>node.type===listType)(tr.selection);if(!list)return!0;const after=tr.doc.resolve(list.start).after(list.depth);if(void 0===after)return!0;const nodeAfter=tr.doc.nodeAt(after);return list.node.type!==(null==nodeAfter?void 0:nodeAfter.type)||!(0,prosemirror_transform_dist.n9)(tr.doc,after)||(tr.join(after),!0)};var commands=Object.freeze({__proto__:null,blur:()=>({editor,view})=>(requestAnimationFrame(()=>{var _a;editor.isDestroyed||(view.dom.blur(),null===(_a=null===window||void 0===window?void 0:window.getSelection())||void 0===_a||_a.removeAllRanges())}),!0),clearContent:(emitUpdate=!1)=>({commands})=>commands.setContent("",emitUpdate),clearNodes:()=>({state,tr,dispatch})=>{const{selection}=tr,{ranges}=selection;return!dispatch||(ranges.forEach(({$from,$to})=>{state.doc.nodesBetween($from.pos,$to.pos,(node,pos)=>{if(node.type.isText)return;const{doc,mapping}=tr,$mappedFrom=doc.resolve(mapping.map(pos)),$mappedTo=doc.resolve(mapping.map(pos+node.nodeSize)),nodeRange=$mappedFrom.blockRange($mappedTo);if(!nodeRange)return;const targetLiftDepth=(0,prosemirror_transform_dist.jP)(nodeRange);if(node.type.isTextblock){const{defaultType}=$mappedFrom.parent.contentMatchAt($mappedFrom.index());tr.setNodeMarkup(nodeRange.start,defaultType)}(targetLiftDepth||0===targetLiftDepth)&&tr.lift(nodeRange,targetLiftDepth)})}),!0)},command:fn=>props=>fn(props),createParagraphNear:()=>({state,dispatch})=>createParagraphNear(state,dispatch),cut:(originRange,targetPos)=>({editor,tr})=>{const{state}=editor,contentSlice=state.doc.slice(originRange.from,originRange.to);tr.deleteRange(originRange.from,originRange.to);const newPos=tr.mapping.map(targetPos);return tr.insert(newPos,contentSlice.content),tr.setSelection(new dist.U3(tr.doc.resolve(newPos-1))),!0},deleteCurrentNode:()=>({tr,dispatch})=>{const{selection}=tr,currentNode=selection.$anchor.node();if(currentNode.content.size>0)return!1;const $pos=tr.selection.$anchor;for(let depth=$pos.depth;depth>0;depth-=1){if($pos.node(depth).type===currentNode.type){if(dispatch){const from=$pos.before(depth),to=$pos.after(depth);tr.delete(from,to).scrollIntoView()}return!0}}return!1},deleteNode:typeOrName=>({tr,state,dispatch})=>{const type=getNodeType(typeOrName,state.schema),$pos=tr.selection.$anchor;for(let depth=$pos.depth;depth>0;depth-=1){if($pos.node(depth).type===type){if(dispatch){const from=$pos.before(depth),to=$pos.after(depth);tr.delete(from,to).scrollIntoView()}return!0}}return!1},deleteRange:range=>({tr,dispatch})=>{const{from,to}=range;return dispatch&&tr.delete(from,to),!0},deleteSelection:()=>({state,dispatch})=>deleteSelection(state,dispatch),enter:()=>({commands})=>commands.keyboardShortcut("Enter"),exitCode:()=>({state,dispatch})=>exitCode(state,dispatch),extendMarkRange:(typeOrName,attributes={})=>({tr,state,dispatch})=>{const type=getMarkType(typeOrName,state.schema),{doc,selection}=tr,{$from,from,to}=selection;if(dispatch){const range=getMarkRange($from,type,attributes);if(range&&range.from<=from&&range.to>=to){const newSelection=dist.U3.create(doc,range.from,range.to);tr.setSelection(newSelection)}}return!0},first:commands=>props=>{const items="function"==typeof commands?commands(props):commands;for(let i=0;i<items.length;i+=1)if(items[i](props))return!0;return!1},focus:(position=null,options={})=>({editor,view,tr,dispatch})=>{options={scrollIntoView:!0,...options};const delayedFocus=()=>{(isiOS()||isAndroid())&&view.dom.focus(),requestAnimationFrame(()=>{editor.isDestroyed||(view.focus(),(null==options?void 0:options.scrollIntoView)&&editor.commands.scrollIntoView())})};if(view.hasFocus()&&null===position||!1===position)return!0;if(dispatch&&null===position&&!isTextSelection(editor.state.selection))return delayedFocus(),!0;const selection=resolveFocusPosition(tr.doc,position)||editor.state.selection,isSameSelection=editor.state.selection.eq(selection);return dispatch&&(isSameSelection||tr.setSelection(selection),isSameSelection&&tr.storedMarks&&tr.setStoredMarks(tr.storedMarks),delayedFocus()),!0},forEach:(items,fn)=>props=>items.every((item,index)=>fn(item,{...props,index})),insertContent:(value,options)=>({tr,commands})=>commands.insertContentAt({from:tr.selection.from,to:tr.selection.to},value,options),insertContentAt:(position,value,options)=>({tr,dispatch,editor})=>{var _a;if(dispatch){let content;const emitContentError=error=>{editor.emit("contentError",{editor,error,disableCollaboration:()=>{editor.storage.collaboration&&(editor.storage.collaboration.isDisabled=!0)}})},parseOptions={preserveWhitespace:"full",...(options={parseOptions:editor.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...options}).parseOptions};if(!options.errorOnInvalidContent&&!editor.options.enableContentCheck&&editor.options.emitContentError)try{createNodeFromContent(value,editor.schema,{parseOptions,errorOnInvalidContent:!0})}catch(e){emitContentError(e)}try{content=createNodeFromContent(value,editor.schema,{parseOptions,errorOnInvalidContent:null!==(_a=options.errorOnInvalidContent)&&void 0!==_a?_a:editor.options.enableContentCheck})}catch(e){return emitContentError(e),!1}let{from,to}="number"==typeof position?{from:position,to:position}:{from:position.from,to:position.to},isOnlyTextContent=!0,isOnlyBlockContent=!0;if(("type"in content?[content]:content).forEach(node=>{node.check(),isOnlyTextContent=!!isOnlyTextContent&&(node.isText&&0===node.marks.length),isOnlyBlockContent=!!isOnlyBlockContent&&node.isBlock}),from===to&&isOnlyBlockContent){const{parent}=tr.doc.resolve(from);parent.isTextblock&&!parent.type.spec.code&&!parent.childCount&&(from-=1,to+=1)}let newContent;if(isOnlyTextContent){if(Array.isArray(value))newContent=value.map(v=>v.text||"").join("");else if(value instanceof prosemirror_model_dist.FK){let text="";value.forEach(node=>{node.text&&(text+=node.text)}),newContent=text}else newContent="object"==typeof value&&value&&value.text?value.text:value;tr.insertText(newContent,from,to)}else newContent=content,tr.replaceWith(from,to,newContent);options.updateSelection&&function selectionToInsertionEnd(tr,startLen,bias){const last=tr.steps.length-1;if(last<startLen)return;const step=tr.steps[last];if(!(step instanceof prosemirror_transform_dist.Ln||step instanceof prosemirror_transform_dist.Wg))return;const map=tr.mapping.maps[last];let end=0;map.forEach((_from,_to,_newFrom,newTo)=>{0===end&&(end=newTo)}),tr.setSelection(dist.LN.near(tr.doc.resolve(end),bias))}(tr,tr.steps.length-1,-1),options.applyInputRules&&tr.setMeta("applyInputRules",{from,text:newContent}),options.applyPasteRules&&tr.setMeta("applyPasteRules",{from,text:newContent})}return!0},joinBackward:()=>({state,dispatch})=>joinBackward(state,dispatch),joinDown:()=>({state,dispatch})=>((state,dispatch)=>{let point,sel=state.selection;if(sel instanceof dist.nh){if(sel.node.isTextblock||!(0,prosemirror_transform_dist.n9)(state.doc,sel.to))return!1;point=sel.to}else if(point=(0,prosemirror_transform_dist.N0)(state.doc,sel.to,1),null==point)return!1;return dispatch&&dispatch(state.tr.join(point).scrollIntoView()),!0})(state,dispatch),joinForward:()=>({state,dispatch})=>joinForward(state,dispatch),joinItemBackward:()=>({state,dispatch,tr})=>{try{const point=(0,prosemirror_transform_dist.N0)(state.doc,state.selection.$from.pos,-1);return null!=point&&(tr.join(point,2),dispatch&&dispatch(tr),!0)}catch{return!1}},joinItemForward:()=>({state,dispatch,tr})=>{try{const point=(0,prosemirror_transform_dist.N0)(state.doc,state.selection.$from.pos,1);return null!=point&&(tr.join(point,2),dispatch&&dispatch(tr),!0)}catch{return!1}},joinTextblockBackward:()=>({state,dispatch})=>((state,dispatch,view)=>{let $cursor=atBlockStart(state,view);if(!$cursor)return!1;let $cut=findCutBefore($cursor);return!!$cut&&joinTextblocksAround(state,$cut,dispatch)})(state,dispatch),joinTextblockForward:()=>({state,dispatch})=>((state,dispatch,view)=>{let $cursor=atBlockEnd(state,view);if(!$cursor)return!1;let $cut=findCutAfter($cursor);return!!$cut&&joinTextblocksAround(state,$cut,dispatch)})(state,dispatch),joinUp:()=>({state,dispatch})=>((state,dispatch)=>{let point,sel=state.selection,nodeSel=sel instanceof dist.nh;if(nodeSel){if(sel.node.isTextblock||!(0,prosemirror_transform_dist.n9)(state.doc,sel.from))return!1;point=sel.from}else if(point=(0,prosemirror_transform_dist.N0)(state.doc,sel.from,-1),null==point)return!1;if(dispatch){let tr=state.tr.join(point);nodeSel&&tr.setSelection(dist.nh.create(tr.doc,point-state.doc.resolve(point).nodeBefore.nodeSize)),dispatch(tr.scrollIntoView())}return!0})(state,dispatch),keyboardShortcut:name=>({editor,view,tr,dispatch})=>{const keys=function normalizeKeyName(name){const parts=name.split(/-(?!$)/);let alt,ctrl,shift,meta,result=parts[parts.length-1];"Space"===result&&(result=" ");for(let i=0;i<parts.length-1;i+=1){const mod=parts[i];if(/^(cmd|meta|m)$/i.test(mod))meta=!0;else if(/^a(lt)?$/i.test(mod))alt=!0;else if(/^(c|ctrl|control)$/i.test(mod))ctrl=!0;else if(/^s(hift)?$/i.test(mod))shift=!0;else{if(!/^mod$/i.test(mod))throw new Error(`Unrecognized modifier name: ${mod}`);isiOS()||isMacOS()?meta=!0:ctrl=!0}}return alt&&(result=`Alt-${result}`),ctrl&&(result=`Ctrl-${result}`),meta&&(result=`Meta-${result}`),shift&&(result=`Shift-${result}`),result}(name).split(/-(?!$)/),key=keys.find(item=>!["Alt","Ctrl","Meta","Shift"].includes(item)),event=new KeyboardEvent("keydown",{key:"Space"===key?" ":key,altKey:keys.includes("Alt"),ctrlKey:keys.includes("Ctrl"),metaKey:keys.includes("Meta"),shiftKey:keys.includes("Shift"),bubbles:!0,cancelable:!0}),capturedTransaction=editor.captureTransaction(()=>{view.someProp("handleKeyDown",f=>f(view,event))});return null==capturedTransaction||capturedTransaction.steps.forEach(step=>{const newStep=step.map(tr.mapping);newStep&&dispatch&&tr.maybeStep(newStep)}),!0},lift:(typeOrName,attributes={})=>({state,dispatch})=>!!isNodeActive(state,getNodeType(typeOrName,state.schema),attributes)&&((state,dispatch)=>{let{$from,$to}=state.selection,range=$from.blockRange($to),target=range&&(0,prosemirror_transform_dist.jP)(range);return null!=target&&(dispatch&&dispatch(state.tr.lift(range,target).scrollIntoView()),!0)})(state,dispatch),liftEmptyBlock:()=>({state,dispatch})=>liftEmptyBlock(state,dispatch),liftListItem:typeOrName=>({state,dispatch})=>liftListItem(getNodeType(typeOrName,state.schema))(state,dispatch),newlineInCode:()=>({state,dispatch})=>newlineInCode(state,dispatch),resetAttributes:(typeOrName,attributes)=>({tr,state,dispatch})=>{let nodeType=null,markType=null;const schemaType=getSchemaTypeNameByName("string"==typeof typeOrName?typeOrName:typeOrName.name,state.schema);return!!schemaType&&("node"===schemaType&&(nodeType=getNodeType(typeOrName,state.schema)),"mark"===schemaType&&(markType=getMarkType(typeOrName,state.schema)),dispatch&&tr.selection.ranges.forEach(range=>{state.doc.nodesBetween(range.$from.pos,range.$to.pos,(node,pos)=>{nodeType&&nodeType===node.type&&tr.setNodeMarkup(pos,void 0,deleteProps(node.attrs,attributes)),markType&&node.marks.length&&node.marks.forEach(mark=>{markType===mark.type&&tr.addMark(pos,pos+node.nodeSize,markType.create(deleteProps(mark.attrs,attributes)))})})}),!0)},scrollIntoView:()=>({tr,dispatch})=>(dispatch&&tr.scrollIntoView(),!0),selectAll:()=>({tr,dispatch})=>{if(dispatch){const selection=new dist.i5(tr.doc);tr.setSelection(selection)}return!0},selectNodeBackward:()=>({state,dispatch})=>selectNodeBackward(state,dispatch),selectNodeForward:()=>({state,dispatch})=>selectNodeForward(state,dispatch),selectParentNode:()=>({state,dispatch})=>((state,dispatch)=>{let pos,{$from,to}=state.selection,same=$from.sharedDepth(to);return 0!=same&&(pos=$from.before(same),dispatch&&dispatch(state.tr.setSelection(dist.nh.create(state.doc,pos))),!0)})(state,dispatch),selectTextblockEnd:()=>({state,dispatch})=>selectTextblockEnd(state,dispatch),selectTextblockStart:()=>({state,dispatch})=>selectTextblockStart(state,dispatch),setContent:(content,emitUpdate=!1,parseOptions={},options={})=>({editor,tr,dispatch,commands})=>{var _a,_b;const{doc}=tr;if("full"!==parseOptions.preserveWhitespace){const document=createDocument(content,editor.schema,parseOptions,{errorOnInvalidContent:null!==(_a=options.errorOnInvalidContent)&&void 0!==_a?_a:editor.options.enableContentCheck});return dispatch&&tr.replaceWith(0,doc.content.size,document).setMeta("preventUpdate",!emitUpdate),!0}return dispatch&&tr.setMeta("preventUpdate",!emitUpdate),commands.insertContentAt({from:0,to:doc.content.size},content,{parseOptions,errorOnInvalidContent:null!==(_b=options.errorOnInvalidContent)&&void 0!==_b?_b:editor.options.enableContentCheck})},setMark:(typeOrName,attributes={})=>({tr,state,dispatch})=>{const{selection}=tr,{empty,ranges}=selection,type=getMarkType(typeOrName,state.schema);if(dispatch)if(empty){const oldAttributes=getMarkAttributes(state,type);tr.addStoredMark(type.create({...oldAttributes,...attributes}))}else ranges.forEach(range=>{const from=range.$from.pos,to=range.$to.pos;state.doc.nodesBetween(from,to,(node,pos)=>{const trimmedFrom=Math.max(pos,from),trimmedTo=Math.min(pos+node.nodeSize,to);node.marks.find(mark=>mark.type===type)?node.marks.forEach(mark=>{type===mark.type&&tr.addMark(trimmedFrom,trimmedTo,type.create({...mark.attrs,...attributes}))}):tr.addMark(trimmedFrom,trimmedTo,type.create(attributes))})});return function canSetMark(state,tr,newMarkType){var _a;const{selection}=tr;let cursor=null;if(isTextSelection(selection)&&(cursor=selection.$cursor),cursor){const currentMarks=null!==(_a=state.storedMarks)&&void 0!==_a?_a:cursor.marks();return!!newMarkType.isInSet(currentMarks)||!currentMarks.some(mark=>mark.type.excludes(newMarkType))}const{ranges}=selection;return ranges.some(({$from,$to})=>{let someNodeSupportsMark=0===$from.depth&&state.doc.inlineContent&&state.doc.type.allowsMarkType(newMarkType);return state.doc.nodesBetween($from.pos,$to.pos,(node,_pos,parent)=>{if(someNodeSupportsMark)return!1;if(node.isInline){const parentAllowsMarkType=!parent||parent.type.allowsMarkType(newMarkType),currentMarksAllowMarkType=!!newMarkType.isInSet(node.marks)||!node.marks.some(otherMark=>otherMark.type.excludes(newMarkType));someNodeSupportsMark=parentAllowsMarkType&¤tMarksAllowMarkType}return!someNodeSupportsMark}),someNodeSupportsMark})}(state,tr,type)},setMeta:(key,value)=>({tr})=>(tr.setMeta(key,value),!0),setNode:(typeOrName,attributes={})=>({state,dispatch,chain})=>{const type=getNodeType(typeOrName,state.schema);let attributesToCopy;return state.selection.$anchor.sameParent(state.selection.$head)&&(attributesToCopy=state.selection.$anchor.parent.attrs),type.isTextblock?chain().command(({commands})=>!!setBlockType(type,{...attributesToCopy,...attributes})(state)||commands.clearNodes()).command(({state:updatedState})=>setBlockType(type,{...attributesToCopy,...attributes})(updatedState,dispatch)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:position=>({tr,dispatch})=>{if(dispatch){const{doc}=tr,from=minMax(position,0,doc.content.size),selection=dist.nh.create(doc,from);tr.setSelection(selection)}return!0},setTextSelection:position=>({tr,dispatch})=>{if(dispatch){const{doc}=tr,{from,to}="number"==typeof position?{from:position,to:position}:position,minPos=dist.U3.atStart(doc).from,maxPos=dist.U3.atEnd(doc).to,resolvedFrom=minMax(from,minPos,maxPos),resolvedEnd=minMax(to,minPos,maxPos),selection=dist.U3.create(doc,resolvedFrom,resolvedEnd);tr.setSelection(selection)}return!0},sinkListItem:typeOrName=>({state,dispatch})=>function sinkListItem(itemType){return function(state,dispatch){let{$from,$to}=state.selection,range=$from.blockRange($to,node=>node.childCount>0&&node.firstChild.type==itemType);if(!range)return!1;let startIndex=range.startIndex;if(0==startIndex)return!1;let parent=range.parent,nodeBefore=parent.child(startIndex-1);if(nodeBefore.type!=itemType)return!1;if(dispatch){let nestedBefore=nodeBefore.lastChild&&nodeBefore.lastChild.type==parent.type,inner=prosemirror_model_dist.FK.from(nestedBefore?itemType.create():null),slice=new prosemirror_model_dist.Ji(prosemirror_model_dist.FK.from(itemType.create(null,prosemirror_model_dist.FK.from(parent.type.create(null,inner)))),nestedBefore?3:1,0),before=range.start,after=range.end;dispatch(state.tr.step(new prosemirror_transform_dist.Wg(before-(nestedBefore?3:1),after,before,after,slice,1,!0)).scrollIntoView())}return!0}}(getNodeType(typeOrName,state.schema))(state,dispatch),splitBlock:({keepMarks=!0}={})=>({tr,state,dispatch,editor})=>{const{selection,doc}=tr,{$from,$to}=selection,newAttributes=getSplittedAttributes(editor.extensionManager.attributes,$from.node().type.name,$from.node().attrs);if(selection instanceof dist.nh&&selection.node.isBlock)return!(!$from.parentOffset||!(0,prosemirror_transform_dist.zy)(doc,$from.pos))&&(dispatch&&(keepMarks&&ensureMarks(state,editor.extensionManager.splittableMarks),tr.split($from.pos).scrollIntoView()),!0);if(!$from.parent.isBlock)return!1;const atEnd=$to.parentOffset===$to.parent.content.size,deflt=0===$from.depth?void 0:function dist_defaultBlockAt(match){for(let i=0;i<match.edgeCount;i+=1){const{type}=match.edge(i);if(type.isTextblock&&!type.hasRequiredAttrs())return type}return null}($from.node(-1).contentMatchAt($from.indexAfter(-1)));let types=atEnd&&deflt?[{type:deflt,attrs:newAttributes}]:void 0,can=(0,prosemirror_transform_dist.zy)(tr.doc,tr.mapping.map($from.pos),1,types);if(types||can||!(0,prosemirror_transform_dist.zy)(tr.doc,tr.mapping.map($from.pos),1,deflt?[{type:deflt}]:void 0)||(can=!0,types=deflt?[{type:deflt,attrs:newAttributes}]:void 0),dispatch){if(can&&(selection instanceof dist.U3&&tr.deleteSelection(),tr.split(tr.mapping.map($from.pos),1,types),deflt&&!atEnd&&!$from.parentOffset&&$from.parent.type!==deflt)){const first=tr.mapping.map($from.before()),$first=tr.doc.resolve(first);$from.node(-1).canReplaceWith($first.index(),$first.index()+1,deflt)&&tr.setNodeMarkup(tr.mapping.map($from.before()),deflt)}keepMarks&&ensureMarks(state,editor.extensionManager.splittableMarks),tr.scrollIntoView()}return can},splitListItem:(typeOrName,overrideAttrs={})=>({tr,state,dispatch,editor})=>{var _a;const type=getNodeType(typeOrName,state.schema),{$from,$to}=state.selection,node=state.selection.node;if(node&&node.isBlock||$from.depth<2||!$from.sameParent($to))return!1;const grandParent=$from.node(-1);if(grandParent.type!==type)return!1;const extensionAttributes=editor.extensionManager.attributes;if(0===$from.parent.content.size&&$from.node(-1).childCount===$from.indexAfter(-1)){if(2===$from.depth||$from.node(-3).type!==type||$from.index(-2)!==$from.node(-2).childCount-1)return!1;if(dispatch){let wrap=prosemirror_model_dist.FK.empty;const depthBefore=$from.index(-1)?1:$from.index(-2)?2:3;for(let d=$from.depth-depthBefore;d>=$from.depth-3;d-=1)wrap=prosemirror_model_dist.FK.from($from.node(d).copy(wrap));const depthAfter=$from.indexAfter(-1)<$from.node(-2).childCount?1:$from.indexAfter(-2)<$from.node(-3).childCount?2:3,newNextTypeAttributes={...getSplittedAttributes(extensionAttributes,$from.node().type.name,$from.node().attrs),...overrideAttrs},nextType=(null===(_a=type.contentMatch.defaultType)||void 0===_a?void 0:_a.createAndFill(newNextTypeAttributes))||void 0;wrap=wrap.append(prosemirror_model_dist.FK.from(type.createAndFill(null,nextType)||void 0));const start=$from.before($from.depth-(depthBefore-1));tr.replace(start,$from.after(-depthAfter),new prosemirror_model_dist.Ji(wrap,4-depthBefore,0));let sel=-1;tr.doc.nodesBetween(start,tr.doc.content.size,(n,pos)=>{if(sel>-1)return!1;n.isTextblock&&0===n.content.size&&(sel=pos+1)}),sel>-1&&tr.setSelection(dist.U3.near(tr.doc.resolve(sel))),tr.scrollIntoView()}return!0}const nextType=$to.pos===$from.end()?grandParent.contentMatchAt(0).defaultType:null,newTypeAttributes={...getSplittedAttributes(extensionAttributes,grandParent.type.name,grandParent.attrs),...overrideAttrs},newNextTypeAttributes={...getSplittedAttributes(extensionAttributes,$from.node().type.name,$from.node().attrs),...overrideAttrs};tr.delete($from.pos,$to.pos);const types=nextType?[{type,attrs:newTypeAttributes},{type:nextType,attrs:newNextTypeAttributes}]:[{type,attrs:newTypeAttributes}];if(!(0,prosemirror_transform_dist.zy)(tr.doc,$from.pos,2))return!1;if(dispatch){const{selection,storedMarks}=state,{splittableMarks}=editor.extensionManager,marks=storedMarks||selection.$to.parentOffset&&selection.$from.marks();if(tr.split($from.pos,2,types).scrollIntoView(),!marks||!dispatch)return!0;const filteredMarks=marks.filter(mark=>splittableMarks.includes(mark.type.name));tr.ensureMarks(filteredMarks)}return!0},toggleList:(listTypeOrName,itemTypeOrName,keepMarks,attributes={})=>({editor,tr,state,dispatch,chain,commands,can})=>{const{extensions,splittableMarks}=editor.extensionManager,listType=getNodeType(listTypeOrName,state.schema),itemType=getNodeType(itemTypeOrName,state.schema),{selection,storedMarks}=state,{$from,$to}=selection,range=$from.blockRange($to),marks=storedMarks||selection.$to.parentOffset&&selection.$from.marks();if(!range)return!1;const parentList=findParentNode(node=>isList(node.type.name,extensions))(selection);if(range.depth>=1&&parentList&&range.depth-parentList.depth<=1){if(parentList.node.type===listType)return commands.liftListItem(itemType);if(isList(parentList.node.type.name,extensions)&&listType.validContent(parentList.node.content)&&dispatch)return chain().command(()=>(tr.setNodeMarkup(parentList.pos,listType),!0)).command(()=>joinListBackwards(tr,listType)).command(()=>joinListForwards(tr,listType)).run()}return keepMarks&&marks&&dispatch?chain().command(()=>{const canWrapInList=can().wrapInList(listType,attributes),filteredMarks=marks.filter(mark=>splittableMarks.includes(mark.type.name));return tr.ensureMarks(filteredMarks),!!canWrapInList||commands.clearNodes()}).wrapInList(listType,attributes).command(()=>joinListBackwards(tr,listType)).command(()=>joinListForwards(tr,listType)).run():chain().command(()=>!!can().wrapInList(listType,attributes)||commands.clearNodes()).wrapInList(listType,attributes).command(()=>joinListBackwards(tr,listType)).command(()=>joinListForwards(tr,listType)).run()},toggleMark:(typeOrName,attributes={},options={})=>({state,commands})=>{const{extendEmptyMarkRange=!1}=options,type=getMarkType(typeOrName,state.schema);return isMarkActive(state,type,attributes)?commands.unsetMark(type,{extendEmptyMarkRange}):commands.setMark(type,attributes)},toggleNode:(typeOrName,toggleTypeOrName,attributes={})=>({state,commands})=>{const type=getNodeType(typeOrName,state.schema),toggleType=getNodeType(toggleTypeOrName,state.schema),isActive=isNodeActive(state,type,attributes);let attributesToCopy;return state.selection.$anchor.sameParent(state.selection.$head)&&(attributesToCopy=state.selection.$anchor.parent.attrs),isActive?commands.setNode(toggleType,attributesToCopy):commands.setNode(type,{...attributesToCopy,...attributes})},toggleWrap:(typeOrName,attributes={})=>({state,commands})=>{const type=getNodeType(typeOrName,state.schema);return isNodeActive(state,type,attributes)?commands.lift(type):commands.wrapIn(type,attributes)},undoInputRule:()=>({state,dispatch})=>{const plugins=state.plugins;for(let i=0;i<plugins.length;i+=1){const plugin=plugins[i];let undoable;if(plugin.spec.isInputRules&&(undoable=plugin.getState(state))){if(dispatch){const tr=state.tr,toUndo=undoable.transform;for(let j=toUndo.steps.length-1;j>=0;j-=1)tr.step(toUndo.steps[j].invert(toUndo.docs[j]));if(undoable.text){const marks=tr.doc.resolve(undoable.from).marks();tr.replaceWith(undoable.from,undoable.to,state.schema.text(undoable.text,marks))}else tr.delete(undoable.from,undoable.to)}return!0}}return!1},unsetAllMarks:()=>({tr,dispatch})=>{const{selection}=tr,{empty,ranges}=selection;return empty||dispatch&&ranges.forEach(range=>{tr.removeMark(range.$from.pos,range.$to.pos)}),!0},unsetMark:(typeOrName,options={})=>({tr,state,dispatch})=>{var _a;const{extendEmptyMarkRange=!1}=options,{selection}=tr,type=getMarkType(typeOrName,state.schema),{$from,empty,ranges}=selection;if(!dispatch)return!0;if(empty&&extendEmptyMarkRange){let{from,to}=selection;const attrs=null===(_a=$from.marks().find(mark=>mark.type===type))||void 0===_a?void 0:_a.attrs,range=getMarkRange($from,type,attrs);range&&(from=range.from,to=range.to),tr.removeMark(from,to,type)}else ranges.forEach(range=>{tr.removeMark(range.$from.pos,range.$to.pos,type)});return tr.removeStoredMark(type),!0},updateAttributes:(typeOrName,attributes={})=>({tr,state,dispatch})=>{let nodeType=null,markType=null;const schemaType=getSchemaTypeNameByName("string"==typeof typeOrName?typeOrName:typeOrName.name,state.schema);return!!schemaType&&("node"===schemaType&&(nodeType=getNodeType(typeOrName,state.schema)),"mark"===schemaType&&(markType=getMarkType(typeOrName,state.schema)),dispatch&&tr.selection.ranges.forEach(range=>{const from=range.$from.pos,to=range.$to.pos;let lastPos,lastNode,trimmedFrom,trimmedTo;tr.selection.empty?state.doc.nodesBetween(from,to,(node,pos)=>{nodeType&&nodeType===node.type&&(trimmedFrom=Math.max(pos,from),trimmedTo=Math.min(pos+node.nodeSize,to),lastPos=pos,lastNode=node)}):state.doc.nodesBetween(from,to,(node,pos)=>{pos<from&&nodeType&&nodeType===node.type&&(trimmedFrom=Math.max(pos,from),trimmedTo=Math.min(pos+node.nodeSize,to),lastPos=pos,lastNode=node),pos>=from&&pos<=to&&(nodeType&&nodeType===node.type&&tr.setNodeMarkup(pos,void 0,{...node.attrs,...attributes}),markType&&node.marks.length&&node.marks.forEach(mark=>{if(markType===mark.type){const trimmedFrom2=Math.max(pos,from),trimmedTo2=Math.min(pos+node.nodeSize,to);tr.addMark(trimmedFrom2,trimmedTo2,markType.create({...mark.attrs,...attributes}))}}))}),lastNode&&(void 0!==lastPos&&tr.setNodeMarkup(lastPos,void 0,{...lastNode.attrs,...attributes}),markType&&lastNode.marks.length&&lastNode.marks.forEach(mark=>{markType===mark.type&&tr.addMark(trimmedFrom,trimmedTo,markType.create({...mark.attrs,...attributes}))}))}),!0)},wrapIn:(typeOrName,attributes={})=>({state,dispatch})=>function wrapIn(nodeType,attrs=null){return function(state,dispatch){let{$from,$to}=state.selection,range=$from.blockRange($to),wrapping=range&&(0,prosemirror_transform_dist.oM)(range,nodeType,attrs);return!!wrapping&&(dispatch&&dispatch(state.tr.wrap(range,wrapping).scrollIntoView()),!0)}}(getNodeType(typeOrName,state.schema),attributes)(state,dispatch),wrapInList:(typeOrName,attributes={})=>({state,dispatch})=>wrapInList(getNodeType(typeOrName,state.schema),attributes)(state,dispatch)});const Commands=Extension.create({name:"commands",addCommands:()=>({...commands})}),Drop=Extension.create({name:"drop",addProseMirrorPlugins(){return[new dist.k_({key:new dist.hs("tiptapDrop"),props:{handleDrop:(_,e,slice,moved)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice,moved})}}})]}}),Editable=Extension.create({name:"editable",addProseMirrorPlugins(){return[new dist.k_({key:new dist.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),focusEventsPluginKey=new dist.hs("focusEvents"),FocusEvents=Extension.create({name:"focusEvents",addProseMirrorPlugins(){const{editor}=this;return[new dist.k_({key:focusEventsPluginKey,props:{handleDOMEvents:{focus:(view,event)=>{editor.isFocused=!0;const transaction=editor.state.tr.setMeta("focus",{event}).setMeta("addToHistory",!1);return view.dispatch(transaction),!1},blur:(view,event)=>{editor.isFocused=!1;const transaction=editor.state.tr.setMeta("blur",{event}).setMeta("addToHistory",!1);return view.dispatch(transaction),!1}}}})]}}),Keymap=Extension.create({name:"keymap",addKeyboardShortcuts(){const handleBackspace=()=>this.editor.commands.first(({commands})=>[()=>commands.undoInputRule(),()=>commands.command(({tr})=>{const{selection,doc}=tr,{empty,$anchor}=selection,{pos,parent}=$anchor,$parentPos=$anchor.parent.isTextblock&&pos>0?tr.doc.resolve(pos-1):$anchor,parentIsIsolating=$parentPos.parent.type.spec.isolating,parentPos=$anchor.pos-$anchor.parentOffset,isAtStart=parentIsIsolating&&1===$parentPos.parent.childCount?parentPos===$anchor.pos:dist.LN.atStart(doc).from===pos;return!(!empty||!parent.type.isTextblock||parent.textContent.length||!isAtStart||isAtStart&&"paragraph"===$anchor.parent.type.name)&&commands.clearNodes()}),()=>commands.deleteSelection(),()=>commands.joinBackward(),()=>commands.selectNodeBackward()]),handleDelete=()=>this.editor.commands.first(({commands})=>[()=>commands.deleteSelection(),()=>commands.deleteCurrentNode(),()=>commands.joinForward(),()=>commands.selectNodeForward()]),baseKeymap={Enter:()=>this.editor.commands.first(({commands})=>[()=>commands.newlineInCode(),()=>commands.createParagraphNear(),()=>commands.liftEmptyBlock(),()=>commands.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:handleBackspace,"Mod-Backspace":handleBackspace,"Shift-Backspace":handleBackspace,Delete:handleDelete,"Mod-Delete":handleDelete,"Mod-a":()=>this.editor.commands.selectAll()},pcKeymap={...baseKeymap},macKeymap={...baseKeymap,"Ctrl-h":handleBackspace,"Alt-Backspace":handleBackspace,"Ctrl-d":handleDelete,"Ctrl-Alt-Backspace":handleDelete,"Alt-Delete":handleDelete,"Alt-d":handleDelete,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return isiOS()||isMacOS()?macKeymap:pcKeymap},addProseMirrorPlugins(){return[new dist.k_({key:new dist.hs("clearDocument"),appendTransaction:(transactions,oldState,newState)=>{if(transactions.some(tr=>tr.getMeta("composition")))return;const docChanges=transactions.some(transaction=>transaction.docChanged)&&!oldState.doc.eq(newState.doc),ignoreTr=transactions.some(transaction=>transaction.getMeta("preventClearDocument"));if(!docChanges||ignoreTr)return;const{empty,from,to}=oldState.selection,allFrom=dist.LN.atStart(oldState.doc).from,allEnd=dist.LN.atEnd(oldState.doc).to;if(empty||!(from===allFrom&&to===allEnd))return;if(!isNodeEmpty(newState.doc))return;const tr=newState.tr,state=createChainableState({state:newState,transaction:tr}),{commands}=new CommandManager({editor:this.editor,state});return commands.clearNodes(),tr.steps.length?tr:void 0}})]}}),Paste=Extension.create({name:"paste",addProseMirrorPlugins(){return[new dist.k_({key:new dist.hs("tiptapPaste"),props:{handlePaste:(_view,e,slice)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice})}}})]}}),Tabindex=Extension.create({name:"tabindex",addProseMirrorPlugins(){return[new dist.k_({key:new dist.hs("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class NodePos{get name(){return this.node.type.name}constructor(pos,editor,isBlock=!1,node=null){this.currentNode=null,this.actualDepth=null,this.isBlock=isBlock,this.resolvedPos=pos,this.editor=editor,this.currentNode=node}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var _a;return null!==(_a=this.actualDepth)&&void 0!==_a?_a:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(content){let from=this.from,to=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);from=this.from+1,to=this.to-1}this.editor.commands.insertContentAt({from,to},content)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const parentPos=this.resolvedPos.start(this.resolvedPos.depth-1),$pos=this.resolvedPos.doc.resolve(parentPos);return new NodePos($pos,this.editor)}get before(){let $pos=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return $pos.depth!==this.depth&&($pos=this.resolvedPos.doc.resolve(this.from-3)),new NodePos($pos,this.editor)}get after(){let $pos=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return $pos.depth!==this.depth&&($pos=this.resolvedPos.doc.resolve(this.to+3)),new NodePos($pos,this.editor)}get children(){const children=[];return this.node.content.forEach((node,offset)=>{const isBlock=node.isBlock&&!node.isTextblock,isNonTextAtom=node.isAtom&&!node.isText,targetPos=this.pos+offset+(isNonTextAtom?0:1);if(targetPos<0||targetPos>this.resolvedPos.doc.nodeSize-2)return;const $pos=this.resolvedPos.doc.resolve(targetPos);if(!isBlock&&$pos.depth<=this.depth)return;const childNodePos=new NodePos($pos,this.editor,isBlock,isBlock?node:null);isBlock&&(childNodePos.actualDepth=this.depth+1),children.push(new NodePos($pos,this.editor,isBlock,isBlock?node:null))}),children}get firstChild(){return this.children[0]||null}get lastChild(){const children=this.children;return children[children.length-1]||null}closest(selector,attributes={}){let node=null,currentNode=this.parent;for(;currentNode&&!node;){if(currentNode.node.type.name===selector)if(Object.keys(attributes).length>0){const nodeAttributes=currentNode.node.attrs,attrKeys=Object.keys(attributes);for(let index=0;index<attrKeys.length;index+=1){const key=attrKeys[index];if(nodeAttributes[key]!==attributes[key])break}}else node=currentNode;currentNode=currentNode.parent}return node}querySelector(selector,attributes={}){return this.querySelectorAll(selector,attributes,!0)[0]||null}querySelectorAll(selector,attributes={},firstItemOnly=!1){let nodes=[];if(!this.children||0===this.children.length)return nodes;const attrKeys=Object.keys(attributes);return this.children.forEach(childPos=>{if(!(firstItemOnly&&nodes.length>0)){if(childPos.node.type.name===selector){attrKeys.every(key=>attributes[key]===childPos.node.attrs[key])&&nodes.push(childPos)}firstItemOnly&&nodes.length>0||(nodes=nodes.concat(childPos.querySelectorAll(selector,attributes,firstItemOnly)))}}),nodes}setAttribute(attributes){const{tr}=this.editor.state;tr.setNodeMarkup(this.from,void 0,{...this.node.attrs,...attributes}),this.editor.view.dispatch(tr)}}class Editor extends EventEmitter{constructor(options={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error})=>{throw error},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(options),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event,slice,moved})=>this.options.onDrop(event,slice,moved)),this.on("paste",({event,slice})=>this.options.onPaste(event,slice)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=function createStyleTag(style,nonce,suffix){const tiptapStyleTag=document.querySelector(`style[data-tiptap-style${suffix?`-${suffix}`:""}]`);if(null!==tiptapStyleTag)return tiptapStyleTag;const styleNode=document.createElement("style");return nonce&&styleNode.setAttribute("nonce",nonce),styleNode.setAttribute("data-tiptap-style"+(suffix?`-${suffix}`:""),""),styleNode.innerHTML=style,document.getElementsByTagName("head")[0].appendChild(styleNode),styleNode}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(options={}){this.options={...this.options,...options},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(editable,emitUpdate=!0){this.setOptions({editable}),emitUpdate&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(plugin,handlePlugins){const plugins=isFunction(handlePlugins)?handlePlugins(plugin,[...this.state.plugins]):[...this.state.plugins,plugin],state=this.state.reconfigure({plugins});return this.view.updateState(state),state}unregisterPlugin(nameOrPluginKeyToRemove){if(this.isDestroyed)return;const prevPlugins=this.state.plugins;let plugins=prevPlugins;if([].concat(nameOrPluginKeyToRemove).forEach(nameOrPluginKey=>{const name="string"==typeof nameOrPluginKey?`${nameOrPluginKey}$`:nameOrPluginKey.key;plugins=plugins.filter(plugin=>!plugin.key.startsWith(name))}),prevPlugins.length===plugins.length)return;const state=this.state.reconfigure({plugins});return this.view.updateState(state),state}createExtensionManager(){var _a,_b;const allExtensions=[...this.options.enableCoreExtensions?[Editable,ClipboardTextSerializer.configure({blockSeparator:null===(_b=null===(_a=this.options.coreExtensionOptions)||void 0===_a?void 0:_a.clipboardTextSerializer)||void 0===_b?void 0:_b.blockSeparator}),Commands,FocusEvents,Keymap,Tabindex,Drop,Paste].filter(ext=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[ext.name]):[],...this.options.extensions].filter(extension=>["extension","node","mark"].includes(null==extension?void 0:extension.type));this.extensionManager=new ExtensionManager(allExtensions,this)}createCommandManager(){this.commandManager=new CommandManager({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var _a;let doc;try{doc=createDocument(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(extension=>"collaboration"!==extension.name),this.createExtensionManager()}}),doc=createDocument(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const selection=resolveFocusPosition(doc,this.options.autofocus);this.view=new prosemirror_view_dist.Lz(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null===(_a=this.options.editorProps)||void 0===_a?void 0:_a.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:dist.$t.create({doc,selection:selection||void 0})});const newState=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(newState),this.createNodeViews(),this.prependClass();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(fn){this.isCapturingTransaction=!0,fn(),this.isCapturingTransaction=!1;const tr=this.capturedTransaction;return this.capturedTransaction=null,tr}dispatchTransaction(transaction){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void transaction.steps.forEach(step=>{var _a;return null===(_a=this.capturedTransaction)||void 0===_a?void 0:_a.step(step)}):void(this.capturedTransaction=transaction);const state=this.state.apply(transaction),selectionHasChanged=!this.state.selection.eq(state.selection);this.emit("beforeTransaction",{editor:this,transaction,nextState:state}),this.view.updateState(state),this.emit("transaction",{editor:this,transaction}),selectionHasChanged&&this.emit("selectionUpdate",{editor:this,transaction});const focus=transaction.getMeta("focus"),blur=transaction.getMeta("blur");focus&&this.emit("focus",{editor:this,event:focus.event,transaction}),blur&&this.emit("blur",{editor:this,event:blur.event,transaction}),transaction.docChanged&&!transaction.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction})}getAttributes(nameOrType){return getAttributes(this.state,nameOrType)}isActive(nameOrAttributes,attributesOrUndefined){const name="string"==typeof nameOrAttributes?nameOrAttributes:null,attributes="string"==typeof nameOrAttributes?attributesOrUndefined:nameOrAttributes;return function isActive(state,name,attributes={}){if(!name)return isNodeActive(state,null,attributes)||isMarkActive(state,null,attributes);const schemaType=getSchemaTypeNameByName(name,state.schema);return"node"===schemaType?isNodeActive(state,name,attributes):"mark"===schemaType&&isMarkActive(state,name,attributes)}(this.state,name,attributes)}getJSON(){return this.state.doc.toJSON()}getHTML(){return getHTMLFromFragment(this.state.doc.content,this.schema)}getText(options){const{blockSeparator="\n\n",textSerializers={}}=options||{};return getText(this.state.doc,{blockSeparator,textSerializers:{...getTextSerializersFromSchema(this.schema),...textSerializers}})}get isEmpty(){return isNodeEmpty(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const dom=this.view.dom;dom&&dom.editor&&delete dom.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var _a;return!(null===(_a=this.view)||void 0===_a?void 0:_a.docView)}$node(selector,attributes){var _a;return(null===(_a=this.$doc)||void 0===_a?void 0:_a.querySelector(selector,attributes))||null}$nodes(selector,attributes){var _a;return(null===(_a=this.$doc)||void 0===_a?void 0:_a.querySelectorAll(selector,attributes))||null}$pos(pos){const $pos=this.state.doc.resolve(pos);return new NodePos($pos,this)}get $doc(){return this.$pos(0)}}function markInputRule(config){return new InputRule({find:config.find,handler:({state,range,match})=>{const attributes=callOrReturn(config.getAttributes,void 0,match);if(!1===attributes||null===attributes)return null;const{tr}=state,captureGroup=match[match.length-1],fullMatch=match[0];if(captureGroup){const startSpaces=fullMatch.search(/\S/),textStart=range.from+fullMatch.indexOf(captureGroup),textEnd=textStart+captureGroup.length;if(getMarksBetween(range.from,range.to,state.doc).filter(item=>item.mark.type.excluded.find(type=>type===config.type&&type!==item.mark.type)).filter(item=>item.to>textStart).length)return null;textEnd<range.to&&tr.delete(textEnd,range.to),textStart>range.from&&tr.delete(range.from+startSpaces,textStart);const markEnd=range.from+startSpaces+captureGroup.length;tr.addMark(range.from+startSpaces,markEnd,config.type.create(attributes||{})),tr.removeStoredMark(config.type)}}})}function nodeInputRule(config){return new InputRule({find:config.find,handler:({state,range,match})=>{const attributes=callOrReturn(config.getAttributes,void 0,match)||{},{tr}=state,start=range.from;let end=range.to;const newNode=config.type.create(attributes);if(match[1]){let matchStart=start+match[0].lastIndexOf(match[1]);matchStart>end?matchStart=end:end=matchStart+match[1].length;const lastChar=match[0][match[0].length-1];tr.insertText(lastChar,start+match[0].length-1),tr.replaceWith(matchStart,end,newNode)}else if(match[0]){const insertionStart=config.type.isInline?start:start-1;tr.insert(insertionStart,config.type.create(attributes)).delete(tr.mapping.map(start),tr.mapping.map(end))}tr.scrollIntoView()}})}function textblockTypeInputRule(config){return new InputRule({find:config.find,handler:({state,range,match})=>{const $start=state.doc.resolve(range.from),attributes=callOrReturn(config.getAttributes,void 0,match)||{};if(!$start.node(-1).canReplaceWith($start.index(-1),$start.indexAfter(-1),config.type))return null;state.tr.delete(range.from,range.to).setBlockType(range.from,range.from,config.type,attributes)}})}function wrappingInputRule(config){return new InputRule({find:config.find,handler:({state,range,match,chain})=>{const attributes=callOrReturn(config.getAttributes,void 0,match)||{},tr=state.tr.delete(range.from,range.to),blockRange=tr.doc.resolve(range.from).blockRange(),wrapping=blockRange&&(0,prosemirror_transform_dist.oM)(blockRange,config.type,attributes);if(!wrapping)return null;if(tr.wrap(blockRange,wrapping),config.keepMarks&&config.editor){const{selection,storedMarks}=state,{splittableMarks}=config.editor.extensionManager,marks=storedMarks||selection.$to.parentOffset&&selection.$from.marks();if(marks){const filteredMarks=marks.filter(mark=>splittableMarks.includes(mark.type.name));tr.ensureMarks(filteredMarks)}}if(config.keepAttributes){const nodeType="bulletList"===config.type.name||"orderedList"===config.type.name?"listItem":"taskList";chain().updateAttributes(nodeType,attributes).run()}const before=tr.doc.resolve(range.from-1).nodeBefore;before&&before.type===config.type&&(0,prosemirror_transform_dist.n9)(tr.doc,range.from-1)&&(!config.joinPredicate||config.joinPredicate(match,before))&&tr.join(range.from-1)}})}class Node{constructor(config={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...config},this.name=this.config.name,config.defaultOptions&&Object.keys(config.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=callOrReturn(getExtensionField(this,"addOptions",{name:this.name}))),this.storage=callOrReturn(getExtensionField(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(config={}){return new Node(config)}configure(options={}){const extension=this.extend({...this.config,addOptions:()=>mergeDeep(this.options,options)});return extension.name=this.name,extension.parent=this.parent,extension}extend(extendedConfig={}){const extension=new Node(extendedConfig);return extension.parent=this,this.child=extension,extension.name=extendedConfig.name?extendedConfig.name:extension.parent.name,extendedConfig.defaultOptions&&Object.keys(extendedConfig.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`),extension.options=callOrReturn(getExtensionField(extension,"addOptions",{name:extension.name})),extension.storage=callOrReturn(getExtensionField(extension,"addStorage",{name:extension.name,options:extension.options})),extension}}function markPasteRule(config){return new PasteRule({find:config.find,handler:({state,range,match,pasteEvent})=>{const attributes=callOrReturn(config.getAttributes,void 0,match,pasteEvent);if(!1===attributes||null===attributes)return null;const{tr}=state,captureGroup=match[match.length-1],fullMatch=match[0];let markEnd=range.to;if(captureGroup){const startSpaces=fullMatch.search(/\S/),textStart=range.from+fullMatch.indexOf(captureGroup),textEnd=textStart+captureGroup.length;if(getMarksBetween(range.from,range.to,state.doc).filter(item=>item.mark.type.excluded.find(type=>type===config.type&&type!==item.mark.type)).filter(item=>item.to>textStart).length)return null;textEnd<range.to&&tr.delete(textEnd,range.to),textStart>range.from&&tr.delete(range.from+startSpaces,textStart),markEnd=range.from+startSpaces+captureGroup.length,tr.addMark(range.from+startSpaces,markEnd,config.type.create(attributes||{})),tr.removeStoredMark(config.type)}}})}function canInsertNode(state,nodeType){const{selection}=state,{$from}=selection;if(selection instanceof dist.nh){const index=$from.index();return $from.parent.canReplaceWith(index,index+1,nodeType)}let depth=$from.depth;for(;depth>=0;){const index=$from.index(depth);if($from.node(depth).contentMatchAt(index).matchType(nodeType))return!0;depth-=1}return!1}},"./node_modules/@tiptap/extension-gapcursor/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{v:()=>Gapcursor,A:()=>Gapcursor});var dist=__webpack_require__("./node_modules/@tiptap/core/dist/index.js"),prosemirror_keymap_dist=__webpack_require__("./node_modules/prosemirror-keymap/dist/index.js"),prosemirror_state_dist=__webpack_require__("./node_modules/prosemirror-state/dist/index.js"),prosemirror_model_dist=__webpack_require__("./node_modules/prosemirror-model/dist/index.js"),prosemirror_view_dist=__webpack_require__("./node_modules/prosemirror-view/dist/index.js");class GapCursor extends prosemirror_state_dist.LN{constructor($pos){super($pos,$pos)}map(doc,mapping){let $pos=doc.resolve(mapping.map(this.head));return GapCursor.valid($pos)?new GapCursor($pos):prosemirror_state_dist.LN.near($pos)}content(){return prosemirror_model_dist.Ji.empty}eq(other){return other instanceof GapCursor&&other.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(doc,json){if("number"!=typeof json.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new GapCursor(doc.resolve(json.pos))}getBookmark(){return new GapBookmark(this.anchor)}static valid($pos){let parent=$pos.parent;if(parent.isTextblock||!function closedBefore($pos){for(let d=$pos.depth;d>=0;d--){let index=$pos.index(d),parent=$pos.node(d);if(0!=index)for(let before=parent.child(index-1);;before=before.lastChild){if(0==before.childCount&&!before.inlineContent||before.isAtom||before.type.spec.isolating)return!0;if(before.inlineContent)return!1}else if(parent.type.spec.isolating)return!0}return!0}($pos)||!function closedAfter($pos){for(let d=$pos.depth;d>=0;d--){let index=$pos.indexAfter(d),parent=$pos.node(d);if(index!=parent.childCount)for(let after=parent.child(index);;after=after.firstChild){if(0==after.childCount&&!after.inlineContent||after.isAtom||after.type.spec.isolating)return!0;if(after.inlineContent)return!1}else if(parent.type.spec.isolating)return!0}return!0}($pos))return!1;let override=parent.type.spec.allowGapCursor;if(null!=override)return override;let deflt=parent.contentMatchAt($pos.index()).defaultType;return deflt&&deflt.isTextblock}static findGapCursorFrom($pos,dir,mustMove=!1){search:for(;;){if(!mustMove&&GapCursor.valid($pos))return $pos;let pos=$pos.pos,next=null;for(let d=$pos.depth;;d--){let parent=$pos.node(d);if(dir>0?$pos.indexAfter(d)<parent.childCount:$pos.index(d)>0){next=parent.child(dir>0?$pos.indexAfter(d):$pos.index(d)-1);break}if(0==d)return null;pos+=dir;let $cur=$pos.doc.resolve(pos);if(GapCursor.valid($cur))return $cur}for(;;){let inside=dir>0?next.firstChild:next.lastChild;if(!inside){if(next.isAtom&&!next.isText&&!prosemirror_state_dist.nh.isSelectable(next)){$pos=$pos.doc.resolve(pos+next.nodeSize*dir),mustMove=!1;continue search}break}next=inside,pos+=dir;let $cur=$pos.doc.resolve(pos);if(GapCursor.valid($cur))return $cur}return null}}}GapCursor.prototype.visible=!1,GapCursor.findFrom=GapCursor.findGapCursorFrom,prosemirror_state_dist.LN.jsonID("gapcursor",GapCursor);class GapBookmark{constructor(pos){this.pos=pos}map(mapping){return new GapBookmark(mapping.map(this.pos))}resolve(doc){let $pos=doc.resolve(this.pos);return GapCursor.valid($pos)?new GapCursor($pos):prosemirror_state_dist.LN.near($pos)}}const handleKeyDown=(0,prosemirror_keymap_dist.K)({ArrowLeft:arrow("horiz",-1),ArrowRight:arrow("horiz",1),ArrowUp:arrow("vert",-1),ArrowDown:arrow("vert",1)});function arrow(axis,dir){const dirStr="vert"==axis?dir>0?"down":"up":dir>0?"right":"left";return function(state,dispatch,view){let sel=state.selection,$start=dir>0?sel.$to:sel.$from,mustMove=sel.empty;if(sel instanceof prosemirror_state_dist.U3){if(!view.endOfTextblock(dirStr)||0==$start.depth)return!1;mustMove=!1,$start=state.doc.resolve(dir>0?$start.after():$start.before())}let $found=GapCursor.findGapCursorFrom($start,dir,mustMove);return!!$found&&(dispatch&&dispatch(state.tr.setSelection(new GapCursor($found))),!0)}}function handleClick(view,pos,event){if(!view||!view.editable)return!1;let $pos=view.state.doc.resolve(pos);if(!GapCursor.valid($pos))return!1;let clickPos=view.posAtCoords({left:event.clientX,top:event.clientY});return!(clickPos&&clickPos.inside>-1&&prosemirror_state_dist.nh.isSelectable(view.state.doc.nodeAt(clickPos.inside)))&&(view.dispatch(view.state.tr.setSelection(new GapCursor($pos))),!0)}function beforeinput(view,event){if("insertCompositionText"!=event.inputType||!(view.state.selection instanceof GapCursor))return!1;let{$from}=view.state.selection,insert=$from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);if(!insert)return!1;let frag=prosemirror_model_dist.FK.empty;for(let i=insert.length-1;i>=0;i--)frag=prosemirror_model_dist.FK.from(insert[i].createAndFill(null,frag));let tr=view.state.tr.replace($from.pos,$from.pos,new prosemirror_model_dist.Ji(frag,0,0));return tr.setSelection(prosemirror_state_dist.U3.near(tr.doc.resolve($from.pos+1))),view.dispatch(tr),!1}function drawGapCursor(state){if(!(state.selection instanceof GapCursor))return null;let node=document.createElement("div");return node.className="ProseMirror-gapcursor",prosemirror_view_dist.zF.create(state.doc,[prosemirror_view_dist.NZ.widget(state.selection.head,node,{key:"gapcursor"})])}const Gapcursor=dist.YY.create({name:"gapCursor",addProseMirrorPlugins:()=>[new prosemirror_state_dist.k_({props:{decorations:drawGapCursor,createSelectionBetween:(_view,$anchor,$head)=>$anchor.pos==$head.pos&&GapCursor.valid($head)?new GapCursor($head):null,handleClick,handleKeyDown,handleDOMEvents:{beforeinput}}})],extendNodeSchema(extension){var _a;const context={name:extension.name,options:extension.options,storage:extension.storage};return{allowGapCursor:null!==(_a=(0,dist.gk)((0,dist.iI)(extension,"allowGapCursor",context)))&&void 0!==_a?_a:null}}})},"./node_modules/@tiptap/extension-table-cell/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>TableCell});var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/@tiptap/core/dist/index.js");const TableCell=_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.bP.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:element=>{const colwidth=element.getAttribute("colwidth");return colwidth?colwidth.split(",").map(width=>parseInt(width,10)):null}}}),tableRole:"cell",isolating:!0,parseHTML:()=>[{tag:"td"}],renderHTML({HTMLAttributes}){return["td",(0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.KV)(this.options.HTMLAttributes,HTMLAttributes),0]}})},"./node_modules/@tiptap/extension-table-header/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{h:()=>TableHeader});var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/@tiptap/core/dist/index.js");const TableHeader=_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.bP.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:element=>{const colwidth=element.getAttribute("colwidth");return colwidth?colwidth.split(",").map(width=>parseInt(width,10)):null}}}),tableRole:"header_cell",isolating:!0,parseHTML:()=>[{tag:"th"}],renderHTML({HTMLAttributes}){return["th",(0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.KV)(this.options.HTMLAttributes,HTMLAttributes),0]}})},"./node_modules/@tiptap/extension-table-row/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>TableRow});var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/@tiptap/core/dist/index.js");const TableRow=_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.bP.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes}){return["tr",(0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.KV)(this.options.HTMLAttributes,HTMLAttributes),0]}})},"./node_modules/@tiptap/extension-table/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Ay:()=>Table});var readFromCache,addToCache,dist=__webpack_require__("./node_modules/@tiptap/core/dist/index.js"),prosemirror_state_dist=__webpack_require__("./node_modules/prosemirror-state/dist/index.js"),prosemirror_model_dist=__webpack_require__("./node_modules/prosemirror-model/dist/index.js"),prosemirror_view_dist=__webpack_require__("./node_modules/prosemirror-view/dist/index.js"),prosemirror_keymap_dist=__webpack_require__("./node_modules/prosemirror-keymap/dist/index.js"),prosemirror_transform_dist=__webpack_require__("./node_modules/prosemirror-transform/dist/index.js");if("undefined"!=typeof WeakMap){let cache=new WeakMap;readFromCache=key=>cache.get(key),addToCache=(key,value)=>(cache.set(key,value),value)}else{const cache=[],cacheSize=10;let cachePos=0;readFromCache=key=>{for(let i=0;i<cache.length;i+=2)if(cache[i]==key)return cache[i+1]},addToCache=(key,value)=>(cachePos==cacheSize&&(cachePos=0),cache[cachePos++]=key,cache[cachePos++]=value)}var TableMap=class{constructor(width,height,map,problems){this.width=width,this.height=height,this.map=map,this.problems=problems}findCell(pos){for(let i=0;i<this.map.length;i++){const curPos=this.map[i];if(curPos!=pos)continue;const left=i%this.width,top=i/this.width|0;let right=left+1,bottom=top+1;for(let j=1;right<this.width&&this.map[i+j]==curPos;j++)right++;for(let j=1;bottom<this.height&&this.map[i+this.width*j]==curPos;j++)bottom++;return{left,top,right,bottom}}throw new RangeError(`No cell with offset ${pos} found`)}colCount(pos){for(let i=0;i<this.map.length;i++)if(this.map[i]==pos)return i%this.width;throw new RangeError(`No cell with offset ${pos} found`)}nextCell(pos,axis,dir){const{left,right,top,bottom}=this.findCell(pos);return"horiz"==axis?(dir<0?0==left:right==this.width)?null:this.map[top*this.width+(dir<0?left-1:right)]:(dir<0?0==top:bottom==this.height)?null:this.map[left+this.width*(dir<0?top-1:bottom)]}rectBetween(a,b){const{left:leftA,right:rightA,top:topA,bottom:bottomA}=this.findCell(a),{left:leftB,right:rightB,top:topB,bottom:bottomB}=this.findCell(b);return{left:Math.min(leftA,leftB),top:Math.min(topA,topB),right:Math.max(rightA,rightB),bottom:Math.max(bottomA,bottomB)}}cellsInRect(rect){const result=[],seen={};for(let row=rect.top;row<rect.bottom;row++)for(let col=rect.left;col<rect.right;col++){const index=row*this.width+col,pos=this.map[index];seen[pos]||(seen[pos]=!0,col==rect.left&&col&&this.map[index-1]==pos||row==rect.top&&row&&this.map[index-this.width]==pos||result.push(pos))}return result}positionAt(row,col,table){for(let i=0,rowStart=0;;i++){const rowEnd=rowStart+table.child(i).nodeSize;if(i==row){let index=col+row*this.width;const rowEndIndex=(row+1)*this.width;for(;index<rowEndIndex&&this.map[index]<rowStart;)index++;return index==rowEndIndex?rowEnd-1:this.map[index]}rowStart=rowEnd}}static get(table){return readFromCache(table)||addToCache(table,function computeMap(table){if("table"!=table.type.spec.tableRole)throw new RangeError("Not a table node: "+table.type.name);const width=function findWidth(table){let width=-1,hasRowSpan=!1;for(let row=0;row<table.childCount;row++){const rowNode=table.child(row);let rowWidth=0;if(hasRowSpan)for(let j=0;j<row;j++){const prevRow=table.child(j);for(let i=0;i<prevRow.childCount;i++){const cell=prevRow.child(i);j+cell.attrs.rowspan>row&&(rowWidth+=cell.attrs.colspan)}}for(let i=0;i<rowNode.childCount;i++){const cell=rowNode.child(i);rowWidth+=cell.attrs.colspan,cell.attrs.rowspan>1&&(hasRowSpan=!0)}-1==width?width=rowWidth:width!=rowWidth&&(width=Math.max(width,rowWidth))}return width}(table),height=table.childCount,map=[];let mapPos=0,problems=null;const colWidths=[];for(let i=0,e=width*height;i<e;i++)map[i]=0;for(let row=0,pos=0;row<height;row++){const rowNode=table.child(row);pos++;for(let i=0;;i++){for(;mapPos<map.length&&0!=map[mapPos];)mapPos++;if(i==rowNode.childCount)break;const cellNode=rowNode.child(i),{colspan,rowspan,colwidth}=cellNode.attrs;for(let h=0;h<rowspan;h++){if(h+row>=height){(problems||(problems=[])).push({type:"overlong_rowspan",pos,n:rowspan-h});break}const start=mapPos+h*width;for(let w=0;w<colspan;w++){0==map[start+w]?map[start+w]=pos:(problems||(problems=[])).push({type:"collision",row,pos,n:colspan-w});const colW=colwidth&&colwidth[w];if(colW){const widthIndex=(start+w)%width*2,prev=colWidths[widthIndex];null==prev||prev!=colW&&1==colWidths[widthIndex+1]?(colWidths[widthIndex]=colW,colWidths[widthIndex+1]=1):prev==colW&&colWidths[widthIndex+1]++}}}mapPos+=colspan,pos+=cellNode.nodeSize}const expectedPos=(row+1)*width;let missing=0;for(;mapPos<expectedPos;)0==map[mapPos++]&&missing++;missing&&(problems||(problems=[])).push({type:"missing",row,n:missing}),pos++}0!==width&&0!==height||(problems||(problems=[])).push({type:"zero_sized"});const tableMap=new TableMap(width,height,map,problems);let badWidths=!1;for(let i=0;!badWidths&&i<colWidths.length;i+=2)null!=colWidths[i]&&colWidths[i+1]<height&&(badWidths=!0);badWidths&&function findBadColWidths(map,colWidths,table){map.problems||(map.problems=[]);const seen={};for(let i=0;i<map.map.length;i++){const pos=map.map[i];if(seen[pos])continue;seen[pos]=!0;const node=table.nodeAt(pos);if(!node)throw new RangeError(`No cell with offset ${pos} found`);let updated=null;const attrs=node.attrs;for(let j=0;j<attrs.colspan;j++){const colWidth=colWidths[2*((i+j)%map.width)];null==colWidth||attrs.colwidth&&attrs.colwidth[j]==colWidth||((updated||(updated=freshColWidth(attrs)))[j]=colWidth)}updated&&map.problems.unshift({type:"colwidth mismatch",pos,colwidth:updated})}}(tableMap,colWidths,table);return tableMap}(table))}};function freshColWidth(attrs){if(attrs.colwidth)return attrs.colwidth.slice();const result=[];for(let i=0;i<attrs.colspan;i++)result.push(0);return result}function tableNodeTypes(schema){let result=schema.cached.tableNodeTypes;if(!result){result=schema.cached.tableNodeTypes={};for(const name in schema.nodes){const type=schema.nodes[name],role=type.spec.tableRole;role&&(result[role]=type)}}return result}var tableEditingKey=new prosemirror_state_dist.hs("selectingCells");function cellAround($pos){for(let d=$pos.depth-1;d>0;d--)if("row"==$pos.node(d).type.spec.tableRole)return $pos.node(0).resolve($pos.before(d+1));return null}function isInTable(state){const $head=state.selection.$head;for(let d=$head.depth;d>0;d--)if("row"==$head.node(d).type.spec.tableRole)return!0;return!1}function selectionCell(state){const sel=state.selection;if("$anchorCell"in sel&&sel.$anchorCell)return sel.$anchorCell.pos>sel.$headCell.pos?sel.$anchorCell:sel.$headCell;if("node"in sel&&sel.node&&"cell"==sel.node.type.spec.tableRole)return sel.$anchor;const $cell=cellAround(sel.$head)||function cellNear($pos){for(let after=$pos.nodeAfter,pos=$pos.pos;after;after=after.firstChild,pos++){const role=after.type.spec.tableRole;if("cell"==role||"header_cell"==role)return $pos.doc.resolve(pos)}for(let before=$pos.nodeBefore,pos=$pos.pos;before;before=before.lastChild,pos--){const role=before.type.spec.tableRole;if("cell"==role||"header_cell"==role)return $pos.doc.resolve(pos-before.nodeSize)}}(sel.$head);if($cell)return $cell;throw new RangeError(`No cell found around position ${sel.head}`)}function pointsAtCell($pos){return"row"==$pos.parent.type.spec.tableRole&&!!$pos.nodeAfter}function inSameTable($cellA,$cellB){return $cellA.depth==$cellB.depth&&$cellA.pos>=$cellB.start(-1)&&$cellA.pos<=$cellB.end(-1)}function nextCell($pos,axis,dir){const table=$pos.node(-1),map=TableMap.get(table),tableStart=$pos.start(-1),moved=map.nextCell($pos.pos-tableStart,axis,dir);return null==moved?null:$pos.node(0).resolve(tableStart+moved)}function removeColSpan(attrs,pos,n=1){const result={...attrs,colspan:attrs.colspan-n};return result.colwidth&&(result.colwidth=result.colwidth.slice(),result.colwidth.splice(pos,n),result.colwidth.some(w=>w>0)||(result.colwidth=null)),result}function addColSpan(attrs,pos,n=1){const result={...attrs,colspan:attrs.colspan+n};if(result.colwidth){result.colwidth=result.colwidth.slice();for(let i=0;i<n;i++)result.colwidth.splice(pos,0,0)}return result}var CellSelection=class _CellSelection extends prosemirror_state_dist.LN{constructor($anchorCell,$headCell=$anchorCell){const table=$anchorCell.node(-1),map=TableMap.get(table),tableStart=$anchorCell.start(-1),rect=map.rectBetween($anchorCell.pos-tableStart,$headCell.pos-tableStart),doc=$anchorCell.node(0),cells=map.cellsInRect(rect).filter(p=>p!=$headCell.pos-tableStart);cells.unshift($headCell.pos-tableStart);const ranges=cells.map(pos=>{const cell=table.nodeAt(pos);if(!cell)throw RangeError(`No cell with offset ${pos} found`);const from=tableStart+pos+1;return new prosemirror_state_dist.yn(doc.resolve(from),doc.resolve(from+cell.content.size))});super(ranges[0].$from,ranges[0].$to,ranges),this.$anchorCell=$anchorCell,this.$headCell=$headCell}map(doc,mapping){const $anchorCell=doc.resolve(mapping.map(this.$anchorCell.pos)),$headCell=doc.resolve(mapping.map(this.$headCell.pos));if(pointsAtCell($anchorCell)&&pointsAtCell($headCell)&&inSameTable($anchorCell,$headCell)){const tableChanged=this.$anchorCell.node(-1)!=$anchorCell.node(-1);return tableChanged&&this.isRowSelection()?_CellSelection.rowSelection($anchorCell,$headCell):tableChanged&&this.isColSelection()?_CellSelection.colSelection($anchorCell,$headCell):new _CellSelection($anchorCell,$headCell)}return prosemirror_state_dist.U3.between($anchorCell,$headCell)}content(){const table=this.$anchorCell.node(-1),map=TableMap.get(table),tableStart=this.$anchorCell.start(-1),rect=map.rectBetween(this.$anchorCell.pos-tableStart,this.$headCell.pos-tableStart),seen={},rows=[];for(let row=rect.top;row<rect.bottom;row++){const rowContent=[];for(let index=row*map.width+rect.left,col=rect.left;col<rect.right;col++,index++){const pos=map.map[index];if(seen[pos])continue;seen[pos]=!0;const cellRect=map.findCell(pos);let cell=table.nodeAt(pos);if(!cell)throw RangeError(`No cell with offset ${pos} found`);const extraLeft=rect.left-cellRect.left,extraRight=cellRect.right-rect.right;if(extraLeft>0||extraRight>0){let attrs=cell.attrs;if(extraLeft>0&&(attrs=removeColSpan(attrs,0,extraLeft)),extraRight>0&&(attrs=removeColSpan(attrs,attrs.colspan-extraRight,extraRight)),cellRect.left<rect.left){if(cell=cell.type.createAndFill(attrs),!cell)throw RangeError(`Could not create cell with attrs ${JSON.stringify(attrs)}`)}else cell=cell.type.create(attrs,cell.content)}if(cellRect.top<rect.top||cellRect.bottom>rect.bottom){const attrs={...cell.attrs,rowspan:Math.min(cellRect.bottom,rect.bottom)-Math.max(cellRect.top,rect.top)};cell=cellRect.top<rect.top?cell.type.createAndFill(attrs):cell.type.create(attrs,cell.content)}rowContent.push(cell)}rows.push(table.child(row).copy(prosemirror_model_dist.FK.from(rowContent)))}const fragment=this.isColSelection()&&this.isRowSelection()?table:rows;return new prosemirror_model_dist.Ji(prosemirror_model_dist.FK.from(fragment),1,1)}replace(tr,content=prosemirror_model_dist.Ji.empty){const mapFrom=tr.steps.length,ranges=this.ranges;for(let i=0;i<ranges.length;i++){const{$from,$to}=ranges[i],mapping=tr.mapping.slice(mapFrom);tr.replace(mapping.map($from.pos),mapping.map($to.pos),i?prosemirror_model_dist.Ji.empty:content)}const sel=prosemirror_state_dist.LN.findFrom(tr.doc.resolve(tr.mapping.slice(mapFrom).map(this.to)),-1);sel&&tr.setSelection(sel)}replaceWith(tr,node){this.replace(tr,new prosemirror_model_dist.Ji(prosemirror_model_dist.FK.from(node),0,0))}forEachCell(f){const table=this.$anchorCell.node(-1),map=TableMap.get(table),tableStart=this.$anchorCell.start(-1),cells=map.cellsInRect(map.rectBetween(this.$anchorCell.pos-tableStart,this.$headCell.pos-tableStart));for(let i=0;i<cells.length;i++)f(table.nodeAt(cells[i]),tableStart+cells[i])}isColSelection(){const anchorTop=this.$anchorCell.index(-1),headTop=this.$headCell.index(-1);if(Math.min(anchorTop,headTop)>0)return!1;const anchorBottom=anchorTop+this.$anchorCell.nodeAfter.attrs.rowspan,headBottom=headTop+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(anchorBottom,headBottom)==this.$headCell.node(-1).childCount}static colSelection($anchorCell,$headCell=$anchorCell){const table=$anchorCell.node(-1),map=TableMap.get(table),tableStart=$anchorCell.start(-1),anchorRect=map.findCell($anchorCell.pos-tableStart),headRect=map.findCell($headCell.pos-tableStart),doc=$anchorCell.node(0);return anchorRect.top<=headRect.top?(anchorRect.top>0&&($anchorCell=doc.resolve(tableStart+map.map[anchorRect.left])),headRect.bottom<map.height&&($headCell=doc.resolve(tableStart+map.map[map.width*(map.height-1)+headRect.right-1]))):(headRect.top>0&&($headCell=doc.resolve(tableStart+map.map[headRect.left])),anchorRect.bottom<map.height&&($anchorCell=doc.resolve(tableStart+map.map[map.width*(map.height-1)+anchorRect.right-1]))),new _CellSelection($anchorCell,$headCell)}isRowSelection(){const table=this.$anchorCell.node(-1),map=TableMap.get(table),tableStart=this.$anchorCell.start(-1),anchorLeft=map.colCount(this.$anchorCell.pos-tableStart),headLeft=map.colCount(this.$headCell.pos-tableStart);if(Math.min(anchorLeft,headLeft)>0)return!1;const anchorRight=anchorLeft+this.$anchorCell.nodeAfter.attrs.colspan,headRight=headLeft+this.$headCell.nodeAfter.attrs.colspan;return Math.max(anchorRight,headRight)==map.width}eq(other){return other instanceof _CellSelection&&other.$anchorCell.pos==this.$anchorCell.pos&&other.$headCell.pos==this.$headCell.pos}static rowSelection($anchorCell,$headCell=$anchorCell){const table=$anchorCell.node(-1),map=TableMap.get(table),tableStart=$anchorCell.start(-1),anchorRect=map.findCell($anchorCell.pos-tableStart),headRect=map.findCell($headCell.pos-tableStart),doc=$anchorCell.node(0);return anchorRect.left<=headRect.left?(anchorRect.left>0&&($anchorCell=doc.resolve(tableStart+map.map[anchorRect.top*map.width])),headRect.right<map.width&&($headCell=doc.resolve(tableStart+map.map[map.width*(headRect.top+1)-1]))):(headRect.left>0&&($headCell=doc.resolve(tableStart+map.map[headRect.top*map.width])),anchorRect.right<map.width&&($anchorCell=doc.resolve(tableStart+map.map[map.width*(anchorRect.top+1)-1]))),new _CellSelection($anchorCell,$headCell)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(doc,json){return new _CellSelection(doc.resolve(json.anchor),doc.resolve(json.head))}static create(doc,anchorCell,headCell=anchorCell){return new _CellSelection(doc.resolve(anchorCell),doc.resolve(headCell))}getBookmark(){return new CellBookmark(this.$anchorCell.pos,this.$headCell.pos)}};CellSelection.prototype.visible=!1,prosemirror_state_dist.LN.jsonID("cell",CellSelection);var CellBookmark=class _CellBookmark{constructor(anchor,head){this.anchor=anchor,this.head=head}map(mapping){return new _CellBookmark(mapping.map(this.anchor),mapping.map(this.head))}resolve(doc){const $anchorCell=doc.resolve(this.anchor),$headCell=doc.resolve(this.head);return"row"==$anchorCell.parent.type.spec.tableRole&&"row"==$headCell.parent.type.spec.tableRole&&$anchorCell.index()<$anchorCell.parent.childCount&&$headCell.index()<$headCell.parent.childCount&&inSameTable($anchorCell,$headCell)?new CellSelection($anchorCell,$headCell):prosemirror_state_dist.LN.near($headCell,1)}};function drawCellSelection(state){if(!(state.selection instanceof CellSelection))return null;const cells=[];return state.selection.forEachCell((node,pos)=>{cells.push(prosemirror_view_dist.NZ.node(pos,pos+node.nodeSize,{class:"selectedCell"}))}),prosemirror_view_dist.zF.create(state.doc,cells)}var fixTablesKey=new prosemirror_state_dist.hs("fix-tables");function changedDescendants(old,cur,offset,f){const oldSize=old.childCount,curSize=cur.childCount;outer:for(let i=0,j=0;i<curSize;i++){const child=cur.child(i);for(let scan=j,e=Math.min(oldSize,i+3);scan<e;scan++)if(old.child(scan)==child){j=scan+1,offset+=child.nodeSize;continue outer}f(child,offset),j<oldSize&&old.child(j).sameMarkup(child)?changedDescendants(old.child(j),child,offset+1,f):child.nodesBetween(0,child.content.size,f,offset+1),offset+=child.nodeSize}}function fixTables(state,oldState){let tr;const check=(node,pos)=>{"table"==node.type.spec.tableRole&&(tr=function fixTable(state,table,tablePos,tr){const map=TableMap.get(table);if(!map.problems)return tr;tr||(tr=state.tr);const mustAdd=[];for(let i=0;i<map.height;i++)mustAdd.push(0);for(let i=0;i<map.problems.length;i++){const prob=map.problems[i];if("collision"==prob.type){const cell=table.nodeAt(prob.pos);if(!cell)continue;const attrs=cell.attrs;for(let j=0;j<attrs.rowspan;j++)mustAdd[prob.row+j]+=prob.n;tr.setNodeMarkup(tr.mapping.map(tablePos+1+prob.pos),null,removeColSpan(attrs,attrs.colspan-prob.n,prob.n))}else if("missing"==prob.type)mustAdd[prob.row]+=prob.n;else if("overlong_rowspan"==prob.type){const cell=table.nodeAt(prob.pos);if(!cell)continue;tr.setNodeMarkup(tr.mapping.map(tablePos+1+prob.pos),null,{...cell.attrs,rowspan:cell.attrs.rowspan-prob.n})}else if("colwidth mismatch"==prob.type){const cell=table.nodeAt(prob.pos);if(!cell)continue;tr.setNodeMarkup(tr.mapping.map(tablePos+1+prob.pos),null,{...cell.attrs,colwidth:prob.colwidth})}else if("zero_sized"==prob.type){const pos=tr.mapping.map(tablePos);tr.delete(pos,pos+table.nodeSize)}}let first,last;for(let i=0;i<mustAdd.length;i++)mustAdd[i]&&(null==first&&(first=i),last=i);for(let i=0,pos=tablePos+1;i<map.height;i++){const row=table.child(i),end=pos+row.nodeSize,add=mustAdd[i];if(add>0){let role="cell";row.firstChild&&(role=row.firstChild.type.spec.tableRole);const nodes=[];for(let j=0;j<add;j++){const node=tableNodeTypes(state.schema)[role].createAndFill();node&&nodes.push(node)}const side=0!=i&&first!=i-1||last!=i?end-1:pos+1;tr.insert(tr.mapping.map(side),nodes)}pos=end}return tr.setMeta(fixTablesKey,{fixTables:!0})}(state,node,pos,tr))};return oldState?oldState.doc!=state.doc&&changedDescendants(oldState.doc,state.doc,0,check):state.doc.descendants(check),tr}function selectedRect(state){const sel=state.selection,$pos=selectionCell(state),table=$pos.node(-1),tableStart=$pos.start(-1),map=TableMap.get(table);return{...sel instanceof CellSelection?map.rectBetween(sel.$anchorCell.pos-tableStart,sel.$headCell.pos-tableStart):map.findCell($pos.pos-tableStart),tableStart,map,table}}function addColumn(tr,{map,tableStart,table},col){let refColumn=col>0?-1:0;(function columnIsHeader(map,table,col){const headerCell=tableNodeTypes(table.type.schema).header_cell;for(let row=0;row<map.height;row++)if(table.nodeAt(map.map[col+row*map.width]).type!=headerCell)return!1;return!0})(map,table,col+refColumn)&&(refColumn=0==col||col==map.width?null:0);for(let row=0;row<map.height;row++){const index=row*map.width+col;if(col>0&&col<map.width&&map.map[index-1]==map.map[index]){const pos=map.map[index],cell=table.nodeAt(pos);tr.setNodeMarkup(tr.mapping.map(tableStart+pos),null,addColSpan(cell.attrs,col-map.colCount(pos))),row+=cell.attrs.rowspan-1}else{const type=null==refColumn?tableNodeTypes(table.type.schema).cell:table.nodeAt(map.map[index+refColumn]).type,pos=map.positionAt(row,col,table);tr.insert(tr.mapping.map(tableStart+pos),type.createAndFill())}}return tr}function removeColumn(tr,{map,table,tableStart},col){const mapStart=tr.mapping.maps.length;for(let row=0;row<map.height;){const index=row*map.width+col,pos=map.map[index],cell=table.nodeAt(pos),attrs=cell.attrs;if(col>0&&map.map[index-1]==pos||col<map.width-1&&map.map[index+1]==pos)tr.setNodeMarkup(tr.mapping.slice(mapStart).map(tableStart+pos),null,removeColSpan(attrs,col-map.colCount(pos)));else{const start=tr.mapping.slice(mapStart).map(tableStart+pos);tr.delete(start,start+cell.nodeSize)}row+=attrs.rowspan}}function addRow(tr,{map,tableStart,table},row){var _a;let rowPos=tableStart;for(let i=0;i<row;i++)rowPos+=table.child(i).nodeSize;const cells=[];let refRow=row>0?-1:0;(function rowIsHeader(map,table,row){var _a;const headerCell=tableNodeTypes(table.type.schema).header_cell;for(let col=0;col<map.width;col++)if((null==(_a=table.nodeAt(map.map[col+row*map.width]))?void 0:_a.type)!=headerCell)return!1;return!0})(map,table,row+refRow)&&(refRow=0==row||row==map.height?null:0);for(let col=0,index=map.width*row;col<map.width;col++,index++)if(row>0&&row<map.height&&map.map[index]==map.map[index-map.width]){const pos=map.map[index],attrs=table.nodeAt(pos).attrs;tr.setNodeMarkup(tableStart+pos,null,{...attrs,rowspan:attrs.rowspan+1}),col+=attrs.colspan-1}else{const type=null==refRow?tableNodeTypes(table.type.schema).cell:null==(_a=table.nodeAt(map.map[index+refRow*map.width]))?void 0:_a.type,node=null==type?void 0:type.createAndFill();node&&cells.push(node)}return tr.insert(rowPos,tableNodeTypes(table.type.schema).row.create(null,cells)),tr}function removeRow(tr,{map,table,tableStart},row){let rowPos=0;for(let i=0;i<row;i++)rowPos+=table.child(i).nodeSize;const nextRow=rowPos+table.child(row).nodeSize,mapFrom=tr.mapping.maps.length;tr.delete(rowPos+tableStart,nextRow+tableStart);const seen=new Set;for(let col=0,index=row*map.width;col<map.width;col++,index++){const pos=map.map[index];if(!seen.has(pos))if(seen.add(pos),row>0&&pos==map.map[index-map.width]){const attrs=table.nodeAt(pos).attrs;tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos+tableStart),null,{...attrs,rowspan:attrs.rowspan-1}),col+=attrs.colspan-1}else if(row<map.height&&pos==map.map[index+map.width]){const cell=table.nodeAt(pos),attrs=cell.attrs,copy=cell.type.create({...attrs,rowspan:cell.attrs.rowspan-1},cell.content),newPos=map.positionAt(row+1,col,table);tr.insert(tr.mapping.slice(mapFrom).map(tableStart+newPos),copy),col+=attrs.colspan-1}}}function isEmpty(cell){const c=cell.content;return 1==c.childCount&&c.child(0).isTextblock&&0==c.child(0).childCount}function mergeCells(state,dispatch){const sel=state.selection;if(!(sel instanceof CellSelection)||sel.$anchorCell.pos==sel.$headCell.pos)return!1;const rect=selectedRect(state),{map}=rect;if(function cellsOverlapRectangle({width,height,map},rect){let indexTop=rect.top*width+rect.left,indexLeft=indexTop,indexBottom=(rect.bottom-1)*width+rect.left,indexRight=indexTop+(rect.right-rect.left-1);for(let i=rect.top;i<rect.bottom;i++){if(rect.left>0&&map[indexLeft]==map[indexLeft-1]||rect.right<width&&map[indexRight]==map[indexRight+1])return!0;indexLeft+=width,indexRight+=width}for(let i=rect.left;i<rect.right;i++){if(rect.top>0&&map[indexTop]==map[indexTop-width]||rect.bottom<height&&map[indexBottom]==map[indexBottom+width])return!0;indexTop++,indexBottom++}return!1}(map,rect))return!1;if(dispatch){const tr=state.tr,seen={};let mergedPos,mergedCell,content=prosemirror_model_dist.FK.empty;for(let row=rect.top;row<rect.bottom;row++)for(let col=rect.left;col<rect.right;col++){const cellPos=map.map[row*map.width+col],cell=rect.table.nodeAt(cellPos);if(!seen[cellPos]&&cell)if(seen[cellPos]=!0,null==mergedPos)mergedPos=cellPos,mergedCell=cell;else{isEmpty(cell)||(content=content.append(cell.content));const mapped=tr.mapping.map(cellPos+rect.tableStart);tr.delete(mapped,mapped+cell.nodeSize)}}if(null==mergedPos||null==mergedCell)return!0;if(tr.setNodeMarkup(mergedPos+rect.tableStart,null,{...addColSpan(mergedCell.attrs,mergedCell.attrs.colspan,rect.right-rect.left-mergedCell.attrs.colspan),rowspan:rect.bottom-rect.top}),content.size){const end=mergedPos+1+mergedCell.content.size,start=isEmpty(mergedCell)?mergedPos+1:end;tr.replaceWith(start+rect.tableStart,end+rect.tableStart,content)}tr.setSelection(new CellSelection(tr.doc.resolve(mergedPos+rect.tableStart))),dispatch(tr)}return!0}function splitCell(state,dispatch){const nodeTypes=tableNodeTypes(state.schema);return function splitCellWithType(getCellType){return(state,dispatch)=>{var _a;const sel=state.selection;let cellNode,cellPos;if(sel instanceof CellSelection){if(sel.$anchorCell.pos!=sel.$headCell.pos)return!1;cellNode=sel.$anchorCell.nodeAfter,cellPos=sel.$anchorCell.pos}else{if(cellNode=function cellWrapping($pos){for(let d=$pos.depth;d>0;d--){const role=$pos.node(d).type.spec.tableRole;if("cell"===role||"header_cell"===role)return $pos.node(d)}return null}(sel.$from),!cellNode)return!1;cellPos=null==(_a=cellAround(sel.$from))?void 0:_a.pos}if(null==cellNode||null==cellPos)return!1;if(1==cellNode.attrs.colspan&&1==cellNode.attrs.rowspan)return!1;if(dispatch){let baseAttrs=cellNode.attrs;const attrs=[],colwidth=baseAttrs.colwidth;baseAttrs.rowspan>1&&(baseAttrs={...baseAttrs,rowspan:1}),baseAttrs.colspan>1&&(baseAttrs={...baseAttrs,colspan:1});const rect=selectedRect(state),tr=state.tr;for(let i=0;i<rect.right-rect.left;i++)attrs.push(colwidth?{...baseAttrs,colwidth:colwidth&&colwidth[i]?[colwidth[i]]:null}:baseAttrs);let lastCell;for(let row=rect.top;row<rect.bottom;row++){let pos=rect.map.positionAt(row,rect.left,rect.table);row==rect.top&&(pos+=cellNode.nodeSize);for(let col=rect.left,i=0;col<rect.right;col++,i++)col==rect.left&&row==rect.top||tr.insert(lastCell=tr.mapping.map(pos+rect.tableStart,1),getCellType({node:cellNode,row,col}).createAndFill(attrs[i]))}tr.setNodeMarkup(cellPos,getCellType({node:cellNode,row:rect.top,col:rect.left}),attrs[0]),sel instanceof CellSelection&&tr.setSelection(new CellSelection(tr.doc.resolve(sel.$anchorCell.pos),lastCell?tr.doc.resolve(lastCell):void 0)),dispatch(tr)}return!0}}(({node})=>nodeTypes[node.type.spec.tableRole])(state,dispatch)}function isHeaderEnabledByType(type,rect,types){const cellPositions=rect.map.cellsInRect({left:0,top:0,right:"row"==type?rect.map.width:1,bottom:"column"==type?rect.map.height:1});for(let i=0;i<cellPositions.length;i++){const cell=rect.table.nodeAt(cellPositions[i]);if(cell&&cell.type!==types.header_cell)return!1}return!0}function toggleHeader(type,options){return(options=options||{useDeprecatedLogic:!1}).useDeprecatedLogic?function deprecated_toggleHeader(type){return function(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const types=tableNodeTypes(state.schema),rect=selectedRect(state),tr=state.tr,cells=rect.map.cellsInRect("column"==type?{left:rect.left,top:0,right:rect.right,bottom:rect.map.height}:"row"==type?{left:0,top:rect.top,right:rect.map.width,bottom:rect.bottom}:rect),nodes=cells.map(pos=>rect.table.nodeAt(pos));for(let i=0;i<cells.length;i++)nodes[i].type==types.header_cell&&tr.setNodeMarkup(rect.tableStart+cells[i],types.cell,nodes[i].attrs);if(0==tr.steps.length)for(let i=0;i<cells.length;i++)tr.setNodeMarkup(rect.tableStart+cells[i],types.header_cell,nodes[i].attrs);dispatch(tr)}return!0}}(type):function(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const types=tableNodeTypes(state.schema),rect=selectedRect(state),tr=state.tr,isHeaderRowEnabled=isHeaderEnabledByType("row",rect,types),isHeaderColumnEnabled=isHeaderEnabledByType("column",rect,types),selectionStartsAt=("column"===type?isHeaderRowEnabled:"row"===type&&isHeaderColumnEnabled)?1:0,cellsRect="column"==type?{left:0,top:selectionStartsAt,right:1,bottom:rect.map.height}:"row"==type?{left:selectionStartsAt,top:0,right:rect.map.width,bottom:1}:rect,newType="column"==type?isHeaderColumnEnabled?types.cell:types.header_cell:"row"==type?isHeaderRowEnabled?types.cell:types.header_cell:types.cell;rect.map.cellsInRect(cellsRect).forEach(relativeCellPos=>{const cellPos=relativeCellPos+rect.tableStart,cell=tr.doc.nodeAt(cellPos);cell&&tr.setNodeMarkup(cellPos,newType,cell.attrs)}),dispatch(tr)}return!0}}toggleHeader("row",{useDeprecatedLogic:!0}),toggleHeader("column",{useDeprecatedLogic:!0});var toggleHeaderCell=toggleHeader("cell",{useDeprecatedLogic:!0});function goToNextCell(direction){return function(state,dispatch){if(!isInTable(state))return!1;const cell=function findNextCell($cell,dir){if(dir<0){const before=$cell.nodeBefore;if(before)return $cell.pos-before.nodeSize;for(let row=$cell.index(-1)-1,rowEnd=$cell.before();row>=0;row--){const rowNode=$cell.node(-1).child(row),lastChild=rowNode.lastChild;if(lastChild)return rowEnd-1-lastChild.nodeSize;rowEnd-=rowNode.nodeSize}}else{if($cell.index()<$cell.parent.childCount-1)return $cell.pos+$cell.nodeAfter.nodeSize;const table=$cell.node(-1);for(let row=$cell.indexAfter(-1),rowStart=$cell.after();row<table.childCount;row++){const rowNode=table.child(row);if(rowNode.childCount)return rowStart+1;rowStart+=rowNode.nodeSize}}return null}(selectionCell(state),direction);if(null==cell)return!1;if(dispatch){const $cell=state.doc.resolve(cell);dispatch(state.tr.setSelection(prosemirror_state_dist.U3.between($cell,function moveCellForward($pos){return $pos.node(0).resolve($pos.pos+$pos.nodeAfter.nodeSize)}($cell))).scrollIntoView())}return!0}}function deleteCellSelection(state,dispatch){const sel=state.selection;if(!(sel instanceof CellSelection))return!1;if(dispatch){const tr=state.tr,baseContent=tableNodeTypes(state.schema).cell.createAndFill().content;sel.forEachCell((cell,pos)=>{cell.content.eq(baseContent)||tr.replace(tr.mapping.map(pos+1),tr.mapping.map(pos+cell.nodeSize-1),new prosemirror_model_dist.Ji(baseContent,0,0))}),tr.docChanged&&dispatch(tr)}return!0}function pastedCells(slice){if(!slice.size)return null;let{content,openStart,openEnd}=slice;for(;1==content.childCount&&(openStart>0&&openEnd>0||"table"==content.child(0).type.spec.tableRole);)openStart--,openEnd--,content=content.child(0).content;const first=content.child(0),role=first.type.spec.tableRole,schema=first.type.schema,rows=[];if("row"==role)for(let i=0;i<content.childCount;i++){let cells=content.child(i).content;const left=i?0:Math.max(0,openStart-1),right=i<content.childCount-1?0:Math.max(0,openEnd-1);(left||right)&&(cells=fitSlice(tableNodeTypes(schema).row,new prosemirror_model_dist.Ji(cells,left,right)).content),rows.push(cells)}else{if("cell"!=role&&"header_cell"!=role)return null;rows.push(openStart||openEnd?fitSlice(tableNodeTypes(schema).row,new prosemirror_model_dist.Ji(content,openStart,openEnd)).content:content)}return function ensureRectangular(schema,rows){const widths=[];for(let i=0;i<rows.length;i++){const row=rows[i];for(let j=row.childCount-1;j>=0;j--){const{rowspan,colspan}=row.child(j).attrs;for(let r=i;r<i+rowspan;r++)widths[r]=(widths[r]||0)+colspan}}let width=0;for(let r=0;r<widths.length;r++)width=Math.max(width,widths[r]);for(let r=0;r<widths.length;r++)if(r>=rows.length&&rows.push(prosemirror_model_dist.FK.empty),widths[r]<width){const empty=tableNodeTypes(schema).cell.createAndFill(),cells=[];for(let i=widths[r];i<width;i++)cells.push(empty);rows[r]=rows[r].append(prosemirror_model_dist.FK.from(cells))}return{height:rows.length,width,rows}}(schema,rows)}function fitSlice(nodeType,slice){const node=nodeType.createAndFill();return new prosemirror_transform_dist.dL(node).replace(0,node.content.size,slice).doc}function isolateHorizontal(tr,map,table,start,left,right,top,mapFrom){if(0==top||top==map.height)return!1;let found=!1;for(let col=left;col<right;col++){const index=top*map.width+col,pos=map.map[index];if(map.map[index-map.width]==pos){found=!0;const cell=table.nodeAt(pos),{top:cellTop,left:cellLeft}=map.findCell(pos);tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos+start),null,{...cell.attrs,rowspan:top-cellTop}),tr.insert(tr.mapping.slice(mapFrom).map(map.positionAt(top,cellLeft,table)),cell.type.createAndFill({...cell.attrs,rowspan:cellTop+cell.attrs.rowspan-top})),col+=cell.attrs.colspan-1}}return found}function isolateVertical(tr,map,table,start,top,bottom,left,mapFrom){if(0==left||left==map.width)return!1;let found=!1;for(let row=top;row<bottom;row++){const index=row*map.width+left,pos=map.map[index];if(map.map[index-1]==pos){found=!0;const cell=table.nodeAt(pos),cellLeft=map.colCount(pos),updatePos=tr.mapping.slice(mapFrom).map(pos+start);tr.setNodeMarkup(updatePos,null,removeColSpan(cell.attrs,left-cellLeft,cell.attrs.colspan-(left-cellLeft))),tr.insert(updatePos+cell.nodeSize,cell.type.createAndFill(removeColSpan(cell.attrs,0,left-cellLeft))),row+=cell.attrs.rowspan-1}}return found}function insertCells(state,dispatch,tableStart,rect,cells){let table=tableStart?state.doc.nodeAt(tableStart-1):state.doc;if(!table)throw new Error("No table found");let map=TableMap.get(table);const{top,left}=rect,right=left+cells.width,bottom=top+cells.height,tr=state.tr;let mapFrom=0;function recomp(){if(table=tableStart?tr.doc.nodeAt(tableStart-1):tr.doc,!table)throw new Error("No table found");map=TableMap.get(table),mapFrom=tr.mapping.maps.length}(function growTable(tr,map,table,start,width,height,mapFrom){const types=tableNodeTypes(tr.doc.type.schema);let empty,emptyHead;if(width>map.width)for(let row=0,rowEnd=0;row<map.height;row++){const rowNode=table.child(row);rowEnd+=rowNode.nodeSize;const cells=[];let add;add=null==rowNode.lastChild||rowNode.lastChild.type==types.cell?empty||(empty=types.cell.createAndFill()):emptyHead||(emptyHead=types.header_cell.createAndFill());for(let i=map.width;i<width;i++)cells.push(add);tr.insert(tr.mapping.slice(mapFrom).map(rowEnd-1+start),cells)}if(height>map.height){const cells=[];for(let i=0,start2=(map.height-1)*map.width;i<Math.max(map.width,width);i++){const header=!(i>=map.width)&&table.nodeAt(map.map[start2+i]).type==types.header_cell;cells.push(header?emptyHead||(emptyHead=types.header_cell.createAndFill()):empty||(empty=types.cell.createAndFill()))}const emptyRow=types.row.create(null,prosemirror_model_dist.FK.from(cells)),rows=[];for(let i=map.height;i<height;i++)rows.push(emptyRow);tr.insert(tr.mapping.slice(mapFrom).map(start+table.nodeSize-2),rows)}return!(!empty&&!emptyHead)})(tr,map,table,tableStart,right,bottom,mapFrom)&&recomp(),isolateHorizontal(tr,map,table,tableStart,left,right,top,mapFrom)&&recomp(),isolateHorizontal(tr,map,table,tableStart,left,right,bottom,mapFrom)&&recomp(),isolateVertical(tr,map,table,tableStart,top,bottom,left,mapFrom)&&recomp(),isolateVertical(tr,map,table,tableStart,top,bottom,right,mapFrom)&&recomp();for(let row=top;row<bottom;row++){const from=map.positionAt(row,left,table),to=map.positionAt(row,right,table);tr.replace(tr.mapping.slice(mapFrom).map(from+tableStart),tr.mapping.slice(mapFrom).map(to+tableStart),new prosemirror_model_dist.Ji(cells.rows[row-top],0,0))}recomp(),tr.setSelection(new CellSelection(tr.doc.resolve(tableStart+map.positionAt(top,left,table)),tr.doc.resolve(tableStart+map.positionAt(bottom-1,right-1,table)))),dispatch(tr)}var handleKeyDown=(0,prosemirror_keymap_dist.K)({ArrowLeft:arrow("horiz",-1),ArrowRight:arrow("horiz",1),ArrowUp:arrow("vert",-1),ArrowDown:arrow("vert",1),"Shift-ArrowLeft":shiftArrow("horiz",-1),"Shift-ArrowRight":shiftArrow("horiz",1),"Shift-ArrowUp":shiftArrow("vert",-1),"Shift-ArrowDown":shiftArrow("vert",1),Backspace:deleteCellSelection,"Mod-Backspace":deleteCellSelection,Delete:deleteCellSelection,"Mod-Delete":deleteCellSelection});function maybeSetSelection(state,dispatch,selection){return!selection.eq(state.selection)&&(dispatch&&dispatch(state.tr.setSelection(selection).scrollIntoView()),!0)}function arrow(axis,dir){return(state,dispatch,view)=>{if(!view)return!1;const sel=state.selection;if(sel instanceof CellSelection)return maybeSetSelection(state,dispatch,prosemirror_state_dist.LN.near(sel.$headCell,dir));if("horiz"!=axis&&!sel.empty)return!1;const end=atEndOfCell(view,axis,dir);if(null==end)return!1;if("horiz"==axis)return maybeSetSelection(state,dispatch,prosemirror_state_dist.LN.near(state.doc.resolve(sel.head+dir),dir));{const $cell=state.doc.resolve(end),$next=nextCell($cell,axis,dir);let newSel;return newSel=$next?prosemirror_state_dist.LN.near($next,1):dir<0?prosemirror_state_dist.LN.near(state.doc.resolve($cell.before(-1)),-1):prosemirror_state_dist.LN.near(state.doc.resolve($cell.after(-1)),1),maybeSetSelection(state,dispatch,newSel)}}}function shiftArrow(axis,dir){return(state,dispatch,view)=>{if(!view)return!1;const sel=state.selection;let cellSel;if(sel instanceof CellSelection)cellSel=sel;else{const end=atEndOfCell(view,axis,dir);if(null==end)return!1;cellSel=new CellSelection(state.doc.resolve(end))}const $head=nextCell(cellSel.$headCell,axis,dir);return!!$head&&maybeSetSelection(state,dispatch,new CellSelection(cellSel.$anchorCell,$head))}}function handleTripleClick(view,pos){const $cell=cellAround(view.state.doc.resolve(pos));return!!$cell&&(view.dispatch(view.state.tr.setSelection(new CellSelection($cell))),!0)}function handlePaste(view,_,slice){if(!isInTable(view.state))return!1;let cells=pastedCells(slice);const sel=view.state.selection;if(sel instanceof CellSelection){cells||(cells={width:1,height:1,rows:[prosemirror_model_dist.FK.from(fitSlice(tableNodeTypes(view.state.schema).cell,slice))]});const table=sel.$anchorCell.node(-1),start=sel.$anchorCell.start(-1),rect=TableMap.get(table).rectBetween(sel.$anchorCell.pos-start,sel.$headCell.pos-start);return cells=function clipCells({width,height,rows},newWidth,newHeight){if(width!=newWidth){const added=[],newRows=[];for(let row=0;row<rows.length;row++){const frag=rows[row],cells=[];for(let col=added[row]||0,i=0;col<newWidth;i++){let cell=frag.child(i%frag.childCount);col+cell.attrs.colspan>newWidth&&(cell=cell.type.createChecked(removeColSpan(cell.attrs,cell.attrs.colspan,col+cell.attrs.colspan-newWidth),cell.content)),cells.push(cell),col+=cell.attrs.colspan;for(let j=1;j<cell.attrs.rowspan;j++)added[row+j]=(added[row+j]||0)+cell.attrs.colspan}newRows.push(prosemirror_model_dist.FK.from(cells))}rows=newRows,width=newWidth}if(height!=newHeight){const newRows=[];for(let row=0,i=0;row<newHeight;row++,i++){const cells=[],source=rows[i%height];for(let j=0;j<source.childCount;j++){let cell=source.child(j);row+cell.attrs.rowspan>newHeight&&(cell=cell.type.create({...cell.attrs,rowspan:Math.max(1,newHeight-cell.attrs.rowspan)},cell.content)),cells.push(cell)}newRows.push(prosemirror_model_dist.FK.from(cells))}rows=newRows,height=newHeight}return{width,height,rows}}(cells,rect.right-rect.left,rect.bottom-rect.top),insertCells(view.state,view.dispatch,start,rect,cells),!0}if(cells){const $cell=selectionCell(view.state),start=$cell.start(-1);return insertCells(view.state,view.dispatch,start,TableMap.get($cell.node(-1)).findCell($cell.pos-start),cells),!0}return!1}function handleMouseDown(view,startEvent){var _a;if(startEvent.ctrlKey||startEvent.metaKey)return;const startDOMCell=domInCell(view,startEvent.target);let $anchor;if(startEvent.shiftKey&&view.state.selection instanceof CellSelection)setCellSelection(view.state.selection.$anchorCell,startEvent),startEvent.preventDefault();else if(startEvent.shiftKey&&startDOMCell&&null!=($anchor=cellAround(view.state.selection.$anchor))&&(null==(_a=cellUnderMouse(view,startEvent))?void 0:_a.pos)!=$anchor.pos)setCellSelection($anchor,startEvent),startEvent.preventDefault();else if(!startDOMCell)return;function setCellSelection($anchor2,event){let $head=cellUnderMouse(view,event);const starting=null==tableEditingKey.getState(view.state);if(!$head||!inSameTable($anchor2,$head)){if(!starting)return;$head=$anchor2}const selection=new CellSelection($anchor2,$head);if(starting||!view.state.selection.eq(selection)){const tr=view.state.tr.setSelection(selection);starting&&tr.setMeta(tableEditingKey,$anchor2.pos),view.dispatch(tr)}}function stop(){view.root.removeEventListener("mouseup",stop),view.root.removeEventListener("dragstart",stop),view.root.removeEventListener("mousemove",move),null!=tableEditingKey.getState(view.state)&&view.dispatch(view.state.tr.setMeta(tableEditingKey,-1))}function move(_event){const event=_event,anchor=tableEditingKey.getState(view.state);let $anchor2;if(null!=anchor)$anchor2=view.state.doc.resolve(anchor);else if(domInCell(view,event.target)!=startDOMCell&&($anchor2=cellUnderMouse(view,startEvent),!$anchor2))return stop();$anchor2&&setCellSelection($anchor2,event)}view.root.addEventListener("mouseup",stop),view.root.addEventListener("dragstart",stop),view.root.addEventListener("mousemove",move)}function atEndOfCell(view,axis,dir){if(!(view.state.selection instanceof prosemirror_state_dist.U3))return null;const{$head}=view.state.selection;for(let d=$head.depth-1;d>=0;d--){const parent=$head.node(d);if((dir<0?$head.index(d):$head.indexAfter(d))!=(dir<0?0:parent.childCount))return null;if("cell"==parent.type.spec.tableRole||"header_cell"==parent.type.spec.tableRole){const cellPos=$head.before(d),dirStr="vert"==axis?dir>0?"down":"up":dir>0?"right":"left";return view.endOfTextblock(dirStr)?cellPos:null}}return null}function domInCell(view,dom){for(;dom&&dom!=view.dom;dom=dom.parentNode)if("TD"==dom.nodeName||"TH"==dom.nodeName)return dom;return null}function cellUnderMouse(view,event){const mousePos=view.posAtCoords({left:event.clientX,top:event.clientY});return mousePos&&mousePos?cellAround(view.state.doc.resolve(mousePos.pos)):null}var TableView=class{constructor(node,defaultCellMinWidth){this.node=node,this.defaultCellMinWidth=defaultCellMinWidth,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${defaultCellMinWidth}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),updateColumnsOnResize(node,this.colgroup,this.table,defaultCellMinWidth),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(node){return node.type==this.node.type&&(this.node=node,updateColumnsOnResize(node,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(record){return"attributes"==record.type&&(record.target==this.table||this.colgroup.contains(record.target))}};function updateColumnsOnResize(node,colgroup,table,defaultCellMinWidth,overrideCol,overrideValue){var _a;let totalWidth=0,fixedWidth=!0,nextDOM=colgroup.firstChild;const row=node.firstChild;if(row){for(let i=0,col=0;i<row.childCount;i++){const{colspan,colwidth}=row.child(i).attrs;for(let j=0;j<colspan;j++,col++){const hasWidth=overrideCol==col?overrideValue:colwidth&&colwidth[j],cssWidth=hasWidth?hasWidth+"px":"";if(totalWidth+=hasWidth||defaultCellMinWidth,hasWidth||(fixedWidth=!1),nextDOM)nextDOM.style.width!=cssWidth&&(nextDOM.style.width=cssWidth),nextDOM=nextDOM.nextSibling;else{const col2=document.createElement("col");col2.style.width=cssWidth,colgroup.appendChild(col2)}}}for(;nextDOM;){const after=nextDOM.nextSibling;null==(_a=nextDOM.parentNode)||_a.removeChild(nextDOM),nextDOM=after}fixedWidth?(table.style.width=totalWidth+"px",table.style.minWidth=""):(table.style.width="",table.style.minWidth=totalWidth+"px")}}var columnResizingPluginKey=new prosemirror_state_dist.hs("tableColumnResizing");function columnResizing({handleWidth=5,cellMinWidth=25,defaultCellMinWidth=100,View=TableView,lastColumnResizable=!0}={}){const plugin=new prosemirror_state_dist.k_({key:columnResizingPluginKey,state:{init(_,state){var _a,_b;const nodeViews=null==(_b=null==(_a=plugin.spec)?void 0:_a.props)?void 0:_b.nodeViews,tableName=tableNodeTypes(state.schema).table.name;return View&&nodeViews&&(nodeViews[tableName]=(node,view)=>new View(node,defaultCellMinWidth,view)),new ResizeState(-1,!1)},apply:(tr,prev)=>prev.apply(tr)},props:{attributes:state=>{const pluginState=columnResizingPluginKey.getState(state);return pluginState&&pluginState.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(view,event)=>{!function handleMouseMove(view,event,handleWidth,lastColumnResizable){if(!view.editable)return;const pluginState=columnResizingPluginKey.getState(view.state);if(!pluginState)return;if(!pluginState.dragging){const target=function domCellAround(target){for(;target&&"TD"!=target.nodeName&&"TH"!=target.nodeName;)target=target.classList&&target.classList.contains("ProseMirror")?null:target.parentNode;return target}(event.target);let cell=-1;if(target){const{left,right}=target.getBoundingClientRect();event.clientX-left<=handleWidth?cell=edgeCell(view,event,"left",handleWidth):right-event.clientX<=handleWidth&&(cell=edgeCell(view,event,"right",handleWidth))}if(cell!=pluginState.activeHandle){if(!lastColumnResizable&&-1!==cell){const $cell=view.state.doc.resolve(cell),table=$cell.node(-1),map=TableMap.get(table),tableStart=$cell.start(-1);if(map.colCount($cell.pos-tableStart)+$cell.nodeAfter.attrs.colspan-1==map.width-1)return}updateHandle(view,cell)}}}(view,event,handleWidth,lastColumnResizable)},mouseleave:view=>{!function handleMouseLeave(view){if(!view.editable)return;const pluginState=columnResizingPluginKey.getState(view.state);pluginState&&pluginState.activeHandle>-1&&!pluginState.dragging&&updateHandle(view,-1)}(view)},mousedown:(view,event)=>{!function handleMouseDown2(view,event,cellMinWidth,defaultCellMinWidth){var _a;if(!view.editable)return!1;const win=null!=(_a=view.dom.ownerDocument.defaultView)?_a:window,pluginState=columnResizingPluginKey.getState(view.state);if(!pluginState||-1==pluginState.activeHandle||pluginState.dragging)return!1;const cell=view.state.doc.nodeAt(pluginState.activeHandle),width=function currentColWidth(view,cellPos,{colspan,colwidth}){const width=colwidth&&colwidth[colwidth.length-1];if(width)return width;const dom=view.domAtPos(cellPos);let domWidth=dom.node.childNodes[dom.offset].offsetWidth,parts=colspan;if(colwidth)for(let i=0;i<colspan;i++)colwidth[i]&&(domWidth-=colwidth[i],parts--);return domWidth/parts}(view,pluginState.activeHandle,cell.attrs);function finish(event2){win.removeEventListener("mouseup",finish),win.removeEventListener("mousemove",move);const pluginState2=columnResizingPluginKey.getState(view.state);(null==pluginState2?void 0:pluginState2.dragging)&&(!function updateColumnWidth(view,cell,width){const $cell=view.state.doc.resolve(cell),table=$cell.node(-1),map=TableMap.get(table),start=$cell.start(-1),col=map.colCount($cell.pos-start)+$cell.nodeAfter.attrs.colspan-1,tr=view.state.tr;for(let row=0;row<map.height;row++){const mapIndex=row*map.width+col;if(row&&map.map[mapIndex]==map.map[mapIndex-map.width])continue;const pos=map.map[mapIndex],attrs=table.nodeAt(pos).attrs,index=1==attrs.colspan?0:col-map.colCount(pos);if(attrs.colwidth&&attrs.colwidth[index]==width)continue;const colwidth=attrs.colwidth?attrs.colwidth.slice():zeroes(attrs.colspan);colwidth[index]=width,tr.setNodeMarkup(start+pos,null,{...attrs,colwidth})}tr.docChanged&&view.dispatch(tr)}(view,pluginState2.activeHandle,draggedWidth(pluginState2.dragging,event2,cellMinWidth)),view.dispatch(view.state.tr.setMeta(columnResizingPluginKey,{setDragging:null})))}function move(event2){if(!event2.which)return finish(event2);const pluginState2=columnResizingPluginKey.getState(view.state);if(pluginState2&&pluginState2.dragging){const dragged=draggedWidth(pluginState2.dragging,event2,cellMinWidth);displayColumnWidth(view,pluginState2.activeHandle,dragged,defaultCellMinWidth)}}return view.dispatch(view.state.tr.setMeta(columnResizingPluginKey,{setDragging:{startX:event.clientX,startWidth:width}})),displayColumnWidth(view,pluginState.activeHandle,width,defaultCellMinWidth),win.addEventListener("mouseup",finish),win.addEventListener("mousemove",move),event.preventDefault(),!0}(view,event,cellMinWidth,defaultCellMinWidth)}},decorations:state=>{const pluginState=columnResizingPluginKey.getState(state);if(pluginState&&pluginState.activeHandle>-1)return function handleDecorations(state,cell){var _a;const decorations=[],$cell=state.doc.resolve(cell),table=$cell.node(-1);if(!table)return prosemirror_view_dist.zF.empty;const map=TableMap.get(table),start=$cell.start(-1),col=map.colCount($cell.pos-start)+$cell.nodeAfter.attrs.colspan-1;for(let row=0;row<map.height;row++){const index=col+row*map.width;if(!(col!=map.width-1&&map.map[index]==map.map[index+1]||0!=row&&map.map[index]==map.map[index-map.width])){const cellPos=map.map[index],pos=start+cellPos+table.nodeAt(cellPos).nodeSize-1,dom=document.createElement("div");dom.className="column-resize-handle",(null==(_a=columnResizingPluginKey.getState(state))?void 0:_a.dragging)&&decorations.push(prosemirror_view_dist.NZ.node(start+cellPos,start+cellPos+table.nodeAt(cellPos).nodeSize,{class:"column-resize-dragging"})),decorations.push(prosemirror_view_dist.NZ.widget(pos,dom))}}return prosemirror_view_dist.zF.create(state.doc,decorations)}(state,pluginState.activeHandle)},nodeViews:{}}});return plugin}var ResizeState=class _ResizeState{constructor(activeHandle,dragging){this.activeHandle=activeHandle,this.dragging=dragging}apply(tr){const state=this,action=tr.getMeta(columnResizingPluginKey);if(action&&null!=action.setHandle)return new _ResizeState(action.setHandle,!1);if(action&&void 0!==action.setDragging)return new _ResizeState(state.activeHandle,action.setDragging);if(state.activeHandle>-1&&tr.docChanged){let handle=tr.mapping.map(state.activeHandle,-1);return pointsAtCell(tr.doc.resolve(handle))||(handle=-1),new _ResizeState(handle,state.dragging)}return state}};function edgeCell(view,event,side,handleWidth){const offset="right"==side?-handleWidth:handleWidth,found=view.posAtCoords({left:event.clientX+offset,top:event.clientY});if(!found)return-1;const{pos}=found,$cell=cellAround(view.state.doc.resolve(pos));if(!$cell)return-1;if("right"==side)return $cell.pos;const map=TableMap.get($cell.node(-1)),start=$cell.start(-1),index=map.map.indexOf($cell.pos-start);return index%map.width==0?-1:start+map.map[index-1]}function draggedWidth(dragging,event,resizeMinWidth){const offset=event.clientX-dragging.startX;return Math.max(resizeMinWidth,dragging.startWidth+offset)}function updateHandle(view,value){view.dispatch(view.state.tr.setMeta(columnResizingPluginKey,{setHandle:value}))}function displayColumnWidth(view,cell,width,defaultCellMinWidth){const $cell=view.state.doc.resolve(cell),table=$cell.node(-1),start=$cell.start(-1),col=TableMap.get(table).colCount($cell.pos-start)+$cell.nodeAfter.attrs.colspan-1;let dom=view.domAtPos($cell.start(-1)).node;for(;dom&&"TABLE"!=dom.nodeName;)dom=dom.parentNode;dom&&updateColumnsOnResize(table,dom.firstChild,dom,defaultCellMinWidth,col,width)}function zeroes(n){return Array(n).fill(0)}function tableEditing({allowTableNodeSelection=!1}={}){return new prosemirror_state_dist.k_({key:tableEditingKey,state:{init:()=>null,apply(tr,cur){const set=tr.getMeta(tableEditingKey);if(null!=set)return-1==set?null:set;if(null==cur||!tr.docChanged)return cur;const{deleted,pos}=tr.mapping.mapResult(cur);return deleted?null:pos}},props:{decorations:drawCellSelection,handleDOMEvents:{mousedown:handleMouseDown},createSelectionBetween:view=>null!=tableEditingKey.getState(view.state)?view.state.selection:null,handleTripleClick,handleKeyDown,handlePaste},appendTransaction:(_,oldState,state)=>function normalizeSelection(state,tr,allowTableNodeSelection){const sel=(tr||state).selection,doc=(tr||state).doc;let normalize,role;if(sel instanceof prosemirror_state_dist.nh&&(role=sel.node.type.spec.tableRole)){if("cell"==role||"header_cell"==role)normalize=CellSelection.create(doc,sel.from);else if("row"==role){const $cell=doc.resolve(sel.from+1);normalize=CellSelection.rowSelection($cell,$cell)}else if(!allowTableNodeSelection){const map=TableMap.get(sel.node),start=sel.from+1,lastCell=start+map.map[map.width*map.height-1];normalize=CellSelection.create(doc,start+1,lastCell)}}else sel instanceof prosemirror_state_dist.U3&&function isCellBoundarySelection({$from,$to}){if($from.pos==$to.pos||$from.pos<$to.pos-6)return!1;let afterFrom=$from.pos,beforeTo=$to.pos,depth=$from.depth;for(;depth>=0&&!($from.after(depth+1)<$from.end(depth));depth--,afterFrom++);for(let d=$to.depth;d>=0&&!($to.before(d+1)>$to.start(d));d--,beforeTo--);return afterFrom==beforeTo&&/row|table/.test($from.node(depth).type.spec.tableRole)}(sel)?normalize=prosemirror_state_dist.U3.create(doc,sel.from):sel instanceof prosemirror_state_dist.U3&&function isTextSelectionAcrossCells({$from,$to}){let fromCellBoundaryNode,toCellBoundaryNode;for(let i=$from.depth;i>0;i--){const node=$from.node(i);if("cell"===node.type.spec.tableRole||"header_cell"===node.type.spec.tableRole){fromCellBoundaryNode=node;break}}for(let i=$to.depth;i>0;i--){const node=$to.node(i);if("cell"===node.type.spec.tableRole||"header_cell"===node.type.spec.tableRole){toCellBoundaryNode=node;break}}return fromCellBoundaryNode!==toCellBoundaryNode&&0===$to.parentOffset}(sel)&&(normalize=prosemirror_state_dist.U3.create(doc,sel.$from.start(),sel.$from.end()));return normalize&&(tr||(tr=state.tr)).setSelection(normalize),tr}(state,fixTables(state,oldState),allowTableNodeSelection)})}function getColStyleDeclaration(minWidth,width){return width?["width",`${Math.max(width,minWidth)}px`]:["min-width",`${minWidth}px`]}function updateColumns(node,colgroup,table,cellMinWidth,overrideCol,overrideValue){var _a;let totalWidth=0,fixedWidth=!0,nextDOM=colgroup.firstChild;const row=node.firstChild;if(null!==row)for(let i=0,col=0;i<row.childCount;i+=1){const{colspan,colwidth}=row.child(i).attrs;for(let j=0;j<colspan;j+=1,col+=1){const hasWidth=overrideCol===col?overrideValue:colwidth&&colwidth[j],cssWidth=hasWidth?`${hasWidth}px`:"";if(totalWidth+=hasWidth||cellMinWidth,hasWidth||(fixedWidth=!1),nextDOM){if(nextDOM.style.width!==cssWidth){const[propertyKey,propertyValue]=getColStyleDeclaration(cellMinWidth,hasWidth);nextDOM.style.setProperty(propertyKey,propertyValue)}nextDOM=nextDOM.nextSibling}else{const colElement=document.createElement("col"),[propertyKey,propertyValue]=getColStyleDeclaration(cellMinWidth,hasWidth);colElement.style.setProperty(propertyKey,propertyValue),colgroup.appendChild(colElement)}}}for(;nextDOM;){const after=nextDOM.nextSibling;null===(_a=nextDOM.parentNode)||void 0===_a||_a.removeChild(nextDOM),nextDOM=after}fixedWidth?(table.style.width=`${totalWidth}px`,table.style.minWidth=""):(table.style.width="",table.style.minWidth=`${totalWidth}px`)}class dist_TableView{constructor(node,cellMinWidth){this.node=node,this.cellMinWidth=cellMinWidth,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),updateColumns(node,this.colgroup,this.table,cellMinWidth),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(node){return node.type===this.node.type&&(this.node=node,updateColumns(node,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(mutation){return"attributes"===mutation.type&&(mutation.target===this.table||this.colgroup.contains(mutation.target))}}function createCell(cellType,cellContent){return cellContent?cellType.createChecked(null,cellContent):cellType.createAndFill()}function createTable(schema,rowsCount,colsCount,withHeaderRow,cellContent){const types=function getTableNodeTypes(schema){if(schema.cached.tableNodeTypes)return schema.cached.tableNodeTypes;const roles={};return Object.keys(schema.nodes).forEach(type=>{const nodeType=schema.nodes[type];nodeType.spec.tableRole&&(roles[nodeType.spec.tableRole]=nodeType)}),schema.cached.tableNodeTypes=roles,roles}(schema),headerCells=[],cells=[];for(let index=0;index<colsCount;index+=1){const cell=createCell(types.cell,cellContent);if(cell&&cells.push(cell),withHeaderRow){const headerCell=createCell(types.header_cell,cellContent);headerCell&&headerCells.push(headerCell)}}const rows=[];for(let index=0;index<rowsCount;index+=1)rows.push(types.row.createChecked(null,withHeaderRow&&0===index?headerCells:cells));return types.table.createChecked(null,rows)}const deleteTableWhenAllCellsSelected=({editor})=>{const{selection}=editor.state;if(!function isCellSelection(value){return value instanceof CellSelection}(selection))return!1;let cellCount=0;const table=(0,dist.eL)(selection.ranges[0].$from,node=>"table"===node.type.name);null==table||table.node.descendants(node=>{if("table"===node.type.name)return!1;["tableCell","tableHeader"].includes(node.type.name)&&(cellCount+=1)});return cellCount===selection.ranges.length&&(editor.commands.deleteTable(),!0)},Table=dist.bP.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:dist_TableView,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node,HTMLAttributes}){const{colgroup,tableWidth,tableMinWidth}=function createColGroup(node,cellMinWidth,overrideCol,overrideValue){let totalWidth=0,fixedWidth=!0;const cols=[],row=node.firstChild;if(!row)return{};for(let i=0,col=0;i<row.childCount;i+=1){const{colspan,colwidth}=row.child(i).attrs;for(let j=0;j<colspan;j+=1,col+=1){const hasWidth=overrideCol===col?overrideValue:colwidth&&colwidth[j];totalWidth+=hasWidth||cellMinWidth,hasWidth||(fixedWidth=!1);const[property,value]=getColStyleDeclaration(cellMinWidth,hasWidth);cols.push(["col",{style:`${property}: ${value}`}])}}const tableWidth=fixedWidth?`${totalWidth}px`:"",tableMinWidth=fixedWidth?"":`${totalWidth}px`;return{colgroup:["colgroup",{},...cols],tableWidth,tableMinWidth}}(node,this.options.cellMinWidth);return["table",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes,{style:tableWidth?`width: ${tableWidth}`:`min-width: ${tableMinWidth}`}),colgroup,["tbody",0]]},addCommands:()=>({insertTable:({rows=3,cols=3,withHeaderRow=!0}={})=>({tr,dispatch,editor})=>{const node=createTable(editor.schema,rows,cols,withHeaderRow);if(dispatch){const offset=tr.selection.from+1;tr.replaceSelectionWith(node).scrollIntoView().setSelection(prosemirror_state_dist.U3.near(tr.doc.resolve(offset)))}return!0},addColumnBefore:()=>({state,dispatch})=>function addColumnBefore(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state);dispatch(addColumn(state.tr,rect,rect.left))}return!0}(state,dispatch),addColumnAfter:()=>({state,dispatch})=>function addColumnAfter(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state);dispatch(addColumn(state.tr,rect,rect.right))}return!0}(state,dispatch),deleteColumn:()=>({state,dispatch})=>function deleteColumn(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state),tr=state.tr;if(0==rect.left&&rect.right==rect.map.width)return!1;for(let i=rect.right-1;removeColumn(tr,rect,i),i!=rect.left;i--){const table=rect.tableStart?tr.doc.nodeAt(rect.tableStart-1):tr.doc;if(!table)throw RangeError("No table found");rect.table=table,rect.map=TableMap.get(table)}dispatch(tr)}return!0}(state,dispatch),addRowBefore:()=>({state,dispatch})=>function addRowBefore(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state);dispatch(addRow(state.tr,rect,rect.top))}return!0}(state,dispatch),addRowAfter:()=>({state,dispatch})=>function addRowAfter(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state);dispatch(addRow(state.tr,rect,rect.bottom))}return!0}(state,dispatch),deleteRow:()=>({state,dispatch})=>function deleteRow(state,dispatch){if(!isInTable(state))return!1;if(dispatch){const rect=selectedRect(state),tr=state.tr;if(0==rect.top&&rect.bottom==rect.map.height)return!1;for(let i=rect.bottom-1;removeRow(tr,rect,i),i!=rect.top;i--){const table=rect.tableStart?tr.doc.nodeAt(rect.tableStart-1):tr.doc;if(!table)throw RangeError("No table found");rect.table=table,rect.map=TableMap.get(rect.table)}dispatch(tr)}return!0}(state,dispatch),deleteTable:()=>({state,dispatch})=>function deleteTable(state,dispatch){const $pos=state.selection.$anchor;for(let d=$pos.depth;d>0;d--)if("table"==$pos.node(d).type.spec.tableRole)return dispatch&&dispatch(state.tr.delete($pos.before(d),$pos.after(d)).scrollIntoView()),!0;return!1}(state,dispatch),mergeCells:()=>({state,dispatch})=>mergeCells(state,dispatch),splitCell:()=>({state,dispatch})=>splitCell(state,dispatch),toggleHeaderColumn:()=>({state,dispatch})=>toggleHeader("column")(state,dispatch),toggleHeaderRow:()=>({state,dispatch})=>toggleHeader("row")(state,dispatch),toggleHeaderCell:()=>({state,dispatch})=>toggleHeaderCell(state,dispatch),mergeOrSplit:()=>({state,dispatch})=>!!mergeCells(state,dispatch)||splitCell(state,dispatch),setCellAttribute:(name,value)=>({state,dispatch})=>function setCellAttr(name,value){return function(state,dispatch){if(!isInTable(state))return!1;const $cell=selectionCell(state);if($cell.nodeAfter.attrs[name]===value)return!1;if(dispatch){const tr=state.tr;state.selection instanceof CellSelection?state.selection.forEachCell((node,pos)=>{node.attrs[name]!==value&&tr.setNodeMarkup(pos,null,{...node.attrs,[name]:value})}):tr.setNodeMarkup($cell.pos,null,{...$cell.nodeAfter.attrs,[name]:value}),dispatch(tr)}return!0}}(name,value)(state,dispatch),goToNextCell:()=>({state,dispatch})=>goToNextCell(1)(state,dispatch),goToPreviousCell:()=>({state,dispatch})=>goToNextCell(-1)(state,dispatch),fixTables:()=>({state,dispatch})=>(dispatch&&fixTables(state),!0),setCellSelection:position=>({tr,dispatch})=>{if(dispatch){const selection=CellSelection.create(tr.doc,position.anchorCell,position.headCell);tr.setSelection(selection)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:deleteTableWhenAllCellsSelected,"Mod-Backspace":deleteTableWhenAllCellsSelected,Delete:deleteTableWhenAllCellsSelected,"Mod-Delete":deleteTableWhenAllCellsSelected}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[columnResizing({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],tableEditing({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(extension){const context={name:extension.name,options:extension.options,storage:extension.storage};return{tableRole:(0,dist.gk)((0,dist.iI)(extension,"tableRole",context))}}})},"./node_modules/@tiptap/extension-underline/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>Underline});var _tiptap_core__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/@tiptap/core/dist/index.js");const Underline=_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.CU.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:style=>!!style.includes("underline")&&{}}],renderHTML({HTMLAttributes}){return["u",(0,_tiptap_core__WEBPACK_IMPORTED_MODULE_0__.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setUnderline:()=>({commands})=>commands.setMark(this.name),toggleUnderline:()=>({commands})=>commands.toggleMark(this.name),unsetUnderline:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}})},"./node_modules/@tiptap/react/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{$Z:()=>EditorContent,hG:()=>useEditor});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_dom__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react-dom/index.js"),_tiptap_core__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/@tiptap/core/dist/index.js");function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}var hasRequiredUseSyncExternalStoreShim_production_min,shim={exports:{}},useSyncExternalStoreShim_production_min={};shim.exports=function requireUseSyncExternalStoreShim_production_min(){if(hasRequiredUseSyncExternalStoreShim_production_min)return useSyncExternalStoreShim_production_min;hasRequiredUseSyncExternalStoreShim_production_min=1;var e=react__WEBPACK_IMPORTED_MODULE_0__,k="function"==typeof Object.is?Object.is:function h(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},l=e.useState,m=e.useEffect,n=e.useLayoutEffect,p=e.useDebugValue;function r(a){var b=a.getSnapshot;a=a.value;try{var d=b();return!k(a,d)}catch(f){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function t(a,b){return b()}:function q(a,b){var d=b(),f=l({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];return n(function(){c.value=d,c.getSnapshot=b,r(c)&&g({inst:c})},[a,d,b]),m(function(){return r(c)&&g({inst:c}),a(function(){r(c)&&g({inst:c})})},[a]),p(d),d};return useSyncExternalStoreShim_production_min.useSyncExternalStore=void 0!==e.useSyncExternalStore?e.useSyncExternalStore:u,useSyncExternalStoreShim_production_min}();var shimExports=shim.exports;const mergeRefs=(...refs)=>node=>{refs.forEach(ref=>{"function"==typeof ref?ref(node):ref&&(ref.current=node)})},Portals=({contentComponent})=>{const renderers=shimExports.useSyncExternalStore(contentComponent.subscribe,contentComponent.getSnapshot,contentComponent.getServerSnapshot);return react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,null,Object.values(renderers))};class PureEditorContent extends react__WEBPACK_IMPORTED_MODULE_0__.Component{constructor(props){var _a;super(props),this.editorContentRef=react__WEBPACK_IMPORTED_MODULE_0__.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:Boolean(null===(_a=props.editor)||void 0===_a?void 0:_a.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const editor=this.props.editor;if(editor&&!editor.isDestroyed&&editor.options.element){if(editor.contentComponent)return;const element=this.editorContentRef.current;element.append(...editor.options.element.childNodes),editor.setOptions({element}),editor.contentComponent=function getInstance(){const subscribers=new Set;let renderers={};return{subscribe:callback=>(subscribers.add(callback),()=>{subscribers.delete(callback)}),getSnapshot:()=>renderers,getServerSnapshot:()=>renderers,setRenderer(id,renderer){renderers={...renderers,[id]:react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal(renderer.reactElement,renderer.element,id)},subscribers.forEach(subscriber=>subscriber())},removeRenderer(id){const nextRenderers={...renderers};delete nextRenderers[id],renderers=nextRenderers,subscribers.forEach(subscriber=>subscriber())}}}(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=editor.contentComponent.subscribe(()=>{this.setState(prevState=>prevState.hasContentComponentInitialized?prevState:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),editor.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const editor=this.props.editor;if(!editor)return;if(this.initialized=!1,editor.isDestroyed||editor.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),editor.contentComponent=null,!editor.options.element.firstChild)return;const newElement=document.createElement("div");newElement.append(...editor.options.element.childNodes),editor.setOptions({element:newElement})}render(){const{editor,innerRef,...rest}=this.props;return react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment,null,react__WEBPACK_IMPORTED_MODULE_0__.createElement("div",{ref:mergeRefs(innerRef,this.editorContentRef),...rest}),(null==editor?void 0:editor.contentComponent)&&react__WEBPACK_IMPORTED_MODULE_0__.createElement(Portals,{contentComponent:editor.contentComponent}))}}const EditorContentWithKey=(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)((props,ref)=>{const key=react__WEBPACK_IMPORTED_MODULE_0__.useMemo(()=>Math.floor(4294967295*Math.random()).toString(),[props.editor]);return react__WEBPACK_IMPORTED_MODULE_0__.createElement(PureEditorContent,{key,innerRef:ref,...props})}),EditorContent=react__WEBPACK_IMPORTED_MODULE_0__.memo(EditorContentWithKey);var hasRequiredWithSelector_production_min,deepEqual=getDefaultExportFromCjs(function equal(a,b){if(a===b)return!0;if(a&&b&&"object"==typeof a&&"object"==typeof b){if(a.constructor!==b.constructor)return!1;var length,i,keys;if(Array.isArray(a)){if((length=a.length)!=b.length)return!1;for(i=length;0!==i--;)if(!equal(a[i],b[i]))return!1;return!0}if(a instanceof Map&&b instanceof Map){if(a.size!==b.size)return!1;for(i of a.entries())if(!b.has(i[0]))return!1;for(i of a.entries())if(!equal(i[1],b.get(i[0])))return!1;return!0}if(a instanceof Set&&b instanceof Set){if(a.size!==b.size)return!1;for(i of a.entries())if(!b.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(a)&&ArrayBuffer.isView(b)){if((length=a.length)!=b.length)return!1;for(i=length;0!==i--;)if(a[i]!==b[i])return!1;return!0}if(a.constructor===RegExp)return a.source===b.source&&a.flags===b.flags;if(a.valueOf!==Object.prototype.valueOf)return a.valueOf()===b.valueOf();if(a.toString!==Object.prototype.toString)return a.toString()===b.toString();if((length=(keys=Object.keys(a)).length)!==Object.keys(b).length)return!1;for(i=length;0!==i--;)if(!Object.prototype.hasOwnProperty.call(b,keys[i]))return!1;for(i=length;0!==i--;){var key=keys[i];if(("_owner"!==key||!a.$$typeof)&&!equal(a[key],b[key]))return!1}return!0}return a!=a&&b!=b}),withSelector={exports:{}},withSelector_production_min={};withSelector.exports=function requireWithSelector_production_min(){if(hasRequiredWithSelector_production_min)return withSelector_production_min;hasRequiredWithSelector_production_min=1;var h=react__WEBPACK_IMPORTED_MODULE_0__,n=shimExports,q="function"==typeof Object.is?Object.is:function p(a,b){return a===b&&(0!==a||1/a==1/b)||a!=a&&b!=b},r=n.useSyncExternalStore,t=h.useRef,u=h.useEffect,v=h.useMemo,w=h.useDebugValue;return withSelector_production_min.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f}else f=c.current;c=v(function(){function a(a){if(!c){if(c=!0,d=a,a=l(a),void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}if(b=k,q(d,a))return b;var e=l(a);return void 0!==g&&g(b,e)?b:(d=a,k=e)}var d,k,c=!1,m=void 0===e?null:e;return[function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r(a,c[0],c[1]);return u(function(){f.hasValue=!0,f.value=d},[d]),w(d),d},withSelector_production_min}();var withSelectorExports=withSelector.exports;const useIsomorphicLayoutEffect="undefined"!=typeof window?react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect:react__WEBPACK_IMPORTED_MODULE_0__.useEffect;class EditorStateManager{constructor(initialEditor){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=initialEditor,this.lastSnapshot={editor:initialEditor,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(callback){return this.subscribers.add(callback),()=>{this.subscribers.delete(callback)}}watch(nextEditor){if(this.editor=nextEditor,this.editor){const fn=()=>{this.transactionNumber+=1,this.subscribers.forEach(callback=>callback())},currentEditor=this.editor;return currentEditor.on("transaction",fn),()=>{currentEditor.off("transaction",fn)}}}}const isSSR="undefined"==typeof window,isNext=isSSR||Boolean("undefined"!=typeof window&&window.next);class EditorInstanceManager{constructor(options){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=options,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(editor){this.editor=editor,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(cb=>cb())}getInitialEditor(){return void 0===this.options.current.immediatelyRender?isSSR||isNext?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const optionsToApply={...this.options.current,onBeforeCreate:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onBeforeCreate)||void 0===_b?void 0:_b.call(_a,...args)},onBlur:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onBlur)||void 0===_b?void 0:_b.call(_a,...args)},onCreate:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onCreate)||void 0===_b?void 0:_b.call(_a,...args)},onDestroy:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onDestroy)||void 0===_b?void 0:_b.call(_a,...args)},onFocus:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onFocus)||void 0===_b?void 0:_b.call(_a,...args)},onSelectionUpdate:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onSelectionUpdate)||void 0===_b?void 0:_b.call(_a,...args)},onTransaction:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onTransaction)||void 0===_b?void 0:_b.call(_a,...args)},onUpdate:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onUpdate)||void 0===_b?void 0:_b.call(_a,...args)},onContentError:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onContentError)||void 0===_b?void 0:_b.call(_a,...args)},onDrop:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onDrop)||void 0===_b?void 0:_b.call(_a,...args)},onPaste:(...args)=>{var _a,_b;return null===(_b=(_a=this.options.current).onPaste)||void 0===_b?void 0:_b.call(_a,...args)}};return new _tiptap_core__WEBPACK_IMPORTED_MODULE_2__.KE(optionsToApply)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(onStoreChange){return this.subscriptions.add(onStoreChange),()=>{this.subscriptions.delete(onStoreChange)}}static compareOptions(a,b){return Object.keys(a).every(key=>!!["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(key)||("extensions"===key&&a.extensions&&b.extensions?a.extensions.length===b.extensions.length&&a.extensions.every((extension,index)=>{var _a;return extension===(null===(_a=b.extensions)||void 0===_a?void 0:_a[index])}):a[key]===b[key]))}onRender(deps){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&0===deps.length?EditorInstanceManager.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(deps),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(deps){if(this.editor&&!this.editor.isDestroyed){if(null===this.previousDeps)return void(this.previousDeps=deps);if(this.previousDeps.length===deps.length&&this.previousDeps.every((dep,index)=>dep===deps[index]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=deps}scheduleDestroy(){const currentInstanceId=this.instanceId,currentEditor=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===currentInstanceId?currentEditor&¤tEditor.setOptions(this.options.current):currentEditor&&!currentEditor.isDestroyed&&(currentEditor.destroy(),this.instanceId===currentInstanceId&&this.setEditor(null))},1)}}function useEditor(options={},deps=[]){const mostRecentOptions=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(options);mostRecentOptions.current=options;const[instanceManager]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(()=>new EditorInstanceManager(mostRecentOptions)),editor=shimExports.useSyncExternalStore(instanceManager.subscribe,instanceManager.getEditor,instanceManager.getServerSnapshot);return(0,react__WEBPACK_IMPORTED_MODULE_0__.useDebugValue)(editor),(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(instanceManager.onRender(deps)),function useEditorState(options){var _a;const[editorStateManager]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(()=>new EditorStateManager(options.editor)),selectedState=withSelectorExports.useSyncExternalStoreWithSelector(editorStateManager.subscribe,editorStateManager.getSnapshot,editorStateManager.getServerSnapshot,options.selector,null!==(_a=options.equalityFn)&&void 0!==_a?_a:deepEqual);return useIsomorphicLayoutEffect(()=>editorStateManager.watch(options.editor),[options.editor,editorStateManager]),(0,react__WEBPACK_IMPORTED_MODULE_0__.useDebugValue)(selectedState),selectedState}({editor,selector:({transactionNumber})=>!1===options.shouldRerenderOnTransaction?null:options.immediatelyRender&&0===transactionNumber?0:transactionNumber+1}),editor}const EditorContext=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({editor:null});EditorContext.Consumer;const ReactNodeViewContext=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)({onDragStart:void 0}),useReactNodeView=()=>(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ReactNodeViewContext);react__WEBPACK_IMPORTED_MODULE_0__.forwardRef((props,ref)=>{const{onDragStart}=useReactNodeView(),Tag=props.as||"div";return react__WEBPACK_IMPORTED_MODULE_0__.createElement(Tag,{...props,ref,"data-node-view-wrapper":"",onDragStart,style:{whiteSpace:"normal",...props.style}})})},"./node_modules/@tiptap/starter-kit/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>StarterKit});var dist=__webpack_require__("./node_modules/@tiptap/core/dist/index.js");const inputRegex=/^\s*>\s$/,Blockquote=dist.bP.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes}){return["blockquote",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setBlockquote:()=>({commands})=>commands.wrapIn(this.name),toggleBlockquote:()=>({commands})=>commands.toggleWrap(this.name),unsetBlockquote:()=>({commands})=>commands.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[(0,dist.tG)({find:inputRegex,type:this.type})]}}),starInputRegex=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,starPasteRegex=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,underscoreInputRegex=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,underscorePasteRegex=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Bold=dist.CU.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:node=>"normal"!==node.style.fontWeight&&null},{style:"font-weight=400",clearMark:mark=>mark.type.name===this.name},{style:"font-weight",getAttrs:value=>/^(bold(er)?|[5-9]\d{2,})$/.test(value)&&null}]},renderHTML({HTMLAttributes}){return["strong",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setBold:()=>({commands})=>commands.setMark(this.name),toggleBold:()=>({commands})=>commands.toggleMark(this.name),unsetBold:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[(0,dist.OX)({find:starInputRegex,type:this.type}),(0,dist.OX)({find:underscoreInputRegex,type:this.type})]},addPasteRules(){return[(0,dist.Zc)({find:starPasteRegex,type:this.type}),(0,dist.Zc)({find:underscorePasteRegex,type:this.type})]}}),dist_inputRegex=/^\s*([-+*])\s$/,BulletList=dist.bP.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes}){return["ul",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{toggleBulletList:()=>({commands,chain})=>this.options.keepAttributes?chain().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes("textStyle")).run():commands.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let inputRule=(0,dist.tG)({find:dist_inputRegex,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(inputRule=(0,dist.tG)({find:dist_inputRegex,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[inputRule]}}),extension_code_dist_inputRegex=/(^|[^`])`([^`]+)`(?!`)/,pasteRegex=/(^|[^`])`([^`]+)`(?!`)/g,Code=dist.CU.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes}){return["code",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setCode:()=>({commands})=>commands.setMark(this.name),toggleCode:()=>({commands})=>commands.toggleMark(this.name),unsetCode:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[(0,dist.OX)({find:extension_code_dist_inputRegex,type:this.type})]},addPasteRules(){return[(0,dist.Zc)({find:pasteRegex,type:this.type})]}});var prosemirror_state_dist=__webpack_require__("./node_modules/prosemirror-state/dist/index.js");const backtickInputRegex=/^```([a-z]+)?[\s\n]$/,tildeInputRegex=/^~~~([a-z]+)?[\s\n]$/,CodeBlock=dist.bP.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:element=>{var _a;const{languageClassPrefix}=this.options,language=[...(null===(_a=element.firstElementChild)||void 0===_a?void 0:_a.classList)||[]].filter(className=>className.startsWith(languageClassPrefix)).map(className=>className.replace(languageClassPrefix,""))[0];return language||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node,HTMLAttributes}){return["pre",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),["code",{class:node.attrs.language?this.options.languageClassPrefix+node.attrs.language:null},0]]},addCommands(){return{setCodeBlock:attributes=>({commands})=>commands.setNode(this.name,attributes),toggleCodeBlock:attributes=>({commands})=>commands.toggleNode(this.name,"paragraph",attributes)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty,$anchor}=this.editor.state.selection,isAtStart=1===$anchor.pos;return!(!empty||$anchor.parent.type.name!==this.name)&&(!(!isAtStart&&$anchor.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor})=>{if(!this.options.exitOnTripleEnter)return!1;const{state}=editor,{selection}=state,{$from,empty}=selection;if(!empty||$from.parent.type!==this.type)return!1;const isAtEnd=$from.parentOffset===$from.parent.nodeSize-2,endsWithDoubleNewline=$from.parent.textContent.endsWith("\n\n");return!(!isAtEnd||!endsWithDoubleNewline)&&editor.chain().command(({tr})=>(tr.delete($from.pos-2,$from.pos),!0)).exitCode().run()},ArrowDown:({editor})=>{if(!this.options.exitOnArrowDown)return!1;const{state}=editor,{selection,doc}=state,{$from,empty}=selection;if(!empty||$from.parent.type!==this.type)return!1;if(!($from.parentOffset===$from.parent.nodeSize-2))return!1;const after=$from.after();if(void 0===after)return!1;return doc.nodeAt(after)?editor.commands.command(({tr})=>(tr.setSelection(prosemirror_state_dist.LN.near(doc.resolve(after))),!0)):editor.commands.exitCode()}}},addInputRules(){return[(0,dist.JJ)({find:backtickInputRegex,type:this.type,getAttributes:match=>({language:match[1]})}),(0,dist.JJ)({find:tildeInputRegex,type:this.type,getAttributes:match=>({language:match[1]})})]},addProseMirrorPlugins(){return[new prosemirror_state_dist.k_({key:new prosemirror_state_dist.hs("codeBlockVSCodeHandler"),props:{handlePaste:(view,event)=>{if(!event.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const text=event.clipboardData.getData("text/plain"),vscode=event.clipboardData.getData("vscode-editor-data"),vscodeData=vscode?JSON.parse(vscode):void 0,language=null==vscodeData?void 0:vscodeData.mode;if(!text||!language)return!1;const{tr,schema}=view.state,textNode=schema.text(text.replace(/\r\n?/g,"\n"));return tr.replaceSelectionWith(this.type.create({language},textNode)),tr.selection.$from.parent.type!==this.type&&tr.setSelection(prosemirror_state_dist.U3.near(tr.doc.resolve(Math.max(0,tr.selection.from-2)))),tr.setMeta("paste",!0),view.dispatch(tr),!0}}})]}}),Document=dist.bP.create({name:"doc",topNode:!0,content:"block+"});var prosemirror_transform_dist=__webpack_require__("./node_modules/prosemirror-transform/dist/index.js");function dropCursor(options={}){return new prosemirror_state_dist.k_({view:editorView=>new DropCursorView(editorView,options)})}class DropCursorView{constructor(editorView,options){var _a;this.editorView=editorView,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(_a=options.width)&&void 0!==_a?_a:1,this.color=!1===options.color?void 0:options.color||"black",this.class=options.class,this.handlers=["dragover","dragend","drop","dragleave"].map(name=>{let handler=e=>{this[name](e)};return editorView.dom.addEventListener(name,handler),{name,handler}})}destroy(){this.handlers.forEach(({name,handler})=>this.editorView.dom.removeEventListener(name,handler))}update(editorView,prevState){null!=this.cursorPos&&prevState.doc!=editorView.state.doc&&(this.cursorPos>editorView.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(pos){pos!=this.cursorPos&&(this.cursorPos=pos,null==pos?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let rect,$pos=this.editorView.state.doc.resolve(this.cursorPos),isBlock=!$pos.parent.inlineContent,editorDOM=this.editorView.dom,editorRect=editorDOM.getBoundingClientRect(),scaleX=editorRect.width/editorDOM.offsetWidth,scaleY=editorRect.height/editorDOM.offsetHeight;if(isBlock){let before=$pos.nodeBefore,after=$pos.nodeAfter;if(before||after){let node=this.editorView.nodeDOM(this.cursorPos-(before?before.nodeSize:0));if(node){let nodeRect=node.getBoundingClientRect(),top=before?nodeRect.bottom:nodeRect.top;before&&after&&(top=(top+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let halfWidth=this.width/2*scaleY;rect={left:nodeRect.left,right:nodeRect.right,top:top-halfWidth,bottom:top+halfWidth}}}}if(!rect){let coords=this.editorView.coordsAtPos(this.cursorPos),halfWidth=this.width/2*scaleX;rect={left:coords.left-halfWidth,right:coords.left+halfWidth,top:coords.top,bottom:coords.bottom}}let parentLeft,parentTop,parent=this.editorView.dom.offsetParent;if(this.element||(this.element=parent.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",isBlock),this.element.classList.toggle("prosemirror-dropcursor-inline",!isBlock),!parent||parent==document.body&&"static"==getComputedStyle(parent).position)parentLeft=-pageXOffset,parentTop=-pageYOffset;else{let rect=parent.getBoundingClientRect(),parentScaleX=rect.width/parent.offsetWidth,parentScaleY=rect.height/parent.offsetHeight;parentLeft=rect.left-parent.scrollLeft*parentScaleX,parentTop=rect.top-parent.scrollTop*parentScaleY}this.element.style.left=(rect.left-parentLeft)/scaleX+"px",this.element.style.top=(rect.top-parentTop)/scaleY+"px",this.element.style.width=(rect.right-rect.left)/scaleX+"px",this.element.style.height=(rect.bottom-rect.top)/scaleY+"px"}scheduleRemoval(timeout){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),timeout)}dragover(event){if(!this.editorView.editable)return;let pos=this.editorView.posAtCoords({left:event.clientX,top:event.clientY}),node=pos&&pos.inside>=0&&this.editorView.state.doc.nodeAt(pos.inside),disableDropCursor=node&&node.type.spec.disableDropCursor,disabled="function"==typeof disableDropCursor?disableDropCursor(this.editorView,pos,event):disableDropCursor;if(pos&&!disabled){let target=pos.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let point=(0,prosemirror_transform_dist.Um)(this.editorView.state.doc,target,this.editorView.dragging.slice);null!=point&&(target=point)}this.setCursor(target),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(event){this.editorView.dom.contains(event.relatedTarget)||this.setCursor(null)}}const Dropcursor=dist.YY.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[dropCursor(this.options)]}});var extension_gapcursor_dist=__webpack_require__("./node_modules/@tiptap/extension-gapcursor/dist/index.js");const HardBreak=dist.bP.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes}){return["br",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands,chain,state,editor})=>commands.first([()=>commands.exitCode(),()=>commands.command(()=>{const{selection,storedMarks}=state;if(selection.$from.parent.type.spec.isolating)return!1;const{keepMarks}=this.options,{splittableMarks}=editor.extensionManager,marks=storedMarks||selection.$to.parentOffset&&selection.$from.marks();return chain().insertContent({type:this.name}).command(({tr,dispatch})=>{if(dispatch&&marks&&keepMarks){const filteredMarks=marks.filter(mark=>splittableMarks.includes(mark.type.name));tr.ensureMarks(filteredMarks)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Heading=dist.bP.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(level=>({tag:`h${level}`,attrs:{level}}))},renderHTML({node,HTMLAttributes}){return[`h${this.options.levels.includes(node.attrs.level)?node.attrs.level:this.options.levels[0]}`,(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setHeading:attributes=>({commands})=>!!this.options.levels.includes(attributes.level)&&commands.setNode(this.name,attributes),toggleHeading:attributes=>({commands})=>!!this.options.levels.includes(attributes.level)&&commands.toggleNode(this.name,"paragraph",attributes)}},addKeyboardShortcuts(){return this.options.levels.reduce((items,level)=>({...items,[`Mod-Alt-${level}`]:()=>this.editor.commands.toggleHeading({level})}),{})},addInputRules(){return this.options.levels.map(level=>(0,dist.JJ)({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${level}})\\s$`),type:this.type,getAttributes:{level}}))}});var RopeSequence=function RopeSequence(){};RopeSequence.prototype.append=function append(other){return other.length?(other=RopeSequence.from(other),!this.length&&other||other.length<200&&this.leafAppend(other)||this.length<200&&other.leafPrepend(this)||this.appendInner(other)):this},RopeSequence.prototype.prepend=function prepend(other){return other.length?RopeSequence.from(other).append(this):this},RopeSequence.prototype.appendInner=function appendInner(other){return new Append(this,other)},RopeSequence.prototype.slice=function slice(from,to){return void 0===from&&(from=0),void 0===to&&(to=this.length),from>=to?RopeSequence.empty:this.sliceInner(Math.max(0,from),Math.min(this.length,to))},RopeSequence.prototype.get=function get(i){if(!(i<0||i>=this.length))return this.getInner(i)},RopeSequence.prototype.forEach=function forEach(f,from,to){void 0===from&&(from=0),void 0===to&&(to=this.length),from<=to?this.forEachInner(f,from,to,0):this.forEachInvertedInner(f,from,to,0)},RopeSequence.prototype.map=function map(f,from,to){void 0===from&&(from=0),void 0===to&&(to=this.length);var result=[];return this.forEach(function(elt,i){return result.push(f(elt,i))},from,to),result},RopeSequence.from=function from(values){return values instanceof RopeSequence?values:values&&values.length?new Leaf(values):RopeSequence.empty};var Leaf=function(RopeSequence){function Leaf(values){RopeSequence.call(this),this.values=values}RopeSequence&&(Leaf.__proto__=RopeSequence),Leaf.prototype=Object.create(RopeSequence&&RopeSequence.prototype),Leaf.prototype.constructor=Leaf;var prototypeAccessors={length:{configurable:!0},depth:{configurable:!0}};return Leaf.prototype.flatten=function flatten(){return this.values},Leaf.prototype.sliceInner=function sliceInner(from,to){return 0==from&&to==this.length?this:new Leaf(this.values.slice(from,to))},Leaf.prototype.getInner=function getInner(i){return this.values[i]},Leaf.prototype.forEachInner=function forEachInner(f,from,to,start){for(var i=from;i<to;i++)if(!1===f(this.values[i],start+i))return!1},Leaf.prototype.forEachInvertedInner=function forEachInvertedInner(f,from,to,start){for(var i=from-1;i>=to;i--)if(!1===f(this.values[i],start+i))return!1},Leaf.prototype.leafAppend=function leafAppend(other){if(this.length+other.length<=200)return new Leaf(this.values.concat(other.flatten()))},Leaf.prototype.leafPrepend=function leafPrepend(other){if(this.length+other.length<=200)return new Leaf(other.flatten().concat(this.values))},prototypeAccessors.length.get=function(){return this.values.length},prototypeAccessors.depth.get=function(){return 0},Object.defineProperties(Leaf.prototype,prototypeAccessors),Leaf}(RopeSequence);RopeSequence.empty=new Leaf([]);var Append=function(RopeSequence){function Append(left,right){RopeSequence.call(this),this.left=left,this.right=right,this.length=left.length+right.length,this.depth=Math.max(left.depth,right.depth)+1}return RopeSequence&&(Append.__proto__=RopeSequence),Append.prototype=Object.create(RopeSequence&&RopeSequence.prototype),Append.prototype.constructor=Append,Append.prototype.flatten=function flatten(){return this.left.flatten().concat(this.right.flatten())},Append.prototype.getInner=function getInner(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},Append.prototype.forEachInner=function forEachInner(f,from,to,start){var leftLen=this.left.length;return!(from<leftLen&&!1===this.left.forEachInner(f,from,Math.min(to,leftLen),start))&&(!(to>leftLen&&!1===this.right.forEachInner(f,Math.max(from-leftLen,0),Math.min(this.length,to)-leftLen,start+leftLen))&&void 0)},Append.prototype.forEachInvertedInner=function forEachInvertedInner(f,from,to,start){var leftLen=this.left.length;return!(from>leftLen&&!1===this.right.forEachInvertedInner(f,from-leftLen,Math.max(to,leftLen)-leftLen,start+leftLen))&&(!(to<leftLen&&!1===this.left.forEachInvertedInner(f,Math.min(from,leftLen),to,start))&&void 0)},Append.prototype.sliceInner=function sliceInner(from,to){if(0==from&&to==this.length)return this;var leftLen=this.left.length;return to<=leftLen?this.left.slice(from,to):from>=leftLen?this.right.slice(from-leftLen,to-leftLen):this.left.slice(from,leftLen).append(this.right.slice(0,to-leftLen))},Append.prototype.leafAppend=function leafAppend(other){var inner=this.right.leafAppend(other);if(inner)return new Append(this.left,inner)},Append.prototype.leafPrepend=function leafPrepend(other){var inner=this.left.leafPrepend(other);if(inner)return new Append(inner,this.right)},Append.prototype.appendInner=function appendInner(other){return this.left.depth>=Math.max(this.right.depth,other.depth)+1?new Append(this.left,new Append(this.right,other)):new Append(this,other)},Append}(RopeSequence);const rope_sequence_dist=RopeSequence;class Branch{constructor(items,eventCount){this.items=items,this.eventCount=eventCount}popEvent(state,preserveItems){if(0==this.eventCount)return null;let remap,mapFrom,end=this.items.length;for(;;end--){if(this.items.get(end-1).selection){--end;break}}preserveItems&&(remap=this.remapping(end,this.items.length),mapFrom=remap.maps.length);let selection,remaining,transform=state.tr,addAfter=[],addBefore=[];return this.items.forEach((item,i)=>{if(!item.step)return remap||(remap=this.remapping(end,i+1),mapFrom=remap.maps.length),mapFrom--,void addBefore.push(item);if(remap){addBefore.push(new Item(item.map));let map,step=item.step.map(remap.slice(mapFrom));step&&transform.maybeStep(step).doc&&(map=transform.mapping.maps[transform.mapping.maps.length-1],addAfter.push(new Item(map,void 0,void 0,addAfter.length+addBefore.length))),mapFrom--,map&&remap.appendMap(map,mapFrom)}else transform.maybeStep(item.step);return item.selection?(selection=remap?item.selection.map(remap.slice(mapFrom)):item.selection,remaining=new Branch(this.items.slice(0,end).append(addBefore.reverse().concat(addAfter)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining,transform,selection}}addTransform(transform,selection,histOptions,preserveItems){let newItems=[],eventCount=this.eventCount,oldItems=this.items,lastItem=!preserveItems&&oldItems.length?oldItems.get(oldItems.length-1):null;for(let i=0;i<transform.steps.length;i++){let merged,step=transform.steps[i].invert(transform.docs[i]),item=new Item(transform.mapping.maps[i],step,selection);(merged=lastItem&&lastItem.merge(item))&&(item=merged,i?newItems.pop():oldItems=oldItems.slice(0,oldItems.length-1)),newItems.push(item),selection&&(eventCount++,selection=void 0),preserveItems||(lastItem=item)}let overflow=eventCount-histOptions.depth;return overflow>DEPTH_OVERFLOW&&(oldItems=function cutOffEvents(items,n){let cutPoint;return items.forEach((item,i)=>{if(item.selection&&0==n--)return cutPoint=i,!1}),items.slice(cutPoint)}(oldItems,overflow),eventCount-=overflow),new Branch(oldItems.append(newItems),eventCount)}remapping(from,to){let maps=new prosemirror_transform_dist.X9;return this.items.forEach((item,i)=>{let mirrorPos=null!=item.mirrorOffset&&i-item.mirrorOffset>=from?maps.maps.length-item.mirrorOffset:void 0;maps.appendMap(item.map,mirrorPos)},from,to),maps}addMaps(array){return 0==this.eventCount?this:new Branch(this.items.append(array.map(map=>new Item(map))),this.eventCount)}rebased(rebasedTransform,rebasedCount){if(!this.eventCount)return this;let rebasedItems=[],start=Math.max(0,this.items.length-rebasedCount),mapping=rebasedTransform.mapping,newUntil=rebasedTransform.steps.length,eventCount=this.eventCount;this.items.forEach(item=>{item.selection&&eventCount--},start);let iRebased=rebasedCount;this.items.forEach(item=>{let pos=mapping.getMirror(--iRebased);if(null==pos)return;newUntil=Math.min(newUntil,pos);let map=mapping.maps[pos];if(item.step){let step=rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]),selection=item.selection&&item.selection.map(mapping.slice(iRebased+1,pos));selection&&eventCount++,rebasedItems.push(new Item(map,step,selection))}else rebasedItems.push(new Item(map))},start);let newMaps=[];for(let i=rebasedCount;i<newUntil;i++)newMaps.push(new Item(mapping.maps[i]));let items=this.items.slice(0,start).append(newMaps).append(rebasedItems),branch=new Branch(items,eventCount);return branch.emptyItemCount()>500&&(branch=branch.compress(this.items.length-rebasedItems.length)),branch}emptyItemCount(){let count=0;return this.items.forEach(item=>{item.step||count++}),count}compress(upto=this.items.length){let remap=this.remapping(0,upto),mapFrom=remap.maps.length,items=[],events=0;return this.items.forEach((item,i)=>{if(i>=upto)items.push(item),item.selection&&events++;else if(item.step){let step=item.step.map(remap.slice(mapFrom)),map=step&&step.getMap();if(mapFrom--,map&&remap.appendMap(map,mapFrom),step){let selection=item.selection&&item.selection.map(remap.slice(mapFrom));selection&&events++;let merged,newItem=new Item(map.invert(),step,selection),last=items.length-1;(merged=items.length&&items[last].merge(newItem))?items[last]=merged:items.push(newItem)}}else item.map&&mapFrom--},this.items.length,0),new Branch(rope_sequence_dist.from(items.reverse()),events)}}Branch.empty=new Branch(rope_sequence_dist.empty,0);class Item{constructor(map,step,selection,mirrorOffset){this.map=map,this.step=step,this.selection=selection,this.mirrorOffset=mirrorOffset}merge(other){if(this.step&&other.step&&!other.selection){let step=other.step.merge(this.step);if(step)return new Item(step.getMap().invert(),step,this.selection)}}}class HistoryState{constructor(done,undone,prevRanges,prevTime,prevComposition){this.done=done,this.undone=undone,this.prevRanges=prevRanges,this.prevTime=prevTime,this.prevComposition=prevComposition}}const DEPTH_OVERFLOW=20;function rangesFor(maps){let result=[];for(let i=maps.length-1;i>=0&&0==result.length;i--)maps[i].forEach((_from,_to,from,to)=>result.push(from,to));return result}function mapRanges(ranges,mapping){if(!ranges)return null;let result=[];for(let i=0;i<ranges.length;i+=2){let from=mapping.map(ranges[i],1),to=mapping.map(ranges[i+1],-1);from<=to&&result.push(from,to)}return result}let cachedPreserveItems=!1,cachedPreserveItemsPlugins=null;function mustPreserveItems(state){let plugins=state.plugins;if(cachedPreserveItemsPlugins!=plugins){cachedPreserveItems=!1,cachedPreserveItemsPlugins=plugins;for(let i=0;i<plugins.length;i++)if(plugins[i].spec.historyPreserveItems){cachedPreserveItems=!0;break}}return cachedPreserveItems}const historyKey=new prosemirror_state_dist.hs("history"),closeHistoryKey=new prosemirror_state_dist.hs("closeHistory");function dist_history(config={}){return config={depth:config.depth||100,newGroupDelay:config.newGroupDelay||500},new prosemirror_state_dist.k_({key:historyKey,state:{init:()=>new HistoryState(Branch.empty,Branch.empty,null,0,-1),apply:(tr,hist,state)=>function applyTransaction(history,state,tr,options){let rebased,historyTr=tr.getMeta(historyKey);if(historyTr)return historyTr.historyState;tr.getMeta(closeHistoryKey)&&(history=new HistoryState(history.done,history.undone,null,0,-1));let appended=tr.getMeta("appendedTransaction");if(0==tr.steps.length)return history;if(appended&&appended.getMeta(historyKey))return appended.getMeta(historyKey).redo?new HistoryState(history.done.addTransform(tr,void 0,options,mustPreserveItems(state)),history.undone,rangesFor(tr.mapping.maps),history.prevTime,history.prevComposition):new HistoryState(history.done,history.undone.addTransform(tr,void 0,options,mustPreserveItems(state)),null,history.prevTime,history.prevComposition);if(!1===tr.getMeta("addToHistory")||appended&&!1===appended.getMeta("addToHistory"))return(rebased=tr.getMeta("rebased"))?new HistoryState(history.done.rebased(tr,rebased),history.undone.rebased(tr,rebased),mapRanges(history.prevRanges,tr.mapping),history.prevTime,history.prevComposition):new HistoryState(history.done.addMaps(tr.mapping.maps),history.undone.addMaps(tr.mapping.maps),mapRanges(history.prevRanges,tr.mapping),history.prevTime,history.prevComposition);{let composition=tr.getMeta("composition"),newGroup=0==history.prevTime||!appended&&history.prevComposition!=composition&&(history.prevTime<(tr.time||0)-options.newGroupDelay||!function isAdjacentTo(transform,prevRanges){if(!prevRanges)return!1;if(!transform.docChanged)return!0;let adjacent=!1;return transform.mapping.maps[0].forEach((start,end)=>{for(let i=0;i<prevRanges.length;i+=2)start<=prevRanges[i+1]&&end>=prevRanges[i]&&(adjacent=!0)}),adjacent}(tr,history.prevRanges)),prevRanges=appended?mapRanges(history.prevRanges,tr.mapping):rangesFor(tr.mapping.maps);return new HistoryState(history.done.addTransform(tr,newGroup?state.selection.getBookmark():void 0,options,mustPreserveItems(state)),Branch.empty,prevRanges,tr.time,null==composition?history.prevComposition:composition)}}(hist,state,tr,config)},config,props:{handleDOMEvents:{beforeinput(view,e){let inputType=e.inputType,command="historyUndo"==inputType?undo:"historyRedo"==inputType?redo:null;return!!command&&(e.preventDefault(),command(view.state,view.dispatch))}}}})}function buildCommand(redo,scroll){return(state,dispatch)=>{let hist=historyKey.getState(state);if(!hist||0==(redo?hist.undone:hist.done).eventCount)return!1;if(dispatch){let tr=function histTransaction(history,state,redo){let preserveItems=mustPreserveItems(state),histOptions=historyKey.get(state).spec.config,pop=(redo?history.undone:history.done).popEvent(state,preserveItems);if(!pop)return null;let selection=pop.selection.resolve(pop.transform.doc),added=(redo?history.done:history.undone).addTransform(pop.transform,state.selection.getBookmark(),histOptions,preserveItems),newHist=new HistoryState(redo?added:pop.remaining,redo?pop.remaining:added,null,0,-1);return pop.transform.setSelection(selection).setMeta(historyKey,{redo,historyState:newHist})}(hist,state,redo);tr&&dispatch(scroll?tr.scrollIntoView():tr)}return!0}}const undo=buildCommand(!1,!0),redo=buildCommand(!0,!0);buildCommand(!1,!1),buildCommand(!0,!1);const History=dist.YY.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state,dispatch})=>undo(state,dispatch),redo:()=>({state,dispatch})=>redo(state,dispatch)}),addProseMirrorPlugins(){return[dist_history(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),HorizontalRule=dist.bP.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes}){return["hr",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes)]},addCommands(){return{setHorizontalRule:()=>({chain,state})=>{if(!(0,dist.AB)(state,state.schema.nodes[this.name]))return!1;const{selection}=state,{$from:$originFrom,$to:$originTo}=selection,currentChain=chain();return 0===$originFrom.parentOffset?currentChain.insertContentAt({from:Math.max($originFrom.pos-1,0),to:$originTo.pos},{type:this.name}):(0,dist.BQ)(selection)?currentChain.insertContentAt($originTo.pos,{type:this.name}):currentChain.insertContent({type:this.name}),currentChain.command(({tr,dispatch})=>{var _a;if(dispatch){const{$to}=tr.selection,posAfter=$to.end();if($to.nodeAfter)$to.nodeAfter.isTextblock?tr.setSelection(prosemirror_state_dist.U3.create(tr.doc,$to.pos+1)):$to.nodeAfter.isBlock?tr.setSelection(prosemirror_state_dist.nh.create(tr.doc,$to.pos)):tr.setSelection(prosemirror_state_dist.U3.create(tr.doc,$to.pos));else{const node=null===(_a=$to.parent.type.contentMatch.defaultType)||void 0===_a?void 0:_a.create();node&&(tr.insert(posAfter,node),tr.setSelection(prosemirror_state_dist.U3.create(tr.doc,posAfter+1)))}tr.scrollIntoView()}return!0}).run()}}},addInputRules(){return[(0,dist.jT)({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),dist_starInputRegex=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,dist_starPasteRegex=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,dist_underscoreInputRegex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,dist_underscorePasteRegex=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Italic=dist.CU.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:node=>"normal"!==node.style.fontStyle&&null},{style:"font-style=normal",clearMark:mark=>mark.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes}){return["em",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setItalic:()=>({commands})=>commands.setMark(this.name),toggleItalic:()=>({commands})=>commands.toggleMark(this.name),unsetItalic:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[(0,dist.OX)({find:dist_starInputRegex,type:this.type}),(0,dist.OX)({find:dist_underscoreInputRegex,type:this.type})]},addPasteRules(){return[(0,dist.Zc)({find:dist_starPasteRegex,type:this.type}),(0,dist.Zc)({find:dist_underscorePasteRegex,type:this.type})]}}),ListItem=dist.bP.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes}){return["li",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),extension_ordered_list_dist_inputRegex=/^(\d+)\.\s$/,OrderedList=dist.bP.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:element=>element.hasAttribute("start")?parseInt(element.getAttribute("start")||"",10):1},type:{default:null,parseHTML:element=>element.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes}){const{start,...attributesWithoutStart}=HTMLAttributes;return 1===start?["ol",(0,dist.KV)(this.options.HTMLAttributes,attributesWithoutStart),0]:["ol",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{toggleOrderedList:()=>({commands,chain})=>this.options.keepAttributes?chain().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes("textStyle")).run():commands.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let inputRule=(0,dist.tG)({find:extension_ordered_list_dist_inputRegex,type:this.type,getAttributes:match=>({start:+match[1]}),joinPredicate:(match,node)=>node.childCount+node.attrs.start===+match[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(inputRule=(0,dist.tG)({find:extension_ordered_list_dist_inputRegex,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:match=>({start:+match[1],...this.editor.getAttributes("textStyle")}),joinPredicate:(match,node)=>node.childCount+node.attrs.start===+match[1],editor:this.editor})),[inputRule]}}),Paragraph=dist.bP.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes}){return["p",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setParagraph:()=>({commands})=>commands.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),extension_strike_dist_inputRegex=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,dist_pasteRegex=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Strike=dist.CU.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:style=>!!style.includes("line-through")&&{}}],renderHTML({HTMLAttributes}){return["s",(0,dist.KV)(this.options.HTMLAttributes,HTMLAttributes),0]},addCommands(){return{setStrike:()=>({commands})=>commands.setMark(this.name),toggleStrike:()=>({commands})=>commands.toggleMark(this.name),unsetStrike:()=>({commands})=>commands.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[(0,dist.OX)({find:extension_strike_dist_inputRegex,type:this.type})]},addPasteRules(){return[(0,dist.Zc)({find:dist_pasteRegex,type:this.type})]}}),Text=dist.bP.create({name:"text",group:"inline"}),StarterKit=dist.YY.create({name:"starterKit",addExtensions(){const extensions=[];return!1!==this.options.bold&&extensions.push(Bold.configure(this.options.bold)),!1!==this.options.blockquote&&extensions.push(Blockquote.configure(this.options.blockquote)),!1!==this.options.bulletList&&extensions.push(BulletList.configure(this.options.bulletList)),!1!==this.options.code&&extensions.push(Code.configure(this.options.code)),!1!==this.options.codeBlock&&extensions.push(CodeBlock.configure(this.options.codeBlock)),!1!==this.options.document&&extensions.push(Document.configure(this.options.document)),!1!==this.options.dropcursor&&extensions.push(Dropcursor.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&extensions.push(extension_gapcursor_dist.v.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&extensions.push(HardBreak.configure(this.options.hardBreak)),!1!==this.options.heading&&extensions.push(Heading.configure(this.options.heading)),!1!==this.options.history&&extensions.push(History.configure(this.options.history)),!1!==this.options.horizontalRule&&extensions.push(HorizontalRule.configure(this.options.horizontalRule)),!1!==this.options.italic&&extensions.push(Italic.configure(this.options.italic)),!1!==this.options.listItem&&extensions.push(ListItem.configure(this.options.listItem)),!1!==this.options.orderedList&&extensions.push(OrderedList.configure(this.options.orderedList)),!1!==this.options.paragraph&&extensions.push(Paragraph.configure(this.options.paragraph)),!1!==this.options.strike&&extensions.push(Strike.configure(this.options.strike)),!1!==this.options.text&&extensions.push(Text.configure(this.options.text)),extensions}})},"./node_modules/dompurify/dist/purify.es.mjs":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>purify});const{entries,setPrototypeOf,isFrozen,getPrototypeOf,getOwnPropertyDescriptor}=Object;let{freeze,seal,create}=Object,{apply,construct}="undefined"!=typeof Reflect&&Reflect;freeze||(freeze=function freeze(x){return x}),seal||(seal=function seal(x){return x}),apply||(apply=function apply(fun,thisValue,args){return fun.apply(thisValue,args)}),construct||(construct=function construct(Func,args){return new Func(...args)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=function unconstruct(func){return function(){for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++)args[_key2]=arguments[_key2];return construct(func,args)}}(TypeError);function unapply(func){return function(thisArg){thisArg instanceof RegExp&&(thisArg.lastIndex=0);for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return apply(func,thisArg,args)}}function addToSet(set,array){let transformCaseFunc=arguments.length>2&&void 0!==arguments[2]?arguments[2]:stringToLowerCase;setPrototypeOf&&setPrototypeOf(set,null);let l=array.length;for(;l--;){let element=array[l];if("string"==typeof element){const lcElement=transformCaseFunc(element);lcElement!==element&&(isFrozen(array)||(array[l]=lcElement),element=lcElement)}set[element]=!0}return set}function cleanArray(array){for(let index=0;index<array.length;index++){objectHasOwnProperty(array,index)||(array[index]=null)}return array}function clone(object){const newObject=create(null);for(const[property,value]of entries(object)){objectHasOwnProperty(object,property)&&(Array.isArray(value)?newObject[property]=cleanArray(value):value&&"object"==typeof value&&value.constructor===Object?newObject[property]=clone(value):newObject[property]=value)}return newObject}function lookupGetter(object,prop){for(;null!==object;){const desc=getOwnPropertyDescriptor(object,prop);if(desc){if(desc.get)return unapply(desc.get);if("function"==typeof desc.value)return unapply(desc.value)}object=getPrototypeOf(object)}return function fallbackValue(){return null}}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text=freeze(["#text"]),html=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR,ATTR_WHITESPACE,CUSTOM_ELEMENT,DATA_ATTR,DOCTYPE_NAME,ERB_EXPR,IS_ALLOWED_URI,IS_SCRIPT_OR_DATA,MUSTACHE_EXPR,TMPLIT_EXPR});const NODE_TYPE_element=1,NODE_TYPE_text=3,NODE_TYPE_progressingInstruction=7,NODE_TYPE_comment=8,NODE_TYPE_document=9,getGlobal=function getGlobal(){return"undefined"==typeof window?null:window};var purify=function createDOMPurify(){let window=arguments.length>0&&void 0!==arguments[0]?arguments[0]:getGlobal();const DOMPurify=root=>createDOMPurify(root);if(DOMPurify.version="3.2.6",DOMPurify.removed=[],!window||!window.document||window.document.nodeType!==NODE_TYPE_document||!window.Element)return DOMPurify.isSupported=!1,DOMPurify;let{document}=window;const originalDocument=document,currentScript=originalDocument.currentScript,{DocumentFragment,HTMLTemplateElement,Node,Element,NodeFilter,NamedNodeMap=window.NamedNodeMap||window.MozNamedAttrMap,HTMLFormElement,DOMParser,trustedTypes}=window,ElementPrototype=Element.prototype,cloneNode=lookupGetter(ElementPrototype,"cloneNode"),remove=lookupGetter(ElementPrototype,"remove"),getNextSibling=lookupGetter(ElementPrototype,"nextSibling"),getChildNodes=lookupGetter(ElementPrototype,"childNodes"),getParentNode=lookupGetter(ElementPrototype,"parentNode");if("function"==typeof HTMLTemplateElement){const template=document.createElement("template");template.content&&template.content.ownerDocument&&(document=template.content.ownerDocument)}let trustedTypesPolicy,emptyHTML="";const{implementation,createNodeIterator,createDocumentFragment,getElementsByTagName}=document,{importNode}=originalDocument;let hooks={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};DOMPurify.isSupported="function"==typeof entries&&"function"==typeof getParentNode&&implementation&&void 0!==implementation.createHTMLDocument;const{MUSTACHE_EXPR,ERB_EXPR,TMPLIT_EXPR,DATA_ATTR,ARIA_ATTR,IS_SCRIPT_OR_DATA,ATTR_WHITESPACE,CUSTOM_ELEMENT}=EXPRESSIONS;let{IS_ALLOWED_URI:IS_ALLOWED_URI$1}=EXPRESSIONS,ALLOWED_TAGS=null;const DEFAULT_ALLOWED_TAGS=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text]);let ALLOWED_ATTR=null;const DEFAULT_ALLOWED_ATTR=addToSet({},[...html,...svg,...mathMl,...xml]);let CUSTOM_ELEMENT_HANDLING=Object.seal(create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),FORBID_TAGS=null,FORBID_ATTR=null,ALLOW_ARIA_ATTR=!0,ALLOW_DATA_ATTR=!0,ALLOW_UNKNOWN_PROTOCOLS=!1,ALLOW_SELF_CLOSE_IN_ATTR=!0,SAFE_FOR_TEMPLATES=!1,SAFE_FOR_XML=!0,WHOLE_DOCUMENT=!1,SET_CONFIG=!1,FORCE_BODY=!1,RETURN_DOM=!1,RETURN_DOM_FRAGMENT=!1,RETURN_TRUSTED_TYPE=!1,SANITIZE_DOM=!0,SANITIZE_NAMED_PROPS=!1,KEEP_CONTENT=!0,IN_PLACE=!1,USE_PROFILES={},FORBID_CONTENTS=null;const DEFAULT_FORBID_CONTENTS=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let DATA_URI_TAGS=null;const DEFAULT_DATA_URI_TAGS=addToSet({},["audio","video","img","source","image","track"]);let URI_SAFE_ATTRIBUTES=null;const DEFAULT_URI_SAFE_ATTRIBUTES=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),MATHML_NAMESPACE="http://www.w3.org/1998/Math/MathML",SVG_NAMESPACE="http://www.w3.org/2000/svg",HTML_NAMESPACE="http://www.w3.org/1999/xhtml";let NAMESPACE=HTML_NAMESPACE,IS_EMPTY_INPUT=!1,ALLOWED_NAMESPACES=null;const DEFAULT_ALLOWED_NAMESPACES=addToSet({},[MATHML_NAMESPACE,SVG_NAMESPACE,HTML_NAMESPACE],stringToString);let MATHML_TEXT_INTEGRATION_POINTS=addToSet({},["mi","mo","mn","ms","mtext"]),HTML_INTEGRATION_POINTS=addToSet({},["annotation-xml"]);const COMMON_SVG_AND_HTML_ELEMENTS=addToSet({},["title","style","font","a","script"]);let PARSER_MEDIA_TYPE=null;const SUPPORTED_PARSER_MEDIA_TYPES=["application/xhtml+xml","text/html"];let transformCaseFunc=null,CONFIG=null;const formElement=document.createElement("form"),isRegexOrFunction=function isRegexOrFunction(testValue){return testValue instanceof RegExp||testValue instanceof Function},_parseConfig=function _parseConfig(){let cfg=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!CONFIG||CONFIG!==cfg){if(cfg&&"object"==typeof cfg||(cfg={}),cfg=clone(cfg),PARSER_MEDIA_TYPE=-1===SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE)?"text/html":cfg.PARSER_MEDIA_TYPE,transformCaseFunc="application/xhtml+xml"===PARSER_MEDIA_TYPE?stringToString:stringToLowerCase,ALLOWED_TAGS=objectHasOwnProperty(cfg,"ALLOWED_TAGS")?addToSet({},cfg.ALLOWED_TAGS,transformCaseFunc):DEFAULT_ALLOWED_TAGS,ALLOWED_ATTR=objectHasOwnProperty(cfg,"ALLOWED_ATTR")?addToSet({},cfg.ALLOWED_ATTR,transformCaseFunc):DEFAULT_ALLOWED_ATTR,ALLOWED_NAMESPACES=objectHasOwnProperty(cfg,"ALLOWED_NAMESPACES")?addToSet({},cfg.ALLOWED_NAMESPACES,stringToString):DEFAULT_ALLOWED_NAMESPACES,URI_SAFE_ATTRIBUTES=objectHasOwnProperty(cfg,"ADD_URI_SAFE_ATTR")?addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),cfg.ADD_URI_SAFE_ATTR,transformCaseFunc):DEFAULT_URI_SAFE_ATTRIBUTES,DATA_URI_TAGS=objectHasOwnProperty(cfg,"ADD_DATA_URI_TAGS")?addToSet(clone(DEFAULT_DATA_URI_TAGS),cfg.ADD_DATA_URI_TAGS,transformCaseFunc):DEFAULT_DATA_URI_TAGS,FORBID_CONTENTS=objectHasOwnProperty(cfg,"FORBID_CONTENTS")?addToSet({},cfg.FORBID_CONTENTS,transformCaseFunc):DEFAULT_FORBID_CONTENTS,FORBID_TAGS=objectHasOwnProperty(cfg,"FORBID_TAGS")?addToSet({},cfg.FORBID_TAGS,transformCaseFunc):clone({}),FORBID_ATTR=objectHasOwnProperty(cfg,"FORBID_ATTR")?addToSet({},cfg.FORBID_ATTR,transformCaseFunc):clone({}),USE_PROFILES=!!objectHasOwnProperty(cfg,"USE_PROFILES")&&cfg.USE_PROFILES,ALLOW_ARIA_ATTR=!1!==cfg.ALLOW_ARIA_ATTR,ALLOW_DATA_ATTR=!1!==cfg.ALLOW_DATA_ATTR,ALLOW_UNKNOWN_PROTOCOLS=cfg.ALLOW_UNKNOWN_PROTOCOLS||!1,ALLOW_SELF_CLOSE_IN_ATTR=!1!==cfg.ALLOW_SELF_CLOSE_IN_ATTR,SAFE_FOR_TEMPLATES=cfg.SAFE_FOR_TEMPLATES||!1,SAFE_FOR_XML=!1!==cfg.SAFE_FOR_XML,WHOLE_DOCUMENT=cfg.WHOLE_DOCUMENT||!1,RETURN_DOM=cfg.RETURN_DOM||!1,RETURN_DOM_FRAGMENT=cfg.RETURN_DOM_FRAGMENT||!1,RETURN_TRUSTED_TYPE=cfg.RETURN_TRUSTED_TYPE||!1,FORCE_BODY=cfg.FORCE_BODY||!1,SANITIZE_DOM=!1!==cfg.SANITIZE_DOM,SANITIZE_NAMED_PROPS=cfg.SANITIZE_NAMED_PROPS||!1,KEEP_CONTENT=!1!==cfg.KEEP_CONTENT,IN_PLACE=cfg.IN_PLACE||!1,IS_ALLOWED_URI$1=cfg.ALLOWED_URI_REGEXP||IS_ALLOWED_URI,NAMESPACE=cfg.NAMESPACE||HTML_NAMESPACE,MATHML_TEXT_INTEGRATION_POINTS=cfg.MATHML_TEXT_INTEGRATION_POINTS||MATHML_TEXT_INTEGRATION_POINTS,HTML_INTEGRATION_POINTS=cfg.HTML_INTEGRATION_POINTS||HTML_INTEGRATION_POINTS,CUSTOM_ELEMENT_HANDLING=cfg.CUSTOM_ELEMENT_HANDLING||{},cfg.CUSTOM_ELEMENT_HANDLING&&isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck=cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck),cfg.CUSTOM_ELEMENT_HANDLING&&isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(CUSTOM_ELEMENT_HANDLING.attributeNameCheck=cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),cfg.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),SAFE_FOR_TEMPLATES&&(ALLOW_DATA_ATTR=!1),RETURN_DOM_FRAGMENT&&(RETURN_DOM=!0),USE_PROFILES&&(ALLOWED_TAGS=addToSet({},text),ALLOWED_ATTR=[],!0===USE_PROFILES.html&&(addToSet(ALLOWED_TAGS,html$1),addToSet(ALLOWED_ATTR,html)),!0===USE_PROFILES.svg&&(addToSet(ALLOWED_TAGS,svg$1),addToSet(ALLOWED_ATTR,svg),addToSet(ALLOWED_ATTR,xml)),!0===USE_PROFILES.svgFilters&&(addToSet(ALLOWED_TAGS,svgFilters),addToSet(ALLOWED_ATTR,svg),addToSet(ALLOWED_ATTR,xml)),!0===USE_PROFILES.mathMl&&(addToSet(ALLOWED_TAGS,mathMl$1),addToSet(ALLOWED_ATTR,mathMl),addToSet(ALLOWED_ATTR,xml))),cfg.ADD_TAGS&&(ALLOWED_TAGS===DEFAULT_ALLOWED_TAGS&&(ALLOWED_TAGS=clone(ALLOWED_TAGS)),addToSet(ALLOWED_TAGS,cfg.ADD_TAGS,transformCaseFunc)),cfg.ADD_ATTR&&(ALLOWED_ATTR===DEFAULT_ALLOWED_ATTR&&(ALLOWED_ATTR=clone(ALLOWED_ATTR)),addToSet(ALLOWED_ATTR,cfg.ADD_ATTR,transformCaseFunc)),cfg.ADD_URI_SAFE_ATTR&&addToSet(URI_SAFE_ATTRIBUTES,cfg.ADD_URI_SAFE_ATTR,transformCaseFunc),cfg.FORBID_CONTENTS&&(FORBID_CONTENTS===DEFAULT_FORBID_CONTENTS&&(FORBID_CONTENTS=clone(FORBID_CONTENTS)),addToSet(FORBID_CONTENTS,cfg.FORBID_CONTENTS,transformCaseFunc)),KEEP_CONTENT&&(ALLOWED_TAGS["#text"]=!0),WHOLE_DOCUMENT&&addToSet(ALLOWED_TAGS,["html","head","body"]),ALLOWED_TAGS.table&&(addToSet(ALLOWED_TAGS,["tbody"]),delete FORBID_TAGS.tbody),cfg.TRUSTED_TYPES_POLICY){if("function"!=typeof cfg.TRUSTED_TYPES_POLICY.createHTML)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');trustedTypesPolicy=cfg.TRUSTED_TYPES_POLICY,emptyHTML=trustedTypesPolicy.createHTML("")}else void 0===trustedTypesPolicy&&(trustedTypesPolicy=function _createTrustedTypesPolicy(trustedTypes,purifyHostElement){if("object"!=typeof trustedTypes||"function"!=typeof trustedTypes.createPolicy)return null;let suffix=null;purifyHostElement&&purifyHostElement.hasAttribute("data-tt-policy-suffix")&&(suffix=purifyHostElement.getAttribute("data-tt-policy-suffix"));const policyName="dompurify"+(suffix?"#"+suffix:"");try{return trustedTypes.createPolicy(policyName,{createHTML:html=>html,createScriptURL:scriptUrl=>scriptUrl})}catch(_){return console.warn("TrustedTypes policy "+policyName+" could not be created."),null}}(trustedTypes,currentScript)),null!==trustedTypesPolicy&&"string"==typeof emptyHTML&&(emptyHTML=trustedTypesPolicy.createHTML(""));freeze&&freeze(cfg),CONFIG=cfg}},ALL_SVG_TAGS=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),ALL_MATHML_TAGS=addToSet({},[...mathMl$1,...mathMlDisallowed]),_forceRemove=function _forceRemove(node){arrayPush(DOMPurify.removed,{element:node});try{getParentNode(node).removeChild(node)}catch(_){remove(node)}},_removeAttribute=function _removeAttribute(name,element){try{arrayPush(DOMPurify.removed,{attribute:element.getAttributeNode(name),from:element})}catch(_){arrayPush(DOMPurify.removed,{attribute:null,from:element})}if(element.removeAttribute(name),"is"===name)if(RETURN_DOM||RETURN_DOM_FRAGMENT)try{_forceRemove(element)}catch(_){}else try{element.setAttribute(name,"")}catch(_){}},_initDocument=function _initDocument(dirty){let doc=null,leadingWhitespace=null;if(FORCE_BODY)dirty="<remove></remove>"+dirty;else{const matches=stringMatch(dirty,/^[\r\n\t ]+/);leadingWhitespace=matches&&matches[0]}"application/xhtml+xml"===PARSER_MEDIA_TYPE&&NAMESPACE===HTML_NAMESPACE&&(dirty='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+dirty+"</body></html>");const dirtyPayload=trustedTypesPolicy?trustedTypesPolicy.createHTML(dirty):dirty;if(NAMESPACE===HTML_NAMESPACE)try{doc=(new DOMParser).parseFromString(dirtyPayload,PARSER_MEDIA_TYPE)}catch(_){}if(!doc||!doc.documentElement){doc=implementation.createDocument(NAMESPACE,"template",null);try{doc.documentElement.innerHTML=IS_EMPTY_INPUT?emptyHTML:dirtyPayload}catch(_){}}const body=doc.body||doc.documentElement;return dirty&&leadingWhitespace&&body.insertBefore(document.createTextNode(leadingWhitespace),body.childNodes[0]||null),NAMESPACE===HTML_NAMESPACE?getElementsByTagName.call(doc,WHOLE_DOCUMENT?"html":"body")[0]:WHOLE_DOCUMENT?doc.documentElement:body},_createNodeIterator=function _createNodeIterator(root){return createNodeIterator.call(root.ownerDocument||root,root,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_PROCESSING_INSTRUCTION|NodeFilter.SHOW_CDATA_SECTION,null)},_isClobbered=function _isClobbered(element){return element instanceof HTMLFormElement&&("string"!=typeof element.nodeName||"string"!=typeof element.textContent||"function"!=typeof element.removeChild||!(element.attributes instanceof NamedNodeMap)||"function"!=typeof element.removeAttribute||"function"!=typeof element.setAttribute||"string"!=typeof element.namespaceURI||"function"!=typeof element.insertBefore||"function"!=typeof element.hasChildNodes)},_isNode=function _isNode(value){return"function"==typeof Node&&value instanceof Node};function _executeHooks(hooks,currentNode,data){arrayForEach(hooks,hook=>{hook.call(DOMPurify,currentNode,data,CONFIG)})}const _sanitizeElements=function _sanitizeElements(currentNode){let content=null;if(_executeHooks(hooks.beforeSanitizeElements,currentNode,null),_isClobbered(currentNode))return _forceRemove(currentNode),!0;const tagName=transformCaseFunc(currentNode.nodeName);if(_executeHooks(hooks.uponSanitizeElement,currentNode,{tagName,allowedTags:ALLOWED_TAGS}),SAFE_FOR_XML&¤tNode.hasChildNodes()&&!_isNode(currentNode.firstElementChild)&®ExpTest(/<[/\w!]/g,currentNode.innerHTML)&®ExpTest(/<[/\w!]/g,currentNode.textContent))return _forceRemove(currentNode),!0;if(currentNode.nodeType===NODE_TYPE_progressingInstruction)return _forceRemove(currentNode),!0;if(SAFE_FOR_XML&¤tNode.nodeType===NODE_TYPE_comment&®ExpTest(/<[/\w]/g,currentNode.data))return _forceRemove(currentNode),!0;if(!ALLOWED_TAGS[tagName]||FORBID_TAGS[tagName]){if(!FORBID_TAGS[tagName]&&_isBasicCustomElement(tagName)){if(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&®ExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,tagName))return!1;if(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName))return!1}if(KEEP_CONTENT&&!FORBID_CONTENTS[tagName]){const parentNode=getParentNode(currentNode)||currentNode.parentNode,childNodes=getChildNodes(currentNode)||currentNode.childNodes;if(childNodes&&parentNode){for(let i=childNodes.length-1;i>=0;--i){const childClone=cloneNode(childNodes[i],!0);childClone.__removalCount=(currentNode.__removalCount||0)+1,parentNode.insertBefore(childClone,getNextSibling(currentNode))}}}return _forceRemove(currentNode),!0}return currentNode instanceof Element&&!function _checkValidNamespace(element){let parent=getParentNode(element);parent&&parent.tagName||(parent={namespaceURI:NAMESPACE,tagName:"template"});const tagName=stringToLowerCase(element.tagName),parentTagName=stringToLowerCase(parent.tagName);return!!ALLOWED_NAMESPACES[element.namespaceURI]&&(element.namespaceURI===SVG_NAMESPACE?parent.namespaceURI===HTML_NAMESPACE?"svg"===tagName:parent.namespaceURI===MATHML_NAMESPACE?"svg"===tagName&&("annotation-xml"===parentTagName||MATHML_TEXT_INTEGRATION_POINTS[parentTagName]):Boolean(ALL_SVG_TAGS[tagName]):element.namespaceURI===MATHML_NAMESPACE?parent.namespaceURI===HTML_NAMESPACE?"math"===tagName:parent.namespaceURI===SVG_NAMESPACE?"math"===tagName&&HTML_INTEGRATION_POINTS[parentTagName]:Boolean(ALL_MATHML_TAGS[tagName]):element.namespaceURI===HTML_NAMESPACE?!(parent.namespaceURI===SVG_NAMESPACE&&!HTML_INTEGRATION_POINTS[parentTagName])&&!(parent.namespaceURI===MATHML_NAMESPACE&&!MATHML_TEXT_INTEGRATION_POINTS[parentTagName])&&!ALL_MATHML_TAGS[tagName]&&(COMMON_SVG_AND_HTML_ELEMENTS[tagName]||!ALL_SVG_TAGS[tagName]):!("application/xhtml+xml"!==PARSER_MEDIA_TYPE||!ALLOWED_NAMESPACES[element.namespaceURI]))}(currentNode)?(_forceRemove(currentNode),!0):"noscript"!==tagName&&"noembed"!==tagName&&"noframes"!==tagName||!regExpTest(/<\/no(script|embed|frames)/i,currentNode.innerHTML)?(SAFE_FOR_TEMPLATES&¤tNode.nodeType===NODE_TYPE_text&&(content=currentNode.textContent,arrayForEach([MUSTACHE_EXPR,ERB_EXPR,TMPLIT_EXPR],expr=>{content=stringReplace(content,expr," ")}),currentNode.textContent!==content&&(arrayPush(DOMPurify.removed,{element:currentNode.cloneNode()}),currentNode.textContent=content)),_executeHooks(hooks.afterSanitizeElements,currentNode,null),!1):(_forceRemove(currentNode),!0)},_isValidAttribute=function _isValidAttribute(lcTag,lcName,value){if(SANITIZE_DOM&&("id"===lcName||"name"===lcName)&&(value in document||value in formElement))return!1;if(ALLOW_DATA_ATTR&&!FORBID_ATTR[lcName]&®ExpTest(DATA_ATTR,lcName));else if(ALLOW_ARIA_ATTR&®ExpTest(ARIA_ATTR,lcName));else if(!ALLOWED_ATTR[lcName]||FORBID_ATTR[lcName]){if(!(_isBasicCustomElement(lcTag)&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&®ExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,lcTag)||CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag))&&(CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp&®ExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck,lcName)||CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName))||"is"===lcName&&CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp&®ExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck,value)||CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function&&CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))))return!1}else if(URI_SAFE_ATTRIBUTES[lcName]);else if(regExpTest(IS_ALLOWED_URI$1,stringReplace(value,ATTR_WHITESPACE,"")));else if("src"!==lcName&&"xlink:href"!==lcName&&"href"!==lcName||"script"===lcTag||0!==stringIndexOf(value,"data:")||!DATA_URI_TAGS[lcTag]){if(ALLOW_UNKNOWN_PROTOCOLS&&!regExpTest(IS_SCRIPT_OR_DATA,stringReplace(value,ATTR_WHITESPACE,"")));else if(value)return!1}else;return!0},_isBasicCustomElement=function _isBasicCustomElement(tagName){return"annotation-xml"!==tagName&&stringMatch(tagName,CUSTOM_ELEMENT)},_sanitizeAttributes=function _sanitizeAttributes(currentNode){_executeHooks(hooks.beforeSanitizeAttributes,currentNode,null);const{attributes}=currentNode;if(!attributes||_isClobbered(currentNode))return;const hookEvent={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ALLOWED_ATTR,forceKeepAttr:void 0};let l=attributes.length;for(;l--;){const attr=attributes[l],{name,namespaceURI,value:attrValue}=attr,lcName=transformCaseFunc(name),initValue=attrValue;let value="value"===name?initValue:stringTrim(initValue);if(hookEvent.attrName=lcName,hookEvent.attrValue=value,hookEvent.keepAttr=!0,hookEvent.forceKeepAttr=void 0,_executeHooks(hooks.uponSanitizeAttribute,currentNode,hookEvent),value=hookEvent.attrValue,!SANITIZE_NAMED_PROPS||"id"!==lcName&&"name"!==lcName||(_removeAttribute(name,currentNode),value="user-content-"+value),SAFE_FOR_XML&®ExpTest(/((--!?|])>)|<\/(style|title)/i,value)){_removeAttribute(name,currentNode);continue}if(hookEvent.forceKeepAttr)continue;if(!hookEvent.keepAttr){_removeAttribute(name,currentNode);continue}if(!ALLOW_SELF_CLOSE_IN_ATTR&®ExpTest(/\/>/i,value)){_removeAttribute(name,currentNode);continue}SAFE_FOR_TEMPLATES&&arrayForEach([MUSTACHE_EXPR,ERB_EXPR,TMPLIT_EXPR],expr=>{value=stringReplace(value,expr," ")});const lcTag=transformCaseFunc(currentNode.nodeName);if(_isValidAttribute(lcTag,lcName,value)){if(trustedTypesPolicy&&"object"==typeof trustedTypes&&"function"==typeof trustedTypes.getAttributeType)if(namespaceURI);else switch(trustedTypes.getAttributeType(lcTag,lcName)){case"TrustedHTML":value=trustedTypesPolicy.createHTML(value);break;case"TrustedScriptURL":value=trustedTypesPolicy.createScriptURL(value)}if(value!==initValue)try{namespaceURI?currentNode.setAttributeNS(namespaceURI,name,value):currentNode.setAttribute(name,value),_isClobbered(currentNode)?_forceRemove(currentNode):arrayPop(DOMPurify.removed)}catch(_){_removeAttribute(name,currentNode)}}else _removeAttribute(name,currentNode)}_executeHooks(hooks.afterSanitizeAttributes,currentNode,null)},_sanitizeShadowDOM=function _sanitizeShadowDOM(fragment){let shadowNode=null;const shadowIterator=_createNodeIterator(fragment);for(_executeHooks(hooks.beforeSanitizeShadowDOM,fragment,null);shadowNode=shadowIterator.nextNode();)_executeHooks(hooks.uponSanitizeShadowNode,shadowNode,null),_sanitizeElements(shadowNode),_sanitizeAttributes(shadowNode),shadowNode.content instanceof DocumentFragment&&_sanitizeShadowDOM(shadowNode.content);_executeHooks(hooks.afterSanitizeShadowDOM,fragment,null)};return DOMPurify.sanitize=function(dirty){let cfg=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},body=null,importedNode=null,currentNode=null,returnNode=null;if(IS_EMPTY_INPUT=!dirty,IS_EMPTY_INPUT&&(dirty="\x3c!--\x3e"),"string"!=typeof dirty&&!_isNode(dirty)){if("function"!=typeof dirty.toString)throw typeErrorCreate("toString is not a function");if("string"!=typeof(dirty=dirty.toString()))throw typeErrorCreate("dirty is not a string, aborting")}if(!DOMPurify.isSupported)return dirty;if(SET_CONFIG||_parseConfig(cfg),DOMPurify.removed=[],"string"==typeof dirty&&(IN_PLACE=!1),IN_PLACE){if(dirty.nodeName){const tagName=transformCaseFunc(dirty.nodeName);if(!ALLOWED_TAGS[tagName]||FORBID_TAGS[tagName])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(dirty instanceof Node)body=_initDocument("\x3c!----\x3e"),importedNode=body.ownerDocument.importNode(dirty,!0),importedNode.nodeType===NODE_TYPE_element&&"BODY"===importedNode.nodeName||"HTML"===importedNode.nodeName?body=importedNode:body.appendChild(importedNode);else{if(!RETURN_DOM&&!SAFE_FOR_TEMPLATES&&!WHOLE_DOCUMENT&&-1===dirty.indexOf("<"))return trustedTypesPolicy&&RETURN_TRUSTED_TYPE?trustedTypesPolicy.createHTML(dirty):dirty;if(body=_initDocument(dirty),!body)return RETURN_DOM?null:RETURN_TRUSTED_TYPE?emptyHTML:""}body&&FORCE_BODY&&_forceRemove(body.firstChild);const nodeIterator=_createNodeIterator(IN_PLACE?dirty:body);for(;currentNode=nodeIterator.nextNode();)_sanitizeElements(currentNode),_sanitizeAttributes(currentNode),currentNode.content instanceof DocumentFragment&&_sanitizeShadowDOM(currentNode.content);if(IN_PLACE)return dirty;if(RETURN_DOM){if(RETURN_DOM_FRAGMENT)for(returnNode=createDocumentFragment.call(body.ownerDocument);body.firstChild;)returnNode.appendChild(body.firstChild);else returnNode=body;return(ALLOWED_ATTR.shadowroot||ALLOWED_ATTR.shadowrootmode)&&(returnNode=importNode.call(originalDocument,returnNode,!0)),returnNode}let serializedHTML=WHOLE_DOCUMENT?body.outerHTML:body.innerHTML;return WHOLE_DOCUMENT&&ALLOWED_TAGS["!doctype"]&&body.ownerDocument&&body.ownerDocument.doctype&&body.ownerDocument.doctype.name&®ExpTest(DOCTYPE_NAME,body.ownerDocument.doctype.name)&&(serializedHTML="<!DOCTYPE "+body.ownerDocument.doctype.name+">\n"+serializedHTML),SAFE_FOR_TEMPLATES&&arrayForEach([MUSTACHE_EXPR,ERB_EXPR,TMPLIT_EXPR],expr=>{serializedHTML=stringReplace(serializedHTML,expr," ")}),trustedTypesPolicy&&RETURN_TRUSTED_TYPE?trustedTypesPolicy.createHTML(serializedHTML):serializedHTML},DOMPurify.setConfig=function(){_parseConfig(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),SET_CONFIG=!0},DOMPurify.clearConfig=function(){CONFIG=null,SET_CONFIG=!1},DOMPurify.isValidAttribute=function(tag,attr,value){CONFIG||_parseConfig({});const lcTag=transformCaseFunc(tag),lcName=transformCaseFunc(attr);return _isValidAttribute(lcTag,lcName,value)},DOMPurify.addHook=function(entryPoint,hookFunction){"function"==typeof hookFunction&&arrayPush(hooks[entryPoint],hookFunction)},DOMPurify.removeHook=function(entryPoint,hookFunction){if(void 0!==hookFunction){const index=arrayLastIndexOf(hooks[entryPoint],hookFunction);return-1===index?void 0:arraySplice(hooks[entryPoint],index,1)[0]}return arrayPop(hooks[entryPoint])},DOMPurify.removeHooks=function(entryPoint){hooks[entryPoint]=[]},DOMPurify.removeAllHooks=function(){hooks={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},DOMPurify}()},"./node_modules/prosemirror-keymap/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{K:()=>keydownHandler,w:()=>keymap});for(var base={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},shift={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mac="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ie="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),i=0;i<10;i++)base[48+i]=base[96+i]=String(i);for(i=1;i<=24;i++)base[i+111]="F"+i;for(i=65;i<=90;i++)base[i]=String.fromCharCode(i+32),shift[i]=String.fromCharCode(i);for(var code in base)shift.hasOwnProperty(code)||(shift[code]=base[code]);var dist=__webpack_require__("./node_modules/prosemirror-state/dist/index.js");const dist_mac="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),windows="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function normalizeKeyName(name){let alt,ctrl,shift,meta,parts=name.split(/-(?!$)/),result=parts[parts.length-1];"Space"==result&&(result=" ");for(let i=0;i<parts.length-1;i++){let mod=parts[i];if(/^(cmd|meta|m)$/i.test(mod))meta=!0;else if(/^a(lt)?$/i.test(mod))alt=!0;else if(/^(c|ctrl|control)$/i.test(mod))ctrl=!0;else if(/^s(hift)?$/i.test(mod))shift=!0;else{if(!/^mod$/i.test(mod))throw new Error("Unrecognized modifier name: "+mod);dist_mac?meta=!0:ctrl=!0}}return alt&&(result="Alt-"+result),ctrl&&(result="Ctrl-"+result),meta&&(result="Meta-"+result),shift&&(result="Shift-"+result),result}function modifiers(name,event,shift=!0){return event.altKey&&(name="Alt-"+name),event.ctrlKey&&(name="Ctrl-"+name),event.metaKey&&(name="Meta-"+name),shift&&event.shiftKey&&(name="Shift-"+name),name}function keymap(bindings){return new dist.k_({props:{handleKeyDown:keydownHandler(bindings)}})}function keydownHandler(bindings){let map=function normalize(map){let copy=Object.create(null);for(let prop in map)copy[normalizeKeyName(prop)]=map[prop];return copy}(bindings);return function(view,event){let baseName,name=function keyName(event){var name=!(mac&&event.metaKey&&event.shiftKey&&!event.ctrlKey&&!event.altKey||ie&&event.shiftKey&&event.key&&1==event.key.length||"Unidentified"==event.key)&&event.key||(event.shiftKey?shift:base)[event.keyCode]||event.key||"Unidentified";return"Esc"==name&&(name="Escape"),"Del"==name&&(name="Delete"),"Left"==name&&(name="ArrowLeft"),"Up"==name&&(name="ArrowUp"),"Right"==name&&(name="ArrowRight"),"Down"==name&&(name="ArrowDown"),name}(event),direct=map[modifiers(name,event)];if(direct&&direct(view.state,view.dispatch,view))return!0;if(1==name.length&&" "!=name){if(event.shiftKey){let noShift=map[modifiers(name,event,!1)];if(noShift&&noShift(view.state,view.dispatch,view))return!0}if((event.altKey||event.metaKey||event.ctrlKey)&&!(windows&&event.ctrlKey&&event.altKey)&&(baseName=base[event.keyCode])&&baseName!=name){let fromCode=map[modifiers(baseName,event)];if(fromCode&&fromCode(view.state,view.dispatch,view))return!0}}return!1}}},"./node_modules/prosemirror-model/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function OrderedMap(content){this.content=content}__webpack_require__.d(__webpack_exports__,{S4:()=>DOMParser,ZF:()=>DOMSerializer,FK:()=>Fragment,CU:()=>Mark,sX:()=>MarkType,bP:()=>Node,u$:()=>NodeRange,vI:()=>ReplaceError,Sj:()=>Schema,Ji:()=>Slice}),OrderedMap.prototype={constructor:OrderedMap,find:function(key){for(var i=0;i<this.content.length;i+=2)if(this.content[i]===key)return i;return-1},get:function(key){var found=this.find(key);return-1==found?void 0:this.content[found+1]},update:function(key,value,newKey){var self=newKey&&newKey!=key?this.remove(newKey):this,found=self.find(key),content=self.content.slice();return-1==found?content.push(newKey||key,value):(content[found+1]=value,newKey&&(content[found]=newKey)),new OrderedMap(content)},remove:function(key){var found=this.find(key);if(-1==found)return this;var content=this.content.slice();return content.splice(found,2),new OrderedMap(content)},addToStart:function(key,value){return new OrderedMap([key,value].concat(this.remove(key).content))},addToEnd:function(key,value){var content=this.remove(key).content.slice();return content.push(key,value),new OrderedMap(content)},addBefore:function(place,key,value){var without=this.remove(key),content=without.content.slice(),found=without.find(place);return content.splice(-1==found?content.length:found,0,key,value),new OrderedMap(content)},forEach:function(f){for(var i=0;i<this.content.length;i+=2)f(this.content[i],this.content[i+1])},prepend:function(map){return(map=OrderedMap.from(map)).size?new OrderedMap(map.content.concat(this.subtract(map).content)):this},append:function(map){return(map=OrderedMap.from(map)).size?new OrderedMap(this.subtract(map).content.concat(map.content)):this},subtract:function(map){var result=this;map=OrderedMap.from(map);for(var i=0;i<map.content.length;i+=2)result=result.remove(map.content[i]);return result},toObject:function(){var result={};return this.forEach(function(key,value){result[key]=value}),result},get size(){return this.content.length>>1}},OrderedMap.from=function(value){if(value instanceof OrderedMap)return value;var content=[];if(value)for(var prop in value)content.push(prop,value[prop]);return new OrderedMap(content)};const dist=OrderedMap;function findDiffStart(a,b,pos){for(let i=0;;i++){if(i==a.childCount||i==b.childCount)return a.childCount==b.childCount?null:pos;let childA=a.child(i),childB=b.child(i);if(childA!=childB){if(!childA.sameMarkup(childB))return pos;if(childA.isText&&childA.text!=childB.text){for(let j=0;childA.text[j]==childB.text[j];j++)pos++;return pos}if(childA.content.size||childB.content.size){let inner=findDiffStart(childA.content,childB.content,pos+1);if(null!=inner)return inner}pos+=childA.nodeSize}else pos+=childA.nodeSize}}function findDiffEnd(a,b,posA,posB){for(let iA=a.childCount,iB=b.childCount;;){if(0==iA||0==iB)return iA==iB?null:{a:posA,b:posB};let childA=a.child(--iA),childB=b.child(--iB),size=childA.nodeSize;if(childA!=childB){if(!childA.sameMarkup(childB))return{a:posA,b:posB};if(childA.isText&&childA.text!=childB.text){let same=0,minSize=Math.min(childA.text.length,childB.text.length);for(;same<minSize&&childA.text[childA.text.length-same-1]==childB.text[childB.text.length-same-1];)same++,posA--,posB--;return{a:posA,b:posB}}if(childA.content.size||childB.content.size){let inner=findDiffEnd(childA.content,childB.content,posA-1,posB-1);if(inner)return inner}posA-=size,posB-=size}else posA-=size,posB-=size}}class Fragment{constructor(content,size){if(this.content=content,this.size=size||0,null==size)for(let i=0;i<content.length;i++)this.size+=content[i].nodeSize}nodesBetween(from,to,f,nodeStart=0,parent){for(let i=0,pos=0;pos<to;i++){let child=this.content[i],end=pos+child.nodeSize;if(end>from&&!1!==f(child,nodeStart+pos,parent||null,i)&&child.content.size){let start=pos+1;child.nodesBetween(Math.max(0,from-start),Math.min(child.content.size,to-start),f,nodeStart+start)}pos=end}}descendants(f){this.nodesBetween(0,this.size,f)}textBetween(from,to,blockSeparator,leafText){let text="",first=!0;return this.nodesBetween(from,to,(node,pos)=>{let nodeText=node.isText?node.text.slice(Math.max(from,pos)-pos,to-pos):node.isLeaf?leafText?"function"==typeof leafText?leafText(node):leafText:node.type.spec.leafText?node.type.spec.leafText(node):"":"";node.isBlock&&(node.isLeaf&&nodeText||node.isTextblock)&&blockSeparator&&(first?first=!1:text+=blockSeparator),text+=nodeText},0),text}append(other){if(!other.size)return this;if(!this.size)return other;let last=this.lastChild,first=other.firstChild,content=this.content.slice(),i=0;for(last.isText&&last.sameMarkup(first)&&(content[content.length-1]=last.withText(last.text+first.text),i=1);i<other.content.length;i++)content.push(other.content[i]);return new Fragment(content,this.size+other.size)}cut(from,to=this.size){if(0==from&&to==this.size)return this;let result=[],size=0;if(to>from)for(let i=0,pos=0;pos<to;i++){let child=this.content[i],end=pos+child.nodeSize;end>from&&((pos<from||end>to)&&(child=child.isText?child.cut(Math.max(0,from-pos),Math.min(child.text.length,to-pos)):child.cut(Math.max(0,from-pos-1),Math.min(child.content.size,to-pos-1))),result.push(child),size+=child.nodeSize),pos=end}return new Fragment(result,size)}cutByIndex(from,to){return from==to?Fragment.empty:0==from&&to==this.content.length?this:new Fragment(this.content.slice(from,to))}replaceChild(index,node){let current=this.content[index];if(current==node)return this;let copy=this.content.slice(),size=this.size+node.nodeSize-current.nodeSize;return copy[index]=node,new Fragment(copy,size)}addToStart(node){return new Fragment([node].concat(this.content),this.size+node.nodeSize)}addToEnd(node){return new Fragment(this.content.concat(node),this.size+node.nodeSize)}eq(other){if(this.content.length!=other.content.length)return!1;for(let i=0;i<this.content.length;i++)if(!this.content[i].eq(other.content[i]))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(index){let found=this.content[index];if(!found)throw new RangeError("Index "+index+" out of range for "+this);return found}maybeChild(index){return this.content[index]||null}forEach(f){for(let i=0,p=0;i<this.content.length;i++){let child=this.content[i];f(child,p,i),p+=child.nodeSize}}findDiffStart(other,pos=0){return findDiffStart(this,other,pos)}findDiffEnd(other,pos=this.size,otherPos=other.size){return findDiffEnd(this,other,pos,otherPos)}findIndex(pos,round=-1){if(0==pos)return retIndex(0,pos);if(pos==this.size)return retIndex(this.content.length,pos);if(pos>this.size||pos<0)throw new RangeError(`Position ${pos} outside of fragment (${this})`);for(let i=0,curPos=0;;i++){let end=curPos+this.child(i).nodeSize;if(end>=pos)return end==pos||round>0?retIndex(i+1,end):retIndex(i,curPos);curPos=end}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(n=>n.toJSON()):null}static fromJSON(schema,value){if(!value)return Fragment.empty;if(!Array.isArray(value))throw new RangeError("Invalid input for Fragment.fromJSON");return new Fragment(value.map(schema.nodeFromJSON))}static fromArray(array){if(!array.length)return Fragment.empty;let joined,size=0;for(let i=0;i<array.length;i++){let node=array[i];size+=node.nodeSize,i&&node.isText&&array[i-1].sameMarkup(node)?(joined||(joined=array.slice(0,i)),joined[joined.length-1]=node.withText(joined[joined.length-1].text+node.text)):joined&&joined.push(node)}return new Fragment(joined||array,size)}static from(nodes){if(!nodes)return Fragment.empty;if(nodes instanceof Fragment)return nodes;if(Array.isArray(nodes))return this.fromArray(nodes);if(nodes.attrs)return new Fragment([nodes],nodes.nodeSize);throw new RangeError("Can not convert "+nodes+" to a Fragment"+(nodes.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Fragment.empty=new Fragment([],0);const found={index:0,offset:0};function retIndex(index,offset){return found.index=index,found.offset=offset,found}function compareDeep(a,b){if(a===b)return!0;if(!a||"object"!=typeof a||!b||"object"!=typeof b)return!1;let array=Array.isArray(a);if(Array.isArray(b)!=array)return!1;if(array){if(a.length!=b.length)return!1;for(let i=0;i<a.length;i++)if(!compareDeep(a[i],b[i]))return!1}else{for(let p in a)if(!(p in b)||!compareDeep(a[p],b[p]))return!1;for(let p in b)if(!(p in a))return!1}return!0}class Mark{constructor(type,attrs){this.type=type,this.attrs=attrs}addToSet(set){let copy,placed=!1;for(let i=0;i<set.length;i++){let other=set[i];if(this.eq(other))return set;if(this.type.excludes(other.type))copy||(copy=set.slice(0,i));else{if(other.type.excludes(this.type))return set;!placed&&other.type.rank>this.type.rank&&(copy||(copy=set.slice(0,i)),copy.push(this),placed=!0),copy&©.push(other)}}return copy||(copy=set.slice()),placed||copy.push(this),copy}removeFromSet(set){for(let i=0;i<set.length;i++)if(this.eq(set[i]))return set.slice(0,i).concat(set.slice(i+1));return set}isInSet(set){for(let i=0;i<set.length;i++)if(this.eq(set[i]))return!0;return!1}eq(other){return this==other||this.type==other.type&&compareDeep(this.attrs,other.attrs)}toJSON(){let obj={type:this.type.name};for(let _ in this.attrs){obj.attrs=this.attrs;break}return obj}static fromJSON(schema,json){if(!json)throw new RangeError("Invalid input for Mark.fromJSON");let type=schema.marks[json.type];if(!type)throw new RangeError(`There is no mark type ${json.type} in this schema`);let mark=type.create(json.attrs);return type.checkAttrs(mark.attrs),mark}static sameSet(a,b){if(a==b)return!0;if(a.length!=b.length)return!1;for(let i=0;i<a.length;i++)if(!a[i].eq(b[i]))return!1;return!0}static setFrom(marks){if(!marks||Array.isArray(marks)&&0==marks.length)return Mark.none;if(marks instanceof Mark)return[marks];let copy=marks.slice();return copy.sort((a,b)=>a.type.rank-b.type.rank),copy}}Mark.none=[];class ReplaceError extends Error{}class Slice{constructor(content,openStart,openEnd){this.content=content,this.openStart=openStart,this.openEnd=openEnd}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(pos,fragment){let content=insertInto(this.content,pos+this.openStart,fragment);return content&&new Slice(content,this.openStart,this.openEnd)}removeBetween(from,to){return new Slice(removeRange(this.content,from+this.openStart,to+this.openStart),this.openStart,this.openEnd)}eq(other){return this.content.eq(other.content)&&this.openStart==other.openStart&&this.openEnd==other.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let json={content:this.content.toJSON()};return this.openStart>0&&(json.openStart=this.openStart),this.openEnd>0&&(json.openEnd=this.openEnd),json}static fromJSON(schema,json){if(!json)return Slice.empty;let openStart=json.openStart||0,openEnd=json.openEnd||0;if("number"!=typeof openStart||"number"!=typeof openEnd)throw new RangeError("Invalid input for Slice.fromJSON");return new Slice(Fragment.fromJSON(schema,json.content),openStart,openEnd)}static maxOpen(fragment,openIsolating=!0){let openStart=0,openEnd=0;for(let n=fragment.firstChild;n&&!n.isLeaf&&(openIsolating||!n.type.spec.isolating);n=n.firstChild)openStart++;for(let n=fragment.lastChild;n&&!n.isLeaf&&(openIsolating||!n.type.spec.isolating);n=n.lastChild)openEnd++;return new Slice(fragment,openStart,openEnd)}}function removeRange(content,from,to){let{index,offset}=content.findIndex(from),child=content.maybeChild(index),{index:indexTo,offset:offsetTo}=content.findIndex(to);if(offset==from||child.isText){if(offsetTo!=to&&!content.child(indexTo).isText)throw new RangeError("Removing non-flat range");return content.cut(0,from).append(content.cut(to))}if(index!=indexTo)throw new RangeError("Removing non-flat range");return content.replaceChild(index,child.copy(removeRange(child.content,from-offset-1,to-offset-1)))}function insertInto(content,dist,insert,parent){let{index,offset}=content.findIndex(dist),child=content.maybeChild(index);if(offset==dist||child.isText)return parent&&!parent.canReplace(index,index,insert)?null:content.cut(0,dist).append(insert).append(content.cut(dist));let inner=insertInto(child.content,dist-offset-1,insert);return inner&&content.replaceChild(index,child.copy(inner))}function replace($from,$to,slice){if(slice.openStart>$from.depth)throw new ReplaceError("Inserted content deeper than insertion position");if($from.depth-slice.openStart!=$to.depth-slice.openEnd)throw new ReplaceError("Inconsistent open depths");return replaceOuter($from,$to,slice,0)}function replaceOuter($from,$to,slice,depth){let index=$from.index(depth),node=$from.node(depth);if(index==$to.index(depth)&&depth<$from.depth-slice.openStart){let inner=replaceOuter($from,$to,slice,depth+1);return node.copy(node.content.replaceChild(index,inner))}if(slice.content.size){if(slice.openStart||slice.openEnd||$from.depth!=depth||$to.depth!=depth){let{start,end}=function prepareSliceForReplace(slice,$along){let extra=$along.depth-slice.openStart,node=$along.node(extra).copy(slice.content);for(let i=extra-1;i>=0;i--)node=$along.node(i).copy(Fragment.from(node));return{start:node.resolveNoCache(slice.openStart+extra),end:node.resolveNoCache(node.content.size-slice.openEnd-extra)}}(slice,$from);return dist_close(node,replaceThreeWay($from,start,end,$to,depth))}{let parent=$from.parent,content=parent.content;return dist_close(parent,content.cut(0,$from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)))}}return dist_close(node,replaceTwoWay($from,$to,depth))}function checkJoin(main,sub){if(!sub.type.compatibleContent(main.type))throw new ReplaceError("Cannot join "+sub.type.name+" onto "+main.type.name)}function joinable($before,$after,depth){let node=$before.node(depth);return checkJoin(node,$after.node(depth)),node}function addNode(child,target){let last=target.length-1;last>=0&&child.isText&&child.sameMarkup(target[last])?target[last]=child.withText(target[last].text+child.text):target.push(child)}function addRange($start,$end,depth,target){let node=($end||$start).node(depth),startIndex=0,endIndex=$end?$end.index(depth):node.childCount;$start&&(startIndex=$start.index(depth),$start.depth>depth?startIndex++:$start.textOffset&&(addNode($start.nodeAfter,target),startIndex++));for(let i=startIndex;i<endIndex;i++)addNode(node.child(i),target);$end&&$end.depth==depth&&$end.textOffset&&addNode($end.nodeBefore,target)}function dist_close(node,content){return node.type.checkContent(content),node.copy(content)}function replaceThreeWay($from,$start,$end,$to,depth){let openStart=$from.depth>depth&&joinable($from,$start,depth+1),openEnd=$to.depth>depth&&joinable($end,$to,depth+1),content=[];return addRange(null,$from,depth,content),openStart&&openEnd&&$start.index(depth)==$end.index(depth)?(checkJoin(openStart,openEnd),addNode(dist_close(openStart,replaceThreeWay($from,$start,$end,$to,depth+1)),content)):(openStart&&addNode(dist_close(openStart,replaceTwoWay($from,$start,depth+1)),content),addRange($start,$end,depth,content),openEnd&&addNode(dist_close(openEnd,replaceTwoWay($end,$to,depth+1)),content)),addRange($to,null,depth,content),new Fragment(content)}function replaceTwoWay($from,$to,depth){let content=[];if(addRange(null,$from,depth,content),$from.depth>depth){addNode(dist_close(joinable($from,$to,depth+1),replaceTwoWay($from,$to,depth+1)),content)}return addRange($to,null,depth,content),new Fragment(content)}Slice.empty=new Slice(Fragment.empty,0,0);class ResolvedPos{constructor(pos,path,parentOffset){this.pos=pos,this.path=path,this.parentOffset=parentOffset,this.depth=path.length/3-1}resolveDepth(val){return null==val?this.depth:val<0?this.depth+val:val}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(depth){return this.path[3*this.resolveDepth(depth)]}index(depth){return this.path[3*this.resolveDepth(depth)+1]}indexAfter(depth){return depth=this.resolveDepth(depth),this.index(depth)+(depth!=this.depth||this.textOffset?1:0)}start(depth){return 0==(depth=this.resolveDepth(depth))?0:this.path[3*depth-1]+1}end(depth){return depth=this.resolveDepth(depth),this.start(depth)+this.node(depth).content.size}before(depth){if(!(depth=this.resolveDepth(depth)))throw new RangeError("There is no position before the top-level node");return depth==this.depth+1?this.pos:this.path[3*depth-1]}after(depth){if(!(depth=this.resolveDepth(depth)))throw new RangeError("There is no position after the top-level node");return depth==this.depth+1?this.pos:this.path[3*depth-1]+this.path[3*depth].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let parent=this.parent,index=this.index(this.depth);if(index==parent.childCount)return null;let dOff=this.pos-this.path[this.path.length-1],child=parent.child(index);return dOff?parent.child(index).cut(dOff):child}get nodeBefore(){let index=this.index(this.depth),dOff=this.pos-this.path[this.path.length-1];return dOff?this.parent.child(index).cut(0,dOff):0==index?null:this.parent.child(index-1)}posAtIndex(index,depth){depth=this.resolveDepth(depth);let node=this.path[3*depth],pos=0==depth?0:this.path[3*depth-1]+1;for(let i=0;i<index;i++)pos+=node.child(i).nodeSize;return pos}marks(){let parent=this.parent,index=this.index();if(0==parent.content.size)return Mark.none;if(this.textOffset)return parent.child(index).marks;let main=parent.maybeChild(index-1),other=parent.maybeChild(index);if(!main){let tmp=main;main=other,other=tmp}let marks=main.marks;for(var i=0;i<marks.length;i++)!1!==marks[i].type.spec.inclusive||other&&marks[i].isInSet(other.marks)||(marks=marks[i--].removeFromSet(marks));return marks}marksAcross($end){let after=this.parent.maybeChild(this.index());if(!after||!after.isInline)return null;let marks=after.marks,next=$end.parent.maybeChild($end.index());for(var i=0;i<marks.length;i++)!1!==marks[i].type.spec.inclusive||next&&marks[i].isInSet(next.marks)||(marks=marks[i--].removeFromSet(marks));return marks}sharedDepth(pos){for(let depth=this.depth;depth>0;depth--)if(this.start(depth)<=pos&&this.end(depth)>=pos)return depth;return 0}blockRange(other=this,pred){if(other.pos<this.pos)return other.blockRange(this);for(let d=this.depth-(this.parent.inlineContent||this.pos==other.pos?1:0);d>=0;d--)if(other.pos<=this.end(d)&&(!pred||pred(this.node(d))))return new NodeRange(this,other,d);return null}sameParent(other){return this.pos-this.parentOffset==other.pos-other.parentOffset}max(other){return other.pos>this.pos?other:this}min(other){return other.pos<this.pos?other:this}toString(){let str="";for(let i=1;i<=this.depth;i++)str+=(str?"/":"")+this.node(i).type.name+"_"+this.index(i-1);return str+":"+this.parentOffset}static resolve(doc,pos){if(!(pos>=0&&pos<=doc.content.size))throw new RangeError("Position "+pos+" out of range");let path=[],start=0,parentOffset=pos;for(let node=doc;;){let{index,offset}=node.content.findIndex(parentOffset),rem=parentOffset-offset;if(path.push(node,index,start+offset),!rem)break;if(node=node.child(index),node.isText)break;parentOffset=rem-1,start+=offset+1}return new ResolvedPos(pos,path,parentOffset)}static resolveCached(doc,pos){let cache=resolveCache.get(doc);if(cache)for(let i=0;i<cache.elts.length;i++){let elt=cache.elts[i];if(elt.pos==pos)return elt}else resolveCache.set(doc,cache=new ResolveCache);let result=cache.elts[cache.i]=ResolvedPos.resolve(doc,pos);return cache.i=(cache.i+1)%resolveCacheSize,result}}class ResolveCache{constructor(){this.elts=[],this.i=0}}const resolveCacheSize=12,resolveCache=new WeakMap;class NodeRange{constructor($from,$to,depth){this.$from=$from,this.$to=$to,this.depth=depth}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 emptyAttrs=Object.create(null);class Node{constructor(type,attrs,content,marks=Mark.none){this.type=type,this.attrs=attrs,this.marks=marks,this.content=content||Fragment.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(index){return this.content.child(index)}maybeChild(index){return this.content.maybeChild(index)}forEach(f){this.content.forEach(f)}nodesBetween(from,to,f,startPos=0){this.content.nodesBetween(from,to,f,startPos,this)}descendants(f){this.nodesBetween(0,this.content.size,f)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(from,to,blockSeparator,leafText){return this.content.textBetween(from,to,blockSeparator,leafText)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(other){return this==other||this.sameMarkup(other)&&this.content.eq(other.content)}sameMarkup(other){return this.hasMarkup(other.type,other.attrs,other.marks)}hasMarkup(type,attrs,marks){return this.type==type&&compareDeep(this.attrs,attrs||type.defaultAttrs||emptyAttrs)&&Mark.sameSet(this.marks,marks||Mark.none)}copy(content=null){return content==this.content?this:new Node(this.type,this.attrs,content,this.marks)}mark(marks){return marks==this.marks?this:new Node(this.type,this.attrs,this.content,marks)}cut(from,to=this.content.size){return 0==from&&to==this.content.size?this:this.copy(this.content.cut(from,to))}slice(from,to=this.content.size,includeParents=!1){if(from==to)return Slice.empty;let $from=this.resolve(from),$to=this.resolve(to),depth=includeParents?0:$from.sharedDepth(to),start=$from.start(depth),content=$from.node(depth).content.cut($from.pos-start,$to.pos-start);return new Slice(content,$from.depth-depth,$to.depth-depth)}replace(from,to,slice){return replace(this.resolve(from),this.resolve(to),slice)}nodeAt(pos){for(let node=this;;){let{index,offset}=node.content.findIndex(pos);if(node=node.maybeChild(index),!node)return null;if(offset==pos||node.isText)return node;pos-=offset+1}}childAfter(pos){let{index,offset}=this.content.findIndex(pos);return{node:this.content.maybeChild(index),index,offset}}childBefore(pos){if(0==pos)return{node:null,index:0,offset:0};let{index,offset}=this.content.findIndex(pos);if(offset<pos)return{node:this.content.child(index),index,offset};let node=this.content.child(index-1);return{node,index:index-1,offset:offset-node.nodeSize}}resolve(pos){return ResolvedPos.resolveCached(this,pos)}resolveNoCache(pos){return ResolvedPos.resolve(this,pos)}rangeHasMark(from,to,type){let found=!1;return to>from&&this.nodesBetween(from,to,node=>(type.isInSet(node.marks)&&(found=!0),!found)),found}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 name=this.type.name;return this.content.size&&(name+="("+this.content.toStringInner()+")"),wrapMarks(this.marks,name)}contentMatchAt(index){let match=this.type.contentMatch.matchFragment(this.content,0,index);if(!match)throw new Error("Called contentMatchAt on a node with invalid content");return match}canReplace(from,to,replacement=Fragment.empty,start=0,end=replacement.childCount){let one=this.contentMatchAt(from).matchFragment(replacement,start,end),two=one&&one.matchFragment(this.content,to);if(!two||!two.validEnd)return!1;for(let i=start;i<end;i++)if(!this.type.allowsMarks(replacement.child(i).marks))return!1;return!0}canReplaceWith(from,to,type,marks){if(marks&&!this.type.allowsMarks(marks))return!1;let start=this.contentMatchAt(from).matchType(type),end=start&&start.matchFragment(this.content,to);return!!end&&end.validEnd}canAppend(other){return other.content.size?this.canReplace(this.childCount,this.childCount,other.content):this.type.compatibleContent(other.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let copy=Mark.none;for(let i=0;i<this.marks.length;i++){let mark=this.marks[i];mark.type.checkAttrs(mark.attrs),copy=mark.addToSet(copy)}if(!Mark.sameSet(copy,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(m=>m.type.name)}`);this.content.forEach(node=>node.check())}toJSON(){let obj={type:this.type.name};for(let _ in this.attrs){obj.attrs=this.attrs;break}return this.content.size&&(obj.content=this.content.toJSON()),this.marks.length&&(obj.marks=this.marks.map(n=>n.toJSON())),obj}static fromJSON(schema,json){if(!json)throw new RangeError("Invalid input for Node.fromJSON");let marks;if(json.marks){if(!Array.isArray(json.marks))throw new RangeError("Invalid mark data for Node.fromJSON");marks=json.marks.map(schema.markFromJSON)}if("text"==json.type){if("string"!=typeof json.text)throw new RangeError("Invalid text node in JSON");return schema.text(json.text,marks)}let content=Fragment.fromJSON(schema,json.content),node=schema.nodeType(json.type).create(json.attrs,content,marks);return node.type.checkAttrs(node.attrs),node}}Node.prototype.text=void 0;class TextNode extends Node{constructor(type,attrs,content,marks){if(super(type,attrs,null,marks),!content)throw new RangeError("Empty text nodes are not allowed");this.text=content}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):wrapMarks(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(from,to){return this.text.slice(from,to)}get nodeSize(){return this.text.length}mark(marks){return marks==this.marks?this:new TextNode(this.type,this.attrs,this.text,marks)}withText(text){return text==this.text?this:new TextNode(this.type,this.attrs,text,this.marks)}cut(from=0,to=this.text.length){return 0==from&&to==this.text.length?this:this.withText(this.text.slice(from,to))}eq(other){return this.sameMarkup(other)&&this.text==other.text}toJSON(){let base=super.toJSON();return base.text=this.text,base}}function wrapMarks(marks,str){for(let i=marks.length-1;i>=0;i--)str=marks[i].type.name+"("+str+")";return str}class ContentMatch{constructor(validEnd){this.validEnd=validEnd,this.next=[],this.wrapCache=[]}static parse(string,nodeTypes){let stream=new TokenStream(string,nodeTypes);if(null==stream.next)return ContentMatch.empty;let expr=parseExpr(stream);stream.next&&stream.err("Unexpected trailing text");let match=function dfa(nfa){let labeled=Object.create(null);return explore(nullFrom(nfa,0));function explore(states){let out=[];states.forEach(node=>{nfa[node].forEach(({term,to})=>{if(!term)return;let set;for(let i=0;i<out.length;i++)out[i][0]==term&&(set=out[i][1]);nullFrom(nfa,to).forEach(node=>{set||out.push([term,set=[]]),-1==set.indexOf(node)&&set.push(node)})})});let state=labeled[states.join(",")]=new ContentMatch(states.indexOf(nfa.length-1)>-1);for(let i=0;i<out.length;i++){let states=out[i][1].sort(cmp);state.next.push({type:out[i][0],next:labeled[states.join(",")]||explore(states)})}return state}}(function nfa(expr){let nfa=[[]];return connect(compile(expr,0),node()),nfa;function node(){return nfa.push([])-1}function edge(from,to,term){let edge={term,to};return nfa[from].push(edge),edge}function connect(edges,to){edges.forEach(edge=>edge.to=to)}function compile(expr,from){if("choice"==expr.type)return expr.exprs.reduce((out,expr)=>out.concat(compile(expr,from)),[]);if("seq"!=expr.type){if("star"==expr.type){let loop=node();return edge(from,loop),connect(compile(expr.expr,loop),loop),[edge(loop)]}if("plus"==expr.type){let loop=node();return connect(compile(expr.expr,from),loop),connect(compile(expr.expr,loop),loop),[edge(loop)]}if("opt"==expr.type)return[edge(from)].concat(compile(expr.expr,from));if("range"==expr.type){let cur=from;for(let i=0;i<expr.min;i++){let next=node();connect(compile(expr.expr,cur),next),cur=next}if(-1==expr.max)connect(compile(expr.expr,cur),cur);else for(let i=expr.min;i<expr.max;i++){let next=node();edge(cur,next),connect(compile(expr.expr,cur),next),cur=next}return[edge(cur)]}if("name"==expr.type)return[edge(from,void 0,expr.value)];throw new Error("Unknown expr type")}for(let i=0;;i++){let next=compile(expr.exprs[i],from);if(i==expr.exprs.length-1)return next;connect(next,from=node())}}}(expr));return function checkForDeadEnds(match,stream){for(let i=0,work=[match];i<work.length;i++){let state=work[i],dead=!state.validEnd,nodes=[];for(let j=0;j<state.next.length;j++){let{type,next}=state.next[j];nodes.push(type.name),!dead||type.isText||type.hasRequiredAttrs()||(dead=!1),-1==work.indexOf(next)&&work.push(next)}dead&&stream.err("Only non-generatable nodes ("+nodes.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(match,stream),match}matchType(type){for(let i=0;i<this.next.length;i++)if(this.next[i].type==type)return this.next[i].next;return null}matchFragment(frag,start=0,end=frag.childCount){let cur=this;for(let i=start;cur&&i<end;i++)cur=cur.matchType(frag.child(i).type);return cur}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let i=0;i<this.next.length;i++){let{type}=this.next[i];if(!type.isText&&!type.hasRequiredAttrs())return type}return null}compatible(other){for(let i=0;i<this.next.length;i++)for(let j=0;j<other.next.length;j++)if(this.next[i].type==other.next[j].type)return!0;return!1}fillBefore(after,toEnd=!1,startIndex=0){let seen=[this];return function search(match,types){let finished=match.matchFragment(after,startIndex);if(finished&&(!toEnd||finished.validEnd))return Fragment.from(types.map(tp=>tp.createAndFill()));for(let i=0;i<match.next.length;i++){let{type,next}=match.next[i];if(!type.isText&&!type.hasRequiredAttrs()&&-1==seen.indexOf(next)){seen.push(next);let found=search(next,types.concat(type));if(found)return found}}return null}(this,[])}findWrapping(target){for(let i=0;i<this.wrapCache.length;i+=2)if(this.wrapCache[i]==target)return this.wrapCache[i+1];let computed=this.computeWrapping(target);return this.wrapCache.push(target,computed),computed}computeWrapping(target){let seen=Object.create(null),active=[{match:this,type:null,via:null}];for(;active.length;){let current=active.shift(),match=current.match;if(match.matchType(target)){let result=[];for(let obj=current;obj.type;obj=obj.via)result.push(obj.type);return result.reverse()}for(let i=0;i<match.next.length;i++){let{type,next}=match.next[i];type.isLeaf||type.hasRequiredAttrs()||type.name in seen||current.type&&!next.validEnd||(active.push({match:type.contentMatch,type,via:current}),seen[type.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(n){if(n>=this.next.length)throw new RangeError(`There's no ${n}th edge in this content match`);return this.next[n]}toString(){let seen=[];return function scan(m){seen.push(m);for(let i=0;i<m.next.length;i++)-1==seen.indexOf(m.next[i].next)&&scan(m.next[i].next)}(this),seen.map((m,i)=>{let out=i+(m.validEnd?"*":" ")+" ";for(let i=0;i<m.next.length;i++)out+=(i?", ":"")+m.next[i].type.name+"->"+seen.indexOf(m.next[i].next);return out}).join("\n")}}ContentMatch.empty=new ContentMatch(!0);class TokenStream{constructor(string,nodeTypes){this.string=string,this.nodeTypes=nodeTypes,this.inline=null,this.pos=0,this.tokens=string.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(tok){return this.next==tok&&(this.pos++||!0)}err(str){throw new SyntaxError(str+" (in content expression '"+this.string+"')")}}function parseExpr(stream){let exprs=[];do{exprs.push(parseExprSeq(stream))}while(stream.eat("|"));return 1==exprs.length?exprs[0]:{type:"choice",exprs}}function parseExprSeq(stream){let exprs=[];do{exprs.push(parseExprSubscript(stream))}while(stream.next&&")"!=stream.next&&"|"!=stream.next);return 1==exprs.length?exprs[0]:{type:"seq",exprs}}function parseExprSubscript(stream){let expr=function parseExprAtom(stream){if(stream.eat("(")){let expr=parseExpr(stream);return stream.eat(")")||stream.err("Missing closing paren"),expr}if(!/\W/.test(stream.next)){let exprs=function resolveName(stream,name){let types=stream.nodeTypes,type=types[name];if(type)return[type];let result=[];for(let typeName in types){let type=types[typeName];type.isInGroup(name)&&result.push(type)}0==result.length&&stream.err("No node type or group '"+name+"' found");return result}(stream,stream.next).map(type=>(null==stream.inline?stream.inline=type.isInline:stream.inline!=type.isInline&&stream.err("Mixing inline and block content"),{type:"name",value:type}));return stream.pos++,1==exprs.length?exprs[0]:{type:"choice",exprs}}stream.err("Unexpected token '"+stream.next+"'")}(stream);for(;;)if(stream.eat("+"))expr={type:"plus",expr};else if(stream.eat("*"))expr={type:"star",expr};else if(stream.eat("?"))expr={type:"opt",expr};else{if(!stream.eat("{"))break;expr=parseExprRange(stream,expr)}return expr}function parseNum(stream){/\D/.test(stream.next)&&stream.err("Expected number, got '"+stream.next+"'");let result=Number(stream.next);return stream.pos++,result}function parseExprRange(stream,expr){let min=parseNum(stream),max=min;return stream.eat(",")&&(max="}"!=stream.next?parseNum(stream):-1),stream.eat("}")||stream.err("Unclosed braced range"),{type:"range",min,max,expr}}function cmp(a,b){return b-a}function nullFrom(nfa,node){let result=[];return function scan(node){let edges=nfa[node];if(1==edges.length&&!edges[0].term)return scan(edges[0].to);result.push(node);for(let i=0;i<edges.length;i++){let{term,to}=edges[i];term||-1!=result.indexOf(to)||scan(to)}}(node),result.sort(cmp)}function defaultAttrs(attrs){let defaults=Object.create(null);for(let attrName in attrs){let attr=attrs[attrName];if(!attr.hasDefault)return null;defaults[attrName]=attr.default}return defaults}function computeAttrs(attrs,value){let built=Object.create(null);for(let name in attrs){let given=value&&value[name];if(void 0===given){let attr=attrs[name];if(!attr.hasDefault)throw new RangeError("No value supplied for attribute "+name);given=attr.default}built[name]=given}return built}function checkAttrs(attrs,values,type,name){for(let name in values)if(!(name in attrs))throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);for(let name in attrs){let attr=attrs[name];attr.validate&&attr.validate(values[name])}}function initAttrs(typeName,attrs){let result=Object.create(null);if(attrs)for(let name in attrs)result[name]=new Attribute(typeName,name,attrs[name]);return result}class NodeType{constructor(name,schema,spec){this.name=name,this.schema=schema,this.spec=spec,this.markSet=null,this.groups=spec.group?spec.group.split(" "):[],this.attrs=initAttrs(name,spec.attrs),this.defaultAttrs=defaultAttrs(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(spec.inline||"text"==name),this.isText="text"==name}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ContentMatch.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(group){return this.groups.indexOf(group)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let n in this.attrs)if(this.attrs[n].isRequired)return!0;return!1}compatibleContent(other){return this==other||this.contentMatch.compatible(other.contentMatch)}computeAttrs(attrs){return!attrs&&this.defaultAttrs?this.defaultAttrs:computeAttrs(this.attrs,attrs)}create(attrs=null,content,marks){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Node(this,this.computeAttrs(attrs),Fragment.from(content),Mark.setFrom(marks))}createChecked(attrs=null,content,marks){return content=Fragment.from(content),this.checkContent(content),new Node(this,this.computeAttrs(attrs),content,Mark.setFrom(marks))}createAndFill(attrs=null,content,marks){if(attrs=this.computeAttrs(attrs),(content=Fragment.from(content)).size){let before=this.contentMatch.fillBefore(content);if(!before)return null;content=before.append(content)}let matched=this.contentMatch.matchFragment(content),after=matched&&matched.fillBefore(Fragment.empty,!0);return after?new Node(this,attrs,content.append(after),Mark.setFrom(marks)):null}validContent(content){let result=this.contentMatch.matchFragment(content);if(!result||!result.validEnd)return!1;for(let i=0;i<content.childCount;i++)if(!this.allowsMarks(content.child(i).marks))return!1;return!0}checkContent(content){if(!this.validContent(content))throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0,50)}`)}checkAttrs(attrs){checkAttrs(this.attrs,attrs,"node",this.name)}allowsMarkType(markType){return null==this.markSet||this.markSet.indexOf(markType)>-1}allowsMarks(marks){if(null==this.markSet)return!0;for(let i=0;i<marks.length;i++)if(!this.allowsMarkType(marks[i].type))return!1;return!0}allowedMarks(marks){if(null==this.markSet)return marks;let copy;for(let i=0;i<marks.length;i++)this.allowsMarkType(marks[i].type)?copy&©.push(marks[i]):copy||(copy=marks.slice(0,i));return copy?copy.length?copy:Mark.none:marks}static compile(nodes,schema){let result=Object.create(null);nodes.forEach((name,spec)=>result[name]=new NodeType(name,schema,spec));let topType=schema.spec.topNode||"doc";if(!result[topType])throw new RangeError("Schema is missing its top node type ('"+topType+"')");if(!result.text)throw new RangeError("Every schema needs a 'text' type");for(let _ in result.text.attrs)throw new RangeError("The text node type should not have attributes");return result}}class Attribute{constructor(typeName,attrName,options){this.hasDefault=Object.prototype.hasOwnProperty.call(options,"default"),this.default=options.default,this.validate="string"==typeof options.validate?function validateType(typeName,attrName,type){let types=type.split("|");return value=>{let name=null===value?"null":typeof value;if(types.indexOf(name)<0)throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`)}}(typeName,attrName,options.validate):options.validate}get isRequired(){return!this.hasDefault}}class MarkType{constructor(name,rank,schema,spec){this.name=name,this.rank=rank,this.schema=schema,this.spec=spec,this.attrs=initAttrs(name,spec.attrs),this.excluded=null;let defaults=defaultAttrs(this.attrs);this.instance=defaults?new Mark(this,defaults):null}create(attrs=null){return!attrs&&this.instance?this.instance:new Mark(this,computeAttrs(this.attrs,attrs))}static compile(marks,schema){let result=Object.create(null),rank=0;return marks.forEach((name,spec)=>result[name]=new MarkType(name,rank++,schema,spec)),result}removeFromSet(set){for(var i=0;i<set.length;i++)set[i].type==this&&(set=set.slice(0,i).concat(set.slice(i+1)),i--);return set}isInSet(set){for(let i=0;i<set.length;i++)if(set[i].type==this)return set[i]}checkAttrs(attrs){checkAttrs(this.attrs,attrs,"mark",this.name)}excludes(other){return this.excluded.indexOf(other)>-1}}class Schema{constructor(spec){this.linebreakReplacement=null,this.cached=Object.create(null);let instanceSpec=this.spec={};for(let prop in spec)instanceSpec[prop]=spec[prop];instanceSpec.nodes=dist.from(spec.nodes),instanceSpec.marks=dist.from(spec.marks||{}),this.nodes=NodeType.compile(this.spec.nodes,this),this.marks=MarkType.compile(this.spec.marks,this);let contentExprCache=Object.create(null);for(let prop in this.nodes){if(prop in this.marks)throw new RangeError(prop+" can not be both a node and a mark");let type=this.nodes[prop],contentExpr=type.spec.content||"",markExpr=type.spec.marks;if(type.contentMatch=contentExprCache[contentExpr]||(contentExprCache[contentExpr]=ContentMatch.parse(contentExpr,this.nodes)),type.inlineContent=type.contentMatch.inlineContent,type.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!type.isInline||!type.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=type}type.markSet="_"==markExpr?null:markExpr?gatherMarks(this,markExpr.split(" ")):""!=markExpr&&type.inlineContent?null:[]}for(let prop in this.marks){let type=this.marks[prop],excl=type.spec.excludes;type.excluded=null==excl?[type]:""==excl?[]:gatherMarks(this,excl.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(type,attrs=null,content,marks){if("string"==typeof type)type=this.nodeType(type);else{if(!(type instanceof NodeType))throw new RangeError("Invalid node type: "+type);if(type.schema!=this)throw new RangeError("Node type from different schema used ("+type.name+")")}return type.createChecked(attrs,content,marks)}text(text,marks){let type=this.nodes.text;return new TextNode(type,type.defaultAttrs,text,Mark.setFrom(marks))}mark(type,attrs){return"string"==typeof type&&(type=this.marks[type]),type.create(attrs)}nodeFromJSON(json){return Node.fromJSON(this,json)}markFromJSON(json){return Mark.fromJSON(this,json)}nodeType(name){let found=this.nodes[name];if(!found)throw new RangeError("Unknown node type: "+name);return found}}function gatherMarks(schema,marks){let found=[];for(let i=0;i<marks.length;i++){let name=marks[i],mark=schema.marks[name],ok=mark;if(mark)found.push(mark);else for(let prop in schema.marks){let mark=schema.marks[prop];("_"==name||mark.spec.group&&mark.spec.group.split(" ").indexOf(name)>-1)&&found.push(ok=mark)}if(!ok)throw new SyntaxError("Unknown mark type: '"+marks[i]+"'")}return found}class DOMParser{constructor(schema,rules){this.schema=schema,this.rules=rules,this.tags=[],this.styles=[];let matchedStyles=this.matchedStyles=[];rules.forEach(rule=>{if(function isTagRule(rule){return null!=rule.tag}(rule))this.tags.push(rule);else if(function isStyleRule(rule){return null!=rule.style}(rule)){let prop=/[^=]*/.exec(rule.style)[0];matchedStyles.indexOf(prop)<0&&matchedStyles.push(prop),this.styles.push(rule)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let node=schema.nodes[r.node];return node.contentMatch.matchType(node)})}parse(dom,options={}){let context=new ParseContext(this,options,!1);return context.addAll(dom,Mark.none,options.from,options.to),context.finish()}parseSlice(dom,options={}){let context=new ParseContext(this,options,!0);return context.addAll(dom,Mark.none,options.from,options.to),Slice.maxOpen(context.finish())}matchTag(dom,context,after){for(let i=after?this.tags.indexOf(after)+1:0;i<this.tags.length;i++){let rule=this.tags[i];if(matches(dom,rule.tag)&&(void 0===rule.namespace||dom.namespaceURI==rule.namespace)&&(!rule.context||context.matchesContext(rule.context))){if(rule.getAttrs){let result=rule.getAttrs(dom);if(!1===result)continue;rule.attrs=result||void 0}return rule}}}matchStyle(prop,value,context,after){for(let i=after?this.styles.indexOf(after)+1:0;i<this.styles.length;i++){let rule=this.styles[i],style=rule.style;if(!(0!=style.indexOf(prop)||rule.context&&!context.matchesContext(rule.context)||style.length>prop.length&&(61!=style.charCodeAt(prop.length)||style.slice(prop.length+1)!=value))){if(rule.getAttrs){let result=rule.getAttrs(value);if(!1===result)continue;rule.attrs=result||void 0}return rule}}}static schemaRules(schema){let result=[];function insert(rule){let priority=null==rule.priority?50:rule.priority,i=0;for(;i<result.length;i++){let next=result[i];if((null==next.priority?50:next.priority)<priority)break}result.splice(i,0,rule)}for(let name in schema.marks){let rules=schema.marks[name].spec.parseDOM;rules&&rules.forEach(rule=>{insert(rule=copy(rule)),rule.mark||rule.ignore||rule.clearMark||(rule.mark=name)})}for(let name in schema.nodes){let rules=schema.nodes[name].spec.parseDOM;rules&&rules.forEach(rule=>{insert(rule=copy(rule)),rule.node||rule.ignore||rule.mark||(rule.node=name)})}return result}static fromSchema(schema){return schema.cached.domParser||(schema.cached.domParser=new DOMParser(schema,DOMParser.schemaRules(schema)))}}const blockTags={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},ignoreTags={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},listTags={ol:!0,ul:!0};function wsOptionsFor(type,preserveWhitespace,base){return null!=preserveWhitespace?(preserveWhitespace?1:0)|("full"===preserveWhitespace?2:0):type&&"pre"==type.whitespace?3:-5&base}class NodeContext{constructor(type,attrs,marks,solid,match,options){this.type=type,this.attrs=attrs,this.marks=marks,this.solid=solid,this.options=options,this.content=[],this.activeMarks=Mark.none,this.match=match||(4&options?null:type.contentMatch)}findWrapping(node){if(!this.match){if(!this.type)return[];let fill=this.type.contentMatch.fillBefore(Fragment.from(node));if(!fill){let wrap,start=this.type.contentMatch;return(wrap=start.findWrapping(node.type))?(this.match=start,wrap):null}this.match=this.type.contentMatch.matchFragment(fill)}return this.match.findWrapping(node.type)}finish(openEnd){if(!(1&this.options)){let m,last=this.content[this.content.length-1];if(last&&last.isText&&(m=/[ \t\r\n\u000c]+$/.exec(last.text))){let text=last;last.text.length==m[0].length?this.content.pop():this.content[this.content.length-1]=text.withText(text.text.slice(0,text.text.length-m[0].length))}}let content=Fragment.from(this.content);return!openEnd&&this.match&&(content=content.append(this.match.fillBefore(Fragment.empty,!0))),this.type?this.type.create(this.attrs,content,this.marks):content}inlineContext(node){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:node.parentNode&&!blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase())}}class ParseContext{constructor(parser,options,isOpen){this.parser=parser,this.options=options,this.isOpen=isOpen,this.open=0,this.localPreserveWS=!1;let topContext,topNode=options.topNode,topOptions=wsOptionsFor(null,options.preserveWhitespace,0)|(isOpen?4:0);topContext=topNode?new NodeContext(topNode.type,topNode.attrs,Mark.none,!0,options.topMatch||topNode.type.contentMatch,topOptions):new NodeContext(isOpen?null:parser.schema.topNodeType,null,Mark.none,!0,null,topOptions),this.nodes=[topContext],this.find=options.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(dom,marks){3==dom.nodeType?this.addTextNode(dom,marks):1==dom.nodeType&&this.addElement(dom,marks)}addTextNode(dom,marks){let value=dom.nodeValue,top=this.top,preserveWS=2&top.options?"full":this.localPreserveWS||(1&top.options)>0;if("full"===preserveWS||top.inlineContext(dom)||/[^ \t\r\n\u000c]/.test(value)){if(preserveWS)value="full"!==preserveWS?value.replace(/\r?\n|\r/g," "):value.replace(/\r\n?/g,"\n");else if(value=value.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(value)&&this.open==this.nodes.length-1){let nodeBefore=top.content[top.content.length-1],domNodeBefore=dom.previousSibling;(!nodeBefore||domNodeBefore&&"BR"==domNodeBefore.nodeName||nodeBefore.isText&&/[ \t\r\n\u000c]$/.test(nodeBefore.text))&&(value=value.slice(1))}value&&this.insertNode(this.parser.schema.text(value),marks,!/\S/.test(value)),this.findInText(dom)}else this.findInside(dom)}addElement(dom,marks,matchAfter){let outerWS=this.localPreserveWS,top=this.top;("PRE"==dom.tagName||/pre/.test(dom.style&&dom.style.whiteSpace))&&(this.localPreserveWS=!0);let ruleID,name=dom.nodeName.toLowerCase();listTags.hasOwnProperty(name)&&this.parser.normalizeLists&&function normalizeList(dom){for(let child=dom.firstChild,prevItem=null;child;child=child.nextSibling){let name=1==child.nodeType?child.nodeName.toLowerCase():null;name&&listTags.hasOwnProperty(name)&&prevItem?(prevItem.appendChild(child),child=prevItem):"li"==name?prevItem=child:name&&(prevItem=null)}}(dom);let rule=this.options.ruleFromNode&&this.options.ruleFromNode(dom)||(ruleID=this.parser.matchTag(dom,this,matchAfter));out:if(rule?rule.ignore:ignoreTags.hasOwnProperty(name))this.findInside(dom),this.ignoreFallback(dom,marks);else if(!rule||rule.skip||rule.closeParent){rule&&rule.closeParent?this.open=Math.max(0,this.open-1):rule&&rule.skip.nodeType&&(dom=rule.skip);let sync,oldNeedsBlock=this.needsBlock;if(blockTags.hasOwnProperty(name))top.content.length&&top.content[0].isInline&&this.open&&(this.open--,top=this.top),sync=!0,top.type||(this.needsBlock=!0);else if(!dom.firstChild){this.leafFallback(dom,marks);break out}let innerMarks=rule&&rule.skip?marks:this.readStyles(dom,marks);innerMarks&&this.addAll(dom,innerMarks),sync&&this.sync(top),this.needsBlock=oldNeedsBlock}else{let innerMarks=this.readStyles(dom,marks);innerMarks&&this.addElementByRule(dom,rule,innerMarks,!1===rule.consuming?ruleID:void 0)}this.localPreserveWS=outerWS}leafFallback(dom,marks){"BR"==dom.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(dom.ownerDocument.createTextNode("\n"),marks)}ignoreFallback(dom,marks){"BR"!=dom.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),marks,!0)}readStyles(dom,marks){let styles=dom.style;if(styles&&styles.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let name=this.parser.matchedStyles[i],value=styles.getPropertyValue(name);if(value)for(let after;;){let rule=this.parser.matchStyle(name,value,this,after);if(!rule)break;if(rule.ignore)return null;if(marks=rule.clearMark?marks.filter(m=>!rule.clearMark(m)):marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs)),!1!==rule.consuming)break;after=rule}}return marks}addElementByRule(dom,rule,marks,continueAfter){let sync,nodeType;if(rule.node)if(nodeType=this.parser.schema.nodes[rule.node],nodeType.isLeaf)this.insertNode(nodeType.create(rule.attrs),marks,"BR"==dom.nodeName)||this.leafFallback(dom,marks);else{let inner=this.enter(nodeType,rule.attrs||null,marks,rule.preserveWhitespace);inner&&(sync=!0,marks=inner)}else{let markType=this.parser.schema.marks[rule.mark];marks=marks.concat(markType.create(rule.attrs))}let startIn=this.top;if(nodeType&&nodeType.isLeaf)this.findInside(dom);else if(continueAfter)this.addElement(dom,marks,continueAfter);else if(rule.getContent)this.findInside(dom),rule.getContent(dom,this.parser.schema).forEach(node=>this.insertNode(node,marks,!1));else{let contentDOM=dom;"string"==typeof rule.contentElement?contentDOM=dom.querySelector(rule.contentElement):"function"==typeof rule.contentElement?contentDOM=rule.contentElement(dom):rule.contentElement&&(contentDOM=rule.contentElement),this.findAround(dom,contentDOM,!0),this.addAll(contentDOM,marks),this.findAround(dom,contentDOM,!1)}sync&&this.sync(startIn)&&this.open--}addAll(parent,marks,startIndex,endIndex){let index=startIndex||0;for(let dom=startIndex?parent.childNodes[startIndex]:parent.firstChild,end=null==endIndex?null:parent.childNodes[endIndex];dom!=end;dom=dom.nextSibling,++index)this.findAtPoint(parent,index),this.addDOM(dom,marks);this.findAtPoint(parent,index)}findPlace(node,marks,cautious){let route,sync;for(let depth=this.open,penalty=0;depth>=0;depth--){let cx=this.nodes[depth],found=cx.findWrapping(node);if(found&&(!route||route.length>found.length+penalty)&&(route=found,sync=cx,!found.length))break;if(cx.solid){if(cautious)break;penalty+=2}}if(!route)return null;this.sync(sync);for(let i=0;i<route.length;i++)marks=this.enterInner(route[i],null,marks,!1);return marks}insertNode(node,marks,cautious){if(node.isInline&&this.needsBlock&&!this.top.type){let block=this.textblockFromContext();block&&(marks=this.enterInner(block,null,marks))}let innerMarks=this.findPlace(node,marks,cautious);if(innerMarks){this.closeExtra();let top=this.top;top.match&&(top.match=top.match.matchType(node.type));let nodeMarks=Mark.none;for(let m of innerMarks.concat(node.marks))(top.type?top.type.allowsMarkType(m.type):markMayApply(m.type,node.type))&&(nodeMarks=m.addToSet(nodeMarks));return top.content.push(node.mark(nodeMarks)),!0}return!1}enter(type,attrs,marks,preserveWS){let innerMarks=this.findPlace(type.create(attrs),marks,!1);return innerMarks&&(innerMarks=this.enterInner(type,attrs,marks,!0,preserveWS)),innerMarks}enterInner(type,attrs,marks,solid=!1,preserveWS){this.closeExtra();let top=this.top;top.match=top.match&&top.match.matchType(type);let options=wsOptionsFor(type,preserveWS,top.options);4&top.options&&0==top.content.length&&(options|=4);let applyMarks=Mark.none;return marks=marks.filter(m=>!(top.type?top.type.allowsMarkType(m.type):markMayApply(m.type,type))||(applyMarks=m.addToSet(applyMarks),!1)),this.nodes.push(new NodeContext(type,attrs,applyMarks,solid,null,options)),this.open++,marks}closeExtra(openEnd=!1){let i=this.nodes.length-1;if(i>this.open){for(;i>this.open;i--)this.nodes[i-1].content.push(this.nodes[i].finish(openEnd));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(to){for(let i=this.open;i>=0;i--){if(this.nodes[i]==to)return this.open=i,!0;this.localPreserveWS&&(this.nodes[i].options|=1)}return!1}get currentPos(){this.closeExtra();let pos=0;for(let i=this.open;i>=0;i--){let content=this.nodes[i].content;for(let j=content.length-1;j>=0;j--)pos+=content[j].nodeSize;i&&pos++}return pos}findAtPoint(parent,offset){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==parent&&this.find[i].offset==offset&&(this.find[i].pos=this.currentPos)}findInside(parent){if(this.find)for(let i=0;i<this.find.length;i++)null==this.find[i].pos&&1==parent.nodeType&&parent.contains(this.find[i].node)&&(this.find[i].pos=this.currentPos)}findAround(parent,content,before){if(parent!=content&&this.find)for(let i=0;i<this.find.length;i++)if(null==this.find[i].pos&&1==parent.nodeType&&parent.contains(this.find[i].node)){content.compareDocumentPosition(this.find[i].node)&(before?2:4)&&(this.find[i].pos=this.currentPos)}}findInText(textNode){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==textNode&&(this.find[i].pos=this.currentPos-(textNode.nodeValue.length-this.find[i].offset))}matchesContext(context){if(context.indexOf("|")>-1)return context.split(/\s*\|\s*/).some(this.matchesContext,this);let parts=context.split("/"),option=this.options.context,useRoot=!(this.isOpen||option&&option.parent.type!=this.nodes[0].type),minDepth=-(option?option.depth+1:0)+(useRoot?0:1),match=(i,depth)=>{for(;i>=0;i--){let part=parts[i];if(""==part){if(i==parts.length-1||0==i)continue;for(;depth>=minDepth;depth--)if(match(i-1,depth))return!0;return!1}{let next=depth>0||0==depth&&useRoot?this.nodes[depth].type:option&&depth>=minDepth?option.node(depth-minDepth).type:null;if(!next||next.name!=part&&!next.isInGroup(part))return!1;depth--}}return!0};return match(parts.length-1,this.open)}textblockFromContext(){let $context=this.options.context;if($context)for(let d=$context.depth;d>=0;d--){let deflt=$context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;if(deflt&&deflt.isTextblock&&deflt.defaultAttrs)return deflt}for(let name in this.parser.schema.nodes){let type=this.parser.schema.nodes[name];if(type.isTextblock&&type.defaultAttrs)return type}}}function matches(dom,selector){return(dom.matches||dom.msMatchesSelector||dom.webkitMatchesSelector||dom.mozMatchesSelector).call(dom,selector)}function copy(obj){let copy={};for(let prop in obj)copy[prop]=obj[prop];return copy}function markMayApply(markType,nodeType){let nodes=nodeType.schema.nodes;for(let name in nodes){let parent=nodes[name];if(!parent.allowsMarkType(markType))continue;let seen=[],scan=match=>{seen.push(match);for(let i=0;i<match.edgeCount;i++){let{type,next}=match.edge(i);if(type==nodeType)return!0;if(seen.indexOf(next)<0&&scan(next))return!0}};if(scan(parent.contentMatch))return!0}}class DOMSerializer{constructor(nodes,marks){this.nodes=nodes,this.marks=marks}serializeFragment(fragment,options={},target){target||(target=doc(options).createDocumentFragment());let top=target,active=[];return fragment.forEach(node=>{if(active.length||node.marks.length){let keep=0,rendered=0;for(;keep<active.length&&rendered<node.marks.length;){let next=node.marks[rendered];if(this.marks[next.type.name]){if(!next.eq(active[keep][0])||!1===next.type.spec.spanning)break;keep++,rendered++}else rendered++}for(;keep<active.length;)top=active.pop()[1];for(;rendered<node.marks.length;){let add=node.marks[rendered++],markDOM=this.serializeMark(add,node.isInline,options);markDOM&&(active.push([add,top]),top.appendChild(markDOM.dom),top=markDOM.contentDOM||markDOM.dom)}}top.appendChild(this.serializeNodeInner(node,options))}),target}serializeNodeInner(node,options){let{dom,contentDOM}=renderSpec(doc(options),this.nodes[node.type.name](node),null,node.attrs);if(contentDOM){if(node.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(node.content,options,contentDOM)}return dom}serializeNode(node,options={}){let dom=this.serializeNodeInner(node,options);for(let i=node.marks.length-1;i>=0;i--){let wrap=this.serializeMark(node.marks[i],node.isInline,options);wrap&&((wrap.contentDOM||wrap.dom).appendChild(dom),dom=wrap.dom)}return dom}serializeMark(mark,inline,options={}){let toDOM=this.marks[mark.type.name];return toDOM&&renderSpec(doc(options),toDOM(mark,inline),null,mark.attrs)}static renderSpec(doc,structure,xmlNS=null,blockArraysIn){return renderSpec(doc,structure,xmlNS,blockArraysIn)}static fromSchema(schema){return schema.cached.domSerializer||(schema.cached.domSerializer=new DOMSerializer(this.nodesFromSchema(schema),this.marksFromSchema(schema)))}static nodesFromSchema(schema){let result=gatherToDOM(schema.nodes);return result.text||(result.text=node=>node.text),result}static marksFromSchema(schema){return gatherToDOM(schema.marks)}}function gatherToDOM(obj){let result={};for(let name in obj){let toDOM=obj[name].spec.toDOM;toDOM&&(result[name]=toDOM)}return result}function doc(options){return options.document||window.document}const suspiciousAttributeCache=new WeakMap;function suspiciousAttributes(attrs){let value=suspiciousAttributeCache.get(attrs);return void 0===value&&suspiciousAttributeCache.set(attrs,value=function suspiciousAttributesInner(attrs){let result=null;function scan(value){if(value&&"object"==typeof value)if(Array.isArray(value))if("string"==typeof value[0])result||(result=[]),result.push(value);else for(let i=0;i<value.length;i++)scan(value[i]);else for(let prop in value)scan(value[prop])}return scan(attrs),result}(attrs)),value}function renderSpec(doc,structure,xmlNS,blockArraysIn){if("string"==typeof structure)return{dom:doc.createTextNode(structure)};if(null!=structure.nodeType)return{dom:structure};if(structure.dom&&null!=structure.dom.nodeType)return structure;let suspicious,tagName=structure[0];if("string"!=typeof tagName)throw new RangeError("Invalid array passed to renderSpec");if(blockArraysIn&&(suspicious=suspiciousAttributes(blockArraysIn))&&suspicious.indexOf(structure)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let contentDOM,space=tagName.indexOf(" ");space>0&&(xmlNS=tagName.slice(0,space),tagName=tagName.slice(space+1));let dom=xmlNS?doc.createElementNS(xmlNS,tagName):doc.createElement(tagName),attrs=structure[1],start=1;if(attrs&&"object"==typeof attrs&&null==attrs.nodeType&&!Array.isArray(attrs)){start=2;for(let name in attrs)if(null!=attrs[name]){let space=name.indexOf(" ");space>0?dom.setAttributeNS(name.slice(0,space),name.slice(space+1),attrs[name]):dom.setAttribute(name,attrs[name])}}for(let i=start;i<structure.length;i++){let child=structure[i];if(0===child){if(i<structure.length-1||i>start)throw new RangeError("Content hole must be the only child of its parent node");return{dom,contentDOM:dom}}{let{dom:inner,contentDOM:innerContent}=renderSpec(doc,child,xmlNS,blockArraysIn);if(dom.appendChild(inner),innerContent){if(contentDOM)throw new RangeError("Multiple content holes");contentDOM=innerContent}}}return{dom,contentDOM}}},"./node_modules/prosemirror-state/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{$t:()=>EditorState,LN:()=>Selection,U3:()=>TextSelection,hs:()=>PluginKey,i5:()=>AllSelection,k_:()=>Plugin,nh:()=>NodeSelection,yn:()=>SelectionRange});var prosemirror_model__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/prosemirror-model/dist/index.js"),prosemirror_transform__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/prosemirror-transform/dist/index.js");const classesById=Object.create(null);class Selection{constructor($anchor,$head,ranges){this.$anchor=$anchor,this.$head=$head,this.ranges=ranges||[new SelectionRange($anchor.min($head),$anchor.max($head))]}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 ranges=this.ranges;for(let i=0;i<ranges.length;i++)if(ranges[i].$from.pos!=ranges[i].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(tr,content=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty){let lastNode=content.content.lastChild,lastParent=null;for(let i=0;i<content.openEnd;i++)lastParent=lastNode,lastNode=lastNode.lastChild;let mapFrom=tr.steps.length,ranges=this.ranges;for(let i=0;i<ranges.length;i++){let{$from,$to}=ranges[i],mapping=tr.mapping.slice(mapFrom);tr.replaceRange(mapping.map($from.pos),mapping.map($to.pos),i?prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty:content),0==i&&selectionToInsertionEnd(tr,mapFrom,(lastNode?lastNode.isInline:lastParent&&lastParent.isTextblock)?-1:1)}}replaceWith(tr,node){let mapFrom=tr.steps.length,ranges=this.ranges;for(let i=0;i<ranges.length;i++){let{$from,$to}=ranges[i],mapping=tr.mapping.slice(mapFrom),from=mapping.map($from.pos),to=mapping.map($to.pos);i?tr.deleteRange(from,to):(tr.replaceRangeWith(from,to,node),selectionToInsertionEnd(tr,mapFrom,node.isInline?-1:1))}}static findFrom($pos,dir,textOnly=!1){let inner=$pos.parent.inlineContent?new TextSelection($pos):findSelectionIn($pos.node(0),$pos.parent,$pos.pos,$pos.index(),dir,textOnly);if(inner)return inner;for(let depth=$pos.depth-1;depth>=0;depth--){let found=dir<0?findSelectionIn($pos.node(0),$pos.node(depth),$pos.before(depth+1),$pos.index(depth),dir,textOnly):findSelectionIn($pos.node(0),$pos.node(depth),$pos.after(depth+1),$pos.index(depth)+1,dir,textOnly);if(found)return found}return null}static near($pos,bias=1){return this.findFrom($pos,bias)||this.findFrom($pos,-bias)||new AllSelection($pos.node(0))}static atStart(doc){return findSelectionIn(doc,doc,0,0,1)||new AllSelection(doc)}static atEnd(doc){return findSelectionIn(doc,doc,doc.content.size,doc.childCount,-1)||new AllSelection(doc)}static fromJSON(doc,json){if(!json||!json.type)throw new RangeError("Invalid input for Selection.fromJSON");let cls=classesById[json.type];if(!cls)throw new RangeError(`No selection type ${json.type} defined`);return cls.fromJSON(doc,json)}static jsonID(id,selectionClass){if(id in classesById)throw new RangeError("Duplicate use of selection JSON ID "+id);return classesById[id]=selectionClass,selectionClass.prototype.jsonID=id,selectionClass}getBookmark(){return TextSelection.between(this.$anchor,this.$head).getBookmark()}}Selection.prototype.visible=!0;class SelectionRange{constructor($from,$to){this.$from=$from,this.$to=$to}}let warnedAboutTextSelection=!1;function checkTextSelection($pos){warnedAboutTextSelection||$pos.parent.inlineContent||(warnedAboutTextSelection=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+$pos.parent.type.name+")"))}class TextSelection extends Selection{constructor($anchor,$head=$anchor){checkTextSelection($anchor),checkTextSelection($head),super($anchor,$head)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(doc,mapping){let $head=doc.resolve(mapping.map(this.head));if(!$head.parent.inlineContent)return Selection.near($head);let $anchor=doc.resolve(mapping.map(this.anchor));return new TextSelection($anchor.parent.inlineContent?$anchor:$head,$head)}replace(tr,content=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty){if(super.replace(tr,content),content==prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty){let marks=this.$from.marksAcross(this.$to);marks&&tr.ensureMarks(marks)}}eq(other){return other instanceof TextSelection&&other.anchor==this.anchor&&other.head==this.head}getBookmark(){return new TextBookmark(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(doc,json){if("number"!=typeof json.anchor||"number"!=typeof json.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new TextSelection(doc.resolve(json.anchor),doc.resolve(json.head))}static create(doc,anchor,head=anchor){let $anchor=doc.resolve(anchor);return new this($anchor,head==anchor?$anchor:doc.resolve(head))}static between($anchor,$head,bias){let dPos=$anchor.pos-$head.pos;if(bias&&!dPos||(bias=dPos>=0?1:-1),!$head.parent.inlineContent){let found=Selection.findFrom($head,bias,!0)||Selection.findFrom($head,-bias,!0);if(!found)return Selection.near($head,bias);$head=found.$head}return $anchor.parent.inlineContent||(0==dPos||($anchor=(Selection.findFrom($anchor,-bias,!0)||Selection.findFrom($anchor,bias,!0)).$anchor).pos<$head.pos!=dPos<0)&&($anchor=$head),new TextSelection($anchor,$head)}}Selection.jsonID("text",TextSelection);class TextBookmark{constructor(anchor,head){this.anchor=anchor,this.head=head}map(mapping){return new TextBookmark(mapping.map(this.anchor),mapping.map(this.head))}resolve(doc){return TextSelection.between(doc.resolve(this.anchor),doc.resolve(this.head))}}class NodeSelection extends Selection{constructor($pos){let node=$pos.nodeAfter,$end=$pos.node(0).resolve($pos.pos+node.nodeSize);super($pos,$end),this.node=node}map(doc,mapping){let{deleted,pos}=mapping.mapResult(this.anchor),$pos=doc.resolve(pos);return deleted?Selection.near($pos):new NodeSelection($pos)}content(){return new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(this.node),0,0)}eq(other){return other instanceof NodeSelection&&other.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new NodeBookmark(this.anchor)}static fromJSON(doc,json){if("number"!=typeof json.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new NodeSelection(doc.resolve(json.anchor))}static create(doc,from){return new NodeSelection(doc.resolve(from))}static isSelectable(node){return!node.isText&&!1!==node.type.spec.selectable}}NodeSelection.prototype.visible=!1,Selection.jsonID("node",NodeSelection);class NodeBookmark{constructor(anchor){this.anchor=anchor}map(mapping){let{deleted,pos}=mapping.mapResult(this.anchor);return deleted?new TextBookmark(pos,pos):new NodeBookmark(pos)}resolve(doc){let $pos=doc.resolve(this.anchor),node=$pos.nodeAfter;return node&&NodeSelection.isSelectable(node)?new NodeSelection($pos):Selection.near($pos)}}class AllSelection extends Selection{constructor(doc){super(doc.resolve(0),doc.resolve(doc.content.size))}replace(tr,content=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty){if(content==prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty){tr.delete(0,tr.doc.content.size);let sel=Selection.atStart(tr.doc);sel.eq(tr.selection)||tr.setSelection(sel)}else super.replace(tr,content)}toJSON(){return{type:"all"}}static fromJSON(doc){return new AllSelection(doc)}map(doc){return new AllSelection(doc)}eq(other){return other instanceof AllSelection}getBookmark(){return AllBookmark}}Selection.jsonID("all",AllSelection);const AllBookmark={map(){return this},resolve:doc=>new AllSelection(doc)};function findSelectionIn(doc,node,pos,index,dir,text=!1){if(node.inlineContent)return TextSelection.create(doc,pos);for(let i=index-(dir>0?0:1);dir>0?i<node.childCount:i>=0;i+=dir){let child=node.child(i);if(child.isAtom){if(!text&&NodeSelection.isSelectable(child))return NodeSelection.create(doc,pos-(dir<0?child.nodeSize:0))}else{let inner=findSelectionIn(doc,child,pos+dir,dir<0?child.childCount:0,dir,text);if(inner)return inner}pos+=child.nodeSize*dir}return null}function selectionToInsertionEnd(tr,startLen,bias){let last=tr.steps.length-1;if(last<startLen)return;let end,step=tr.steps[last];(step instanceof prosemirror_transform__WEBPACK_IMPORTED_MODULE_1__.Ln||step instanceof prosemirror_transform__WEBPACK_IMPORTED_MODULE_1__.Wg)&&(tr.mapping.maps[last].forEach((_from,_to,_newFrom,newTo)=>{null==end&&(end=newTo)}),tr.setSelection(Selection.near(tr.doc.resolve(end),bias)))}class Transaction extends prosemirror_transform__WEBPACK_IMPORTED_MODULE_1__.dL{constructor(state){super(state.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=state.selection,this.storedMarks=state.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(selection){if(selection.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=selection,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(marks){return this.storedMarks=marks,this.updated|=2,this}ensureMarks(marks){return prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.CU.sameSet(this.storedMarks||this.selection.$from.marks(),marks)||this.setStoredMarks(marks),this}addStoredMark(mark){return this.ensureMarks(mark.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(mark){return this.ensureMarks(mark.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(step,doc){super.addStep(step,doc),this.updated=-3&this.updated,this.storedMarks=null}setTime(time){return this.time=time,this}replaceSelection(slice){return this.selection.replace(this,slice),this}replaceSelectionWith(node,inheritMarks=!0){let selection=this.selection;return inheritMarks&&(node=node.mark(this.storedMarks||(selection.empty?selection.$from.marks():selection.$from.marksAcross(selection.$to)||prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.CU.none))),selection.replaceWith(this,node),this}deleteSelection(){return this.selection.replace(this),this}insertText(text,from,to){let schema=this.doc.type.schema;if(null==from)return text?this.replaceSelectionWith(schema.text(text),!0):this.deleteSelection();{if(null==to&&(to=from),to=null==to?from:to,!text)return this.deleteRange(from,to);let marks=this.storedMarks;if(!marks){let $from=this.doc.resolve(from);marks=to==from?$from.marks():$from.marksAcross(this.doc.resolve(to))}return this.replaceRangeWith(from,to,schema.text(text,marks)),this.selection.empty||this.setSelection(Selection.near(this.selection.$to)),this}}setMeta(key,value){return this.meta["string"==typeof key?key:key.key]=value,this}getMeta(key){return this.meta["string"==typeof key?key:key.key]}get isGeneric(){for(let _ in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function bind(f,self){return self&&f?f.bind(self):f}class FieldDesc{constructor(name,desc,self){this.name=name,this.init=bind(desc.init,self),this.apply=bind(desc.apply,self)}}const baseFields=[new FieldDesc("doc",{init:config=>config.doc||config.schema.topNodeType.createAndFill(),apply:tr=>tr.doc}),new FieldDesc("selection",{init:(config,instance)=>config.selection||Selection.atStart(instance.doc),apply:tr=>tr.selection}),new FieldDesc("storedMarks",{init:config=>config.storedMarks||null,apply:(tr,_marks,_old,state)=>state.selection.$cursor?tr.storedMarks:null}),new FieldDesc("scrollToSelection",{init:()=>0,apply:(tr,prev)=>tr.scrolledIntoView?prev+1:prev})];class Configuration{constructor(schema,plugins){this.schema=schema,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=baseFields.slice(),plugins&&plugins.forEach(plugin=>{if(this.pluginsByKey[plugin.key])throw new RangeError("Adding different instances of a keyed plugin ("+plugin.key+")");this.plugins.push(plugin),this.pluginsByKey[plugin.key]=plugin,plugin.spec.state&&this.fields.push(new FieldDesc(plugin.key,plugin.spec.state,plugin))})}}class EditorState{constructor(config){this.config=config}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(tr){return this.applyTransaction(tr).state}filterTransaction(tr,ignore=-1){for(let i=0;i<this.config.plugins.length;i++)if(i!=ignore){let plugin=this.config.plugins[i];if(plugin.spec.filterTransaction&&!plugin.spec.filterTransaction.call(plugin,tr,this))return!1}return!0}applyTransaction(rootTr){if(!this.filterTransaction(rootTr))return{state:this,transactions:[]};let trs=[rootTr],newState=this.applyInner(rootTr),seen=null;for(;;){let haveNew=!1;for(let i=0;i<this.config.plugins.length;i++){let plugin=this.config.plugins[i];if(plugin.spec.appendTransaction){let n=seen?seen[i].n:0,oldState=seen?seen[i].state:this,tr=n<trs.length&&plugin.spec.appendTransaction.call(plugin,n?trs.slice(n):trs,oldState,newState);if(tr&&newState.filterTransaction(tr,i)){if(tr.setMeta("appendedTransaction",rootTr),!seen){seen=[];for(let j=0;j<this.config.plugins.length;j++)seen.push(j<i?{state:newState,n:trs.length}:{state:this,n:0})}trs.push(tr),newState=newState.applyInner(tr),haveNew=!0}seen&&(seen[i]={state:newState,n:trs.length})}}if(!haveNew)return{state:newState,transactions:trs}}}applyInner(tr){if(!tr.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let newInstance=new EditorState(this.config),fields=this.config.fields;for(let i=0;i<fields.length;i++){let field=fields[i];newInstance[field.name]=field.apply(tr,this[field.name],this,newInstance)}return newInstance}get tr(){return new Transaction(this)}static create(config){let $config=new Configuration(config.doc?config.doc.type.schema:config.schema,config.plugins),instance=new EditorState($config);for(let i=0;i<$config.fields.length;i++)instance[$config.fields[i].name]=$config.fields[i].init(config,instance);return instance}reconfigure(config){let $config=new Configuration(this.schema,config.plugins),fields=$config.fields,instance=new EditorState($config);for(let i=0;i<fields.length;i++){let name=fields[i].name;instance[name]=this.hasOwnProperty(name)?this[name]:fields[i].init(config,instance)}return instance}toJSON(pluginFields){let result={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(result.storedMarks=this.storedMarks.map(m=>m.toJSON())),pluginFields&&"object"==typeof pluginFields)for(let prop in pluginFields){if("doc"==prop||"selection"==prop)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let plugin=pluginFields[prop],state=plugin.spec.state;state&&state.toJSON&&(result[prop]=state.toJSON.call(plugin,this[plugin.key]))}return result}static fromJSON(config,json,pluginFields){if(!json)throw new RangeError("Invalid input for EditorState.fromJSON");if(!config.schema)throw new RangeError("Required config field 'schema' missing");let $config=new Configuration(config.schema,config.plugins),instance=new EditorState($config);return $config.fields.forEach(field=>{if("doc"==field.name)instance.doc=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.bP.fromJSON(config.schema,json.doc);else if("selection"==field.name)instance.selection=Selection.fromJSON(instance.doc,json.selection);else if("storedMarks"==field.name)json.storedMarks&&(instance.storedMarks=json.storedMarks.map(config.schema.markFromJSON));else{if(pluginFields)for(let prop in pluginFields){let plugin=pluginFields[prop],state=plugin.spec.state;if(plugin.key==field.name&&state&&state.fromJSON&&Object.prototype.hasOwnProperty.call(json,prop))return void(instance[field.name]=state.fromJSON.call(plugin,config,json[prop],instance))}instance[field.name]=field.init(config,instance)}}),instance}}function bindProps(obj,self,target){for(let prop in obj){let val=obj[prop];val instanceof Function?val=val.bind(self):"handleDOMEvents"==prop&&(val=bindProps(val,self,{})),target[prop]=val}return target}class Plugin{constructor(spec){this.spec=spec,this.props={},spec.props&&bindProps(spec.props,this,this.props),this.key=spec.key?spec.key.key:createKey("plugin")}getState(state){return state[this.key]}}const keys=Object.create(null);function createKey(name){return name in keys?name+"$"+ ++keys[name]:(keys[name]=0,name+"$")}class PluginKey{constructor(name="key"){this.key=createKey(name)}get(state){return state.config.pluginsByKey[this.key]}getState(state){return state[this.key]}}},"./node_modules/prosemirror-transform/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{$L:()=>replaceStep,Ln:()=>ReplaceStep,N0:()=>joinPoint,Um:()=>dropPoint,Wg:()=>ReplaceAroundStep,X9:()=>Mapping,dL:()=>Transform,jP:()=>liftTarget,n9:()=>canJoin,oM:()=>findWrapping,zy:()=>canSplit});var prosemirror_model__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/prosemirror-model/dist/index.js");const factor16=Math.pow(2,16);function makeRecover(index,offset){return index+offset*factor16}function recoverIndex(value){return 65535&value}class MapResult{constructor(pos,delInfo,recover){this.pos=pos,this.delInfo=delInfo,this.recover=recover}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class StepMap{constructor(ranges,inverted=!1){if(this.ranges=ranges,this.inverted=inverted,!ranges.length&&StepMap.empty)return StepMap.empty}recover(value){let diff=0,index=recoverIndex(value);if(!this.inverted)for(let i=0;i<index;i++)diff+=this.ranges[3*i+2]-this.ranges[3*i+1];return this.ranges[3*index]+diff+function recoverOffset(value){return(value-(65535&value))/factor16}(value)}mapResult(pos,assoc=1){return this._map(pos,assoc,!1)}map(pos,assoc=1){return this._map(pos,assoc,!0)}_map(pos,assoc,simple){let diff=0,oldIndex=this.inverted?2:1,newIndex=this.inverted?1:2;for(let i=0;i<this.ranges.length;i+=3){let start=this.ranges[i]-(this.inverted?diff:0);if(start>pos)break;let oldSize=this.ranges[i+oldIndex],newSize=this.ranges[i+newIndex],end=start+oldSize;if(pos<=end){let result=start+diff+((oldSize?pos==start?-1:pos==end?1:assoc:assoc)<0?0:newSize);if(simple)return result;let recover=pos==(assoc<0?start:end)?null:makeRecover(i/3,pos-start),del=pos==start?2:pos==end?1:4;return(assoc<0?pos!=start:pos!=end)&&(del|=8),new MapResult(result,del,recover)}diff+=newSize-oldSize}return simple?pos+diff:new MapResult(pos+diff,0,null)}touches(pos,recover){let diff=0,index=recoverIndex(recover),oldIndex=this.inverted?2:1,newIndex=this.inverted?1:2;for(let i=0;i<this.ranges.length;i+=3){let start=this.ranges[i]-(this.inverted?diff:0);if(start>pos)break;let oldSize=this.ranges[i+oldIndex];if(pos<=start+oldSize&&i==3*index)return!0;diff+=this.ranges[i+newIndex]-oldSize}return!1}forEach(f){let oldIndex=this.inverted?2:1,newIndex=this.inverted?1:2;for(let i=0,diff=0;i<this.ranges.length;i+=3){let start=this.ranges[i],oldStart=start-(this.inverted?diff:0),newStart=start+(this.inverted?0:diff),oldSize=this.ranges[i+oldIndex],newSize=this.ranges[i+newIndex];f(oldStart,oldStart+oldSize,newStart,newStart+newSize),diff+=newSize-oldSize}}invert(){return new StepMap(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(n){return 0==n?StepMap.empty:new StepMap(n<0?[0,-n,0]:[0,0,n])}}StepMap.empty=new StepMap([]);class Mapping{constructor(maps,mirror,from=0,to=(maps?maps.length:0)){this.mirror=mirror,this.from=from,this.to=to,this._maps=maps||[],this.ownData=!(maps||mirror)}get maps(){return this._maps}slice(from=0,to=this.maps.length){return new Mapping(this._maps,this.mirror,from,to)}appendMap(map,mirrors){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(map),null!=mirrors&&this.setMirror(this._maps.length-1,mirrors)}appendMapping(mapping){for(let i=0,startSize=this._maps.length;i<mapping._maps.length;i++){let mirr=mapping.getMirror(i);this.appendMap(mapping._maps[i],null!=mirr&&mirr<i?startSize+mirr:void 0)}}getMirror(n){if(this.mirror)for(let i=0;i<this.mirror.length;i++)if(this.mirror[i]==n)return this.mirror[i+(i%2?-1:1)]}setMirror(n,m){this.mirror||(this.mirror=[]),this.mirror.push(n,m)}appendMappingInverted(mapping){for(let i=mapping.maps.length-1,totalSize=this._maps.length+mapping._maps.length;i>=0;i--){let mirr=mapping.getMirror(i);this.appendMap(mapping._maps[i].invert(),null!=mirr&&mirr>i?totalSize-mirr-1:void 0)}}invert(){let inverse=new Mapping;return inverse.appendMappingInverted(this),inverse}map(pos,assoc=1){if(this.mirror)return this._map(pos,assoc,!0);for(let i=this.from;i<this.to;i++)pos=this._maps[i].map(pos,assoc);return pos}mapResult(pos,assoc=1){return this._map(pos,assoc,!1)}_map(pos,assoc,simple){let delInfo=0;for(let i=this.from;i<this.to;i++){let result=this._maps[i].mapResult(pos,assoc);if(null!=result.recover){let corr=this.getMirror(i);if(null!=corr&&corr>i&&corr<this.to){i=corr,pos=this._maps[corr].recover(result.recover);continue}}delInfo|=result.delInfo,pos=result.pos}return simple?pos:new MapResult(pos,delInfo,null)}}const stepsByID=Object.create(null);class Step{getMap(){return StepMap.empty}merge(other){return null}static fromJSON(schema,json){if(!json||!json.stepType)throw new RangeError("Invalid input for Step.fromJSON");let type=stepsByID[json.stepType];if(!type)throw new RangeError(`No step type ${json.stepType} defined`);return type.fromJSON(schema,json)}static jsonID(id,stepClass){if(id in stepsByID)throw new RangeError("Duplicate use of step JSON ID "+id);return stepsByID[id]=stepClass,stepClass.prototype.jsonID=id,stepClass}}class StepResult{constructor(doc,failed){this.doc=doc,this.failed=failed}static ok(doc){return new StepResult(doc,null)}static fail(message){return new StepResult(null,message)}static fromReplace(doc,from,to,slice){try{return StepResult.ok(doc.replace(from,to,slice))}catch(e){if(e instanceof prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.vI)return StepResult.fail(e.message);throw e}}}function mapFragment(fragment,f,parent){let mapped=[];for(let i=0;i<fragment.childCount;i++){let child=fragment.child(i);child.content.size&&(child=child.copy(mapFragment(child.content,f,child))),child.isInline&&(child=f(child,parent,i)),mapped.push(child)}return prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.fromArray(mapped)}class AddMarkStep extends Step{constructor(from,to,mark){super(),this.from=from,this.to=to,this.mark=mark}apply(doc){let oldSlice=doc.slice(this.from,this.to),$from=doc.resolve(this.from),parent=$from.node($from.sharedDepth(this.to)),slice=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(mapFragment(oldSlice.content,(node,parent)=>node.isAtom&&parent.type.allowsMarkType(this.mark.type)?node.mark(this.mark.addToSet(node.marks)):node,parent),oldSlice.openStart,oldSlice.openEnd);return StepResult.fromReplace(doc,this.from,this.to,slice)}invert(){return new RemoveMarkStep(this.from,this.to,this.mark)}map(mapping){let from=mapping.mapResult(this.from,1),to=mapping.mapResult(this.to,-1);return from.deleted&&to.deleted||from.pos>=to.pos?null:new AddMarkStep(from.pos,to.pos,this.mark)}merge(other){return other instanceof AddMarkStep&&other.mark.eq(this.mark)&&this.from<=other.to&&this.to>=other.from?new AddMarkStep(Math.min(this.from,other.from),Math.max(this.to,other.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(schema,json){if("number"!=typeof json.from||"number"!=typeof json.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new AddMarkStep(json.from,json.to,schema.markFromJSON(json.mark))}}Step.jsonID("addMark",AddMarkStep);class RemoveMarkStep extends Step{constructor(from,to,mark){super(),this.from=from,this.to=to,this.mark=mark}apply(doc){let oldSlice=doc.slice(this.from,this.to),slice=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(mapFragment(oldSlice.content,node=>node.mark(this.mark.removeFromSet(node.marks)),doc),oldSlice.openStart,oldSlice.openEnd);return StepResult.fromReplace(doc,this.from,this.to,slice)}invert(){return new AddMarkStep(this.from,this.to,this.mark)}map(mapping){let from=mapping.mapResult(this.from,1),to=mapping.mapResult(this.to,-1);return from.deleted&&to.deleted||from.pos>=to.pos?null:new RemoveMarkStep(from.pos,to.pos,this.mark)}merge(other){return other instanceof RemoveMarkStep&&other.mark.eq(this.mark)&&this.from<=other.to&&this.to>=other.from?new RemoveMarkStep(Math.min(this.from,other.from),Math.max(this.to,other.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(schema,json){if("number"!=typeof json.from||"number"!=typeof json.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new RemoveMarkStep(json.from,json.to,schema.markFromJSON(json.mark))}}Step.jsonID("removeMark",RemoveMarkStep);class AddNodeMarkStep extends Step{constructor(pos,mark){super(),this.pos=pos,this.mark=mark}apply(doc){let node=doc.nodeAt(this.pos);if(!node)return StepResult.fail("No node at mark step's position");let updated=node.type.create(node.attrs,null,this.mark.addToSet(node.marks));return StepResult.fromReplace(doc,this.pos,this.pos+1,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(updated),0,node.isLeaf?0:1))}invert(doc){let node=doc.nodeAt(this.pos);if(node){let newSet=this.mark.addToSet(node.marks);if(newSet.length==node.marks.length){for(let i=0;i<node.marks.length;i++)if(!node.marks[i].isInSet(newSet))return new AddNodeMarkStep(this.pos,node.marks[i]);return new AddNodeMarkStep(this.pos,this.mark)}}return new RemoveNodeMarkStep(this.pos,this.mark)}map(mapping){let pos=mapping.mapResult(this.pos,1);return pos.deletedAfter?null:new AddNodeMarkStep(pos.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(schema,json){if("number"!=typeof json.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new AddNodeMarkStep(json.pos,schema.markFromJSON(json.mark))}}Step.jsonID("addNodeMark",AddNodeMarkStep);class RemoveNodeMarkStep extends Step{constructor(pos,mark){super(),this.pos=pos,this.mark=mark}apply(doc){let node=doc.nodeAt(this.pos);if(!node)return StepResult.fail("No node at mark step's position");let updated=node.type.create(node.attrs,null,this.mark.removeFromSet(node.marks));return StepResult.fromReplace(doc,this.pos,this.pos+1,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(updated),0,node.isLeaf?0:1))}invert(doc){let node=doc.nodeAt(this.pos);return node&&this.mark.isInSet(node.marks)?new AddNodeMarkStep(this.pos,this.mark):this}map(mapping){let pos=mapping.mapResult(this.pos,1);return pos.deletedAfter?null:new RemoveNodeMarkStep(pos.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(schema,json){if("number"!=typeof json.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new RemoveNodeMarkStep(json.pos,schema.markFromJSON(json.mark))}}Step.jsonID("removeNodeMark",RemoveNodeMarkStep);class ReplaceStep extends Step{constructor(from,to,slice,structure=!1){super(),this.from=from,this.to=to,this.slice=slice,this.structure=structure}apply(doc){return this.structure&&contentBetween(doc,this.from,this.to)?StepResult.fail("Structure replace would overwrite content"):StepResult.fromReplace(doc,this.from,this.to,this.slice)}getMap(){return new StepMap([this.from,this.to-this.from,this.slice.size])}invert(doc){return new ReplaceStep(this.from,this.from+this.slice.size,doc.slice(this.from,this.to))}map(mapping){let from=mapping.mapResult(this.from,1),to=mapping.mapResult(this.to,-1);return from.deletedAcross&&to.deletedAcross?null:new ReplaceStep(from.pos,Math.max(from.pos,to.pos),this.slice,this.structure)}merge(other){if(!(other instanceof ReplaceStep)||other.structure||this.structure)return null;if(this.from+this.slice.size!=other.from||this.slice.openEnd||other.slice.openStart){if(other.to!=this.from||this.slice.openStart||other.slice.openEnd)return null;{let slice=this.slice.size+other.slice.size==0?prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty:new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(other.slice.content.append(this.slice.content),other.slice.openStart,this.slice.openEnd);return new ReplaceStep(other.from,this.to,slice,this.structure)}}{let slice=this.slice.size+other.slice.size==0?prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty:new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(this.slice.content.append(other.slice.content),this.slice.openStart,other.slice.openEnd);return new ReplaceStep(this.from,this.to+(other.to-other.from),slice,this.structure)}}toJSON(){let json={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(json.slice=this.slice.toJSON()),this.structure&&(json.structure=!0),json}static fromJSON(schema,json){if("number"!=typeof json.from||"number"!=typeof json.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ReplaceStep(json.from,json.to,prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.fromJSON(schema,json.slice),!!json.structure)}}Step.jsonID("replace",ReplaceStep);class ReplaceAroundStep extends Step{constructor(from,to,gapFrom,gapTo,slice,insert,structure=!1){super(),this.from=from,this.to=to,this.gapFrom=gapFrom,this.gapTo=gapTo,this.slice=slice,this.insert=insert,this.structure=structure}apply(doc){if(this.structure&&(contentBetween(doc,this.from,this.gapFrom)||contentBetween(doc,this.gapTo,this.to)))return StepResult.fail("Structure gap-replace would overwrite content");let gap=doc.slice(this.gapFrom,this.gapTo);if(gap.openStart||gap.openEnd)return StepResult.fail("Gap is not a flat range");let inserted=this.slice.insertAt(this.insert,gap.content);return inserted?StepResult.fromReplace(doc,this.from,this.to,inserted):StepResult.fail("Content does not fit in gap")}getMap(){return new StepMap([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(doc){let gap=this.gapTo-this.gapFrom;return new ReplaceAroundStep(this.from,this.from+this.slice.size+gap,this.from+this.insert,this.from+this.insert+gap,doc.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(mapping){let from=mapping.mapResult(this.from,1),to=mapping.mapResult(this.to,-1),gapFrom=this.from==this.gapFrom?from.pos:mapping.map(this.gapFrom,-1),gapTo=this.to==this.gapTo?to.pos:mapping.map(this.gapTo,1);return from.deletedAcross&&to.deletedAcross||gapFrom<from.pos||gapTo>to.pos?null:new ReplaceAroundStep(from.pos,to.pos,gapFrom,gapTo,this.slice,this.insert,this.structure)}toJSON(){let json={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(json.slice=this.slice.toJSON()),this.structure&&(json.structure=!0),json}static fromJSON(schema,json){if("number"!=typeof json.from||"number"!=typeof json.to||"number"!=typeof json.gapFrom||"number"!=typeof json.gapTo||"number"!=typeof json.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ReplaceAroundStep(json.from,json.to,json.gapFrom,json.gapTo,prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.fromJSON(schema,json.slice),json.insert,!!json.structure)}}function contentBetween(doc,from,to){let $from=doc.resolve(from),dist=to-from,depth=$from.depth;for(;dist>0&&depth>0&&$from.indexAfter(depth)==$from.node(depth).childCount;)depth--,dist--;if(dist>0){let next=$from.node(depth).maybeChild($from.indexAfter(depth));for(;dist>0;){if(!next||next.isLeaf)return!0;next=next.firstChild,dist--}}return!1}function clearIncompatible(tr,pos,parentType,match=parentType.contentMatch,clearNewlines=!0){let node=tr.doc.nodeAt(pos),replSteps=[],cur=pos+1;for(let i=0;i<node.childCount;i++){let child=node.child(i),end=cur+child.nodeSize,allowed=match.matchType(child.type);if(allowed){match=allowed;for(let j=0;j<child.marks.length;j++)parentType.allowsMarkType(child.marks[j].type)||tr.step(new RemoveMarkStep(cur,end,child.marks[j]));if(clearNewlines&&child.isText&&"pre"!=parentType.whitespace){let m,slice,newline=/\r?\n|\r/g;for(;m=newline.exec(child.text);)slice||(slice=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(parentType.schema.text(" ",parentType.allowedMarks(child.marks))),0,0)),replSteps.push(new ReplaceStep(cur+m.index,cur+m.index+m[0].length,slice))}}else replSteps.push(new ReplaceStep(cur,end,prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty));cur=end}if(!match.validEnd){let fill=match.fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,!0);tr.replace(cur,cur,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(fill,0,0))}for(let i=replSteps.length-1;i>=0;i--)tr.step(replSteps[i])}function canCut(node,start,end){return(0==start||node.canReplace(start,node.childCount))&&(end==node.childCount||node.canReplace(0,end))}function liftTarget(range){let content=range.parent.content.cutByIndex(range.startIndex,range.endIndex);for(let depth=range.depth;;--depth){let node=range.$from.node(depth),index=range.$from.index(depth),endIndex=range.$to.indexAfter(depth);if(depth<range.depth&&node.canReplace(index,endIndex,content))return depth;if(0==depth||node.type.spec.isolating||!canCut(node,index,endIndex))break}return null}function findWrapping(range,nodeType,attrs=null,innerRange=range){let around=function findWrappingOutside(range,type){let{parent,startIndex,endIndex}=range,around=parent.contentMatchAt(startIndex).findWrapping(type);if(!around)return null;let outer=around.length?around[0]:type;return parent.canReplaceWith(startIndex,endIndex,outer)?around:null}(range,nodeType),inner=around&&function findWrappingInside(range,type){let{parent,startIndex,endIndex}=range,inner=parent.child(startIndex),inside=type.contentMatch.findWrapping(inner.type);if(!inside)return null;let innerMatch=(inside.length?inside[inside.length-1]:type).contentMatch;for(let i=startIndex;innerMatch&&i<endIndex;i++)innerMatch=innerMatch.matchType(parent.child(i).type);return innerMatch&&innerMatch.validEnd?inside:null}(innerRange,nodeType);return inner?around.map(withAttrs).concat({type:nodeType,attrs}).concat(inner.map(withAttrs)):null}function withAttrs(type){return{type,attrs:null}}function replaceNewlines(tr,node,pos,mapFrom){node.forEach((child,offset)=>{if(child.isText){let m,newline=/\r?\n|\r/g;for(;m=newline.exec(child.text);){let start=tr.mapping.slice(mapFrom).map(pos+1+offset+m.index);tr.replaceWith(start,start+1,node.type.schema.linebreakReplacement.create())}}})}function replaceLinebreaks(tr,node,pos,mapFrom){node.forEach((child,offset)=>{if(child.type==child.type.schema.linebreakReplacement){let start=tr.mapping.slice(mapFrom).map(pos+1+offset);tr.replaceWith(start,start+1,node.type.schema.text("\n"))}})}function canSplit(doc,pos,depth=1,typesAfter){let $pos=doc.resolve(pos),base=$pos.depth-depth,innerType=typesAfter&&typesAfter[typesAfter.length-1]||$pos.parent;if(base<0||$pos.parent.type.spec.isolating||!$pos.parent.canReplace($pos.index(),$pos.parent.childCount)||!innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(),$pos.parent.childCount)))return!1;for(let d=$pos.depth-1,i=depth-2;d>base;d--,i--){let node=$pos.node(d),index=$pos.index(d);if(node.type.spec.isolating)return!1;let rest=node.content.cutByIndex(index,node.childCount),overrideChild=typesAfter&&typesAfter[i+1];overrideChild&&(rest=rest.replaceChild(0,overrideChild.type.create(overrideChild.attrs)));let after=typesAfter&&typesAfter[i]||node;if(!node.canReplace(index+1,node.childCount)||!after.type.validContent(rest))return!1}let index=$pos.indexAfter(base),baseType=typesAfter&&typesAfter[0];return $pos.node(base).canReplaceWith(index,index,baseType?baseType.type:$pos.node(base+1).type)}function canJoin(doc,pos){let $pos=doc.resolve(pos),index=$pos.index();return joinable($pos.nodeBefore,$pos.nodeAfter)&&$pos.parent.canReplace(index,index+1)}function joinable(a,b){return!(!a||!b||a.isLeaf||!function canAppendWithSubstitutedLinebreaks(a,b){b.content.size||a.type.compatibleContent(b.type);let match=a.contentMatchAt(a.childCount),{linebreakReplacement}=a.type.schema;for(let i=0;i<b.childCount;i++){let child=b.child(i),type=child.type==linebreakReplacement?a.type.schema.nodes.text:child.type;if(match=match.matchType(type),!match)return!1;if(!a.type.allowsMarks(child.marks))return!1}return match.validEnd}(a,b))}function joinPoint(doc,pos,dir=-1){let $pos=doc.resolve(pos);for(let d=$pos.depth;;d--){let before,after,index=$pos.index(d);if(d==$pos.depth?(before=$pos.nodeBefore,after=$pos.nodeAfter):dir>0?(before=$pos.node(d+1),index++,after=$pos.node(d).maybeChild(index)):(before=$pos.node(d).maybeChild(index-1),after=$pos.node(d+1)),before&&!before.isTextblock&&joinable(before,after)&&$pos.node(d).canReplace(index,index+1))return pos;if(0==d)break;pos=dir<0?$pos.before(d):$pos.after(d)}}function dropPoint(doc,pos,slice){let $pos=doc.resolve(pos);if(!slice.content.size)return pos;let content=slice.content;for(let i=0;i<slice.openStart;i++)content=content.firstChild.content;for(let pass=1;pass<=(0==slice.openStart&&slice.size?2:1);pass++)for(let d=$pos.depth;d>=0;d--){let bias=d==$pos.depth?0:$pos.pos<=($pos.start(d+1)+$pos.end(d+1))/2?-1:1,insertPos=$pos.index(d)+(bias>0?1:0),parent=$pos.node(d),fits=!1;if(1==pass)fits=parent.canReplace(insertPos,insertPos,content);else{let wrapping=parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);fits=wrapping&&parent.canReplaceWith(insertPos,insertPos,wrapping[0])}if(fits)return 0==bias?$pos.pos:bias<0?$pos.before(d+1):$pos.after(d+1)}return null}function replaceStep(doc,from,to=from,slice=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty){if(from==to&&!slice.size)return null;let $from=doc.resolve(from),$to=doc.resolve(to);return fitsTrivially($from,$to,slice)?new ReplaceStep(from,to,slice):new Fitter($from,$to,slice).fit()}function fitsTrivially($from,$to,slice){return!slice.openStart&&!slice.openEnd&&$from.start()==$to.start()&&$from.parent.canReplace($from.index(),$to.index(),slice.content)}Step.jsonID("replaceAround",ReplaceAroundStep);class Fitter{constructor($from,$to,unplaced){this.$from=$from,this.$to=$to,this.unplaced=unplaced,this.frontier=[],this.placed=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty;for(let i=0;i<=$from.depth;i++){let node=$from.node(i);this.frontier.push({type:node.type,match:node.contentMatchAt($from.indexAfter(i))})}for(let i=$from.depth;i>0;i--)this.placed=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from($from.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let fit=this.findFittable();fit?this.placeNodes(fit):this.openMore()||this.dropNode()}let moveInline=this.mustMoveInline(),placedSize=this.placed.size-this.depth-this.$from.depth,$from=this.$from,$to=this.close(moveInline<0?this.$to:$from.doc.resolve(moveInline));if(!$to)return null;let content=this.placed,openStart=$from.depth,openEnd=$to.depth;for(;openStart&&openEnd&&1==content.childCount;)content=content.firstChild.content,openStart--,openEnd--;let slice=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(content,openStart,openEnd);return moveInline>-1?new ReplaceAroundStep($from.pos,moveInline,this.$to.pos,this.$to.end(),slice,placedSize):slice.size||$from.pos!=this.$to.pos?new ReplaceStep($from.pos,$to.pos,slice):null}findFittable(){let startDepth=this.unplaced.openStart;for(let cur=this.unplaced.content,d=0,openEnd=this.unplaced.openEnd;d<startDepth;d++){let node=cur.firstChild;if(cur.childCount>1&&(openEnd=0),node.type.spec.isolating&&openEnd<=d){startDepth=d;break}cur=node.content}for(let pass=1;pass<=2;pass++)for(let sliceDepth=1==pass?startDepth:this.unplaced.openStart;sliceDepth>=0;sliceDepth--){let fragment,parent=null;sliceDepth?(parent=contentAt(this.unplaced.content,sliceDepth-1).firstChild,fragment=parent.content):fragment=this.unplaced.content;let first=fragment.firstChild;for(let frontierDepth=this.depth;frontierDepth>=0;frontierDepth--){let wrap,{type,match}=this.frontier[frontierDepth],inject=null;if(1==pass&&(first?match.matchType(first.type)||(inject=match.fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(first),!1)):parent&&type.compatibleContent(parent.type)))return{sliceDepth,frontierDepth,parent,inject};if(2==pass&&first&&(wrap=match.findWrapping(first.type)))return{sliceDepth,frontierDepth,parent,wrap};if(parent&&match.matchType(parent.type))break}}}openMore(){let{content,openStart,openEnd}=this.unplaced,inner=contentAt(content,openStart);return!(!inner.childCount||inner.firstChild.isLeaf)&&(this.unplaced=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(content,openStart+1,Math.max(openEnd,inner.size+openStart>=content.size-openEnd?openStart+1:0)),!0)}dropNode(){let{content,openStart,openEnd}=this.unplaced,inner=contentAt(content,openStart);if(inner.childCount<=1&&openStart>0){let openAtEnd=content.size-openStart<=openStart+inner.size;this.unplaced=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(dropFromFragment(content,openStart-1,1),openStart-1,openAtEnd?openStart-1:openEnd)}else this.unplaced=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(dropFromFragment(content,openStart,1),openStart,openEnd)}placeNodes({sliceDepth,frontierDepth,parent,inject,wrap}){for(;this.depth>frontierDepth;)this.closeFrontierNode();if(wrap)for(let i=0;i<wrap.length;i++)this.openFrontierNode(wrap[i]);let slice=this.unplaced,fragment=parent?parent.content:slice.content,openStart=slice.openStart-sliceDepth,taken=0,add=[],{match,type}=this.frontier[frontierDepth];if(inject){for(let i=0;i<inject.childCount;i++)add.push(inject.child(i));match=match.matchFragment(inject)}let openEndCount=fragment.size+sliceDepth-(slice.content.size-slice.openEnd);for(;taken<fragment.childCount;){let next=fragment.child(taken),matches=match.matchType(next.type);if(!matches)break;taken++,(taken>1||0==openStart||next.content.size)&&(match=matches,add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)),1==taken?openStart:0,taken==fragment.childCount?openEndCount:-1)))}let toEnd=taken==fragment.childCount;toEnd||(openEndCount=-1),this.placed=addToFragment(this.placed,frontierDepth,prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(add)),this.frontier[frontierDepth].match=match,toEnd&&openEndCount<0&&parent&&parent.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let i=0,cur=fragment;i<openEndCount;i++){let node=cur.lastChild;this.frontier.push({type:node.type,match:node.contentMatchAt(node.childCount)}),cur=node.content}this.unplaced=toEnd?0==sliceDepth?prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty:new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(dropFromFragment(slice.content,sliceDepth-1,1),sliceDepth-1,openEndCount<0?slice.openEnd:sliceDepth-1):new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(dropFromFragment(slice.content,sliceDepth,taken),slice.openStart,slice.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let level,top=this.frontier[this.depth];if(!top.type.isTextblock||!contentAfterFits(this.$to,this.$to.depth,top.type,top.match,!1)||this.$to.depth==this.depth&&(level=this.findCloseLevel(this.$to))&&level.depth==this.depth)return-1;let{depth}=this.$to,after=this.$to.after(depth);for(;depth>1&&after==this.$to.end(--depth);)++after;return after}findCloseLevel($to){scan:for(let i=Math.min(this.depth,$to.depth);i>=0;i--){let{match,type}=this.frontier[i],dropInner=i<$to.depth&&$to.end(i+1)==$to.pos+($to.depth-(i+1)),fit=contentAfterFits($to,i,type,match,dropInner);if(fit){for(let d=i-1;d>=0;d--){let{match,type}=this.frontier[d],matches=contentAfterFits($to,d,type,match,!0);if(!matches||matches.childCount)continue scan}return{depth:i,fit,move:dropInner?$to.doc.resolve($to.after(i+1)):$to}}}}close($to){let close=this.findCloseLevel($to);if(!close)return null;for(;this.depth>close.depth;)this.closeFrontierNode();close.fit.childCount&&(this.placed=addToFragment(this.placed,close.depth,close.fit)),$to=close.move;for(let d=close.depth+1;d<=$to.depth;d++){let node=$to.node(d),add=node.type.contentMatch.fillBefore(node.content,!0,$to.index(d));this.openFrontierNode(node.type,node.attrs,add)}return $to}openFrontierNode(type,attrs=null,content){let top=this.frontier[this.depth];top.match=top.match.matchType(type),this.placed=addToFragment(this.placed,this.depth,prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(type.create(attrs,content))),this.frontier.push({type,match:type.contentMatch})}closeFrontierNode(){let add=this.frontier.pop().match.fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,!0);add.childCount&&(this.placed=addToFragment(this.placed,this.frontier.length,add))}}function dropFromFragment(fragment,depth,count){return 0==depth?fragment.cutByIndex(count,fragment.childCount):fragment.replaceChild(0,fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content,depth-1,count)))}function addToFragment(fragment,depth,content){return 0==depth?fragment.append(content):fragment.replaceChild(fragment.childCount-1,fragment.lastChild.copy(addToFragment(fragment.lastChild.content,depth-1,content)))}function contentAt(fragment,depth){for(let i=0;i<depth;i++)fragment=fragment.firstChild.content;return fragment}function closeNodeStart(node,openStart,openEnd){if(openStart<=0)return node;let frag=node.content;return openStart>1&&(frag=frag.replaceChild(0,closeNodeStart(frag.firstChild,openStart-1,1==frag.childCount?openEnd-1:0))),openStart>0&&(frag=node.type.contentMatch.fillBefore(frag).append(frag),openEnd<=0&&(frag=frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,!0)))),node.copy(frag)}function contentAfterFits($to,depth,type,match,open){let node=$to.node(depth),index=open?$to.indexAfter(depth):$to.index(depth);if(index==node.childCount&&!type.compatibleContent(node.type))return null;let fit=match.fillBefore(node.content,!0,index);return fit&&!function invalidMarks(type,fragment,start){for(let i=start;i<fragment.childCount;i++)if(!type.allowsMarks(fragment.child(i).marks))return!0;return!1}(type,node.content,index)?fit:null}function definesContent(type){return type.spec.defining||type.spec.definingForContent}function closeFragment(fragment,depth,oldOpen,newOpen,parent){if(depth<oldOpen){let first=fragment.firstChild;fragment=fragment.replaceChild(0,first.copy(closeFragment(first.content,depth+1,oldOpen,newOpen,first)))}if(depth>newOpen){let match=parent.contentMatchAt(0),start=match.fillBefore(fragment).append(fragment);fragment=start.append(match.matchFragment(start).fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,!0))}return fragment}function coveredDepths($from,$to){let result=[];for(let d=Math.min($from.depth,$to.depth);d>=0;d--){let start=$from.start(d);if(start<$from.pos-($from.depth-d)||$to.end(d)>$to.pos+($to.depth-d)||$from.node(d).type.spec.isolating||$to.node(d).type.spec.isolating)break;(start==$to.start(d)||d==$from.depth&&d==$to.depth&&$from.parent.inlineContent&&$to.parent.inlineContent&&d&&$to.start(d-1)==start-1)&&result.push(d)}return result}class AttrStep extends Step{constructor(pos,attr,value){super(),this.pos=pos,this.attr=attr,this.value=value}apply(doc){let node=doc.nodeAt(this.pos);if(!node)return StepResult.fail("No node at attribute step's position");let attrs=Object.create(null);for(let name in node.attrs)attrs[name]=node.attrs[name];attrs[this.attr]=this.value;let updated=node.type.create(attrs,null,node.marks);return StepResult.fromReplace(doc,this.pos,this.pos+1,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(updated),0,node.isLeaf?0:1))}getMap(){return StepMap.empty}invert(doc){return new AttrStep(this.pos,this.attr,doc.nodeAt(this.pos).attrs[this.attr])}map(mapping){let pos=mapping.mapResult(this.pos,1);return pos.deletedAfter?null:new AttrStep(pos.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(schema,json){if("number"!=typeof json.pos||"string"!=typeof json.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new AttrStep(json.pos,json.attr,json.value)}}Step.jsonID("attr",AttrStep);class DocAttrStep extends Step{constructor(attr,value){super(),this.attr=attr,this.value=value}apply(doc){let attrs=Object.create(null);for(let name in doc.attrs)attrs[name]=doc.attrs[name];attrs[this.attr]=this.value;let updated=doc.type.create(attrs,doc.content,doc.marks);return StepResult.ok(updated)}getMap(){return StepMap.empty}invert(doc){return new DocAttrStep(this.attr,doc.attrs[this.attr])}map(mapping){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(schema,json){if("string"!=typeof json.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new DocAttrStep(json.attr,json.value)}}Step.jsonID("docAttr",DocAttrStep);let TransformError=class extends Error{};TransformError=function TransformError(message){let err=Error.call(this,message);return err.__proto__=TransformError.prototype,err},(TransformError.prototype=Object.create(Error.prototype)).constructor=TransformError,TransformError.prototype.name="TransformError";class Transform{constructor(doc){this.doc=doc,this.steps=[],this.docs=[],this.mapping=new Mapping}get before(){return this.docs.length?this.docs[0]:this.doc}step(step){let result=this.maybeStep(step);if(result.failed)throw new TransformError(result.failed);return this}maybeStep(step){let result=step.apply(this.doc);return result.failed||this.addStep(step,result.doc),result}get docChanged(){return this.steps.length>0}addStep(step,doc){this.docs.push(this.doc),this.steps.push(step),this.mapping.appendMap(step.getMap()),this.doc=doc}replace(from,to=from,slice=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty){let step=replaceStep(this.doc,from,to,slice);return step&&this.step(step),this}replaceWith(from,to,content){return this.replace(from,to,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(content),0,0))}delete(from,to){return this.replace(from,to,prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty)}insert(pos,content){return this.replaceWith(pos,pos,content)}replaceRange(from,to,slice){return function replaceRange(tr,from,to,slice){if(!slice.size)return tr.deleteRange(from,to);let $from=tr.doc.resolve(from),$to=tr.doc.resolve(to);if(fitsTrivially($from,$to,slice))return tr.step(new ReplaceStep(from,to,slice));let targetDepths=coveredDepths($from,tr.doc.resolve(to));0==targetDepths[targetDepths.length-1]&&targetDepths.pop();let preferredTarget=-($from.depth+1);targetDepths.unshift(preferredTarget);for(let d=$from.depth,pos=$from.pos-1;d>0;d--,pos--){let spec=$from.node(d).type.spec;if(spec.defining||spec.definingAsContext||spec.isolating)break;targetDepths.indexOf(d)>-1?preferredTarget=d:$from.before(d)==pos&&targetDepths.splice(1,0,-d)}let preferredTargetIndex=targetDepths.indexOf(preferredTarget),leftNodes=[],preferredDepth=slice.openStart;for(let content=slice.content,i=0;;i++){let node=content.firstChild;if(leftNodes.push(node),i==slice.openStart)break;content=node.content}for(let d=preferredDepth-1;d>=0;d--){let leftNode=leftNodes[d],def=definesContent(leftNode.type);if(def&&!leftNode.sameMarkup($from.node(Math.abs(preferredTarget)-1)))preferredDepth=d;else if(def||!leftNode.type.isTextblock)break}for(let j=slice.openStart;j>=0;j--){let openDepth=(j+preferredDepth+1)%(slice.openStart+1),insert=leftNodes[openDepth];if(insert)for(let i=0;i<targetDepths.length;i++){let targetDepth=targetDepths[(i+preferredTargetIndex)%targetDepths.length],expand=!0;targetDepth<0&&(expand=!1,targetDepth=-targetDepth);let parent=$from.node(targetDepth-1),index=$from.index(targetDepth-1);if(parent.canReplaceWith(index,index,insert.type,insert.marks))return tr.replace($from.before(targetDepth),expand?$to.after(targetDepth):to,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(closeFragment(slice.content,0,slice.openStart,openDepth),openDepth,slice.openEnd))}}let startSteps=tr.steps.length;for(let i=targetDepths.length-1;i>=0&&(tr.replace(from,to,slice),!(tr.steps.length>startSteps));i--){let depth=targetDepths[i];depth<0||(from=$from.before(depth),to=$to.after(depth))}}(this,from,to,slice),this}replaceRangeWith(from,to,node){return function replaceRangeWith(tr,from,to,node){if(!node.isInline&&from==to&&tr.doc.resolve(from).parent.content.size){let point=function insertPoint(doc,pos,nodeType){let $pos=doc.resolve(pos);if($pos.parent.canReplaceWith($pos.index(),$pos.index(),nodeType))return pos;if(0==$pos.parentOffset)for(let d=$pos.depth-1;d>=0;d--){let index=$pos.index(d);if($pos.node(d).canReplaceWith(index,index,nodeType))return $pos.before(d+1);if(index>0)return null}if($pos.parentOffset==$pos.parent.content.size)for(let d=$pos.depth-1;d>=0;d--){let index=$pos.indexAfter(d);if($pos.node(d).canReplaceWith(index,index,nodeType))return $pos.after(d+1);if(index<$pos.node(d).childCount)return null}return null}(tr.doc,from,node.type);null!=point&&(from=to=point)}tr.replaceRange(from,to,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(node),0,0))}(this,from,to,node),this}deleteRange(from,to){return function deleteRange(tr,from,to){let $from=tr.doc.resolve(from),$to=tr.doc.resolve(to),covered=coveredDepths($from,$to);for(let i=0;i<covered.length;i++){let depth=covered[i],last=i==covered.length-1;if(last&&0==depth||$from.node(depth).type.contentMatch.validEnd)return tr.delete($from.start(depth),$to.end(depth));if(depth>0&&(last||$from.node(depth-1).canReplace($from.index(depth-1),$to.indexAfter(depth-1))))return tr.delete($from.before(depth),$to.after(depth))}for(let d=1;d<=$from.depth&&d<=$to.depth;d++)if(from-$from.start(d)==$from.depth-d&&to>$from.end(d)&&$to.end(d)-to!=$to.depth-d&&$from.start(d-1)==$to.start(d-1)&&$from.node(d-1).canReplace($from.index(d-1),$to.index(d-1)))return tr.delete($from.before(d),to);tr.delete(from,to)}(this,from,to),this}lift(range,target){return function lift(tr,range,target){let{$from,$to,depth}=range,gapStart=$from.before(depth+1),gapEnd=$to.after(depth+1),start=gapStart,end=gapEnd,before=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,openStart=0;for(let d=depth,splitting=!1;d>target;d--)splitting||$from.index(d)>0?(splitting=!0,before=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from($from.node(d).copy(before)),openStart++):start--;let after=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,openEnd=0;for(let d=depth,splitting=!1;d>target;d--)splitting||$to.after(d+1)<$to.end(d)?(splitting=!0,after=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from($to.node(d).copy(after)),openEnd++):end++;tr.step(new ReplaceAroundStep(start,end,gapStart,gapEnd,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(before.append(after),openStart,openEnd),before.size-openStart,!0))}(this,range,target),this}join(pos,depth=1){return function join(tr,pos,depth){let convertNewlines=null,{linebreakReplacement}=tr.doc.type.schema,$before=tr.doc.resolve(pos-depth),beforeType=$before.node().type;if(linebreakReplacement&&beforeType.inlineContent){let pre="pre"==beforeType.whitespace,supportLinebreak=!!beforeType.contentMatch.matchType(linebreakReplacement);pre&&!supportLinebreak?convertNewlines=!1:!pre&&supportLinebreak&&(convertNewlines=!0)}let mapFrom=tr.steps.length;if(!1===convertNewlines){let $after=tr.doc.resolve(pos+depth);replaceLinebreaks(tr,$after.node(),$after.before(),mapFrom)}beforeType.inlineContent&&clearIncompatible(tr,pos+depth-1,beforeType,$before.node().contentMatchAt($before.index()),null==convertNewlines);let mapping=tr.mapping.slice(mapFrom),start=mapping.map(pos-depth);if(tr.step(new ReplaceStep(start,mapping.map(pos+depth,-1),prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty,!0)),!0===convertNewlines){let $full=tr.doc.resolve(start);replaceNewlines(tr,$full.node(),$full.before(),tr.steps.length)}return tr}(this,pos,depth),this}wrap(range,wrappers){return function wrap(tr,range,wrappers){let content=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty;for(let i=wrappers.length-1;i>=0;i--){if(content.size){let match=wrappers[i].type.contentMatch.matchFragment(content);if(!match||!match.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}content=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(wrappers[i].type.create(wrappers[i].attrs,content))}let start=range.start,end=range.end;tr.step(new ReplaceAroundStep(start,end,start,end,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(content,0,0),wrappers.length,!0))}(this,range,wrappers),this}setBlockType(from,to=from,type,attrs=null){return function setBlockType(tr,from,to,type,attrs){if(!type.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let mapFrom=tr.steps.length;tr.doc.nodesBetween(from,to,(node,pos)=>{let attrsHere="function"==typeof attrs?attrs(node):attrs;if(node.isTextblock&&!node.hasMarkup(type,attrsHere)&&function canChangeType(doc,pos,type){let $pos=doc.resolve(pos),index=$pos.index();return $pos.parent.canReplaceWith(index,index+1,type)}(tr.doc,tr.mapping.slice(mapFrom).map(pos),type)){let convertNewlines=null;if(type.schema.linebreakReplacement){let pre="pre"==type.whitespace,supportLinebreak=!!type.contentMatch.matchType(type.schema.linebreakReplacement);pre&&!supportLinebreak?convertNewlines=!1:!pre&&supportLinebreak&&(convertNewlines=!0)}!1===convertNewlines&&replaceLinebreaks(tr,node,pos,mapFrom),clearIncompatible(tr,tr.mapping.slice(mapFrom).map(pos,1),type,void 0,null===convertNewlines);let mapping=tr.mapping.slice(mapFrom),startM=mapping.map(pos,1),endM=mapping.map(pos+node.nodeSize,1);return tr.step(new ReplaceAroundStep(startM,endM,startM+1,endM-1,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(type.create(attrsHere,null,node.marks)),0,0),1,!0)),!0===convertNewlines&&replaceNewlines(tr,node,pos,mapFrom),!1}})}(this,from,to,type,attrs),this}setNodeMarkup(pos,type,attrs=null,marks){return function setNodeMarkup(tr,pos,type,attrs,marks){let node=tr.doc.nodeAt(pos);if(!node)throw new RangeError("No node at given position");type||(type=node.type);let newNode=type.create(attrs,null,marks||node.marks);if(node.isLeaf)return tr.replaceWith(pos,pos+node.nodeSize,newNode);if(!type.validContent(node.content))throw new RangeError("Invalid content for node type "+type.name);tr.step(new ReplaceAroundStep(pos,pos+node.nodeSize,pos+1,pos+node.nodeSize-1,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(newNode),0,0),1,!0))}(this,pos,type,attrs,marks),this}setNodeAttribute(pos,attr,value){return this.step(new AttrStep(pos,attr,value)),this}setDocAttribute(attr,value){return this.step(new DocAttrStep(attr,value)),this}addNodeMark(pos,mark){return this.step(new AddNodeMarkStep(pos,mark)),this}removeNodeMark(pos,mark){let node=this.doc.nodeAt(pos);if(!node)throw new RangeError("No node at position "+pos);if(mark instanceof prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.CU)mark.isInSet(node.marks)&&this.step(new RemoveNodeMarkStep(pos,mark));else{let found,set=node.marks,steps=[];for(;found=mark.isInSet(set);)steps.push(new RemoveNodeMarkStep(pos,found)),set=found.removeFromSet(set);for(let i=steps.length-1;i>=0;i--)this.step(steps[i])}return this}split(pos,depth=1,typesAfter){return function split(tr,pos,depth=1,typesAfter){let $pos=tr.doc.resolve(pos),before=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,after=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty;for(let d=$pos.depth,e=$pos.depth-depth,i=depth-1;d>e;d--,i--){before=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from($pos.node(d).copy(before));let typeAfter=typesAfter&&typesAfter[i];after=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(typeAfter?typeAfter.type.create(typeAfter.attrs,after):$pos.node(d).copy(after))}tr.step(new ReplaceStep(pos,pos,new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(before.append(after),depth,depth),!0))}(this,pos,depth,typesAfter),this}addMark(from,to,mark){return function addMark(tr,from,to,mark){let removing,adding,removed=[],added=[];tr.doc.nodesBetween(from,to,(node,pos,parent)=>{if(!node.isInline)return;let marks=node.marks;if(!mark.isInSet(marks)&&parent.type.allowsMarkType(mark.type)){let start=Math.max(pos,from),end=Math.min(pos+node.nodeSize,to),newSet=mark.addToSet(marks);for(let i=0;i<marks.length;i++)marks[i].isInSet(newSet)||(removing&&removing.to==start&&removing.mark.eq(marks[i])?removing.to=end:removed.push(removing=new RemoveMarkStep(start,end,marks[i])));adding&&adding.to==start?adding.to=end:added.push(adding=new AddMarkStep(start,end,mark))}}),removed.forEach(s=>tr.step(s)),added.forEach(s=>tr.step(s))}(this,from,to,mark),this}removeMark(from,to,mark){return function removeMark(tr,from,to,mark){let matched=[],step=0;tr.doc.nodesBetween(from,to,(node,pos)=>{if(!node.isInline)return;step++;let toRemove=null;if(mark instanceof prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.sX){let found,set=node.marks;for(;found=mark.isInSet(set);)(toRemove||(toRemove=[])).push(found),set=found.removeFromSet(set)}else mark?mark.isInSet(node.marks)&&(toRemove=[mark]):toRemove=node.marks;if(toRemove&&toRemove.length){let end=Math.min(pos+node.nodeSize,to);for(let i=0;i<toRemove.length;i++){let found,style=toRemove[i];for(let j=0;j<matched.length;j++){let m=matched[j];m.step==step-1&&style.eq(matched[j].style)&&(found=m)}found?(found.to=end,found.step=step):matched.push({style,from:Math.max(pos,from),to:end,step})}}}),matched.forEach(m=>tr.step(new RemoveMarkStep(m.from,m.to,m.style)))}(this,from,to,mark),this}clearIncompatible(pos,parentType,match){return clearIncompatible(this,pos,parentType,match),this}}},"./node_modules/prosemirror-view/dist/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Lz:()=>EditorView,NZ:()=>Decoration,zF:()=>DecorationSet});var prosemirror_state__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/prosemirror-state/dist/index.js"),prosemirror_model__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/prosemirror-model/dist/index.js"),prosemirror_transform__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/prosemirror-transform/dist/index.js");const domIndex=function(node){for(var index=0;;index++)if(!(node=node.previousSibling))return index},parentNode=function(node){let parent=node.assignedSlot||node.parentNode;return parent&&11==parent.nodeType?parent.host:parent};let reusedRange=null;const textRange=function(node,from,to){let range=reusedRange||(reusedRange=document.createRange());return range.setEnd(node,null==to?node.nodeValue.length:to),range.setStart(node,from||0),range},isEquivalentPosition=function(node,off,targetNode,targetOff){return targetNode&&(scanFor(node,off,targetNode,targetOff,-1)||scanFor(node,off,targetNode,targetOff,1))},atomElements=/^(img|br|input|textarea|hr)$/i;function scanFor(node,off,targetNode,targetOff,dir){for(var _a;;){if(node==targetNode&&off==targetOff)return!0;if(off==(dir<0?0:nodeSize(node))){let parent=node.parentNode;if(!parent||1!=parent.nodeType||hasBlockDesc(node)||atomElements.test(node.nodeName)||"false"==node.contentEditable)return!1;off=domIndex(node)+(dir<0?0:1),node=parent}else{if(1!=node.nodeType)return!1;{let child=node.childNodes[off+(dir<0?-1:0)];if(1==child.nodeType&&"false"==child.contentEditable){if(!(null===(_a=child.pmViewDesc)||void 0===_a?void 0:_a.ignoreForSelection))return!1;off+=dir}else node=child,off=dir<0?nodeSize(node):0}}}}function nodeSize(node){return 3==node.nodeType?node.nodeValue.length:node.childNodes.length}function hasBlockDesc(dom){let desc;for(let cur=dom;cur&&!(desc=cur.pmViewDesc);cur=cur.parentNode);return desc&&desc.node&&desc.node.isBlock&&(desc.dom==dom||desc.contentDOM==dom)}const selectionCollapsed=function(domSel){return domSel.focusNode&&isEquivalentPosition(domSel.focusNode,domSel.focusOffset,domSel.anchorNode,domSel.anchorOffset)};function keyEvent(keyCode,key){let event=document.createEvent("Event");return event.initEvent("keydown",!0,!0),event.keyCode=keyCode,event.key=event.code=key,event}const nav="undefined"!=typeof navigator?navigator:null,doc="undefined"!=typeof document?document:null,agent=nav&&nav.userAgent||"",ie_edge=/Edge\/(\d+)/.exec(agent),ie_upto10=/MSIE \d/.exec(agent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(agent),ie=!!(ie_upto10||ie_11up||ie_edge),ie_version=ie_upto10?document.documentMode:ie_11up?+ie_11up[1]:ie_edge?+ie_edge[1]:0,gecko=!ie&&/gecko\/(\d+)/i.test(agent);gecko&&(/Firefox\/(\d+)/.exec(agent)||[0,0])[1];const _chrome=!ie&&/Chrome\/(\d+)/.exec(agent),chrome=!!_chrome,chrome_version=_chrome?+_chrome[1]:0,safari=!ie&&!!nav&&/Apple Computer/.test(nav.vendor),ios=safari&&(/Mobile\/\w+/.test(agent)||!!nav&&nav.maxTouchPoints>2),mac=ios||!!nav&&/Mac/.test(nav.platform),windows=!!nav&&/Win/.test(nav.platform),android=/Android \d/.test(agent),webkit=!!doc&&"webkitFontSmoothing"in doc.documentElement.style,webkit_version=webkit?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function windowRect(doc){let vp=doc.defaultView&&doc.defaultView.visualViewport;return vp?{left:0,right:vp.width,top:0,bottom:vp.height}:{left:0,right:doc.documentElement.clientWidth,top:0,bottom:doc.documentElement.clientHeight}}function getSide(value,side){return"number"==typeof value?value:value[side]}function clientRect(node){let rect=node.getBoundingClientRect(),scaleX=rect.width/node.offsetWidth||1,scaleY=rect.height/node.offsetHeight||1;return{left:rect.left,right:rect.left+node.clientWidth*scaleX,top:rect.top,bottom:rect.top+node.clientHeight*scaleY}}function scrollRectIntoView(view,rect,startDOM){let scrollThreshold=view.someProp("scrollThreshold")||0,scrollMargin=view.someProp("scrollMargin")||5,doc=view.dom.ownerDocument;for(let parent=startDOM||view.dom;parent;){if(1!=parent.nodeType){parent=parentNode(parent);continue}let elt=parent,atTop=elt==doc.body,bounding=atTop?windowRect(doc):clientRect(elt),moveX=0,moveY=0;if(rect.top<bounding.top+getSide(scrollThreshold,"top")?moveY=-(bounding.top-rect.top+getSide(scrollMargin,"top")):rect.bottom>bounding.bottom-getSide(scrollThreshold,"bottom")&&(moveY=rect.bottom-rect.top>bounding.bottom-bounding.top?rect.top+getSide(scrollMargin,"top")-bounding.top:rect.bottom-bounding.bottom+getSide(scrollMargin,"bottom")),rect.left<bounding.left+getSide(scrollThreshold,"left")?moveX=-(bounding.left-rect.left+getSide(scrollMargin,"left")):rect.right>bounding.right-getSide(scrollThreshold,"right")&&(moveX=rect.right-bounding.right+getSide(scrollMargin,"right")),moveX||moveY)if(atTop)doc.defaultView.scrollBy(moveX,moveY);else{let startX=elt.scrollLeft,startY=elt.scrollTop;moveY&&(elt.scrollTop+=moveY),moveX&&(elt.scrollLeft+=moveX);let dX=elt.scrollLeft-startX,dY=elt.scrollTop-startY;rect={left:rect.left-dX,top:rect.top-dY,right:rect.right-dX,bottom:rect.bottom-dY}}let pos=atTop?"fixed":getComputedStyle(parent).position;if(/^(fixed|sticky)$/.test(pos))break;parent="absolute"==pos?parent.offsetParent:parentNode(parent)}}function scrollStack(dom){let stack=[],doc=dom.ownerDocument;for(let cur=dom;cur&&(stack.push({dom:cur,top:cur.scrollTop,left:cur.scrollLeft}),dom!=doc);cur=parentNode(cur));return stack}function restoreScrollStack(stack,dTop){for(let i=0;i<stack.length;i++){let{dom,top,left}=stack[i];dom.scrollTop!=top+dTop&&(dom.scrollTop=top+dTop),dom.scrollLeft!=left&&(dom.scrollLeft=left)}}let preventScrollSupported=null;function findOffsetInNode(node,coords){let closest,coordsClosest,firstBelow,coordsBelow,dxClosest=2e8,offset=0,rowBot=coords.top,rowTop=coords.top;for(let child=node.firstChild,childIndex=0;child;child=child.nextSibling,childIndex++){let rects;if(1==child.nodeType)rects=child.getClientRects();else{if(3!=child.nodeType)continue;rects=textRange(child).getClientRects()}for(let i=0;i<rects.length;i++){let rect=rects[i];if(rect.top<=rowBot&&rect.bottom>=rowTop){rowBot=Math.max(rect.bottom,rowBot),rowTop=Math.min(rect.top,rowTop);let dx=rect.left>coords.left?rect.left-coords.left:rect.right<coords.left?coords.left-rect.right:0;if(dx<dxClosest){closest=child,dxClosest=dx,coordsClosest=dx&&3==closest.nodeType?{left:rect.right<coords.left?rect.right:rect.left,top:coords.top}:coords,1==child.nodeType&&dx&&(offset=childIndex+(coords.left>=(rect.left+rect.right)/2?1:0));continue}}else rect.top>coords.top&&!firstBelow&&rect.left<=coords.left&&rect.right>=coords.left&&(firstBelow=child,coordsBelow={left:Math.max(rect.left,Math.min(rect.right,coords.left)),top:rect.top});!closest&&(coords.left>=rect.right&&coords.top>=rect.top||coords.left>=rect.left&&coords.top>=rect.bottom)&&(offset=childIndex+1)}}return!closest&&firstBelow&&(closest=firstBelow,coordsClosest=coordsBelow,dxClosest=0),closest&&3==closest.nodeType?function findOffsetInText(node,coords){let len=node.nodeValue.length,range=document.createRange();for(let i=0;i<len;i++){range.setEnd(node,i+1),range.setStart(node,i);let rect=singleRect(range,1);if(rect.top!=rect.bottom&&inRect(coords,rect))return{node,offset:i+(coords.left>=(rect.left+rect.right)/2?1:0)}}return{node,offset:0}}(closest,coordsClosest):!closest||dxClosest&&1==closest.nodeType?{node,offset}:findOffsetInNode(closest,coordsClosest)}function inRect(coords,rect){return coords.left>=rect.left-1&&coords.left<=rect.right+1&&coords.top>=rect.top-1&&coords.top<=rect.bottom+1}function elementFromPoint(element,coords,box){let len=element.childNodes.length;if(len&&box.top<box.bottom)for(let startI=Math.max(0,Math.min(len-1,Math.floor(len*(coords.top-box.top)/(box.bottom-box.top))-2)),i=startI;;){let child=element.childNodes[i];if(1==child.nodeType){let rects=child.getClientRects();for(let j=0;j<rects.length;j++){let rect=rects[j];if(inRect(coords,rect))return elementFromPoint(child,coords,rect)}}if((i=(i+1)%len)==startI)break}return element}function posAtCoords(view,coords){let node,doc=view.dom.ownerDocument,offset=0,caret=function caretFromPoint(doc,x,y){if(doc.caretPositionFromPoint)try{let pos=doc.caretPositionFromPoint(x,y);if(pos)return{node:pos.offsetNode,offset:Math.min(nodeSize(pos.offsetNode),pos.offset)}}catch(_){}if(doc.caretRangeFromPoint){let range=doc.caretRangeFromPoint(x,y);if(range)return{node:range.startContainer,offset:Math.min(nodeSize(range.startContainer),range.startOffset)}}}(doc,coords.left,coords.top);caret&&({node,offset}=caret);let pos,elt=(view.root.elementFromPoint?view.root:doc).elementFromPoint(coords.left,coords.top);if(!elt||!view.dom.contains(1!=elt.nodeType?elt.parentNode:elt)){let box=view.dom.getBoundingClientRect();if(!inRect(coords,box))return null;if(elt=elementFromPoint(view.dom,coords,box),!elt)return null}if(safari)for(let p=elt;node&&p;p=parentNode(p))p.draggable&&(node=void 0);if(elt=function targetKludge(dom,coords){let parent=dom.parentNode;return parent&&/^li$/i.test(parent.nodeName)&&coords.left<dom.getBoundingClientRect().left?parent:dom}(elt,coords),node){if(gecko&&1==node.nodeType&&(offset=Math.min(offset,node.childNodes.length),offset<node.childNodes.length)){let box,next=node.childNodes[offset];"IMG"==next.nodeName&&(box=next.getBoundingClientRect()).right<=coords.left&&box.bottom>coords.top&&offset++}let prev;webkit&&offset&&1==node.nodeType&&1==(prev=node.childNodes[offset-1]).nodeType&&"false"==prev.contentEditable&&prev.getBoundingClientRect().top>=coords.top&&offset--,node==view.dom&&offset==node.childNodes.length-1&&1==node.lastChild.nodeType&&coords.top>node.lastChild.getBoundingClientRect().bottom?pos=view.state.doc.content.size:0!=offset&&1==node.nodeType&&"BR"==node.childNodes[offset-1].nodeName||(pos=function posFromCaret(view,node,offset,coords){let outsideBlock=-1;for(let cur=node,sawBlock=!1;cur!=view.dom;){let rect,desc=view.docView.nearestDesc(cur,!0);if(!desc)return null;if(1==desc.dom.nodeType&&(desc.node.isBlock&&desc.parent||!desc.contentDOM)&&((rect=desc.dom.getBoundingClientRect()).width||rect.height)&&(desc.node.isBlock&&desc.parent&&(!sawBlock&&rect.left>coords.left||rect.top>coords.top?outsideBlock=desc.posBefore:(!sawBlock&&rect.right<coords.left||rect.bottom<coords.top)&&(outsideBlock=desc.posAfter),sawBlock=!0),!desc.contentDOM&&outsideBlock<0&&!desc.node.isText))return(desc.node.isBlock?coords.top<(rect.top+rect.bottom)/2:coords.left<(rect.left+rect.right)/2)?desc.posBefore:desc.posAfter;cur=desc.dom.parentNode}return outsideBlock>-1?outsideBlock:view.docView.posFromDOM(node,offset,-1)}(view,node,offset,coords))}null==pos&&(pos=function posFromElement(view,elt,coords){let{node,offset}=findOffsetInNode(elt,coords),bias=-1;if(1==node.nodeType&&!node.firstChild){let rect=node.getBoundingClientRect();bias=rect.left!=rect.right&&coords.left>(rect.left+rect.right)/2?1:-1}return view.docView.posFromDOM(node,offset,bias)}(view,elt,coords));let desc=view.docView.nearestDesc(elt,!0);return{pos,inside:desc?desc.posAtStart-desc.border:-1}}function nonZero(rect){return rect.top<rect.bottom||rect.left<rect.right}function singleRect(target,bias){let rects=target.getClientRects();if(rects.length){let first=rects[bias<0?0:rects.length-1];if(nonZero(first))return first}return Array.prototype.find.call(rects,nonZero)||target.getBoundingClientRect()}const BIDI=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function coordsAtPos(view,pos,side){let{node,offset,atom}=view.docView.domFromPos(pos,side<0?-1:1),supportEmptyRange=webkit||gecko;if(3==node.nodeType){if(!supportEmptyRange||!BIDI.test(node.nodeValue)&&(side<0?offset:offset!=node.nodeValue.length)){let from=offset,to=offset,takeSide=side<0?1:-1;return side<0&&!offset?(to++,takeSide=-1):side>=0&&offset==node.nodeValue.length?(from--,takeSide=1):side<0?from--:to++,flattenV(singleRect(textRange(node,from,to),takeSide),takeSide<0)}{let rect=singleRect(textRange(node,offset,offset),side);if(gecko&&offset&&/\s/.test(node.nodeValue[offset-1])&&offset<node.nodeValue.length){let rectBefore=singleRect(textRange(node,offset-1,offset-1),-1);if(rectBefore.top==rect.top){let rectAfter=singleRect(textRange(node,offset,offset+1),-1);if(rectAfter.top!=rect.top)return flattenV(rectAfter,rectAfter.left<rectBefore.left)}}return rect}}if(!view.state.doc.resolve(pos-(atom||0)).parent.inlineContent){if(null==atom&&offset&&(side<0||offset==nodeSize(node))){let before=node.childNodes[offset-1];if(1==before.nodeType)return flattenH(before.getBoundingClientRect(),!1)}if(null==atom&&offset<nodeSize(node)){let after=node.childNodes[offset];if(1==after.nodeType)return flattenH(after.getBoundingClientRect(),!0)}return flattenH(node.getBoundingClientRect(),side>=0)}if(null==atom&&offset&&(side<0||offset==nodeSize(node))){let before=node.childNodes[offset-1],target=3==before.nodeType?textRange(before,nodeSize(before)-(supportEmptyRange?0:1)):1!=before.nodeType||"BR"==before.nodeName&&before.nextSibling?null:before;if(target)return flattenV(singleRect(target,1),!1)}if(null==atom&&offset<nodeSize(node)){let after=node.childNodes[offset];for(;after.pmViewDesc&&after.pmViewDesc.ignoreForCoords;)after=after.nextSibling;let target=after?3==after.nodeType?textRange(after,0,supportEmptyRange?0:1):1==after.nodeType?after:null:null;if(target)return flattenV(singleRect(target,-1),!0)}return flattenV(singleRect(3==node.nodeType?textRange(node):node,-side),side>=0)}function flattenV(rect,left){if(0==rect.width)return rect;let x=left?rect.left:rect.right;return{top:rect.top,bottom:rect.bottom,left:x,right:x}}function flattenH(rect,top){if(0==rect.height)return rect;let y=top?rect.top:rect.bottom;return{top:y,bottom:y,left:rect.left,right:rect.right}}function withFlushedState(view,state,f){let viewState=view.state,active=view.root.activeElement;viewState!=state&&view.updateState(state),active!=view.dom&&view.focus();try{return f()}finally{viewState!=state&&view.updateState(viewState),active!=view.dom&&active&&active.focus()}}const maybeRTL=/[\u0590-\u08ac]/;let cachedState=null,cachedDir=null,cachedResult=!1;function endOfTextblock(view,state,dir){return cachedState==state&&cachedDir==dir?cachedResult:(cachedState=state,cachedDir=dir,cachedResult="up"==dir||"down"==dir?function endOfTextblockVertical(view,state,dir){let sel=state.selection,$pos="up"==dir?sel.$from:sel.$to;return withFlushedState(view,state,()=>{let{node:dom}=view.docView.domFromPos($pos.pos,"up"==dir?-1:1);for(;;){let nearest=view.docView.nearestDesc(dom,!0);if(!nearest)break;if(nearest.node.isBlock){dom=nearest.contentDOM||nearest.dom;break}dom=nearest.dom.parentNode}let coords=coordsAtPos(view,$pos.pos,1);for(let child=dom.firstChild;child;child=child.nextSibling){let boxes;if(1==child.nodeType)boxes=child.getClientRects();else{if(3!=child.nodeType)continue;boxes=textRange(child,0,child.nodeValue.length).getClientRects()}for(let i=0;i<boxes.length;i++){let box=boxes[i];if(box.bottom>box.top+1&&("up"==dir?coords.top-box.top>2*(box.bottom-coords.top):box.bottom-coords.bottom>2*(coords.bottom-box.top)))return!1}}return!0})}(view,state,dir):function endOfTextblockHorizontal(view,state,dir){let{$head}=state.selection;if(!$head.parent.isTextblock)return!1;let offset=$head.parentOffset,atStart=!offset,atEnd=offset==$head.parent.content.size,sel=view.domSelection();return sel?maybeRTL.test($head.parent.textContent)&&sel.modify?withFlushedState(view,state,()=>{let{focusNode:oldNode,focusOffset:oldOff,anchorNode,anchorOffset}=view.domSelectionRange(),oldBidiLevel=sel.caretBidiLevel;sel.modify("move",dir,"character");let parentDOM=$head.depth?view.docView.domAfterPos($head.before()):view.dom,{focusNode:newNode,focusOffset:newOff}=view.domSelectionRange(),result=newNode&&!parentDOM.contains(1==newNode.nodeType?newNode:newNode.parentNode)||oldNode==newNode&&oldOff==newOff;try{sel.collapse(anchorNode,anchorOffset),oldNode&&(oldNode!=anchorNode||oldOff!=anchorOffset)&&sel.extend&&sel.extend(oldNode,oldOff)}catch(_){}return null!=oldBidiLevel&&(sel.caretBidiLevel=oldBidiLevel),result}):"left"==dir||"backward"==dir?atStart:atEnd:$head.pos==$head.start()||$head.pos==$head.end()}(view,state,dir))}class ViewDesc{constructor(parent,children,dom,contentDOM){this.parent=parent,this.children=children,this.dom=dom,this.contentDOM=contentDOM,this.dirty=0,dom.pmViewDesc=this}matchesWidget(widget){return!1}matchesMark(mark){return!1}matchesNode(node,outerDeco,innerDeco){return!1}matchesHack(nodeName){return!1}parseRule(){return null}stopEvent(event){return!1}get size(){let size=0;for(let i=0;i<this.children.length;i++)size+=this.children[i].size;return size}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let i=0;i<this.children.length;i++)this.children[i].destroy()}posBeforeChild(child){for(let i=0,pos=this.posAtStart;;i++){let cur=this.children[i];if(cur==child)return pos;pos+=cur.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(dom,offset,bias){if(this.contentDOM&&this.contentDOM.contains(1==dom.nodeType?dom:dom.parentNode)){if(bias<0){let domBefore,desc;if(dom==this.contentDOM)domBefore=dom.childNodes[offset-1];else{for(;dom.parentNode!=this.contentDOM;)dom=dom.parentNode;domBefore=dom.previousSibling}for(;domBefore&&(!(desc=domBefore.pmViewDesc)||desc.parent!=this);)domBefore=domBefore.previousSibling;return domBefore?this.posBeforeChild(desc)+desc.size:this.posAtStart}{let domAfter,desc;if(dom==this.contentDOM)domAfter=dom.childNodes[offset];else{for(;dom.parentNode!=this.contentDOM;)dom=dom.parentNode;domAfter=dom.nextSibling}for(;domAfter&&(!(desc=domAfter.pmViewDesc)||desc.parent!=this);)domAfter=domAfter.nextSibling;return domAfter?this.posBeforeChild(desc):this.posAtEnd}}let atEnd;if(dom==this.dom&&this.contentDOM)atEnd=offset>domIndex(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))atEnd=2&dom.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==offset)for(let search=dom;;search=search.parentNode){if(search==this.dom){atEnd=!1;break}if(search.previousSibling)break}if(null==atEnd&&offset==dom.childNodes.length)for(let search=dom;;search=search.parentNode){if(search==this.dom){atEnd=!0;break}if(search.nextSibling)break}}return(null==atEnd?bias>0:atEnd)?this.posAtEnd:this.posAtStart}nearestDesc(dom,onlyNodes=!1){for(let first=!0,cur=dom;cur;cur=cur.parentNode){let nodeDOM,desc=this.getDesc(cur);if(desc&&(!onlyNodes||desc.node)){if(!first||!(nodeDOM=desc.nodeDOM)||(1==nodeDOM.nodeType?nodeDOM.contains(1==dom.nodeType?dom:dom.parentNode):nodeDOM==dom))return desc;first=!1}}}getDesc(dom){let desc=dom.pmViewDesc;for(let cur=desc;cur;cur=cur.parent)if(cur==this)return desc}posFromDOM(dom,offset,bias){for(let scan=dom;scan;scan=scan.parentNode){let desc=this.getDesc(scan);if(desc)return desc.localPosFromDOM(dom,offset,bias)}return-1}descAt(pos){for(let i=0,offset=0;i<this.children.length;i++){let child=this.children[i],end=offset+child.size;if(offset==pos&&end!=offset){for(;!child.border&&child.children.length;)for(let i=0;i<child.children.length;i++){let inner=child.children[i];if(inner.size){child=inner;break}}return child}if(pos<end)return child.descAt(pos-offset-child.border);offset=end}}domFromPos(pos,side){if(!this.contentDOM)return{node:this.dom,offset:0,atom:pos+1};let i=0,offset=0;for(let curPos=0;i<this.children.length;i++){let child=this.children[i],end=curPos+child.size;if(end>pos||child instanceof TrailingHackViewDesc){offset=pos-curPos;break}curPos=end}if(offset)return this.children[i].domFromPos(offset-this.children[i].border,side);for(let prev;i&&!(prev=this.children[i-1]).size&&prev instanceof WidgetViewDesc&&prev.side>=0;i--);if(side<=0){let prev,enter=!0;for(;prev=i?this.children[i-1]:null,prev&&prev.dom.parentNode!=this.contentDOM;i--,enter=!1);return prev&&side&&enter&&!prev.border&&!prev.domAtom?prev.domFromPos(prev.size,side):{node:this.contentDOM,offset:prev?domIndex(prev.dom)+1:0}}{let next,enter=!0;for(;next=i<this.children.length?this.children[i]:null,next&&next.dom.parentNode!=this.contentDOM;i++,enter=!1);return next&&enter&&!next.border&&!next.domAtom?next.domFromPos(0,side):{node:this.contentDOM,offset:next?domIndex(next.dom):this.contentDOM.childNodes.length}}}parseRange(from,to,base=0){if(0==this.children.length)return{node:this.contentDOM,from,to,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let fromOffset=-1,toOffset=-1;for(let offset=base,i=0;;i++){let child=this.children[i],end=offset+child.size;if(-1==fromOffset&&from<=end){let childBase=offset+child.border;if(from>=childBase&&to<=end-child.border&&child.node&&child.contentDOM&&this.contentDOM.contains(child.contentDOM))return child.parseRange(from,to,childBase);from=offset;for(let j=i;j>0;j--){let prev=this.children[j-1];if(prev.size&&prev.dom.parentNode==this.contentDOM&&!prev.emptyChildAt(1)){fromOffset=domIndex(prev.dom)+1;break}from-=prev.size}-1==fromOffset&&(fromOffset=0)}if(fromOffset>-1&&(end>to||i==this.children.length-1)){to=end;for(let j=i+1;j<this.children.length;j++){let next=this.children[j];if(next.size&&next.dom.parentNode==this.contentDOM&&!next.emptyChildAt(-1)){toOffset=domIndex(next.dom);break}to+=next.size}-1==toOffset&&(toOffset=this.contentDOM.childNodes.length);break}offset=end}return{node:this.contentDOM,from,to,fromOffset,toOffset}}emptyChildAt(side){if(this.border||!this.contentDOM||!this.children.length)return!1;let child=this.children[side<0?0:this.children.length-1];return 0==child.size||child.emptyChildAt(side)}domAfterPos(pos){let{node,offset}=this.domFromPos(pos,0);if(1!=node.nodeType||offset==node.childNodes.length)throw new RangeError("No node after pos "+pos);return node.childNodes[offset]}setSelection(anchor,head,view,force=!1){let from=Math.min(anchor,head),to=Math.max(anchor,head);for(let i=0,offset=0;i<this.children.length;i++){let child=this.children[i],end=offset+child.size;if(from>offset&&to<end)return child.setSelection(anchor-offset-child.border,head-offset-child.border,view,force);offset=end}let anchorDOM=this.domFromPos(anchor,anchor?-1:1),headDOM=head==anchor?anchorDOM:this.domFromPos(head,head?-1:1),domSel=view.root.getSelection(),selRange=view.domSelectionRange(),brKludge=!1;if((gecko||safari)&&anchor==head){let{node,offset}=anchorDOM;if(3==node.nodeType){if(brKludge=!(!offset||"\n"!=node.nodeValue[offset-1]),brKludge&&offset==node.nodeValue.length)for(let after,scan=node;scan;scan=scan.parentNode){if(after=scan.nextSibling){"BR"==after.nodeName&&(anchorDOM=headDOM={node:after.parentNode,offset:domIndex(after)+1});break}let desc=scan.pmViewDesc;if(desc&&desc.node&&desc.node.isBlock)break}}else{let prev=node.childNodes[offset-1];brKludge=prev&&("BR"==prev.nodeName||"false"==prev.contentEditable)}}if(gecko&&selRange.focusNode&&selRange.focusNode!=headDOM.node&&1==selRange.focusNode.nodeType){let after=selRange.focusNode.childNodes[selRange.focusOffset];after&&"false"==after.contentEditable&&(force=!0)}if(!(force||brKludge&&safari)&&isEquivalentPosition(anchorDOM.node,anchorDOM.offset,selRange.anchorNode,selRange.anchorOffset)&&isEquivalentPosition(headDOM.node,headDOM.offset,selRange.focusNode,selRange.focusOffset))return;let domSelExtended=!1;if((domSel.extend||anchor==head)&&!brKludge){domSel.collapse(anchorDOM.node,anchorDOM.offset);try{anchor!=head&&domSel.extend(headDOM.node,headDOM.offset),domSelExtended=!0}catch(_){}}if(!domSelExtended){if(anchor>head){let tmp=anchorDOM;anchorDOM=headDOM,headDOM=tmp}let range=document.createRange();range.setEnd(headDOM.node,headDOM.offset),range.setStart(anchorDOM.node,anchorDOM.offset),domSel.removeAllRanges(),domSel.addRange(range)}}ignoreMutation(mutation){return!this.contentDOM&&"selection"!=mutation.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(from,to){for(let offset=0,i=0;i<this.children.length;i++){let child=this.children[i],end=offset+child.size;if(offset==end?from<=end&&to>=offset:from<end&&to>offset){let startInside=offset+child.border,endInside=end-child.border;if(from>=startInside&&to<=endInside)return this.dirty=from==offset||to==end?2:1,void(from!=startInside||to!=endInside||!child.contentLost&&child.dom.parentNode==this.contentDOM?child.markDirty(from-startInside,to-startInside):child.dirty=3);child.dirty=child.dom!=child.contentDOM||child.dom.parentNode!=this.contentDOM||child.children.length?3:2}offset=end}this.dirty=2}markParentsDirty(){let level=1;for(let node=this.parent;node;node=node.parent,level++){let dirty=1==level?2:1;node.dirty<dirty&&(node.dirty=dirty)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(text){return!1}}class WidgetViewDesc extends ViewDesc{constructor(parent,widget,view,pos){let self,dom=widget.type.toDOM;if("function"==typeof dom&&(dom=dom(view,()=>self?self.parent?self.parent.posBeforeChild(self):void 0:pos)),!widget.type.spec.raw){if(1!=dom.nodeType){let wrap=document.createElement("span");wrap.appendChild(dom),dom=wrap}dom.contentEditable="false",dom.classList.add("ProseMirror-widget")}super(parent,[],dom,null),this.widget=widget,this.widget=widget,self=this}matchesWidget(widget){return 0==this.dirty&&widget.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(event){let stop=this.widget.spec.stopEvent;return!!stop&&stop(event)}ignoreMutation(mutation){return"selection"!=mutation.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class CompositionViewDesc extends ViewDesc{constructor(parent,dom,textDOM,text){super(parent,[],dom,null),this.textDOM=textDOM,this.text=text}get size(){return this.text.length}localPosFromDOM(dom,offset){return dom!=this.textDOM?this.posAtStart+(offset?this.size:0):this.posAtStart+offset}domFromPos(pos){return{node:this.textDOM,offset:pos}}ignoreMutation(mut){return"characterData"===mut.type&&mut.target.nodeValue==mut.oldValue}}class MarkViewDesc extends ViewDesc{constructor(parent,mark,dom,contentDOM,spec){super(parent,[],dom,contentDOM),this.mark=mark,this.spec=spec}static create(parent,mark,inline,view){let custom=view.nodeViews[mark.type.name],spec=custom&&custom(mark,view,inline);return spec&&spec.dom||(spec=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.ZF.renderSpec(document,mark.type.spec.toDOM(mark,inline),null,mark.attrs)),new MarkViewDesc(parent,mark,spec.dom,spec.contentDOM||spec.dom,spec)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(mark){return 3!=this.dirty&&this.mark.eq(mark)}markDirty(from,to){if(super.markDirty(from,to),0!=this.dirty){let parent=this.parent;for(;!parent.node;)parent=parent.parent;parent.dirty<this.dirty&&(parent.dirty=this.dirty),this.dirty=0}}slice(from,to,view){let copy=MarkViewDesc.create(this.parent,this.mark,!0,view),nodes=this.children,size=this.size;to<size&&(nodes=replaceNodes(nodes,to,size,view)),from>0&&(nodes=replaceNodes(nodes,0,from,view));for(let i=0;i<nodes.length;i++)nodes[i].parent=copy;return copy.children=nodes,copy}ignoreMutation(mutation){return this.spec.ignoreMutation?this.spec.ignoreMutation(mutation):super.ignoreMutation(mutation)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class NodeViewDesc extends ViewDesc{constructor(parent,node,outerDeco,innerDeco,dom,contentDOM,nodeDOM,view,pos){super(parent,[],dom,contentDOM),this.node=node,this.outerDeco=outerDeco,this.innerDeco=innerDeco,this.nodeDOM=nodeDOM}static create(parent,node,outerDeco,innerDeco,view,pos){let descObj,custom=view.nodeViews[node.type.name],spec=custom&&custom(node,view,()=>descObj?descObj.parent?descObj.parent.posBeforeChild(descObj):void 0:pos,outerDeco,innerDeco),dom=spec&&spec.dom,contentDOM=spec&&spec.contentDOM;if(node.isText)if(dom){if(3!=dom.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else dom=document.createTextNode(node.text);else if(!dom){let spec=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.ZF.renderSpec(document,node.type.spec.toDOM(node),null,node.attrs);({dom,contentDOM}=spec)}contentDOM||node.isText||"BR"==dom.nodeName||(dom.hasAttribute("contenteditable")||(dom.contentEditable="false"),node.type.spec.draggable&&(dom.draggable=!0));let nodeDOM=dom;return dom=applyOuterDeco(dom,outerDeco,node),spec?descObj=new CustomNodeViewDesc(parent,node,outerDeco,innerDeco,dom,contentDOM||null,nodeDOM,spec,view,pos+1):node.isText?new TextViewDesc(parent,node,outerDeco,innerDeco,dom,nodeDOM,view):new NodeViewDesc(parent,node,outerDeco,innerDeco,dom,contentDOM||null,nodeDOM,view,pos+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let rule={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(rule.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let i=this.children.length-1;i>=0;i--){let child=this.children[i];if(this.dom.contains(child.dom.parentNode)){rule.contentElement=child.dom.parentNode;break}}rule.contentElement||(rule.getContent=()=>prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty)}else rule.contentElement=this.contentDOM;else rule.getContent=()=>this.node.content;return rule}matchesNode(node,outerDeco,innerDeco){return 0==this.dirty&&node.eq(this.node)&&sameOuterDeco(outerDeco,this.outerDeco)&&innerDeco.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(view,pos){let inline=this.node.inlineContent,off=pos,composition=view.composing?this.localCompositionInfo(view,pos):null,localComposition=composition&&composition.pos>-1?composition:null,compositionInChild=composition&&composition.pos<0,updater=new ViewTreeUpdater(this,localComposition&&localComposition.node,view);!function iterDeco(parent,deco,onWidget,onNode){let locals=deco.locals(parent),offset=0;if(0==locals.length){for(let i=0;i<parent.childCount;i++){let child=parent.child(i);onNode(child,locals,deco.forChild(offset,child),i),offset+=child.nodeSize}return}let decoIndex=0,active=[],restNode=null;for(let parentIndex=0;;){let widget,widgets,child,index;for(;decoIndex<locals.length&&locals[decoIndex].to==offset;){let next=locals[decoIndex++];next.widget&&(widget?(widgets||(widgets=[widget])).push(next):widget=next)}if(widget)if(widgets){widgets.sort(compareSide);for(let i=0;i<widgets.length;i++)onWidget(widgets[i],parentIndex,!!restNode)}else onWidget(widget,parentIndex,!!restNode);if(restNode)index=-1,child=restNode,restNode=null;else{if(!(parentIndex<parent.childCount))break;index=parentIndex,child=parent.child(parentIndex++)}for(let i=0;i<active.length;i++)active[i].to<=offset&&active.splice(i--,1);for(;decoIndex<locals.length&&locals[decoIndex].from<=offset&&locals[decoIndex].to>offset;)active.push(locals[decoIndex++]);let end=offset+child.nodeSize;if(child.isText){let cutAt=end;decoIndex<locals.length&&locals[decoIndex].from<cutAt&&(cutAt=locals[decoIndex].from);for(let i=0;i<active.length;i++)active[i].to<cutAt&&(cutAt=active[i].to);cutAt<end&&(restNode=child.cut(cutAt-offset),child=child.cut(0,cutAt-offset),end=cutAt,index=-1)}else for(;decoIndex<locals.length&&locals[decoIndex].to<end;)decoIndex++;onNode(child,child.isInline&&!child.isLeaf?active.filter(d=>!d.inline):active.slice(),deco.forChild(offset,child),index),offset=end}}(this.node,this.innerDeco,(widget,i,insideNode)=>{widget.spec.marks?updater.syncToMarks(widget.spec.marks,inline,view):widget.type.side>=0&&!insideNode&&updater.syncToMarks(i==this.node.childCount?prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.CU.none:this.node.child(i).marks,inline,view),updater.placeWidget(widget,view,off)},(child,outerDeco,innerDeco,i)=>{let compIndex;updater.syncToMarks(child.marks,inline,view),updater.findNodeMatch(child,outerDeco,innerDeco,i)||compositionInChild&&view.state.selection.from>off&&view.state.selection.to<off+child.nodeSize&&(compIndex=updater.findIndexWithChild(composition.node))>-1&&updater.updateNodeAt(child,outerDeco,innerDeco,compIndex,view)||updater.updateNextNode(child,outerDeco,innerDeco,view,i,off)||updater.addNode(child,outerDeco,innerDeco,view,off),off+=child.nodeSize}),updater.syncToMarks([],inline,view),this.node.isTextblock&&updater.addTextblockHacks(),updater.destroyRest(),(updater.changed||2==this.dirty)&&(localComposition&&this.protectLocalComposition(view,localComposition),renderDescs(this.contentDOM,this.children,view),ios&&function iosHacks(dom){if("UL"==dom.nodeName||"OL"==dom.nodeName){let oldCSS=dom.style.cssText;dom.style.cssText=oldCSS+"; list-style: square !important",window.getComputedStyle(dom).listStyle,dom.style.cssText=oldCSS}}(this.dom))}localCompositionInfo(view,pos){let{from,to}=view.state.selection;if(!(view.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3)||from<pos||to>pos+this.node.content.size)return null;let textNode=view.input.compositionNode;if(!textNode||!this.dom.contains(textNode.parentNode))return null;if(this.node.inlineContent){let text=textNode.nodeValue,textPos=function findTextInFragment(frag,text,from,to){for(let i=0,pos=0;i<frag.childCount&&pos<=to;){let child=frag.child(i++),childStart=pos;if(pos+=child.nodeSize,!child.isText)continue;let str=child.text;for(;i<frag.childCount;){let next=frag.child(i++);if(pos+=next.nodeSize,!next.isText)break;str+=next.text}if(pos>=from){if(pos>=to&&str.slice(to-text.length-childStart,to-childStart)==text)return to-text.length;let found=childStart<to?str.lastIndexOf(text,to-childStart-1):-1;if(found>=0&&found+text.length+childStart>=from)return childStart+found;if(from==to&&str.length>=to+text.length-childStart&&str.slice(to-childStart,to-childStart+text.length)==text)return to}}return-1}(this.node.content,text,from-pos,to-pos);return textPos<0?null:{node:textNode,pos:textPos,text}}return{node:textNode,pos:-1,text:""}}protectLocalComposition(view,{node,pos,text}){if(this.getDesc(node))return;let topNode=node;for(;topNode.parentNode!=this.contentDOM;topNode=topNode.parentNode){for(;topNode.previousSibling;)topNode.parentNode.removeChild(topNode.previousSibling);for(;topNode.nextSibling;)topNode.parentNode.removeChild(topNode.nextSibling);topNode.pmViewDesc&&(topNode.pmViewDesc=void 0)}let desc=new CompositionViewDesc(this,topNode,node,text);view.input.compositionNodes.push(desc),this.children=replaceNodes(this.children,pos,pos+text.length,view,desc)}update(node,outerDeco,innerDeco,view){return!(3==this.dirty||!node.sameMarkup(this.node))&&(this.updateInner(node,outerDeco,innerDeco,view),!0)}updateInner(node,outerDeco,innerDeco,view){this.updateOuterDeco(outerDeco),this.node=node,this.innerDeco=innerDeco,this.contentDOM&&this.updateChildren(view,this.posAtStart),this.dirty=0}updateOuterDeco(outerDeco){if(sameOuterDeco(outerDeco,this.outerDeco))return;let needsWrap=1!=this.nodeDOM.nodeType,oldDOM=this.dom;this.dom=patchOuterDeco(this.dom,this.nodeDOM,computeOuterDeco(this.outerDeco,this.node,needsWrap),computeOuterDeco(outerDeco,this.node,needsWrap)),this.dom!=oldDOM&&(oldDOM.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=outerDeco}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function docViewDesc(doc,outerDeco,innerDeco,dom,view){applyOuterDeco(dom,outerDeco,doc);let docView=new NodeViewDesc(void 0,doc,outerDeco,innerDeco,dom,dom,dom,view,0);return docView.contentDOM&&docView.updateChildren(view,0),docView}class TextViewDesc extends NodeViewDesc{constructor(parent,node,outerDeco,innerDeco,dom,nodeDOM,view){super(parent,node,outerDeco,innerDeco,dom,null,nodeDOM,view,0)}parseRule(){let skip=this.nodeDOM.parentNode;for(;skip&&skip!=this.dom&&!skip.pmIsDeco;)skip=skip.parentNode;return{skip:skip||!0}}update(node,outerDeco,innerDeco,view){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!node.sameMarkup(this.node))&&(this.updateOuterDeco(outerDeco),0==this.dirty&&node.text==this.node.text||node.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=node.text,view.trackWrites==this.nodeDOM&&(view.trackWrites=null)),this.node=node,this.dirty=0,!0)}inParent(){let parentDOM=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==parentDOM)return!0;return!1}domFromPos(pos){return{node:this.nodeDOM,offset:pos}}localPosFromDOM(dom,offset,bias){return dom==this.nodeDOM?this.posAtStart+Math.min(offset,this.node.text.length):super.localPosFromDOM(dom,offset,bias)}ignoreMutation(mutation){return"characterData"!=mutation.type&&"selection"!=mutation.type}slice(from,to,view){let node=this.node.cut(from,to),dom=document.createTextNode(node.text);return new TextViewDesc(this.parent,node,this.outerDeco,this.innerDeco,dom,dom,view)}markDirty(from,to){super.markDirty(from,to),this.dom==this.nodeDOM||0!=from&&to!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(text){return this.node.text==text}}class TrailingHackViewDesc extends ViewDesc{parseRule(){return{ignore:!0}}matchesHack(nodeName){return 0==this.dirty&&this.dom.nodeName==nodeName}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class CustomNodeViewDesc extends NodeViewDesc{constructor(parent,node,outerDeco,innerDeco,dom,contentDOM,nodeDOM,spec,view,pos){super(parent,node,outerDeco,innerDeco,dom,contentDOM,nodeDOM,view,pos),this.spec=spec}update(node,outerDeco,innerDeco,view){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==node.type||this.spec.multiType)){let result=this.spec.update(node,outerDeco,innerDeco);return result&&this.updateInner(node,outerDeco,innerDeco,view),result}return!(!this.contentDOM&&!node.isLeaf)&&super.update(node,outerDeco,innerDeco,view)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(anchor,head,view,force){this.spec.setSelection?this.spec.setSelection(anchor,head,view.root):super.setSelection(anchor,head,view,force)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(event){return!!this.spec.stopEvent&&this.spec.stopEvent(event)}ignoreMutation(mutation){return this.spec.ignoreMutation?this.spec.ignoreMutation(mutation):super.ignoreMutation(mutation)}}function renderDescs(parentDOM,descs,view){let dom=parentDOM.firstChild,written=!1;for(let i=0;i<descs.length;i++){let desc=descs[i],childDOM=desc.dom;if(childDOM.parentNode==parentDOM){for(;childDOM!=dom;)dom=rm(dom),written=!0;dom=dom.nextSibling}else written=!0,parentDOM.insertBefore(childDOM,dom);if(desc instanceof MarkViewDesc){let pos=dom?dom.previousSibling:parentDOM.lastChild;renderDescs(desc.contentDOM,desc.children,view),dom=pos?pos.nextSibling:parentDOM.firstChild}}for(;dom;)dom=rm(dom),written=!0;written&&view.trackWrites==parentDOM&&(view.trackWrites=null)}const OuterDecoLevel=function(nodeName){nodeName&&(this.nodeName=nodeName)};OuterDecoLevel.prototype=Object.create(null);const noDeco=[new OuterDecoLevel];function computeOuterDeco(outerDeco,node,needsWrap){if(0==outerDeco.length)return noDeco;let top=needsWrap?noDeco[0]:new OuterDecoLevel,result=[top];for(let i=0;i<outerDeco.length;i++){let attrs=outerDeco[i].type.attrs;if(attrs){attrs.nodeName&&result.push(top=new OuterDecoLevel(attrs.nodeName));for(let name in attrs){let val=attrs[name];null!=val&&(needsWrap&&1==result.length&&result.push(top=new OuterDecoLevel(node.isInline?"span":"div")),"class"==name?top.class=(top.class?top.class+" ":"")+val:"style"==name?top.style=(top.style?top.style+";":"")+val:"nodeName"!=name&&(top[name]=val))}}}return result}function patchOuterDeco(outerDOM,nodeDOM,prevComputed,curComputed){if(prevComputed==noDeco&&curComputed==noDeco)return nodeDOM;let curDOM=nodeDOM;for(let i=0;i<curComputed.length;i++){let deco=curComputed[i],prev=prevComputed[i];if(i){let parent;prev&&prev.nodeName==deco.nodeName&&curDOM!=outerDOM&&(parent=curDOM.parentNode)&&parent.nodeName.toLowerCase()==deco.nodeName||(parent=document.createElement(deco.nodeName),parent.pmIsDeco=!0,parent.appendChild(curDOM),prev=noDeco[0]),curDOM=parent}patchAttributes(curDOM,prev||noDeco[0],deco)}return curDOM}function patchAttributes(dom,prev,cur){for(let name in prev)"class"==name||"style"==name||"nodeName"==name||name in cur||dom.removeAttribute(name);for(let name in cur)"class"!=name&&"style"!=name&&"nodeName"!=name&&cur[name]!=prev[name]&&dom.setAttribute(name,cur[name]);if(prev.class!=cur.class){let prevList=prev.class?prev.class.split(" ").filter(Boolean):[],curList=cur.class?cur.class.split(" ").filter(Boolean):[];for(let i=0;i<prevList.length;i++)-1==curList.indexOf(prevList[i])&&dom.classList.remove(prevList[i]);for(let i=0;i<curList.length;i++)-1==prevList.indexOf(curList[i])&&dom.classList.add(curList[i]);0==dom.classList.length&&dom.removeAttribute("class")}if(prev.style!=cur.style){if(prev.style){let m,prop=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;m=prop.exec(prev.style);)dom.style.removeProperty(m[1])}cur.style&&(dom.style.cssText+=cur.style)}}function applyOuterDeco(dom,deco,node){return patchOuterDeco(dom,dom,noDeco,computeOuterDeco(deco,node,1!=dom.nodeType))}function sameOuterDeco(a,b){if(a.length!=b.length)return!1;for(let i=0;i<a.length;i++)if(!a[i].type.eq(b[i].type))return!1;return!0}function rm(dom){let next=dom.nextSibling;return dom.parentNode.removeChild(dom),next}class ViewTreeUpdater{constructor(top,lock,view){this.lock=lock,this.view=view,this.index=0,this.stack=[],this.changed=!1,this.top=top,this.preMatch=function preMatch(frag,parentDesc){let curDesc=parentDesc,descI=curDesc.children.length,fI=frag.childCount,matched=new Map,matches=[];outer:for(;fI>0;){let desc;for(;;)if(descI){let next=curDesc.children[descI-1];if(!(next instanceof MarkViewDesc)){desc=next,descI--;break}curDesc=next,descI=next.children.length}else{if(curDesc==parentDesc)break outer;descI=curDesc.parent.children.indexOf(curDesc),curDesc=curDesc.parent}let node=desc.node;if(node){if(node!=frag.child(fI-1))break;--fI,matched.set(desc,fI),matches.push(desc)}}return{index:fI,matched,matches:matches.reverse()}}(top.node.content,top)}destroyBetween(start,end){if(start!=end){for(let i=start;i<end;i++)this.top.children[i].destroy();this.top.children.splice(start,end-start),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(marks,inline,view){let keep=0,depth=this.stack.length>>1,maxKeep=Math.min(depth,marks.length);for(;keep<maxKeep&&(keep==depth-1?this.top:this.stack[keep+1<<1]).matchesMark(marks[keep])&&!1!==marks[keep].type.spec.spanning;)keep++;for(;keep<depth;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),depth--;for(;depth<marks.length;){this.stack.push(this.top,this.index+1);let found=-1;for(let i=this.index;i<Math.min(this.index+3,this.top.children.length);i++){let next=this.top.children[i];if(next.matchesMark(marks[depth])&&!this.isLocked(next.dom)){found=i;break}}if(found>-1)found>this.index&&(this.changed=!0,this.destroyBetween(this.index,found)),this.top=this.top.children[this.index];else{let markDesc=MarkViewDesc.create(this.top,marks[depth],inline,view);this.top.children.splice(this.index,0,markDesc),this.top=markDesc,this.changed=!0}this.index=0,depth++}}findNodeMatch(node,outerDeco,innerDeco,index){let targetDesc,found=-1;if(index>=this.preMatch.index&&(targetDesc=this.preMatch.matches[index-this.preMatch.index]).parent==this.top&&targetDesc.matchesNode(node,outerDeco,innerDeco))found=this.top.children.indexOf(targetDesc,this.index);else for(let i=this.index,e=Math.min(this.top.children.length,i+5);i<e;i++){let child=this.top.children[i];if(child.matchesNode(node,outerDeco,innerDeco)&&!this.preMatch.matched.has(child)){found=i;break}}return!(found<0)&&(this.destroyBetween(this.index,found),this.index++,!0)}updateNodeAt(node,outerDeco,innerDeco,index,view){let child=this.top.children[index];return 3==child.dirty&&child.dom==child.contentDOM&&(child.dirty=2),!!child.update(node,outerDeco,innerDeco,view)&&(this.destroyBetween(this.index,index),this.index++,!0)}findIndexWithChild(domNode){for(;;){let parent=domNode.parentNode;if(!parent)return-1;if(parent==this.top.contentDOM){let desc=domNode.pmViewDesc;if(desc)for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==desc)return i;return-1}domNode=parent}}updateNextNode(node,outerDeco,innerDeco,view,index,pos){for(let i=this.index;i<this.top.children.length;i++){let next=this.top.children[i];if(next instanceof NodeViewDesc){let preMatch=this.preMatch.matched.get(next);if(null!=preMatch&&preMatch!=index)return!1;let updated,nextDOM=next.dom,locked=this.isLocked(nextDOM)&&!(node.isText&&next.node&&next.node.isText&&next.nodeDOM.nodeValue==node.text&&3!=next.dirty&&sameOuterDeco(outerDeco,next.outerDeco));if(!locked&&next.update(node,outerDeco,innerDeco,view))return this.destroyBetween(this.index,i),next.dom!=nextDOM&&(this.changed=!0),this.index++,!0;if(!locked&&(updated=this.recreateWrapper(next,node,outerDeco,innerDeco,view,pos)))return this.destroyBetween(this.index,i),this.top.children[this.index]=updated,updated.contentDOM&&(updated.dirty=2,updated.updateChildren(view,pos+1),updated.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(next,node,outerDeco,innerDeco,view,pos){if(next.dirty||node.isAtom||!next.children.length||!next.node.content.eq(node.content)||!sameOuterDeco(outerDeco,next.outerDeco)||!innerDeco.eq(next.innerDeco))return null;let wrapper=NodeViewDesc.create(this.top,node,outerDeco,innerDeco,view,pos);if(wrapper.contentDOM){wrapper.children=next.children,next.children=[];for(let ch of wrapper.children)ch.parent=wrapper}return next.destroy(),wrapper}addNode(node,outerDeco,innerDeco,view,pos){let desc=NodeViewDesc.create(this.top,node,outerDeco,innerDeco,view,pos);desc.contentDOM&&desc.updateChildren(view,pos+1),this.top.children.splice(this.index++,0,desc),this.changed=!0}placeWidget(widget,view,pos){let next=this.index<this.top.children.length?this.top.children[this.index]:null;if(!next||!next.matchesWidget(widget)||widget!=next.widget&&next.widget.type.toDOM.parentNode){let desc=new WidgetViewDesc(this.top,widget,view,pos);this.top.children.splice(this.index++,0,desc),this.changed=!0}else this.index++}addTextblockHacks(){let lastChild=this.top.children[this.index-1],parent=this.top;for(;lastChild instanceof MarkViewDesc;)parent=lastChild,lastChild=parent.children[parent.children.length-1];(!lastChild||!(lastChild instanceof TextViewDesc)||/\n$/.test(lastChild.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(lastChild.node.text))&&((safari||chrome)&&lastChild&&"false"==lastChild.dom.contentEditable&&this.addHackNode("IMG",parent),this.addHackNode("BR",this.top))}addHackNode(nodeName,parent){if(parent==this.top&&this.index<parent.children.length&&parent.children[this.index].matchesHack(nodeName))this.index++;else{let dom=document.createElement(nodeName);"IMG"==nodeName&&(dom.className="ProseMirror-separator",dom.alt=""),"BR"==nodeName&&(dom.className="ProseMirror-trailingBreak");let hack=new TrailingHackViewDesc(this.top,[],dom,null);parent!=this.top?parent.children.push(hack):parent.children.splice(this.index++,0,hack),this.changed=!0}}isLocked(node){return this.lock&&(node==this.lock||1==node.nodeType&&node.contains(this.lock.parentNode))}}function compareSide(a,b){return a.type.side-b.type.side}function replaceNodes(nodes,from,to,view,replacement){let result=[];for(let i=0,off=0;i<nodes.length;i++){let child=nodes[i],start=off,end=off+=child.size;start>=to||end<=from?result.push(child):(start<from&&result.push(child.slice(0,from-start,view)),replacement&&(result.push(replacement),replacement=void 0),end>to&&result.push(child.slice(to-start,child.size,view)))}return result}function selectionFromDOM(view,origin=null){let domSel=view.domSelectionRange(),doc=view.state.doc;if(!domSel.focusNode)return null;let nearestDesc=view.docView.nearestDesc(domSel.focusNode),inWidget=nearestDesc&&0==nearestDesc.size,head=view.docView.posFromDOM(domSel.focusNode,domSel.focusOffset,1);if(head<0)return null;let anchor,selection,$head=doc.resolve(head);if(selectionCollapsed(domSel)){for(anchor=head;nearestDesc&&!nearestDesc.node;)nearestDesc=nearestDesc.parent;let nearestDescNode=nearestDesc.node;if(nearestDesc&&nearestDescNode.isAtom&&prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.isSelectable(nearestDescNode)&&nearestDesc.parent&&(!nearestDescNode.isInline||!function isOnEdge(node,offset,parent){for(let atStart=0==offset,atEnd=offset==nodeSize(node);atStart||atEnd;){if(node==parent)return!0;let index=domIndex(node);if(!(node=node.parentNode))return!1;atStart=atStart&&0==index,atEnd=atEnd&&index==nodeSize(node)}}(domSel.focusNode,domSel.focusOffset,nearestDesc.dom))){let pos=nearestDesc.posBefore;selection=new prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh(head==pos?$head:doc.resolve(pos))}}else{if(domSel instanceof view.dom.ownerDocument.defaultView.Selection&&domSel.rangeCount>1){let min=head,max=head;for(let i=0;i<domSel.rangeCount;i++){let range=domSel.getRangeAt(i);min=Math.min(min,view.docView.posFromDOM(range.startContainer,range.startOffset,1)),max=Math.max(max,view.docView.posFromDOM(range.endContainer,range.endOffset,-1))}if(min<0)return null;[anchor,head]=max==view.state.selection.anchor?[max,min]:[min,max],$head=doc.resolve(head)}else anchor=view.docView.posFromDOM(domSel.anchorNode,domSel.anchorOffset,1);if(anchor<0)return null}let $anchor=doc.resolve(anchor);if(!selection){selection=selectionBetween(view,$anchor,$head,"pointer"==origin||view.state.selection.head<$head.pos&&!inWidget?1:-1)}return selection}function editorOwnsSelection(view){return view.editable?view.hasFocus():hasSelection(view)&&document.activeElement&&document.activeElement.contains(view.dom)}function selectionToDOM(view,force=!1){let sel=view.state.selection;if(syncNodeSelection(view,sel),editorOwnsSelection(view)){if(!force&&view.input.mouseDown&&view.input.mouseDown.allowDefault&&chrome){let domSel=view.domSelectionRange(),curSel=view.domObserver.currentSelection;if(domSel.anchorNode&&curSel.anchorNode&&isEquivalentPosition(domSel.anchorNode,domSel.anchorOffset,curSel.anchorNode,curSel.anchorOffset))return view.input.mouseDown.delayedSelectionSync=!0,void view.domObserver.setCurSelection()}if(view.domObserver.disconnectSelection(),view.cursorWrapper)!function selectCursorWrapper(view){let domSel=view.domSelection(),range=document.createRange();if(!domSel)return;let node=view.cursorWrapper.dom,img="IMG"==node.nodeName;img?range.setStart(node.parentNode,domIndex(node)+1):range.setStart(node,0);range.collapse(!0),domSel.removeAllRanges(),domSel.addRange(range),!img&&!view.state.selection.visible&&ie&&ie_version<=11&&(node.disabled=!0,node.disabled=!1)}(view);else{let resetEditableFrom,resetEditableTo,{anchor,head}=sel;!brokenSelectBetweenUneditable||sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3||(sel.$from.parent.inlineContent||(resetEditableFrom=temporarilyEditableNear(view,sel.from)),sel.empty||sel.$from.parent.inlineContent||(resetEditableTo=temporarilyEditableNear(view,sel.to))),view.docView.setSelection(anchor,head,view,force),brokenSelectBetweenUneditable&&(resetEditableFrom&&resetEditable(resetEditableFrom),resetEditableTo&&resetEditable(resetEditableTo)),sel.visible?view.dom.classList.remove("ProseMirror-hideselection"):(view.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function removeClassOnSelectionChange(view){let doc=view.dom.ownerDocument;doc.removeEventListener("selectionchange",view.input.hideSelectionGuard);let domSel=view.domSelectionRange(),node=domSel.anchorNode,offset=domSel.anchorOffset;doc.addEventListener("selectionchange",view.input.hideSelectionGuard=()=>{domSel.anchorNode==node&&domSel.anchorOffset==offset||(doc.removeEventListener("selectionchange",view.input.hideSelectionGuard),setTimeout(()=>{editorOwnsSelection(view)&&!view.state.selection.visible||view.dom.classList.remove("ProseMirror-hideselection")},20))})}(view))}view.domObserver.setCurSelection(),view.domObserver.connectSelection()}}const brokenSelectBetweenUneditable=safari||chrome&&chrome_version<63;function temporarilyEditableNear(view,pos){let{node,offset}=view.docView.domFromPos(pos,0),after=offset<node.childNodes.length?node.childNodes[offset]:null,before=offset?node.childNodes[offset-1]:null;if(safari&&after&&"false"==after.contentEditable)return setEditable(after);if(!(after&&"false"!=after.contentEditable||before&&"false"!=before.contentEditable)){if(after)return setEditable(after);if(before)return setEditable(before)}}function setEditable(element){return element.contentEditable="true",safari&&element.draggable&&(element.draggable=!1,element.wasDraggable=!0),element}function resetEditable(element){element.contentEditable="false",element.wasDraggable&&(element.draggable=!0,element.wasDraggable=null)}function syncNodeSelection(view,sel){if(sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh){let desc=view.docView.descAt(sel.from);desc!=view.lastSelectedViewDesc&&(clearNodeSelection(view),desc&&desc.selectNode(),view.lastSelectedViewDesc=desc)}else clearNodeSelection(view)}function clearNodeSelection(view){view.lastSelectedViewDesc&&(view.lastSelectedViewDesc.parent&&view.lastSelectedViewDesc.deselectNode(),view.lastSelectedViewDesc=void 0)}function selectionBetween(view,$anchor,$head,bias){return view.someProp("createSelectionBetween",f=>f(view,$anchor,$head))||prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3.between($anchor,$head,bias)}function hasFocusAndSelection(view){return!(view.editable&&!view.hasFocus())&&hasSelection(view)}function hasSelection(view){let sel=view.domSelectionRange();if(!sel.anchorNode)return!1;try{return view.dom.contains(3==sel.anchorNode.nodeType?sel.anchorNode.parentNode:sel.anchorNode)&&(view.editable||view.dom.contains(3==sel.focusNode.nodeType?sel.focusNode.parentNode:sel.focusNode))}catch(_){return!1}}function moveSelectionBlock(state,dir){let{$anchor,$head}=state.selection,$side=dir>0?$anchor.max($head):$anchor.min($head),$start=$side.parent.inlineContent?$side.depth?state.doc.resolve(dir>0?$side.after():$side.before()):null:$side;return $start&&prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.LN.findFrom($start,dir)}function apply(view,sel){return view.dispatch(view.state.tr.setSelection(sel).scrollIntoView()),!0}function selectHorizontally(view,dir,mods){let sel=view.state.selection;if(!(sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3)){if(sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh&&sel.node.isInline)return apply(view,new prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3(dir>0?sel.$to:sel.$from));{let next=moveSelectionBlock(view.state,dir);return!!next&&apply(view,next)}}if(mods.indexOf("s")>-1){let{$head}=sel,node=$head.textOffset?null:dir<0?$head.nodeBefore:$head.nodeAfter;if(!node||node.isText||!node.isLeaf)return!1;let $newHead=view.state.doc.resolve($head.pos+node.nodeSize*(dir<0?-1:1));return apply(view,new prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3(sel.$anchor,$newHead))}if(!sel.empty)return!1;if(view.endOfTextblock(dir>0?"forward":"backward")){let next=moveSelectionBlock(view.state,dir);return!!(next&&next instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh)&&apply(view,next)}if(!(mac&&mods.indexOf("m")>-1)){let desc,$head=sel.$head,node=$head.textOffset?null:dir<0?$head.nodeBefore:$head.nodeAfter;if(!node||node.isText)return!1;let nodePos=dir<0?$head.pos-node.nodeSize:$head.pos;return!!(node.isAtom||(desc=view.docView.descAt(nodePos))&&!desc.contentDOM)&&(prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.isSelectable(node)?apply(view,new prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh(dir<0?view.state.doc.resolve($head.pos-node.nodeSize):$head)):!!webkit&&apply(view,new prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3(view.state.doc.resolve(dir<0?nodePos:nodePos+node.nodeSize))))}}function nodeLen(node){return 3==node.nodeType?node.nodeValue.length:node.childNodes.length}function isIgnorable(dom,dir){let desc=dom.pmViewDesc;return desc&&0==desc.size&&(dir<0||dom.nextSibling||"BR"!=dom.nodeName)}function skipIgnoredNodes(view,dir){return dir<0?function skipIgnoredNodesBefore(view){let sel=view.domSelectionRange(),node=sel.focusNode,offset=sel.focusOffset;if(!node)return;let moveNode,moveOffset,force=!1;gecko&&1==node.nodeType&&offset<nodeLen(node)&&isIgnorable(node.childNodes[offset],-1)&&(force=!0);for(;;)if(offset>0){if(1!=node.nodeType)break;{let before=node.childNodes[offset-1];if(isIgnorable(before,-1))moveNode=node,moveOffset=--offset;else{if(3!=before.nodeType)break;node=before,offset=node.nodeValue.length}}}else{if(isBlockNode(node))break;{let prev=node.previousSibling;for(;prev&&isIgnorable(prev,-1);)moveNode=node.parentNode,moveOffset=domIndex(prev),prev=prev.previousSibling;if(prev)node=prev,offset=nodeLen(node);else{if(node=node.parentNode,node==view.dom)break;offset=0}}}force?setSelFocus(view,node,offset):moveNode&&setSelFocus(view,moveNode,moveOffset)}(view):function skipIgnoredNodesAfter(view){let sel=view.domSelectionRange(),node=sel.focusNode,offset=sel.focusOffset;if(!node)return;let moveNode,moveOffset,len=nodeLen(node);for(;;)if(offset<len){if(1!=node.nodeType)break;if(!isIgnorable(node.childNodes[offset],1))break;moveNode=node,moveOffset=++offset}else{if(isBlockNode(node))break;{let next=node.nextSibling;for(;next&&isIgnorable(next,1);)moveNode=next.parentNode,moveOffset=domIndex(next)+1,next=next.nextSibling;if(next)node=next,offset=0,len=nodeLen(node);else{if(node=node.parentNode,node==view.dom)break;offset=len=0}}}moveNode&&setSelFocus(view,moveNode,moveOffset)}(view)}function isBlockNode(dom){let desc=dom.pmViewDesc;return desc&&desc.node&&desc.node.isBlock}function setSelFocus(view,node,offset){if(3!=node.nodeType){let before,after;(after=function textNodeAfter(node,offset){for(;node&&offset==node.childNodes.length&&!hasBlockDesc(node);)offset=domIndex(node)+1,node=node.parentNode;for(;node&&offset<node.childNodes.length;){let next=node.childNodes[offset];if(3==next.nodeType)return next;if(1==next.nodeType&&"false"==next.contentEditable)break;node=next,offset=0}}(node,offset))?(node=after,offset=0):(before=function textNodeBefore(node,offset){for(;node&&!offset&&!hasBlockDesc(node);)offset=domIndex(node),node=node.parentNode;for(;node&&offset;){let next=node.childNodes[offset-1];if(3==next.nodeType)return next;if(1==next.nodeType&&"false"==next.contentEditable)break;offset=(node=next).childNodes.length}}(node,offset))&&(node=before,offset=before.nodeValue.length)}let sel=view.domSelection();if(!sel)return;if(selectionCollapsed(sel)){let range=document.createRange();range.setEnd(node,offset),range.setStart(node,offset),sel.removeAllRanges(),sel.addRange(range)}else sel.extend&&sel.extend(node,offset);view.domObserver.setCurSelection();let{state}=view;setTimeout(()=>{view.state==state&&selectionToDOM(view)},50)}function findDirection(view,pos){let $pos=view.state.doc.resolve(pos);if(!chrome&&!windows&&$pos.parent.inlineContent){let coords=view.coordsAtPos(pos);if(pos>$pos.start()){let before=view.coordsAtPos(pos-1),mid=(before.top+before.bottom)/2;if(mid>coords.top&&mid<coords.bottom&&Math.abs(before.left-coords.left)>1)return before.left<coords.left?"ltr":"rtl"}if(pos<$pos.end()){let after=view.coordsAtPos(pos+1),mid=(after.top+after.bottom)/2;if(mid>coords.top&&mid<coords.bottom&&Math.abs(after.left-coords.left)>1)return after.left>coords.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(view.dom).direction?"rtl":"ltr"}function selectVertically(view,dir,mods){let sel=view.state.selection;if(sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3&&!sel.empty||mods.indexOf("s")>-1)return!1;if(mac&&mods.indexOf("m")>-1)return!1;let{$from,$to}=sel;if(!$from.parent.inlineContent||view.endOfTextblock(dir<0?"up":"down")){let next=moveSelectionBlock(view.state,dir);if(next&&next instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh)return apply(view,next)}if(!$from.parent.inlineContent){let side=dir<0?$from:$to,beyond=sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.i5?prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.LN.near(side,dir):prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.LN.findFrom(side,dir);return!!beyond&&apply(view,beyond)}return!1}function stopNativeHorizontalDelete(view,dir){if(!(view.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3))return!0;let{$head,$anchor,empty}=view.state.selection;if(!$head.sameParent($anchor))return!0;if(!empty)return!1;if(view.endOfTextblock(dir>0?"forward":"backward"))return!0;let nextNode=!$head.textOffset&&(dir<0?$head.nodeBefore:$head.nodeAfter);if(nextNode&&!nextNode.isText){let tr=view.state.tr;return dir<0?tr.delete($head.pos-nextNode.nodeSize,$head.pos):tr.delete($head.pos,$head.pos+nextNode.nodeSize),view.dispatch(tr),!0}return!1}function switchEditable(view,node,state){view.domObserver.stop(),node.contentEditable=state,view.domObserver.start()}function captureKeyDown(view,event){let code=event.keyCode,mods=function getMods(event){let result="";return event.ctrlKey&&(result+="c"),event.metaKey&&(result+="m"),event.altKey&&(result+="a"),event.shiftKey&&(result+="s"),result}(event);if(8==code||mac&&72==code&&"c"==mods)return stopNativeHorizontalDelete(view,-1)||skipIgnoredNodes(view,-1);if(46==code&&!event.shiftKey||mac&&68==code&&"c"==mods)return stopNativeHorizontalDelete(view,1)||skipIgnoredNodes(view,1);if(13==code||27==code)return!0;if(37==code||mac&&66==code&&"c"==mods){let dir=37==code?"ltr"==findDirection(view,view.state.selection.from)?-1:1:-1;return selectHorizontally(view,dir,mods)||skipIgnoredNodes(view,dir)}if(39==code||mac&&70==code&&"c"==mods){let dir=39==code?"ltr"==findDirection(view,view.state.selection.from)?1:-1:1;return selectHorizontally(view,dir,mods)||skipIgnoredNodes(view,dir)}return 38==code||mac&&80==code&&"c"==mods?selectVertically(view,-1,mods)||skipIgnoredNodes(view,-1):40==code||mac&&78==code&&"c"==mods?function safariDownArrowBug(view){if(!safari||view.state.selection.$head.parentOffset>0)return!1;let{focusNode,focusOffset}=view.domSelectionRange();if(focusNode&&1==focusNode.nodeType&&0==focusOffset&&focusNode.firstChild&&"false"==focusNode.firstChild.contentEditable){let child=focusNode.firstChild;switchEditable(view,child,"true"),setTimeout(()=>switchEditable(view,child,"false"),20)}return!1}(view)||selectVertically(view,1,mods)||skipIgnoredNodes(view,1):mods==(mac?"m":"c")&&(66==code||73==code||89==code||90==code)}function serializeForClipboard(view,slice){view.someProp("transformCopied",f=>{slice=f(slice,view)});let context=[],{content,openStart,openEnd}=slice;for(;openStart>1&&openEnd>1&&1==content.childCount&&1==content.firstChild.childCount;){openStart--,openEnd--;let node=content.firstChild;context.push(node.type.name,node.attrs!=node.type.defaultAttrs?node.attrs:null),content=node.content}let serializer=view.someProp("clipboardSerializer")||prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.ZF.fromSchema(view.state.schema),doc=detachedDoc(),wrap=doc.createElement("div");wrap.appendChild(serializer.serializeFragment(content,{document:doc}));let needsWrap,firstChild=wrap.firstChild,wrappers=0;for(;firstChild&&1==firstChild.nodeType&&(needsWrap=wrapMap[firstChild.nodeName.toLowerCase()]);){for(let i=needsWrap.length-1;i>=0;i--){let wrapper=doc.createElement(needsWrap[i]);for(;wrap.firstChild;)wrapper.appendChild(wrap.firstChild);wrap.appendChild(wrapper),wrappers++}firstChild=wrap.firstChild}return firstChild&&1==firstChild.nodeType&&firstChild.setAttribute("data-pm-slice",`${openStart} ${openEnd}${wrappers?` -${wrappers}`:""} ${JSON.stringify(context)}`),{dom:wrap,text:view.someProp("clipboardTextSerializer",f=>f(slice,view))||slice.content.textBetween(0,slice.content.size,"\n\n"),slice}}function parseFromClipboard(view,text,html,plainText,$context){let dom,slice,inCode=$context.parent.type.spec.code;if(!html&&!text)return null;let asText=text&&(plainText||inCode||!html);if(asText){if(view.someProp("transformPastedText",f=>{text=f(text,inCode||plainText,view)}),inCode)return text?new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(view.state.schema.text(text.replace(/\r\n?/g,"\n"))),0,0):prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty;let parsed=view.someProp("clipboardTextParser",f=>f(text,$context,plainText,view));if(parsed)slice=parsed;else{let marks=$context.marks(),{schema}=view.state,serializer=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.ZF.fromSchema(schema);dom=document.createElement("div"),text.split(/(?:\r\n?|\n)+/).forEach(block=>{let p=dom.appendChild(document.createElement("p"));block&&p.appendChild(serializer.serializeNode(schema.text(block,marks)))})}}else view.someProp("transformPastedHTML",f=>{html=f(html,view)}),dom=function readHTML(html){let metas=/^(\s*<meta [^>]*>)*/.exec(html);metas&&(html=html.slice(metas[0].length));let wrap,elt=detachedDoc().createElement("div"),firstTag=/<([a-z][^>\s]+)/i.exec(html);(wrap=firstTag&&wrapMap[firstTag[1].toLowerCase()])&&(html=wrap.map(n=>"<"+n+">").join("")+html+wrap.map(n=>"</"+n+">").reverse().join(""));if(elt.innerHTML=function maybeWrapTrusted(html){let trustedTypes=window.trustedTypes;if(!trustedTypes)return html;_policy||(_policy=trustedTypes.defaultPolicy||trustedTypes.createPolicy("ProseMirrorClipboard",{createHTML:s=>s}));return _policy.createHTML(html)}(html),wrap)for(let i=0;i<wrap.length;i++)elt=elt.querySelector(wrap[i])||elt;return elt}(html),webkit&&function restoreReplacedSpaces(dom){let nodes=dom.querySelectorAll(chrome?"span:not([class]):not([style])":"span.Apple-converted-space");for(let i=0;i<nodes.length;i++){let node=nodes[i];1==node.childNodes.length&&" "==node.textContent&&node.parentNode&&node.parentNode.replaceChild(dom.ownerDocument.createTextNode(" "),node)}}(dom);let contextNode=dom&&dom.querySelector("[data-pm-slice]"),sliceData=contextNode&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(contextNode.getAttribute("data-pm-slice")||"");if(sliceData&&sliceData[3])for(let i=+sliceData[3];i>0;i--){let child=dom.firstChild;for(;child&&1!=child.nodeType;)child=child.nextSibling;if(!child)break;dom=child}if(!slice){let parser=view.someProp("clipboardParser")||view.someProp("domParser")||prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.S4.fromSchema(view.state.schema);slice=parser.parseSlice(dom,{preserveWhitespace:!(!asText&&!sliceData),context:$context,ruleFromNode:dom=>"BR"!=dom.nodeName||dom.nextSibling||!dom.parentNode||inlineParents.test(dom.parentNode.nodeName)?null:{ignore:!0}})}if(sliceData)slice=function addContext(slice,context){if(!slice.size)return slice;let array,schema=slice.content.firstChild.type.schema;try{array=JSON.parse(context)}catch(e){return slice}let{content,openStart,openEnd}=slice;for(let i=array.length-2;i>=0;i-=2){let type=schema.nodes[array[i]];if(!type||type.hasRequiredAttrs())break;content=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(type.create(array[i+1],content)),openStart++,openEnd++}return new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(content,openStart,openEnd)}(closeSlice(slice,+sliceData[1],+sliceData[2]),sliceData[4]);else if(slice=prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.maxOpen(function normalizeSiblings(fragment,$context){if(fragment.childCount<2)return fragment;for(let d=$context.depth;d>=0;d--){let lastWrap,match=$context.node(d).contentMatchAt($context.index(d)),result=[];if(fragment.forEach(node=>{if(!result)return;let inLast,wrap=match.findWrapping(node.type);if(!wrap)return result=null;if(inLast=result.length&&lastWrap.length&&addToSibling(wrap,lastWrap,node,result[result.length-1],0))result[result.length-1]=inLast;else{result.length&&(result[result.length-1]=closeRight(result[result.length-1],lastWrap.length));let wrapped=withWrappers(node,wrap);result.push(wrapped),match=match.matchType(wrapped.type),lastWrap=wrap}}),result)return prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(result)}return fragment}(slice.content,$context),!0),slice.openStart||slice.openEnd){let openStart=0,openEnd=0;for(let node=slice.content.firstChild;openStart<slice.openStart&&!node.type.spec.isolating;openStart++,node=node.firstChild);for(let node=slice.content.lastChild;openEnd<slice.openEnd&&!node.type.spec.isolating;openEnd++,node=node.lastChild);slice=closeSlice(slice,openStart,openEnd)}return view.someProp("transformPasted",f=>{slice=f(slice,view)}),slice}const inlineParents=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function withWrappers(node,wrap,from=0){for(let i=wrap.length-1;i>=from;i--)node=wrap[i].create(null,prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(node));return node}function addToSibling(wrap,lastWrap,node,sibling,depth){if(depth<wrap.length&&depth<lastWrap.length&&wrap[depth]==lastWrap[depth]){let inner=addToSibling(wrap,lastWrap,node,sibling.lastChild,depth+1);if(inner)return sibling.copy(sibling.content.replaceChild(sibling.childCount-1,inner));if(sibling.contentMatchAt(sibling.childCount).matchType(depth==wrap.length-1?node.type:wrap[depth+1]))return sibling.copy(sibling.content.append(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(withWrappers(node,wrap,depth+1))))}}function closeRight(node,depth){if(0==depth)return node;let fragment=node.content.replaceChild(node.childCount-1,closeRight(node.lastChild,depth-1)),fill=node.contentMatchAt(node.childCount).fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,!0);return node.copy(fragment.append(fill))}function closeRange(fragment,side,from,to,depth,openEnd){let node=side<0?fragment.firstChild:fragment.lastChild,inner=node.content;return fragment.childCount>1&&(openEnd=0),depth<to-1&&(inner=closeRange(inner,side,from,to,depth+1,openEnd)),depth>=from&&(inner=side<0?node.contentMatchAt(0).fillBefore(inner,openEnd<=depth).append(inner):inner.append(node.contentMatchAt(node.childCount).fillBefore(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.empty,!0))),fragment.replaceChild(side<0?0:fragment.childCount-1,node.copy(inner))}function closeSlice(slice,openStart,openEnd){return openStart<slice.openStart&&(slice=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(closeRange(slice.content,-1,openStart,slice.openStart,0,slice.openEnd),openStart,slice.openEnd)),openEnd<slice.openEnd&&(slice=new prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji(closeRange(slice.content,1,openEnd,slice.openEnd,0,0),slice.openStart,openEnd)),slice}const wrapMap={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let _detachedDoc=null;function detachedDoc(){return _detachedDoc||(_detachedDoc=document.implementation.createHTMLDocument("title"))}let _policy=null;const handlers={},editHandlers={},passiveHandlers={touchstart:!0,touchmove:!0};class InputState{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 setSelectionOrigin(view,origin){view.input.lastSelectionOrigin=origin,view.input.lastSelectionTime=Date.now()}function ensureListeners(view){view.someProp("handleDOMEvents",currentHandlers=>{for(let type in currentHandlers)view.input.eventHandlers[type]||view.dom.addEventListener(type,view.input.eventHandlers[type]=event=>runCustomHandler(view,event))})}function runCustomHandler(view,event){return view.someProp("handleDOMEvents",handlers=>{let handler=handlers[event.type];return!!handler&&(handler(view,event)||event.defaultPrevented)})}function eventBelongsToView(view,event){if(!event.bubbles)return!0;if(event.defaultPrevented)return!1;for(let node=event.target;node!=view.dom;node=node.parentNode)if(!node||11==node.nodeType||node.pmViewDesc&&node.pmViewDesc.stopEvent(event))return!1;return!0}function eventCoords(event){return{left:event.clientX,top:event.clientY}}function runHandlerOnContext(view,propName,pos,inside,event){if(-1==inside)return!1;let $pos=view.state.doc.resolve(inside);for(let i=$pos.depth+1;i>0;i--)if(view.someProp(propName,f=>i>$pos.depth?f(view,pos,$pos.nodeAfter,$pos.before(i),event,!0):f(view,pos,$pos.node(i),$pos.before(i),event,!1)))return!0;return!1}function updateSelection(view,selection,origin){if(view.focused||view.focus(),view.state.selection.eq(selection))return;let tr=view.state.tr.setSelection(selection);"pointer"==origin&&tr.setMeta("pointer",!0),view.dispatch(tr)}function handleSingleClick(view,pos,inside,event,selectNode){return runHandlerOnContext(view,"handleClickOn",pos,inside,event)||view.someProp("handleClick",f=>f(view,pos,event))||(selectNode?function selectClickedNode(view,inside){if(-1==inside)return!1;let selectedNode,selectAt,sel=view.state.selection;sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh&&(selectedNode=sel.node);let $pos=view.state.doc.resolve(inside);for(let i=$pos.depth+1;i>0;i--){let node=i>$pos.depth?$pos.nodeAfter:$pos.node(i);if(prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.isSelectable(node)){selectAt=selectedNode&&sel.$from.depth>0&&i>=sel.$from.depth&&$pos.before(sel.$from.depth+1)==sel.$from.pos?$pos.before(sel.$from.depth):$pos.before(i);break}}return null!=selectAt&&(updateSelection(view,prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.create(view.state.doc,selectAt),"pointer"),!0)}(view,inside):function selectClickedLeaf(view,inside){if(-1==inside)return!1;let $pos=view.state.doc.resolve(inside),node=$pos.nodeAfter;return!!(node&&node.isAtom&&prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.isSelectable(node))&&(updateSelection(view,new prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh($pos),"pointer"),!0)}(view,inside))}function handleDoubleClick(view,pos,inside,event){return runHandlerOnContext(view,"handleDoubleClickOn",pos,inside,event)||view.someProp("handleDoubleClick",f=>f(view,pos,event))}function handleTripleClick(view,pos,inside,event){return runHandlerOnContext(view,"handleTripleClickOn",pos,inside,event)||view.someProp("handleTripleClick",f=>f(view,pos,event))||function defaultTripleClick(view,inside,event){if(0!=event.button)return!1;let doc=view.state.doc;if(-1==inside)return!!doc.inlineContent&&(updateSelection(view,prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3.create(doc,0,doc.content.size),"pointer"),!0);let $pos=doc.resolve(inside);for(let i=$pos.depth+1;i>0;i--){let node=i>$pos.depth?$pos.nodeAfter:$pos.node(i),nodePos=$pos.before(i);if(node.inlineContent)updateSelection(view,prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3.create(doc,nodePos+1,nodePos+1+node.content.size),"pointer");else{if(!prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.isSelectable(node))continue;updateSelection(view,prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.create(doc,nodePos),"pointer")}return!0}}(view,inside,event)}function forceDOMFlush(view){return endComposition(view)}editHandlers.keydown=(view,_event)=>{let event=_event;if(view.input.shiftKey=16==event.keyCode||event.shiftKey,!inOrNearComposition(view,event)&&(view.input.lastKeyCode=event.keyCode,view.input.lastKeyCodeTime=Date.now(),!android||!chrome||13!=event.keyCode))if(229!=event.keyCode&&view.domObserver.forceFlush(),!ios||13!=event.keyCode||event.ctrlKey||event.altKey||event.metaKey)view.someProp("handleKeyDown",f=>f(view,event))||captureKeyDown(view,event)?event.preventDefault():setSelectionOrigin(view,"key");else{let now=Date.now();view.input.lastIOSEnter=now,view.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{view.input.lastIOSEnter==now&&(view.someProp("handleKeyDown",f=>f(view,keyEvent(13,"Enter"))),view.input.lastIOSEnter=0)},200)}},editHandlers.keyup=(view,event)=>{16==event.keyCode&&(view.input.shiftKey=!1)},editHandlers.keypress=(view,_event)=>{let event=_event;if(inOrNearComposition(view,event)||!event.charCode||event.ctrlKey&&!event.altKey||mac&&event.metaKey)return;if(view.someProp("handleKeyPress",f=>f(view,event)))return void event.preventDefault();let sel=view.state.selection;if(!(sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3&&sel.$from.sameParent(sel.$to))){let text=String.fromCharCode(event.charCode),deflt=()=>view.state.tr.insertText(text).scrollIntoView();/[\r\n]/.test(text)||view.someProp("handleTextInput",f=>f(view,sel.$from.pos,sel.$to.pos,text,deflt))||view.dispatch(deflt()),event.preventDefault()}};const selectNodeModifier=mac?"metaKey":"ctrlKey";handlers.mousedown=(view,_event)=>{let event=_event;view.input.shiftKey=event.shiftKey;let flushed=forceDOMFlush(view),now=Date.now(),type="singleClick";now-view.input.lastClick.time<500&&function isNear(event,click){let dx=click.x-event.clientX,dy=click.y-event.clientY;return dx*dx+dy*dy<100}(event,view.input.lastClick)&&!event[selectNodeModifier]&&view.input.lastClick.button==event.button&&("singleClick"==view.input.lastClick.type?type="doubleClick":"doubleClick"==view.input.lastClick.type&&(type="tripleClick")),view.input.lastClick={time:now,x:event.clientX,y:event.clientY,type,button:event.button};let pos=view.posAtCoords(eventCoords(event));pos&&("singleClick"==type?(view.input.mouseDown&&view.input.mouseDown.done(),view.input.mouseDown=new MouseDown(view,pos,event,!!flushed)):("doubleClick"==type?handleDoubleClick:handleTripleClick)(view,pos.pos,pos.inside,event)?event.preventDefault():setSelectionOrigin(view,"pointer"))};class MouseDown{constructor(view,pos,event,flushed){let targetNode,targetPos;if(this.view=view,this.pos=pos,this.event=event,this.flushed=flushed,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=view.state.doc,this.selectNode=!!event[selectNodeModifier],this.allowDefault=event.shiftKey,pos.inside>-1)targetNode=view.state.doc.nodeAt(pos.inside),targetPos=pos.inside;else{let $pos=view.state.doc.resolve(pos.pos);targetNode=$pos.parent,targetPos=$pos.depth?$pos.before():0}const target=flushed?null:event.target,targetDesc=target?view.docView.nearestDesc(target,!0):null;this.target=targetDesc&&1==targetDesc.dom.nodeType?targetDesc.dom:null;let{selection}=view.state;(0==event.button&&targetNode.type.spec.draggable&&!1!==targetNode.type.spec.selectable||selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh&&selection.from<=targetPos&&selection.to>targetPos)&&(this.mightDrag={node:targetNode,pos:targetPos,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!gecko||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()),view.root.addEventListener("mouseup",this.up=this.up.bind(this)),view.root.addEventListener("mousemove",this.move=this.move.bind(this)),setSelectionOrigin(view,"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(()=>selectionToDOM(this.view)),this.view.input.mouseDown=null}up(event){if(this.done(),!this.view.dom.contains(event.target))return;let pos=this.pos;this.view.state.doc!=this.startDoc&&(pos=this.view.posAtCoords(eventCoords(event))),this.updateAllowDefault(event),this.allowDefault||!pos?setSelectionOrigin(this.view,"pointer"):handleSingleClick(this.view,pos.pos,pos.inside,event,this.selectNode)?event.preventDefault():0==event.button&&(this.flushed||safari&&this.mightDrag&&!this.mightDrag.node.isAtom||chrome&&!this.view.state.selection.visible&&Math.min(Math.abs(pos.pos-this.view.state.selection.from),Math.abs(pos.pos-this.view.state.selection.to))<=2)?(updateSelection(this.view,prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.LN.near(this.view.state.doc.resolve(pos.pos)),"pointer"),event.preventDefault()):setSelectionOrigin(this.view,"pointer")}move(event){this.updateAllowDefault(event),setSelectionOrigin(this.view,"pointer"),0==event.buttons&&this.done()}updateAllowDefault(event){!this.allowDefault&&(Math.abs(this.event.x-event.clientX)>4||Math.abs(this.event.y-event.clientY)>4)&&(this.allowDefault=!0)}}function inOrNearComposition(view,event){return!!view.composing||!!(safari&&Math.abs(event.timeStamp-view.input.compositionEndedAt)<500)&&(view.input.compositionEndedAt=-2e8,!0)}handlers.touchstart=view=>{view.input.lastTouch=Date.now(),forceDOMFlush(view),setSelectionOrigin(view,"pointer")},handlers.touchmove=view=>{view.input.lastTouch=Date.now(),setSelectionOrigin(view,"pointer")},handlers.contextmenu=view=>forceDOMFlush(view);const timeoutComposition=android?5e3:-1;function scheduleComposeEnd(view,delay){clearTimeout(view.input.composingTimeout),delay>-1&&(view.input.composingTimeout=setTimeout(()=>endComposition(view),delay))}function clearComposition(view){for(view.composing&&(view.input.composing=!1,view.input.compositionEndedAt=function timestampFromCustomEvent(){let event=document.createEvent("Event");return event.initEvent("event",!0,!0),event.timeStamp}());view.input.compositionNodes.length>0;)view.input.compositionNodes.pop().markParentsDirty()}function findCompositionNode(view){let sel=view.domSelectionRange();if(!sel.focusNode)return null;let textBefore=function textNodeBefore$1(node,offset){for(;;){if(3==node.nodeType&&offset)return node;if(1==node.nodeType&&offset>0){if("false"==node.contentEditable)return null;offset=nodeSize(node=node.childNodes[offset-1])}else{if(!node.parentNode||hasBlockDesc(node))return null;offset=domIndex(node),node=node.parentNode}}}(sel.focusNode,sel.focusOffset),textAfter=function textNodeAfter$1(node,offset){for(;;){if(3==node.nodeType&&offset<node.nodeValue.length)return node;if(1==node.nodeType&&offset<node.childNodes.length){if("false"==node.contentEditable)return null;node=node.childNodes[offset],offset=0}else{if(!node.parentNode||hasBlockDesc(node))return null;offset=domIndex(node)+1,node=node.parentNode}}}(sel.focusNode,sel.focusOffset);if(textBefore&&textAfter&&textBefore!=textAfter){let descAfter=textAfter.pmViewDesc,lastChanged=view.domObserver.lastChangedTextNode;if(textBefore==lastChanged||textAfter==lastChanged)return lastChanged;if(!descAfter||!descAfter.isText(textAfter.nodeValue))return textAfter;if(view.input.compositionNode==textAfter){let descBefore=textBefore.pmViewDesc;if(descBefore&&descBefore.isText(textBefore.nodeValue))return textAfter}}return textBefore||textAfter}function endComposition(view,restarting=!1){if(!(android&&view.domObserver.flushingSoon>=0)){if(view.domObserver.forceFlush(),clearComposition(view),restarting||view.docView&&view.docView.dirty){let sel=selectionFromDOM(view),cur=view.state.selection;return sel&&!sel.eq(cur)?view.dispatch(view.state.tr.setSelection(sel)):!view.markCursor&&!restarting||cur.$from.node(cur.$from.sharedDepth(cur.to)).inlineContent?view.updateState(view.state):view.dispatch(view.state.tr.deleteSelection()),!0}return!1}}editHandlers.compositionstart=editHandlers.compositionupdate=view=>{if(!view.composing){view.domObserver.flush();let{state}=view,$pos=state.selection.$to;if(state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3&&(state.storedMarks||!$pos.textOffset&&$pos.parentOffset&&$pos.nodeBefore.marks.some(m=>!1===m.type.spec.inclusive)))view.markCursor=view.state.storedMarks||$pos.marks(),endComposition(view,!0),view.markCursor=null;else if(endComposition(view,!state.selection.empty),gecko&&state.selection.empty&&$pos.parentOffset&&!$pos.textOffset&&$pos.nodeBefore.marks.length){let sel=view.domSelectionRange();for(let node=sel.focusNode,offset=sel.focusOffset;node&&1==node.nodeType&&0!=offset;){let before=offset<0?node.lastChild:node.childNodes[offset-1];if(!before)break;if(3==before.nodeType){let sel=view.domSelection();sel&&sel.collapse(before,before.nodeValue.length);break}node=before,offset=-1}}view.input.composing=!0}scheduleComposeEnd(view,timeoutComposition)},editHandlers.compositionend=(view,event)=>{view.composing&&(view.input.composing=!1,view.input.compositionEndedAt=event.timeStamp,view.input.compositionPendingChanges=view.domObserver.pendingRecords().length?view.input.compositionID:0,view.input.compositionNode=null,view.input.compositionPendingChanges&&Promise.resolve().then(()=>view.domObserver.flush()),view.input.compositionID++,scheduleComposeEnd(view,20))};const brokenClipboardAPI=ie&&ie_version<15||ios&&webkit_version<604;function doPaste(view,text,html,preferPlain,event){let slice=parseFromClipboard(view,text,html,preferPlain,view.state.selection.$from);if(view.someProp("handlePaste",f=>f(view,event,slice||prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty)))return!0;if(!slice)return!1;let singleNode=function sliceSingleNode(slice){return 0==slice.openStart&&0==slice.openEnd&&1==slice.content.childCount?slice.content.firstChild:null}(slice),tr=singleNode?view.state.tr.replaceSelectionWith(singleNode,preferPlain):view.state.tr.replaceSelection(slice);return view.dispatch(tr.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function getText(clipboardData){let text=clipboardData.getData("text/plain")||clipboardData.getData("Text");if(text)return text;let uris=clipboardData.getData("text/uri-list");return uris?uris.replace(/\r?\n/g," "):""}handlers.copy=editHandlers.cut=(view,_event)=>{let event=_event,sel=view.state.selection,cut="cut"==event.type;if(sel.empty)return;let data=brokenClipboardAPI?null:event.clipboardData,slice=sel.content(),{dom,text}=serializeForClipboard(view,slice);data?(event.preventDefault(),data.clearData(),data.setData("text/html",dom.innerHTML),data.setData("text/plain",text)):function captureCopy(view,dom){if(!view.dom.parentNode)return;let wrap=view.dom.parentNode.appendChild(document.createElement("div"));wrap.appendChild(dom),wrap.style.cssText="position: fixed; left: -10000px; top: 10px";let sel=getSelection(),range=document.createRange();range.selectNodeContents(dom),view.dom.blur(),sel.removeAllRanges(),sel.addRange(range),setTimeout(()=>{wrap.parentNode&&wrap.parentNode.removeChild(wrap),view.focus()},50)}(view,dom),cut&&view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},editHandlers.paste=(view,_event)=>{let event=_event;if(view.composing&&!android)return;let data=brokenClipboardAPI?null:event.clipboardData,plain=view.input.shiftKey&&45!=view.input.lastKeyCode;data&&doPaste(view,getText(data),data.getData("text/html"),plain,event)?event.preventDefault():function capturePaste(view,event){if(!view.dom.parentNode)return;let plainText=view.input.shiftKey||view.state.selection.$from.parent.type.spec.code,target=view.dom.parentNode.appendChild(document.createElement(plainText?"textarea":"div"));plainText||(target.contentEditable="true"),target.style.cssText="position: fixed; left: -10000px; top: 10px",target.focus();let plain=view.input.shiftKey&&45!=view.input.lastKeyCode;setTimeout(()=>{view.focus(),target.parentNode&&target.parentNode.removeChild(target),plainText?doPaste(view,target.value,null,plain,event):doPaste(view,target.textContent,target.innerHTML,plain,event)},50)}(view,event)};class Dragging{constructor(slice,move,node){this.slice=slice,this.move=move,this.node=node}}const dragCopyModifier=mac?"altKey":"ctrlKey";function dragMoves(view,event){let moves=view.someProp("dragCopies",test=>!test(event));return null!=moves?moves:!event[dragCopyModifier]}handlers.dragstart=(view,_event)=>{let event=_event,mouseDown=view.input.mouseDown;if(mouseDown&&mouseDown.done(),!event.dataTransfer)return;let node,sel=view.state.selection,pos=sel.empty?null:view.posAtCoords(eventCoords(event));if(pos&&pos.pos>=sel.from&&pos.pos<=(sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh?sel.to-1:sel.to));else if(mouseDown&&mouseDown.mightDrag)node=prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.create(view.state.doc,mouseDown.mightDrag.pos);else if(event.target&&1==event.target.nodeType){let desc=view.docView.nearestDesc(event.target,!0);desc&&desc.node.type.spec.draggable&&desc!=view.docView&&(node=prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.create(view.state.doc,desc.posBefore))}let draggedSlice=(node||view.state.selection).content(),{dom,text,slice}=serializeForClipboard(view,draggedSlice);(!event.dataTransfer.files.length||!chrome||chrome_version>120)&&event.dataTransfer.clearData(),event.dataTransfer.setData(brokenClipboardAPI?"Text":"text/html",dom.innerHTML),event.dataTransfer.effectAllowed="copyMove",brokenClipboardAPI||event.dataTransfer.setData("text/plain",text),view.dragging=new Dragging(slice,dragMoves(view,event),node)},handlers.dragend=view=>{let dragging=view.dragging;window.setTimeout(()=>{view.dragging==dragging&&(view.dragging=null)},50)},editHandlers.dragover=editHandlers.dragenter=(_,e)=>e.preventDefault(),editHandlers.drop=(view,_event)=>{let event=_event,dragging=view.dragging;if(view.dragging=null,!event.dataTransfer)return;let eventPos=view.posAtCoords(eventCoords(event));if(!eventPos)return;let $mouse=view.state.doc.resolve(eventPos.pos),slice=dragging&&dragging.slice;slice?view.someProp("transformPasted",f=>{slice=f(slice,view)}):slice=parseFromClipboard(view,getText(event.dataTransfer),brokenClipboardAPI?null:event.dataTransfer.getData("text/html"),!1,$mouse);let move=!(!dragging||!dragMoves(view,event));if(view.someProp("handleDrop",f=>f(view,event,slice||prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.Ji.empty,move)))return void event.preventDefault();if(!slice)return;event.preventDefault();let insertPos=slice?(0,prosemirror_transform__WEBPACK_IMPORTED_MODULE_2__.Um)(view.state.doc,$mouse.pos,slice):$mouse.pos;null==insertPos&&(insertPos=$mouse.pos);let tr=view.state.tr;if(move){let{node}=dragging;node?node.replace(tr):tr.deleteSelection()}let pos=tr.mapping.map(insertPos),isNode=0==slice.openStart&&0==slice.openEnd&&1==slice.content.childCount,beforeInsert=tr.doc;if(isNode?tr.replaceRangeWith(pos,pos,slice.content.firstChild):tr.replaceRange(pos,pos,slice),tr.doc.eq(beforeInsert))return;let $pos=tr.doc.resolve(pos);if(isNode&&prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.isSelectable(slice.content.firstChild)&&$pos.nodeAfter&&$pos.nodeAfter.sameMarkup(slice.content.firstChild))tr.setSelection(new prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh($pos));else{let end=tr.mapping.map(insertPos);tr.mapping.maps[tr.mapping.maps.length-1].forEach((_from,_to,_newFrom,newTo)=>end=newTo),tr.setSelection(selectionBetween(view,$pos,tr.doc.resolve(end)))}view.focus(),view.dispatch(tr.setMeta("uiEvent","drop"))},handlers.focus=view=>{view.input.lastFocus=Date.now(),view.focused||(view.domObserver.stop(),view.dom.classList.add("ProseMirror-focused"),view.domObserver.start(),view.focused=!0,setTimeout(()=>{view.docView&&view.hasFocus()&&!view.domObserver.currentSelection.eq(view.domSelectionRange())&&selectionToDOM(view)},20))},handlers.blur=(view,_event)=>{let event=_event;view.focused&&(view.domObserver.stop(),view.dom.classList.remove("ProseMirror-focused"),view.domObserver.start(),event.relatedTarget&&view.dom.contains(event.relatedTarget)&&view.domObserver.currentSelection.clear(),view.focused=!1)},handlers.beforeinput=(view,_event)=>{if(chrome&&android&&"deleteContentBackward"==_event.inputType){view.domObserver.flushSoon();let{domChangeCount}=view.input;setTimeout(()=>{if(view.input.domChangeCount!=domChangeCount)return;if(view.dom.blur(),view.focus(),view.someProp("handleKeyDown",f=>f(view,keyEvent(8,"Backspace"))))return;let{$cursor}=view.state.selection;$cursor&&$cursor.pos>0&&view.dispatch(view.state.tr.delete($cursor.pos-1,$cursor.pos).scrollIntoView())},50)}};for(let prop in editHandlers)handlers[prop]=editHandlers[prop];function compareObjs(a,b){if(a==b)return!0;for(let p in a)if(a[p]!==b[p])return!1;for(let p in b)if(!(p in a))return!1;return!0}class WidgetType{constructor(toDOM,spec){this.toDOM=toDOM,this.spec=spec||noSpec,this.side=this.spec.side||0}map(mapping,span,offset,oldOffset){let{pos,deleted}=mapping.mapResult(span.from+oldOffset,this.side<0?-1:1);return deleted?null:new Decoration(pos-offset,pos-offset,this)}valid(){return!0}eq(other){return this==other||other instanceof WidgetType&&(this.spec.key&&this.spec.key==other.spec.key||this.toDOM==other.toDOM&&compareObjs(this.spec,other.spec))}destroy(node){this.spec.destroy&&this.spec.destroy(node)}}class InlineType{constructor(attrs,spec){this.attrs=attrs,this.spec=spec||noSpec}map(mapping,span,offset,oldOffset){let from=mapping.map(span.from+oldOffset,this.spec.inclusiveStart?-1:1)-offset,to=mapping.map(span.to+oldOffset,this.spec.inclusiveEnd?1:-1)-offset;return from>=to?null:new Decoration(from,to,this)}valid(_,span){return span.from<span.to}eq(other){return this==other||other instanceof InlineType&&compareObjs(this.attrs,other.attrs)&&compareObjs(this.spec,other.spec)}static is(span){return span.type instanceof InlineType}destroy(){}}class NodeType{constructor(attrs,spec){this.attrs=attrs,this.spec=spec||noSpec}map(mapping,span,offset,oldOffset){let from=mapping.mapResult(span.from+oldOffset,1);if(from.deleted)return null;let to=mapping.mapResult(span.to+oldOffset,-1);return to.deleted||to.pos<=from.pos?null:new Decoration(from.pos-offset,to.pos-offset,this)}valid(node,span){let child,{index,offset}=node.content.findIndex(span.from);return offset==span.from&&!(child=node.child(index)).isText&&offset+child.nodeSize==span.to}eq(other){return this==other||other instanceof NodeType&&compareObjs(this.attrs,other.attrs)&&compareObjs(this.spec,other.spec)}destroy(){}}class Decoration{constructor(from,to,type){this.from=from,this.to=to,this.type=type}copy(from,to){return new Decoration(from,to,this.type)}eq(other,offset=0){return this.type.eq(other.type)&&this.from+offset==other.from&&this.to+offset==other.to}map(mapping,offset,oldOffset){return this.type.map(mapping,this,offset,oldOffset)}static widget(pos,toDOM,spec){return new Decoration(pos,pos,new WidgetType(toDOM,spec))}static inline(from,to,attrs,spec){return new Decoration(from,to,new InlineType(attrs,spec))}static node(from,to,attrs,spec){return new Decoration(from,to,new NodeType(attrs,spec))}get spec(){return this.type.spec}get inline(){return this.type instanceof InlineType}get widget(){return this.type instanceof WidgetType}}const none=[],noSpec={};class DecorationSet{constructor(local,children){this.local=local.length?local:none,this.children=children.length?children:none}static create(doc,decorations){return decorations.length?buildTree(decorations,doc,0,noSpec):empty}find(start,end,predicate){let result=[];return this.findInner(null==start?0:start,null==end?1e9:end,result,0,predicate),result}findInner(start,end,result,offset,predicate){for(let i=0;i<this.local.length;i++){let span=this.local[i];span.from<=end&&span.to>=start&&(!predicate||predicate(span.spec))&&result.push(span.copy(span.from+offset,span.to+offset))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<end&&this.children[i+1]>start){let childOff=this.children[i]+1;this.children[i+2].findInner(start-childOff,end-childOff,result,offset+childOff,predicate)}}map(mapping,doc,options){return this==empty||0==mapping.maps.length?this:this.mapInner(mapping,doc,0,0,options||noSpec)}mapInner(mapping,node,offset,oldOffset,options){let newLocal;for(let i=0;i<this.local.length;i++){let mapped=this.local[i].map(mapping,offset,oldOffset);mapped&&mapped.type.valid(node,mapped)?(newLocal||(newLocal=[])).push(mapped):options.onRemove&&options.onRemove(this.local[i].spec)}return this.children.length?function mapChildren(oldChildren,newLocal,mapping,node,offset,oldOffset,options){let children=oldChildren.slice();for(let i=0,baseOffset=oldOffset;i<mapping.maps.length;i++){let moved=0;mapping.maps[i].forEach((oldStart,oldEnd,newStart,newEnd)=>{let dSize=newEnd-newStart-(oldEnd-oldStart);for(let i=0;i<children.length;i+=3){let end=children[i+1];if(end<0||oldStart>end+baseOffset-moved)continue;let start=children[i]+baseOffset-moved;oldEnd>=start?children[i+1]=oldStart<=start?-2:-1:oldStart>=baseOffset&&dSize&&(children[i]+=dSize,children[i+1]+=dSize)}moved+=dSize}),baseOffset=mapping.maps[i].map(baseOffset,-1)}let mustRebuild=!1;for(let i=0;i<children.length;i+=3)if(children[i+1]<0){if(-2==children[i+1]){mustRebuild=!0,children[i+1]=-1;continue}let from=mapping.map(oldChildren[i]+oldOffset),fromLocal=from-offset;if(fromLocal<0||fromLocal>=node.content.size){mustRebuild=!0;continue}let toLocal=mapping.map(oldChildren[i+1]+oldOffset,-1)-offset,{index,offset:childOffset}=node.content.findIndex(fromLocal),childNode=node.maybeChild(index);if(childNode&&childOffset==fromLocal&&childOffset+childNode.nodeSize==toLocal){let mapped=children[i+2].mapInner(mapping,childNode,from+1,oldChildren[i]+oldOffset+1,options);mapped!=empty?(children[i]=fromLocal,children[i+1]=toLocal,children[i+2]=mapped):(children[i+1]=-2,mustRebuild=!0)}else mustRebuild=!0}if(mustRebuild){let decorations=function mapAndGatherRemainingDecorations(children,oldChildren,decorations,mapping,offset,oldOffset,options){function gather(set,oldOffset){for(let i=0;i<set.local.length;i++){let mapped=set.local[i].map(mapping,offset,oldOffset);mapped?decorations.push(mapped):options.onRemove&&options.onRemove(set.local[i].spec)}for(let i=0;i<set.children.length;i+=3)gather(set.children[i+2],set.children[i]+oldOffset+1)}for(let i=0;i<children.length;i+=3)-1==children[i+1]&&gather(children[i+2],oldChildren[i]+oldOffset+1);return decorations}(children,oldChildren,newLocal,mapping,offset,oldOffset,options),built=buildTree(decorations,node,0,options);newLocal=built.local;for(let i=0;i<children.length;i+=3)children[i+1]<0&&(children.splice(i,3),i-=3);for(let i=0,j=0;i<built.children.length;i+=3){let from=built.children[i];for(;j<children.length&&children[j]<from;)j+=3;children.splice(j,0,built.children[i],built.children[i+1],built.children[i+2])}}return new DecorationSet(newLocal.sort(byPos),children)}(this.children,newLocal||[],mapping,node,offset,oldOffset,options):newLocal?new DecorationSet(newLocal.sort(byPos),none):empty}add(doc,decorations){return decorations.length?this==empty?DecorationSet.create(doc,decorations):this.addInner(doc,decorations,0):this}addInner(doc,decorations,offset){let children,childIndex=0;doc.forEach((childNode,childOffset)=>{let found,baseOffset=childOffset+offset;if(found=takeSpansForNode(decorations,childNode,baseOffset)){for(children||(children=this.children.slice());childIndex<children.length&&children[childIndex]<childOffset;)childIndex+=3;children[childIndex]==childOffset?children[childIndex+2]=children[childIndex+2].addInner(childNode,found,baseOffset+1):children.splice(childIndex,0,childOffset,childOffset+childNode.nodeSize,buildTree(found,childNode,baseOffset+1,noSpec)),childIndex+=3}});let local=moveSpans(childIndex?withoutNulls(decorations):decorations,-offset);for(let i=0;i<local.length;i++)local[i].type.valid(doc,local[i])||local.splice(i--,1);return new DecorationSet(local.length?this.local.concat(local).sort(byPos):this.local,children||this.children)}remove(decorations){return 0==decorations.length||this==empty?this:this.removeInner(decorations,0)}removeInner(decorations,offset){let children=this.children,local=this.local;for(let i=0;i<children.length;i+=3){let found,from=children[i]+offset,to=children[i+1]+offset;for(let span,j=0;j<decorations.length;j++)(span=decorations[j])&&span.from>from&&span.to<to&&(decorations[j]=null,(found||(found=[])).push(span));if(!found)continue;children==this.children&&(children=this.children.slice());let removed=children[i+2].removeInner(found,from+1);removed!=empty?children[i+2]=removed:(children.splice(i,3),i-=3)}if(local.length)for(let span,i=0;i<decorations.length;i++)if(span=decorations[i])for(let j=0;j<local.length;j++)local[j].eq(span,offset)&&(local==this.local&&(local=this.local.slice()),local.splice(j--,1));return children==this.children&&local==this.local?this:local.length||children.length?new DecorationSet(local,children):empty}forChild(offset,node){if(this==empty)return this;if(node.isLeaf)return DecorationSet.empty;let child,local;for(let i=0;i<this.children.length;i+=3)if(this.children[i]>=offset){this.children[i]==offset&&(child=this.children[i+2]);break}let start=offset+1,end=start+node.content.size;for(let i=0;i<this.local.length;i++){let dec=this.local[i];if(dec.from<end&&dec.to>start&&dec.type instanceof InlineType){let from=Math.max(start,dec.from)-start,to=Math.min(end,dec.to)-start;from<to&&(local||(local=[])).push(dec.copy(from,to))}}if(local){let localSet=new DecorationSet(local.sort(byPos),none);return child?new DecorationGroup([localSet,child]):localSet}return child||empty}eq(other){if(this==other)return!0;if(!(other instanceof DecorationSet)||this.local.length!=other.local.length||this.children.length!=other.children.length)return!1;for(let i=0;i<this.local.length;i++)if(!this.local[i].eq(other.local[i]))return!1;for(let i=0;i<this.children.length;i+=3)if(this.children[i]!=other.children[i]||this.children[i+1]!=other.children[i+1]||!this.children[i+2].eq(other.children[i+2]))return!1;return!0}locals(node){return removeOverlap(this.localsInner(node))}localsInner(node){if(this==empty)return none;if(node.inlineContent||!this.local.some(InlineType.is))return this.local;let result=[];for(let i=0;i<this.local.length;i++)this.local[i].type instanceof InlineType||result.push(this.local[i]);return result}forEachSet(f){f(this)}}DecorationSet.empty=new DecorationSet([],[]),DecorationSet.removeOverlap=removeOverlap;const empty=DecorationSet.empty;class DecorationGroup{constructor(members){this.members=members}map(mapping,doc){const mappedDecos=this.members.map(member=>member.map(mapping,doc,noSpec));return DecorationGroup.from(mappedDecos)}forChild(offset,child){if(child.isLeaf)return DecorationSet.empty;let found=[];for(let i=0;i<this.members.length;i++){let result=this.members[i].forChild(offset,child);result!=empty&&(result instanceof DecorationGroup?found=found.concat(result.members):found.push(result))}return DecorationGroup.from(found)}eq(other){if(!(other instanceof DecorationGroup)||other.members.length!=this.members.length)return!1;for(let i=0;i<this.members.length;i++)if(!this.members[i].eq(other.members[i]))return!1;return!0}locals(node){let result,sorted=!0;for(let i=0;i<this.members.length;i++){let locals=this.members[i].localsInner(node);if(locals.length)if(result){sorted&&(result=result.slice(),sorted=!1);for(let j=0;j<locals.length;j++)result.push(locals[j])}else result=locals}return result?removeOverlap(sorted?result:result.sort(byPos)):none}static from(members){switch(members.length){case 0:return empty;case 1:return members[0];default:return new DecorationGroup(members.every(m=>m instanceof DecorationSet)?members:members.reduce((r,m)=>r.concat(m instanceof DecorationSet?m:m.members),[]))}}forEachSet(f){for(let i=0;i<this.members.length;i++)this.members[i].forEachSet(f)}}function moveSpans(spans,offset){if(!offset||!spans.length)return spans;let result=[];for(let i=0;i<spans.length;i++){let span=spans[i];result.push(new Decoration(span.from+offset,span.to+offset,span.type))}return result}function takeSpansForNode(spans,node,offset){if(node.isLeaf)return null;let end=offset+node.nodeSize,found=null;for(let span,i=0;i<spans.length;i++)(span=spans[i])&&span.from>offset&&span.to<end&&((found||(found=[])).push(span),spans[i]=null);return found}function withoutNulls(array){let result=[];for(let i=0;i<array.length;i++)null!=array[i]&&result.push(array[i]);return result}function buildTree(spans,node,offset,options){let children=[],hasNulls=!1;node.forEach((childNode,localStart)=>{let found=takeSpansForNode(spans,childNode,localStart+offset);if(found){hasNulls=!0;let subtree=buildTree(found,childNode,offset+localStart+1,options);subtree!=empty&&children.push(localStart,localStart+childNode.nodeSize,subtree)}});let locals=moveSpans(hasNulls?withoutNulls(spans):spans,-offset).sort(byPos);for(let i=0;i<locals.length;i++)locals[i].type.valid(node,locals[i])||(options.onRemove&&options.onRemove(locals[i].spec),locals.splice(i--,1));return locals.length||children.length?new DecorationSet(locals,children):empty}function byPos(a,b){return a.from-b.from||a.to-b.to}function removeOverlap(spans){let working=spans;for(let i=0;i<working.length-1;i++){let span=working[i];if(span.from!=span.to)for(let j=i+1;j<working.length;j++){let next=working[j];if(next.from!=span.from){next.from<span.to&&(working==spans&&(working=spans.slice()),working[i]=span.copy(span.from,next.from),insertAhead(working,j,span.copy(next.from,span.to)));break}next.to!=span.to&&(working==spans&&(working=spans.slice()),working[j]=next.copy(next.from,span.to),insertAhead(working,j+1,next.copy(span.to,next.to)))}}return working}function insertAhead(array,i,deco){for(;i<array.length&&byPos(deco,array[i])>0;)i++;array.splice(i,0,deco)}function viewDecorations(view){let found=[];return view.someProp("decorations",f=>{let result=f(view.state);result&&result!=empty&&found.push(result)}),view.cursorWrapper&&found.push(DecorationSet.create(view.state.doc,[view.cursorWrapper.deco])),DecorationGroup.from(found)}const observeOptions={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},useCharData=ie&&ie_version<=11;class SelectionState{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(sel){this.anchorNode=sel.anchorNode,this.anchorOffset=sel.anchorOffset,this.focusNode=sel.focusNode,this.focusOffset=sel.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(sel){return sel.anchorNode==this.anchorNode&&sel.anchorOffset==this.anchorOffset&&sel.focusNode==this.focusNode&&sel.focusOffset==this.focusOffset}}class DOMObserver{constructor(view,handleDOMChange){this.view=view,this.handleDOMChange=handleDOMChange,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new SelectionState,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(mutations=>{for(let i=0;i<mutations.length;i++)this.queue.push(mutations[i]);ie&&ie_version<=11&&mutations.some(m=>"childList"==m.type&&m.removedNodes.length||"characterData"==m.type&&m.oldValue.length>m.target.nodeValue.length)?this.flushSoon():this.flush()}),useCharData&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,observeOptions)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let take=this.observer.takeRecords();if(take.length){for(let i=0;i<take.length;i++)this.queue.push(take[i]);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(hasFocusAndSelection(this.view)){if(this.suppressingSelectionUpdates)return selectionToDOM(this.view);if(ie&&ie_version<=11&&!this.view.state.selection.empty){let sel=this.view.domSelectionRange();if(sel.focusNode&&isEquivalentPosition(sel.focusNode,sel.focusOffset,sel.anchorNode,sel.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(sel){if(!sel.focusNode)return!0;let container,ancestors=new Set;for(let scan=sel.focusNode;scan;scan=parentNode(scan))ancestors.add(scan);for(let scan=sel.anchorNode;scan;scan=parentNode(scan))if(ancestors.has(scan)){container=scan;break}let desc=container&&this.view.docView.nearestDesc(container);return desc&&desc.ignoreMutation({type:"selection",target:3==container.nodeType?container.parentNode:container})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let mut of this.observer.takeRecords())this.queue.push(mut);return this.queue}flush(){let{view}=this;if(!view.docView||this.flushingSoon>-1)return;let mutations=this.pendingRecords();mutations.length&&(this.queue=[]);let sel=view.domSelectionRange(),newSel=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(sel)&&hasFocusAndSelection(view)&&!this.ignoreSelectionChange(sel),from=-1,to=-1,typeOver=!1,added=[];if(view.editable)for(let i=0;i<mutations.length;i++){let result=this.registerMutation(mutations[i],added);result&&(from=from<0?result.from:Math.min(result.from,from),to=to<0?result.to:Math.max(result.to,to),result.typeOver&&(typeOver=!0))}if(gecko&&added.length){let brs=added.filter(n=>"BR"==n.nodeName);if(2==brs.length){let[a,b]=brs;a.parentNode&&a.parentNode.parentNode==b.parentNode?b.remove():a.remove()}else{let{focusNode}=this.currentSelection;for(let br of brs){let parent=br.parentNode;!parent||"LI"!=parent.nodeName||focusNode&&blockParent(view,focusNode)==parent||br.remove()}}}let readSel=null;from<0&&newSel&&view.input.lastFocus>Date.now()-200&&Math.max(view.input.lastTouch,view.input.lastClick.time)<Date.now()-300&&selectionCollapsed(sel)&&(readSel=selectionFromDOM(view))&&readSel.eq(prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.LN.near(view.state.doc.resolve(0),1))?(view.input.lastFocus=0,selectionToDOM(view),this.currentSelection.set(sel),view.scrollToSelection()):(from>-1||newSel)&&(from>-1&&(view.docView.markDirty(from,to),function checkCSS(view){if(cssChecked.has(view))return;if(cssChecked.set(view,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(view.dom).whiteSpace)){if(view.requiresGeckoHackNode=gecko,cssCheckWarned)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),cssCheckWarned=!0}}(view)),this.handleDOMChange(from,to,typeOver,added),view.docView&&view.docView.dirty?view.updateState(view.state):this.currentSelection.eq(sel)||selectionToDOM(view),this.currentSelection.set(sel))}registerMutation(mut,added){if(added.indexOf(mut.target)>-1)return null;let desc=this.view.docView.nearestDesc(mut.target);if("attributes"==mut.type&&(desc==this.view.docView||"contenteditable"==mut.attributeName||"style"==mut.attributeName&&!mut.oldValue&&!mut.target.getAttribute("style")))return null;if(!desc||desc.ignoreMutation(mut))return null;if("childList"==mut.type){for(let i=0;i<mut.addedNodes.length;i++){let node=mut.addedNodes[i];added.push(node),3==node.nodeType&&(this.lastChangedTextNode=node)}if(desc.contentDOM&&desc.contentDOM!=desc.dom&&!desc.contentDOM.contains(mut.target))return{from:desc.posBefore,to:desc.posAfter};let prev=mut.previousSibling,next=mut.nextSibling;if(ie&&ie_version<=11&&mut.addedNodes.length)for(let i=0;i<mut.addedNodes.length;i++){let{previousSibling,nextSibling}=mut.addedNodes[i];(!previousSibling||Array.prototype.indexOf.call(mut.addedNodes,previousSibling)<0)&&(prev=previousSibling),(!nextSibling||Array.prototype.indexOf.call(mut.addedNodes,nextSibling)<0)&&(next=nextSibling)}let fromOffset=prev&&prev.parentNode==mut.target?domIndex(prev)+1:0,from=desc.localPosFromDOM(mut.target,fromOffset,-1),toOffset=next&&next.parentNode==mut.target?domIndex(next):mut.target.childNodes.length;return{from,to:desc.localPosFromDOM(mut.target,toOffset,1)}}return"attributes"==mut.type?{from:desc.posAtStart-desc.border,to:desc.posAtEnd+desc.border}:(this.lastChangedTextNode=mut.target,{from:desc.posAtStart,to:desc.posAtEnd,typeOver:mut.target.nodeValue==mut.oldValue})}}let cssChecked=new WeakMap,cssCheckWarned=!1;function rangeToSelectionRange(view,range){let anchorNode=range.startContainer,anchorOffset=range.startOffset,focusNode=range.endContainer,focusOffset=range.endOffset,currentAnchor=view.domAtPos(view.state.selection.anchor);return isEquivalentPosition(currentAnchor.node,currentAnchor.offset,focusNode,focusOffset)&&([anchorNode,anchorOffset,focusNode,focusOffset]=[focusNode,focusOffset,anchorNode,anchorOffset]),{anchorNode,anchorOffset,focusNode,focusOffset}}function blockParent(view,node){for(let p=node.parentNode;p&&p!=view.dom;p=p.parentNode){let desc=view.docView.nearestDesc(p,!0);if(desc&&desc.node.isBlock)return p}return null}function ruleFromNode(dom){let desc=dom.pmViewDesc;if(desc)return desc.parseRule();if("BR"==dom.nodeName&&dom.parentNode){if(safari&&/^(ul|ol)$/i.test(dom.parentNode.nodeName)){let skip=document.createElement("div");return skip.appendChild(document.createElement("li")),{skip}}if(dom.parentNode.lastChild==dom||safari&&/^(tr|table)$/i.test(dom.parentNode.nodeName))return{ignore:!0}}else if("IMG"==dom.nodeName&&dom.getAttribute("mark-placeholder"))return{ignore:!0};return null}const isInline=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function readDOMChange(view,from,to,typeOver,addedNodes){let compositionID=view.input.compositionPendingChanges||(view.composing?view.input.compositionID:0);if(view.input.compositionPendingChanges=0,from<0){let origin=view.input.lastSelectionTime>Date.now()-50?view.input.lastSelectionOrigin:null,newSel=selectionFromDOM(view,origin);if(newSel&&!view.state.selection.eq(newSel)){if(chrome&&android&&13===view.input.lastKeyCode&&Date.now()-100<view.input.lastKeyCodeTime&&view.someProp("handleKeyDown",f=>f(view,keyEvent(13,"Enter"))))return;let tr=view.state.tr.setSelection(newSel);"pointer"==origin?tr.setMeta("pointer",!0):"key"==origin&&tr.scrollIntoView(),compositionID&&tr.setMeta("composition",compositionID),view.dispatch(tr)}return}let $before=view.state.doc.resolve(from),shared=$before.sharedDepth(to);from=$before.before(shared+1),to=view.state.doc.resolve(to).after(shared+1);let preferredPos,preferredSide,sel=view.state.selection,parse=function parseBetween(view,from_,to_){let find,{node:parent,fromOffset,toOffset,from,to}=view.docView.parseRange(from_,to_),domSel=view.domSelectionRange(),anchor=domSel.anchorNode;if(anchor&&view.dom.contains(1==anchor.nodeType?anchor:anchor.parentNode)&&(find=[{node:anchor,offset:domSel.anchorOffset}],selectionCollapsed(domSel)||find.push({node:domSel.focusNode,offset:domSel.focusOffset})),chrome&&8===view.input.lastKeyCode)for(let off=toOffset;off>fromOffset;off--){let node=parent.childNodes[off-1],desc=node.pmViewDesc;if("BR"==node.nodeName&&!desc){toOffset=off;break}if(!desc||desc.size)break}let startDoc=view.state.doc,parser=view.someProp("domParser")||prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.S4.fromSchema(view.state.schema),$from=startDoc.resolve(from),sel=null,doc=parser.parse(parent,{topNode:$from.parent,topMatch:$from.parent.contentMatchAt($from.index()),topOpen:!0,from:fromOffset,to:toOffset,preserveWhitespace:"pre"!=$from.parent.type.whitespace||"full",findPositions:find,ruleFromNode,context:$from});if(find&&null!=find[0].pos){let anchor=find[0].pos,head=find[1]&&find[1].pos;null==head&&(head=anchor),sel={anchor:anchor+from,head:head+from}}return{doc,sel,from,to}}(view,from,to),doc=view.state.doc,compare=doc.slice(parse.from,parse.to);8===view.input.lastKeyCode&&Date.now()-100<view.input.lastKeyCodeTime?(preferredPos=view.state.selection.to,preferredSide="end"):(preferredPos=view.state.selection.from,preferredSide="start"),view.input.lastKeyCode=null;let change=function findDiff(a,b,pos,preferredPos,preferredSide){let start=a.findDiffStart(b,pos);if(null==start)return null;let{a:endA,b:endB}=a.findDiffEnd(b,pos+a.size,pos+b.size);if("end"==preferredSide){preferredPos-=endA+Math.max(0,start-Math.min(endA,endB))-start}if(endA<start&&a.size<b.size){let move=preferredPos<=start&&preferredPos>=endA?start-preferredPos:0;start-=move,start&&start<b.size&&isSurrogatePair(b.textBetween(start-1,start+1))&&(start+=move?1:-1),endB=start+(endB-endA),endA=start}else if(endB<start){let move=preferredPos<=start&&preferredPos>=endB?start-preferredPos:0;start-=move,start&&start<a.size&&isSurrogatePair(a.textBetween(start-1,start+1))&&(start+=move?1:-1),endA=start+(endA-endB),endB=start}return{start,endA,endB}}(compare.content,parse.doc.content,parse.from,preferredPos,preferredSide);if(change&&view.input.domChangeCount++,(ios&&view.input.lastIOSEnter>Date.now()-225||android)&&addedNodes.some(n=>1==n.nodeType&&!isInline.test(n.nodeName))&&(!change||change.endA>=change.endB)&&view.someProp("handleKeyDown",f=>f(view,keyEvent(13,"Enter"))))return void(view.input.lastIOSEnter=0);if(!change){if(!(typeOver&&sel instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3&&!sel.empty&&sel.$head.sameParent(sel.$anchor))||view.composing||parse.sel&&parse.sel.anchor!=parse.sel.head){if(parse.sel){let sel=resolveSelection(view,view.state.doc,parse.sel);if(sel&&!sel.eq(view.state.selection)){let tr=view.state.tr.setSelection(sel);compositionID&&tr.setMeta("composition",compositionID),view.dispatch(tr)}}return}change={start:sel.from,endA:sel.to,endB:sel.to}}view.state.selection.from<view.state.selection.to&&change.start==change.endB&&view.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.U3&&(change.start>view.state.selection.from&&change.start<=view.state.selection.from+2&&view.state.selection.from>=parse.from?change.start=view.state.selection.from:change.endA<view.state.selection.to&&change.endA>=view.state.selection.to-2&&view.state.selection.to<=parse.to&&(change.endB+=view.state.selection.to-change.endA,change.endA=view.state.selection.to)),ie&&ie_version<=11&&change.endB==change.start+1&&change.endA==change.start&&change.start>parse.from&&" "==parse.doc.textBetween(change.start-parse.from-1,change.start-parse.from+1)&&(change.start--,change.endA--,change.endB--);let nextSel,$from=parse.doc.resolveNoCache(change.start-parse.from),$to=parse.doc.resolveNoCache(change.endB-parse.from),$fromA=doc.resolve(change.start),inlineChange=$from.sameParent($to)&&$from.parent.inlineContent&&$fromA.end()>=change.endA;if((ios&&view.input.lastIOSEnter>Date.now()-225&&(!inlineChange||addedNodes.some(n=>"DIV"==n.nodeName||"P"==n.nodeName))||!inlineChange&&$from.pos<parse.doc.content.size&&(!$from.sameParent($to)||!$from.parent.inlineContent)&&!/\S/.test(parse.doc.textBetween($from.pos,$to.pos,"",""))&&(nextSel=prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.LN.findFrom(parse.doc.resolve($from.pos+1),1,!0))&&nextSel.head>$from.pos)&&view.someProp("handleKeyDown",f=>f(view,keyEvent(13,"Enter"))))return void(view.input.lastIOSEnter=0);if(view.state.selection.anchor>change.start&&function looksLikeBackspace(old,start,end,$newStart,$newEnd){if(end-start<=$newEnd.pos-$newStart.pos||skipClosingAndOpening($newStart,!0,!1)<$newEnd.pos)return!1;let $start=old.resolve(start);if(!$newStart.parent.isTextblock){let after=$start.nodeAfter;return null!=after&&end==start+after.nodeSize}if($start.parentOffset<$start.parent.content.size||!$start.parent.isTextblock)return!1;let $next=old.resolve(skipClosingAndOpening($start,!0,!0));return!(!$next.parent.isTextblock||$next.pos>end||skipClosingAndOpening($next,!0,!1)<end)&&$newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content)}(doc,change.start,change.endA,$from,$to)&&view.someProp("handleKeyDown",f=>f(view,keyEvent(8,"Backspace"))))return void(android&&chrome&&view.domObserver.suppressSelectionUpdates());chrome&&change.endB==change.start&&(view.input.lastChromeDelete=Date.now()),android&&!inlineChange&&$from.start()!=$to.start()&&0==$to.parentOffset&&$from.depth==$to.depth&&parse.sel&&parse.sel.anchor==parse.sel.head&&parse.sel.head==change.endA&&(change.endB-=2,$to=parse.doc.resolveNoCache(change.endB-parse.from),setTimeout(()=>{view.someProp("handleKeyDown",function(f){return f(view,keyEvent(13,"Enter"))})},20));let markChange,chFrom=change.start,chTo=change.endA,mkTr=base=>{let tr=base||view.state.tr.replace(chFrom,chTo,parse.doc.slice(change.start-parse.from,change.endB-parse.from));if(parse.sel){let sel=resolveSelection(view,tr.doc,parse.sel);sel&&!(chrome&&view.composing&&sel.empty&&(change.start!=change.endB||view.input.lastChromeDelete<Date.now()-100)&&(sel.head==chFrom||sel.head==tr.mapping.map(chTo)-1)||ie&&sel.empty&&sel.head==chFrom)&&tr.setSelection(sel)}return compositionID&&tr.setMeta("composition",compositionID),tr.scrollIntoView()};if(inlineChange){if($from.pos==$to.pos){ie&&ie_version<=11&&0==$from.parentOffset&&(view.domObserver.suppressSelectionUpdates(),setTimeout(()=>selectionToDOM(view),20));let tr=mkTr(view.state.tr.delete(chFrom,chTo)),marks=doc.resolve(change.start).marksAcross(doc.resolve(change.endA));marks&&tr.ensureMarks(marks),view.dispatch(tr)}else if(change.endA==change.endB&&(markChange=function isMarkChange(cur,prev){let type,mark,update,curMarks=cur.firstChild.marks,prevMarks=prev.firstChild.marks,added=curMarks,removed=prevMarks;for(let i=0;i<prevMarks.length;i++)added=prevMarks[i].removeFromSet(added);for(let i=0;i<curMarks.length;i++)removed=curMarks[i].removeFromSet(removed);if(1==added.length&&0==removed.length)mark=added[0],type="add",update=node=>node.mark(mark.addToSet(node.marks));else{if(0!=added.length||1!=removed.length)return null;mark=removed[0],type="remove",update=node=>node.mark(mark.removeFromSet(node.marks))}let updated=[];for(let i=0;i<prev.childCount;i++)updated.push(update(prev.child(i)));if(prosemirror_model__WEBPACK_IMPORTED_MODULE_0__.FK.from(updated).eq(cur))return{mark,type}}($from.parent.content.cut($from.parentOffset,$to.parentOffset),$fromA.parent.content.cut($fromA.parentOffset,change.endA-$fromA.start())))){let tr=mkTr(view.state.tr);"add"==markChange.type?tr.addMark(chFrom,chTo,markChange.mark):tr.removeMark(chFrom,chTo,markChange.mark),view.dispatch(tr)}else if($from.parent.child($from.index()).isText&&$from.index()==$to.index()-($to.textOffset?0:1)){let text=$from.parent.textBetween($from.parentOffset,$to.parentOffset),deflt=()=>mkTr(view.state.tr.insertText(text,chFrom,chTo));view.someProp("handleTextInput",f=>f(view,chFrom,chTo,text,deflt))||view.dispatch(deflt())}}else view.dispatch(mkTr())}function resolveSelection(view,doc,parsedSel){return Math.max(parsedSel.anchor,parsedSel.head)>doc.content.size?null:selectionBetween(view,doc.resolve(parsedSel.anchor),doc.resolve(parsedSel.head))}function skipClosingAndOpening($pos,fromEnd,mayOpen){let depth=$pos.depth,end=fromEnd?$pos.end():$pos.pos;for(;depth>0&&(fromEnd||$pos.indexAfter(depth)==$pos.node(depth).childCount);)depth--,end++,fromEnd=!1;if(mayOpen){let next=$pos.node(depth).maybeChild($pos.indexAfter(depth));for(;next&&!next.isLeaf;)next=next.firstChild,end++}return end}function isSurrogatePair(str){if(2!=str.length)return!1;let a=str.charCodeAt(0),b=str.charCodeAt(1);return a>=56320&&a<=57343&&b>=55296&&b<=56319}class EditorView{constructor(place,props){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new InputState,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=props,this.state=props.state,this.directPlugins=props.plugins||[],this.directPlugins.forEach(checkStateComponent),this.dispatch=this.dispatch.bind(this),this.dom=place&&place.mount||document.createElement("div"),place&&(place.appendChild?place.appendChild(this.dom):"function"==typeof place?place(this.dom):place.mount&&(this.mounted=!0)),this.editable=getEditable(this),updateCursorWrapper(this),this.nodeViews=buildNodeViews(this),this.docView=docViewDesc(this.state.doc,computeDocDeco(this),viewDecorations(this),this.dom,this),this.domObserver=new DOMObserver(this,(from,to,typeOver,added)=>readDOMChange(this,from,to,typeOver,added)),this.domObserver.start(),function initInput(view){for(let event in handlers){let handler=handlers[event];view.dom.addEventListener(event,view.input.eventHandlers[event]=event=>{!eventBelongsToView(view,event)||runCustomHandler(view,event)||!view.editable&&event.type in editHandlers||handler(view,event)},passiveHandlers[event]?{passive:!0}:void 0)}safari&&view.dom.addEventListener("input",()=>null),ensureListeners(view)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let prev=this._props;this._props={};for(let name in prev)this._props[name]=prev[name];this._props.state=this.state}return this._props}update(props){props.handleDOMEvents!=this._props.handleDOMEvents&&ensureListeners(this);let prevProps=this._props;this._props=props,props.plugins&&(props.plugins.forEach(checkStateComponent),this.directPlugins=props.plugins),this.updateStateInner(props.state,prevProps)}setProps(props){let updated={};for(let name in this._props)updated[name]=this._props[name];updated.state=this.state;for(let name in props)updated[name]=props[name];this.update(updated)}updateState(state){this.updateStateInner(state,this._props)}updateStateInner(state,prevProps){var _a;let prev=this.state,redraw=!1,updateSel=!1;state.storedMarks&&this.composing&&(clearComposition(this),updateSel=!0),this.state=state;let pluginsChanged=prev.plugins!=state.plugins||this._props.plugins!=prevProps.plugins;if(pluginsChanged||this._props.plugins!=prevProps.plugins||this._props.nodeViews!=prevProps.nodeViews){let nodeViews=buildNodeViews(this);(function changedNodeViews(a,b){let nA=0,nB=0;for(let prop in a){if(a[prop]!=b[prop])return!0;nA++}for(let _ in b)nB++;return nA!=nB})(nodeViews,this.nodeViews)&&(this.nodeViews=nodeViews,redraw=!0)}(pluginsChanged||prevProps.handleDOMEvents!=this._props.handleDOMEvents)&&ensureListeners(this),this.editable=getEditable(this),updateCursorWrapper(this);let innerDeco=viewDecorations(this),outerDeco=computeDocDeco(this),scroll=prev.plugins==state.plugins||prev.doc.eq(state.doc)?state.scrollToSelection>prev.scrollToSelection?"to selection":"preserve":"reset",updateDoc=redraw||!this.docView.matchesNode(state.doc,outerDeco,innerDeco);!updateDoc&&state.selection.eq(prev.selection)||(updateSel=!0);let oldScrollPos="preserve"==scroll&&updateSel&&null==this.dom.style.overflowAnchor&&function storeScrollPos(view){let refDOM,refTop,rect=view.dom.getBoundingClientRect(),startY=Math.max(0,rect.top);for(let x=(rect.left+rect.right)/2,y=startY+1;y<Math.min(innerHeight,rect.bottom);y+=5){let dom=view.root.elementFromPoint(x,y);if(!dom||dom==view.dom||!view.dom.contains(dom))continue;let localRect=dom.getBoundingClientRect();if(localRect.top>=startY-20){refDOM=dom,refTop=localRect.top;break}}return{refDOM,refTop,stack:scrollStack(view.dom)}}(this);if(updateSel){this.domObserver.stop();let forceSelUpdate=updateDoc&&(ie||chrome)&&!this.composing&&!prev.selection.empty&&!state.selection.empty&&function selectionContextChanged(sel1,sel2){let depth=Math.min(sel1.$anchor.sharedDepth(sel1.head),sel2.$anchor.sharedDepth(sel2.head));return sel1.$anchor.start(depth)!=sel2.$anchor.start(depth)}(prev.selection,state.selection);if(updateDoc){let chromeKludge=chrome?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=findCompositionNode(this)),!redraw&&this.docView.update(state.doc,outerDeco,innerDeco,this)||(this.docView.updateOuterDeco(outerDeco),this.docView.destroy(),this.docView=docViewDesc(state.doc,outerDeco,innerDeco,this.dom,this)),chromeKludge&&!this.trackWrites&&(forceSelUpdate=!0)}forceSelUpdate||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function anchorInRightPlace(view){let anchorDOM=view.docView.domFromPos(view.state.selection.anchor,0),domSel=view.domSelectionRange();return isEquivalentPosition(anchorDOM.node,anchorDOM.offset,domSel.anchorNode,domSel.anchorOffset)}(this))?selectionToDOM(this,forceSelUpdate):(syncNodeSelection(this,state.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(prev),(null===(_a=this.dragging)||void 0===_a?void 0:_a.node)&&!prev.doc.eq(state.doc)&&this.updateDraggedNode(this.dragging,prev),"reset"==scroll?this.dom.scrollTop=0:"to selection"==scroll?this.scrollToSelection():oldScrollPos&&function resetScrollPos({refDOM,refTop,stack}){let newRefTop=refDOM?refDOM.getBoundingClientRect().top:0;restoreScrollStack(stack,0==newRefTop?0:newRefTop-refTop)}(oldScrollPos)}scrollToSelection(){let startDOM=this.domSelectionRange().focusNode;if(startDOM&&this.dom.contains(1==startDOM.nodeType?startDOM:startDOM.parentNode))if(this.someProp("handleScrollToSelection",f=>f(this)));else if(this.state.selection instanceof prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh){let target=this.docView.domAfterPos(this.state.selection.from);1==target.nodeType&&scrollRectIntoView(this,target.getBoundingClientRect(),startDOM)}else scrollRectIntoView(this,this.coordsAtPos(this.state.selection.head,1),startDOM);else;}destroyPluginViews(){let view;for(;view=this.pluginViews.pop();)view.destroy&&view.destroy()}updatePluginViews(prevState){if(prevState&&prevState.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let i=0;i<this.pluginViews.length;i++){let pluginView=this.pluginViews[i];pluginView.update&&pluginView.update(this,prevState)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let i=0;i<this.directPlugins.length;i++){let plugin=this.directPlugins[i];plugin.spec.view&&this.pluginViews.push(plugin.spec.view(this))}for(let i=0;i<this.state.plugins.length;i++){let plugin=this.state.plugins[i];plugin.spec.view&&this.pluginViews.push(plugin.spec.view(this))}}}updateDraggedNode(dragging,prev){let sel=dragging.node,found=-1;if(this.state.doc.nodeAt(sel.from)==sel.node)found=sel.from;else{let movedPos=sel.from+(this.state.doc.content.size-prev.doc.content.size);(movedPos>0&&this.state.doc.nodeAt(movedPos))==sel.node&&(found=movedPos)}this.dragging=new Dragging(dragging.slice,dragging.move,found<0?void 0:prosemirror_state__WEBPACK_IMPORTED_MODULE_1__.nh.create(this.state.doc,found))}someProp(propName,f){let value,prop=this._props&&this._props[propName];if(null!=prop&&(value=f?f(prop):prop))return value;for(let i=0;i<this.directPlugins.length;i++){let prop=this.directPlugins[i].props[propName];if(null!=prop&&(value=f?f(prop):prop))return value}let plugins=this.state.plugins;if(plugins)for(let i=0;i<plugins.length;i++){let prop=plugins[i].props[propName];if(null!=prop&&(value=f?f(prop):prop))return value}}hasFocus(){if(ie){let node=this.root.activeElement;if(node==this.dom)return!0;if(!node||!this.dom.contains(node))return!1;for(;node&&this.dom!=node&&this.dom.contains(node);){if("false"==node.contentEditable)return!1;node=node.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function focusPreventScroll(dom){if(dom.setActive)return dom.setActive();if(preventScrollSupported)return dom.focus(preventScrollSupported);let stored=scrollStack(dom);dom.focus(null==preventScrollSupported?{get preventScroll(){return preventScrollSupported={preventScroll:!0},!0}}:void 0),preventScrollSupported||(preventScrollSupported=!1,restoreScrollStack(stored,0))}(this.dom),selectionToDOM(this),this.domObserver.start()}get root(){let cached=this._root;if(null==cached)for(let search=this.dom.parentNode;search;search=search.parentNode)if(9==search.nodeType||11==search.nodeType&&search.host)return search.getSelection||(Object.getPrototypeOf(search).getSelection=()=>search.ownerDocument.getSelection()),this._root=search;return cached||document}updateRoot(){this._root=null}posAtCoords(coords){return posAtCoords(this,coords)}coordsAtPos(pos,side=1){return coordsAtPos(this,pos,side)}domAtPos(pos,side=0){return this.docView.domFromPos(pos,side)}nodeDOM(pos){let desc=this.docView.descAt(pos);return desc?desc.nodeDOM:null}posAtDOM(node,offset,bias=-1){let pos=this.docView.posFromDOM(node,offset,bias);if(null==pos)throw new RangeError("DOM position not inside the editor");return pos}endOfTextblock(dir,state){return endOfTextblock(this,state||this.state,dir)}pasteHTML(html,event){return doPaste(this,"",html,!1,event||new ClipboardEvent("paste"))}pasteText(text,event){return doPaste(this,text,null,!0,event||new ClipboardEvent("paste"))}serializeForClipboard(slice){return serializeForClipboard(this,slice)}destroy(){this.docView&&(!function destroyInput(view){view.domObserver.stop();for(let type in view.input.eventHandlers)view.dom.removeEventListener(type,view.input.eventHandlers[type]);clearTimeout(view.input.composingTimeout),clearTimeout(view.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],viewDecorations(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,reusedRange=null)}get isDestroyed(){return null==this.docView}dispatchEvent(event){return function dispatchEvent(view,event){runCustomHandler(view,event)||!handlers[event.type]||!view.editable&&event.type in editHandlers||handlers[event.type](view,event)}(this,event)}domSelectionRange(){let sel=this.domSelection();return sel?safari&&11===this.root.nodeType&&function deepActiveElement(doc){let elt=doc.activeElement;for(;elt&&elt.shadowRoot;)elt=elt.shadowRoot.activeElement;return elt}(this.dom.ownerDocument)==this.dom&&function safariShadowSelectionRange(view,selection){if(selection.getComposedRanges){let range=selection.getComposedRanges(view.root)[0];if(range)return rangeToSelectionRange(view,range)}let found;function read(event){event.preventDefault(),event.stopImmediatePropagation(),found=event.getTargetRanges()[0]}return view.dom.addEventListener("beforeinput",read,!0),document.execCommand("indent"),view.dom.removeEventListener("beforeinput",read,!0),found?rangeToSelectionRange(view,found):null}(this,sel)||sel:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function computeDocDeco(view){let attrs=Object.create(null);return attrs.class="ProseMirror",attrs.contenteditable=String(view.editable),view.someProp("attributes",value=>{if("function"==typeof value&&(value=value(view.state)),value)for(let attr in value)"class"==attr?attrs.class+=" "+value[attr]:"style"==attr?attrs.style=(attrs.style?attrs.style+";":"")+value[attr]:attrs[attr]||"contenteditable"==attr||"nodeName"==attr||(attrs[attr]=String(value[attr]))}),attrs.translate||(attrs.translate="no"),[Decoration.node(0,view.state.doc.content.size,attrs)]}function updateCursorWrapper(view){if(view.markCursor){let dom=document.createElement("img");dom.className="ProseMirror-separator",dom.setAttribute("mark-placeholder","true"),dom.setAttribute("alt",""),view.cursorWrapper={dom,deco:Decoration.widget(view.state.selection.from,dom,{raw:!0,marks:view.markCursor})}}else view.cursorWrapper=null}function getEditable(view){return!view.someProp("editable",value=>!1===value(view.state))}function buildNodeViews(view){let result=Object.create(null);function add(obj){for(let prop in obj)Object.prototype.hasOwnProperty.call(result,prop)||(result[prop]=obj[prop])}return view.someProp("nodeViews",add),view.someProp("markViews",add),result}function checkStateComponent(plugin){if(plugin.spec.state||plugin.spec.filterTransaction||plugin.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}EditorView.prototype.dispatch=function(tr){let dispatchTransaction=this._props.dispatchTransaction;dispatchTransaction?dispatchTransaction.call(this,tr):this.updateState(this.state.apply(tr))}}}]);
|