@instincthub/react-ui 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -3
- package/dist/_virtual/_commonjsHelpers.js +1 -1
- package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -1
- package/dist/_virtual/index.js +1 -1
- package/dist/_virtual/index2.js +1 -1
- package/dist/_virtual/lodash.js +1 -1
- package/dist/_virtual/react-is.development.js +1 -1
- package/dist/_virtual/react-is.production.min.js +1 -1
- package/dist/node_modules/@tiptap/core/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-bullet-list/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-bullet-list/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-character-count/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-character-count/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-dropcursor/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-dropcursor/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-gapcursor/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-gapcursor/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-highlight/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-history/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-history/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-image/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-image/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-list-item/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-list-item/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-ordered-list/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-ordered-list/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-table/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-table/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-table-cell/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-table-cell/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-table-header/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-table-header/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-table-row/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-table-row/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-task-item/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-task-item/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-task-list/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-task-list/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +3 -3
- package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +1 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -1
- package/dist/node_modules/attr-accept/dist/es/index.js +1 -1
- package/dist/node_modules/attr-accept/dist/es/index.js.map +1 -1
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +1 -1
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js.map +1 -1
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +1 -1
- package/dist/node_modules/date-fns/_lib/defaultOptions.js.map +1 -1
- package/dist/node_modules/date-fns/_lib/format/formatters.js +1 -1
- package/dist/node_modules/date-fns/_lib/format/formatters.js.map +1 -1
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +1 -1
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js.map +1 -1
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +1 -1
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js.map +1 -1
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +1 -1
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js.map +1 -1
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +1 -1
- package/dist/node_modules/date-fns/_lib/normalizeDates.js.map +1 -1
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +1 -1
- package/dist/node_modules/date-fns/_lib/protectedTokens.js.map +1 -1
- package/dist/node_modules/date-fns/constants.js +1 -1
- package/dist/node_modules/date-fns/constants.js.map +1 -1
- package/dist/node_modules/date-fns/constructFrom.js +1 -1
- package/dist/node_modules/date-fns/constructFrom.js.map +1 -1
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +1 -1
- package/dist/node_modules/date-fns/differenceInCalendarDays.js.map +1 -1
- package/dist/node_modules/date-fns/format.js +1 -1
- package/dist/node_modules/date-fns/format.js.map +1 -1
- package/dist/node_modules/date-fns/getDayOfYear.js +1 -1
- package/dist/node_modules/date-fns/getDayOfYear.js.map +1 -1
- package/dist/node_modules/date-fns/getISOWeek.js +1 -1
- package/dist/node_modules/date-fns/getISOWeek.js.map +1 -1
- package/dist/node_modules/date-fns/getISOWeekYear.js +1 -1
- package/dist/node_modules/date-fns/getISOWeekYear.js.map +1 -1
- package/dist/node_modules/date-fns/getWeek.js +1 -1
- package/dist/node_modules/date-fns/getWeek.js.map +1 -1
- package/dist/node_modules/date-fns/getWeekYear.js +1 -1
- package/dist/node_modules/date-fns/getWeekYear.js.map +1 -1
- package/dist/node_modules/date-fns/isDate.js +1 -1
- package/dist/node_modules/date-fns/isDate.js.map +1 -1
- package/dist/node_modules/date-fns/isValid.js +1 -1
- package/dist/node_modules/date-fns/isValid.js.map +1 -1
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +1 -1
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js.map +1 -1
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +1 -1
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js.map +1 -1
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +1 -1
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js.map +1 -1
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +1 -1
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js.map +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js.map +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js.map +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js.map +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js.map +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +1 -1
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js.map +1 -1
- package/dist/node_modules/date-fns/locale/en-US.js +1 -1
- package/dist/node_modules/date-fns/locale/en-US.js.map +1 -1
- package/dist/node_modules/date-fns/startOfDay.js +1 -1
- package/dist/node_modules/date-fns/startOfDay.js.map +1 -1
- package/dist/node_modules/date-fns/startOfISOWeek.js +1 -1
- package/dist/node_modules/date-fns/startOfISOWeek.js.map +1 -1
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +1 -1
- package/dist/node_modules/date-fns/startOfISOWeekYear.js.map +1 -1
- package/dist/node_modules/date-fns/startOfWeek.js +1 -1
- package/dist/node_modules/date-fns/startOfWeek.js.map +1 -1
- package/dist/node_modules/date-fns/startOfWeekYear.js +1 -1
- package/dist/node_modules/date-fns/startOfWeekYear.js.map +1 -1
- package/dist/node_modules/date-fns/startOfYear.js +1 -1
- package/dist/node_modules/date-fns/startOfYear.js.map +1 -1
- package/dist/node_modules/date-fns/toDate.js +1 -1
- package/dist/node_modules/date-fns/toDate.js.map +1 -1
- package/dist/node_modules/dompurify/dist/purify.es.mjs.js +2 -1
- package/dist/node_modules/dompurify/dist/purify.es.mjs.js.map +1 -1
- package/dist/node_modules/file-selector/dist/es2015/file-selector.js +1 -1
- package/dist/node_modules/file-selector/dist/es2015/file-selector.js.map +1 -1
- package/dist/node_modules/file-selector/dist/es2015/file.js +1 -1
- package/dist/node_modules/file-selector/dist/es2015/file.js.map +1 -1
- package/dist/node_modules/html2canvas/dist/html2canvas.esm.js +2 -1
- package/dist/node_modules/html2canvas/dist/html2canvas.esm.js.map +1 -1
- package/dist/node_modules/linkifyjs/dist/linkify.es.js +1 -1
- package/dist/node_modules/linkifyjs/dist/linkify.es.js.map +1 -1
- package/dist/node_modules/lodash/lodash.js +3 -2
- package/dist/node_modules/lodash/lodash.js.map +1 -1
- package/dist/node_modules/marked/lib/marked.esm.js +1 -1
- package/dist/node_modules/marked/lib/marked.esm.js.map +1 -1
- package/dist/node_modules/object-assign/index.js +2 -1
- package/dist/node_modules/object-assign/index.js.map +1 -1
- package/dist/node_modules/orderedmap/dist/index.js +1 -1
- package/dist/node_modules/orderedmap/dist/index.js.map +1 -1
- package/dist/node_modules/prop-types/checkPropTypes.js +1 -1
- package/dist/node_modules/prop-types/checkPropTypes.js.map +1 -1
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js +1 -1
- package/dist/node_modules/prop-types/factoryWithThrowingShims.js.map +1 -1
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
- package/dist/node_modules/prop-types/factoryWithTypeCheckers.js.map +1 -1
- package/dist/node_modules/prop-types/index.js +1 -1
- package/dist/node_modules/prop-types/index.js.map +1 -1
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +1 -1
- package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js.map +1 -1
- package/dist/node_modules/prop-types/lib/has.js +1 -1
- package/dist/node_modules/prop-types/lib/has.js.map +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +2 -2
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js.map +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +2 -2
- package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js.map +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/node_modules/prop-types/node_modules/react-is/index.js.map +1 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-commands/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-history/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-keymap/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-keymap/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-model/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-state/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-state/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-tables/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-tables/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
- package/dist/node_modules/react-dropzone/dist/es/index.js +1 -1
- package/dist/node_modules/react-dropzone/dist/es/index.js.map +1 -1
- package/dist/node_modules/react-dropzone/dist/es/utils/index.js +1 -1
- package/dist/node_modules/react-dropzone/dist/es/utils/index.js.map +1 -1
- package/dist/node_modules/rope-sequence/dist/index.js +1 -1
- package/dist/node_modules/rope-sequence/dist/index.js.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +1 -1
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/node_modules/w3c-keyname/index.js +1 -1
- package/dist/node_modules/w3c-keyname/index.js.map +1 -1
- package/dist/node_modules/xlsx/xlsx.mjs.js +2 -1
- package/dist/node_modules/xlsx/xlsx.mjs.js.map +1 -1
- package/dist/src/components/auth/ClientDetector.js +1 -1
- package/dist/src/components/auth/ClientOnly.js +1 -1
- package/dist/src/components/auth/FromInstinctHub.js +1 -1
- package/dist/src/components/auth/FromInstinctHub.js.map +1 -1
- package/dist/src/components/auth/IsUsernameEmailTaken.js +1 -1
- package/dist/src/components/auth/LoginForm.js +1 -1
- package/dist/src/components/auth/PasswordsMatch.js +1 -1
- package/dist/src/components/auth/ReactClientProviders.js +1 -1
- package/dist/src/components/cursors/Cursor.js +1 -1
- package/dist/src/components/cursors/CursorContext.js +1 -1
- package/dist/src/components/cursors/CursorControlDemo.js +1 -1
- package/dist/src/components/cursors/MagneticButton.js +1 -1
- package/dist/src/components/cursors/index.js +1 -1
- package/dist/src/components/cursors/index.js.map +1 -1
- package/dist/src/components/cursors/useCursorInteraction.js +1 -1
- package/dist/src/components/forms/ActionCallbackDropdown.js +1 -1
- package/dist/src/components/forms/ActionDropdown.js +1 -1
- package/dist/src/components/forms/AnimatedBox.js +1 -1
- package/dist/src/components/forms/CheckBoxes.js +1 -1
- package/dist/src/components/forms/CheckboxesField.js +1 -1
- package/dist/src/components/forms/ChipsInput.js +1 -1
- package/dist/src/components/forms/DateInput.js +1 -1
- package/dist/src/components/forms/DateInputPicker.js +1 -1
- package/dist/src/components/forms/DateTimeInput.js +1 -1
- package/dist/src/components/forms/DownloadAsExcel.js +1 -1
- package/dist/src/components/forms/DropFile.js +1 -1
- package/dist/src/components/forms/EmailList.js +1 -1
- package/dist/src/components/forms/FileField.js +1 -1
- package/dist/src/components/forms/FilterArray.js +1 -1
- package/dist/src/components/forms/FilterBy.js +1 -1
- package/dist/src/components/forms/FilterObjects.js +1 -1
- package/dist/src/components/forms/FormError.js +1 -1
- package/dist/src/components/forms/FormError.js.map +1 -1
- package/dist/src/components/forms/HandleError.js +1 -1
- package/dist/src/components/forms/InputAmount.js +1 -1
- package/dist/src/components/forms/InputNumber.js +1 -1
- package/dist/src/components/forms/InputText.js +1 -1
- package/dist/src/components/forms/InputTextarea.js +1 -1
- package/dist/src/components/forms/Logout.js +1 -1
- package/dist/src/components/forms/MessageDisplay.js +1 -1
- package/dist/src/components/forms/MessageDisplay.js.map +1 -1
- package/dist/src/components/forms/MultipleEmail.js +1 -1
- package/dist/src/components/forms/PageLoading.js +1 -1
- package/dist/src/components/forms/PageLoading.js.map +1 -1
- package/dist/src/components/forms/PasswordField.js +1 -1
- package/dist/src/components/forms/PhoneNumberInput.js +1 -1
- package/dist/src/components/forms/RadioField.js +1 -1
- package/dist/src/components/forms/RadioField.js.map +1 -1
- package/dist/src/components/forms/RadioSimple.js +1 -1
- package/dist/src/components/forms/RadioSimple.js.map +1 -1
- package/dist/src/components/forms/ReactTimeAgo.js +1 -1
- package/dist/src/components/forms/ReadTermsAndCondition.js +1 -1
- package/dist/src/components/forms/SearchField.js +1 -1
- package/dist/src/components/forms/SearchFieldDB.js +1 -1
- package/dist/src/components/forms/SearchObjectsFromDB.js +1 -1
- package/dist/src/components/forms/StepProgressBar.js +1 -1
- package/dist/src/components/forms/StepProgressBar.js.map +1 -1
- package/dist/src/components/forms/SubmitButton.js +1 -1
- package/dist/src/components/forms/TBodyNoData.js +1 -1
- package/dist/src/components/forms/TBodyNoData.js.map +1 -1
- package/dist/src/components/forms/THeadSortBtn.js +1 -1
- package/dist/src/components/forms/THeadSortBtn.js.map +1 -1
- package/dist/src/components/forms/THeadSortList.js +1 -1
- package/dist/src/components/forms/Tables.js +1 -1
- package/dist/src/components/forms/TextArea.js +1 -1
- package/dist/src/components/forms/TextArea.js.map +1 -1
- package/dist/src/components/forms/TextField.js +1 -1
- package/dist/src/components/forms/ToggleButton.js +1 -1
- package/dist/src/components/forms/Tooltip.js +1 -1
- package/dist/src/components/forms/UnsplashRandomImage.js +1 -1
- package/dist/src/components/forms/radio-btn/RadioButton.js +1 -1
- package/dist/src/components/forms/radio-btn/RadioButton.js.map +1 -1
- package/dist/src/components/forms/radio-btn/RadioGroup.js +1 -1
- package/dist/src/components/forms/radio-btn/RadioGroup.js.map +1 -1
- package/dist/src/components/forms/uploads/FileUploader.js +1 -1
- package/dist/src/components/forms/uploads/IhubFileUploader.js +1 -1
- package/dist/src/components/lib/auth/actions.js +1 -1
- package/dist/src/components/lib/auth/dbRequestst.js +1 -1
- package/dist/src/components/lib/auth/dbRequestst.js.map +1 -1
- package/dist/src/components/lib/charts.js +1 -1
- package/dist/src/components/lib/charts.js.map +1 -1
- package/dist/src/components/lib/convertArrayToObject.js +1 -1
- package/dist/src/components/lib/convertArrayToObject.js.map +1 -1
- package/dist/src/components/lib/createSubscription.js +1 -1
- package/dist/src/components/lib/createSubscription.js.map +1 -1
- package/dist/src/components/lib/elementIsVisibleInViewport.js +1 -1
- package/dist/src/components/lib/elementIsVisibleInViewport.js.map +1 -1
- package/dist/src/components/lib/fileToBase64.js +1 -1
- package/dist/src/components/lib/fileToBase64.js.map +1 -1
- package/dist/src/components/lib/formError.js +1 -1
- package/dist/src/components/lib/formError.js.map +1 -1
- package/dist/src/components/lib/format.js +1 -1
- package/dist/src/components/lib/format.js.map +1 -1
- package/dist/src/components/lib/getPriceObjects.js +1 -1
- package/dist/src/components/lib/getPriceObjects.js.map +1 -1
- package/dist/src/components/lib/helpFunction.js +1 -1
- package/dist/src/components/lib/helpFunction.js.map +1 -1
- package/dist/src/components/lib/index.js +1 -1
- package/dist/src/components/lib/index.js.map +1 -1
- package/dist/src/components/lib/json/accounts.js +1 -1
- package/dist/src/components/lib/json/accounts.js.map +1 -1
- package/dist/src/components/lib/json/countryObjects.js +1 -1
- package/dist/src/components/lib/json/countryObjects.js.map +1 -1
- package/dist/src/components/lib/json/unsplashDefaultObject.js +1 -1
- package/dist/src/components/lib/json/unsplashDefaultObject.js.map +1 -1
- package/dist/src/components/lib/loadScript.js +2 -0
- package/dist/src/components/lib/loadScript.js.map +1 -0
- package/dist/src/components/lib/modals/modals.js +1 -1
- package/dist/src/components/lib/modals/modals.js.map +1 -1
- package/dist/src/components/lib/modals/openConfirmDelete.js +1 -1
- package/dist/src/components/lib/modals/openConfirmDelete.js.map +1 -1
- package/dist/src/components/lib/oauth_json.js +1 -1
- package/dist/src/components/lib/oauth_json.js.map +1 -1
- package/dist/src/components/lib/paystack.js +1 -1
- package/dist/src/components/lib/paystack.js.map +1 -1
- package/dist/src/components/lib/permissions.js +1 -1
- package/dist/src/components/lib/permissions.js.map +1 -1
- package/dist/src/components/lib/queryParameters/index.js +1 -1
- package/dist/src/components/lib/queryParameters/index.js.map +1 -1
- package/dist/src/components/lib/redux/index.js +1 -1
- package/dist/src/components/lib/redux/middleware.js +1 -1
- package/dist/src/components/lib/redux/middleware.js.map +1 -1
- package/dist/src/components/lib/redux/rootReducer.js +1 -1
- package/dist/src/components/lib/redux/rootReducer.js.map +1 -1
- package/dist/src/components/lib/redux/slices/authSlice/channelCallbackUrl.js +1 -1
- package/dist/src/components/lib/redux/slices/authSlice/channelCallbackUrl.js.map +1 -1
- package/dist/src/components/lib/redux/slices/authSlice/selectors.js +1 -1
- package/dist/src/components/lib/redux/slices/authSlice/selectors.js.map +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/activeChannel.js +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/activeChannel.js.map +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/channelDetails.js +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/channelDetails.js.map +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/channelHandle.js +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/channelHandle.js.map +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/instructorChannelList.js +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/instructorChannelList.js.map +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/selectors.js +1 -1
- package/dist/src/components/lib/redux/slices/channelSlice/selectors.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseDetails.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseDetails.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseFilterDuration.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseFilterDuration.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseFilterLevel.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseFilterLevel.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseFilterSubject.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseFilterSubject.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseModules.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseModules.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseOverview.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseOverview.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseSearch.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/courseSearch.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/selectedCourses.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/selectedCourses.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/selectors.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/selectors.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/stepContent.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/stepContent.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/stepQuestions.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/stepQuestions.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/videoTimestamp.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/videoTimestamp.js.map +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/videoTimestampObject.js +1 -1
- package/dist/src/components/lib/redux/slices/courseSlice/videoTimestampObject.js.map +1 -1
- package/dist/src/components/lib/redux/slices/generics/arraySlice.js +1 -1
- package/dist/src/components/lib/redux/slices/generics/arraySlice.js.map +1 -1
- package/dist/src/components/lib/redux/slices/generics/objectSlice.js +1 -1
- package/dist/src/components/lib/redux/slices/generics/objectSlice.js.map +1 -1
- package/dist/src/components/lib/redux/slices/generics/selectors.js +1 -1
- package/dist/src/components/lib/redux/slices/generics/selectors.js.map +1 -1
- package/dist/src/components/lib/redux/slices/messageSlice/feedbackToggle.js +1 -1
- package/dist/src/components/lib/redux/slices/messageSlice/feedbackToggle.js.map +1 -1
- package/dist/src/components/lib/redux/slices/messageSlice/selectors.js +1 -1
- package/dist/src/components/lib/redux/slices/messageSlice/selectors.js.map +1 -1
- package/dist/src/components/lib/redux/slices/messageSlice/statusMessageState.js +1 -1
- package/dist/src/components/lib/redux/slices/messageSlice/statusMessageState.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/IPAdress.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/IPAdress.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/appToggle.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/appToggle.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/confirmDelete.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/confirmDelete.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/courseNextStep.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/courseNextStep.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/currentPromo.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/currentPromo.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/searchValue.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/searchValue.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/selectors.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/selectors.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/settingsToggle.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/settingsToggle.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/toggleCreateCohort.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/toggleCreateCohort.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/toggleCreateCourse.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/toggleCreateCourse.js.map +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/userLocation.js +1 -1
- package/dist/src/components/lib/redux/slices/navigationSlice/userLocation.js.map +1 -1
- package/dist/src/components/lib/redux/slices/utilsSlice/screenSize.js +1 -1
- package/dist/src/components/lib/redux/slices/utilsSlice/screenSize.js.map +1 -1
- package/dist/src/components/lib/redux/slices/utilsSlice/selectors.js +1 -1
- package/dist/src/components/lib/redux/slices/utilsSlice/selectors.js.map +1 -1
- package/dist/src/components/lib/redux/store.js +1 -1
- package/dist/src/components/lib/redux/store.js.map +1 -1
- package/dist/src/components/lib/roles.js +1 -1
- package/dist/src/components/lib/roles.js.map +1 -1
- package/dist/src/components/lib/utils.js +1 -1
- package/dist/src/components/lib/utils.js.map +1 -1
- package/dist/src/components/navbar/Breadcrumb.js +1 -1
- package/dist/src/components/navbar/ChannelListAvatar.js +1 -1
- package/dist/src/components/navbar/MenuDropdown.js +1 -1
- package/dist/src/components/navbar/ResponsiveNavbar.js +1 -1
- package/dist/src/components/navbar/SideNavbar.js +1 -1
- package/dist/src/components/status/CopyToClipBoard.js +1 -1
- package/dist/src/components/status/DeleteConfirmationModal.js +1 -1
- package/dist/src/components/status/Error500.js +1 -1
- package/dist/src/components/status/Error500.js.map +1 -1
- package/dist/src/components/status/ErrorState.js +1 -1
- package/dist/src/components/status/ErrorState.js.map +1 -1
- package/dist/src/components/status/ModalExamples.js +1 -1
- package/dist/src/components/status/MultiPurposeModal.js +1 -1
- package/dist/src/components/status/NotFound.js +1 -1
- package/dist/src/components/status/ReactTimeTracker.js +1 -1
- package/dist/src/components/status/SessionHandleProvider.js +1 -1
- package/dist/src/components/status/Unauthorized.js +1 -1
- package/dist/src/components/status/Unauthorized.js.map +1 -1
- package/dist/src/components/tabs/TabContent.js +1 -1
- package/dist/src/components/tabs/TabContent.js.map +1 -1
- package/dist/src/components/tabs/Tabs.js +1 -1
- package/dist/src/components/tabs/VerticalTabs.js +1 -1
- package/dist/src/components/theme/ChangeStyleVariable.js +1 -1
- package/dist/src/components/theme/DarkModeProvider.js +1 -1
- package/dist/src/components/theme/LoadingAnimate.js +1 -1
- package/dist/src/components/theme/LoadingAnimate.js.map +1 -1
- package/dist/src/components/theme/SessionProviders.js +1 -1
- package/dist/src/components/theme/signout/SessionExpiresLogout.js +1 -1
- package/dist/src/components/theme/signout/SignOutSession.js +1 -1
- package/dist/src/components/ui/Action.js +1 -1
- package/dist/src/components/ui/Action.js.map +1 -1
- package/dist/src/components/ui/Badge.js +1 -1
- package/dist/src/components/ui/Badge.js.map +1 -1
- package/dist/src/components/ui/ColorPicker.js +1 -1
- package/dist/src/components/ui/ComponentLists.js +1 -1
- package/dist/src/components/ui/ComponentLists.js.map +1 -1
- package/dist/src/components/ui/Dropdown.js +1 -1
- package/dist/src/components/ui/OrDivider.js +1 -1
- package/dist/src/components/ui/cards/Card.js +1 -1
- package/dist/src/components/ui/cards/CardGrid.js +1 -1
- package/dist/src/components/ui/cards/CardGrid.js.map +1 -1
- package/dist/src/components/ui/cards/CardList.js +1 -1
- package/dist/src/components/ui/cards/CardList.js.map +1 -1
- package/dist/src/components/ui/cards/FeatureCard.js +1 -1
- package/dist/src/components/ui/cards/FeatureCard.js.map +1 -1
- package/dist/src/components/ui/cards/HorizontalCard.js +1 -1
- package/dist/src/components/ui/cards/HorizontalCard.js.map +1 -1
- package/dist/src/components/ui/cards/MediaCard.js +1 -1
- package/dist/src/components/ui/cards/MediaCard.js.map +1 -1
- package/dist/src/components/ui/cards/PricingCard.js +1 -1
- package/dist/src/components/ui/cards/PricingCard.js.map +1 -1
- package/dist/src/components/ui/cards/ProfileCard.js +1 -1
- package/dist/src/components/ui/cards/ProfileCard.js.map +1 -1
- package/dist/src/components/ui/charts/ChartConfigurator.js +1 -1
- package/dist/src/components/ui/charts/InstinctHubChart.js +1 -1
- package/dist/src/components/ui/charts/InstinctHubChartDashboard.js +1 -1
- package/dist/src/components/ui/create-button/CreateButton.js +1 -1
- package/dist/src/components/ui/create-button/CreateButtonExample.js +1 -1
- package/dist/src/components/ui/create-button/CreateButtonExample.js.map +1 -1
- package/dist/src/components/ui/dialogs/Dialog.js +1 -1
- package/dist/src/components/ui/editor/CustomTextEditor.js +1 -1
- package/dist/src/components/ui/editor/MenuBar.js +1 -1
- package/dist/src/components/ui/images/RandomGradientImage.js +1 -1
- package/dist/src/components/ui/images/RandomGradientImage.js.map +1 -1
- package/dist/src/components/ui/pagination/Pagination.js +1 -1
- package/dist/src/components/ui/pagination/PaginationDemo.js +1 -1
- package/dist/src/components/ui/tables/IHubTable.js +1 -1
- package/dist/src/components/ui/tables/IHubTableServer.js +1 -1
- package/dist/src/components/ui/viewer/CodeDisplay.js +1 -1
- package/dist/src/components/ui/viewer/ContentViewOrEdit.js +1 -1
- package/dist/src/components/ui/viewer/ContentViewer.js +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/ssr.js +1 -1
- package/dist/src/types/components/auth/IsUsernameEmailTaken.d.ts +13 -0
- package/dist/src/types/components/forms/DateInput.d.ts +3 -4
- package/dist/src/types/components/forms/FilterObjects.d.ts +1 -1
- package/dist/src/types/components/forms/uploads/IhubFileUploader.d.ts +1 -1
- package/dist/src/types/components/lib/index.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/channelSlice/channelDetails.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/channelSlice/instructorChannelList.d.ts +3 -2
- package/dist/src/types/components/lib/redux/slices/courseSlice/courseDetails.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/courseFilterDuration.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/courseFilterLevel.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/courseFilterSubject.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/courseModules.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/courseOverview.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/courseSearch.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/stepContent.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/stepQuestions.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/videoTimestamp.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/courseSlice/videoTimestampObject.d.ts +1 -1
- package/dist/src/types/components/lib/redux/slices/navigationSlice/IPAdress.d.ts +1 -1
- package/dist/src/types/components/status/ReactTimeTracker.d.ts +1 -1
- package/dist/src/types/components/tabs/Tabs.d.ts +1 -1
- package/dist/src/types/components/tabs/VerticalTabs.d.ts +1 -1
- package/dist/src/types/components/theme/signout/SessionExpiresLogout.d.ts +1 -1
- package/dist/src/types/components/ui/Action.d.ts +1 -1
- package/dist/src/types/types/index.d.ts +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../rope-sequence/dist/index.js"),t=require("../../prosemirror-transform/dist/index.js"),n=require("../../prosemirror-state/dist/index.js");class s{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--){if(this.items.get(o-1).selection){--o;break}}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let p,l,a=e.tr,m=[],u=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void u.push(e);if(n){u.push(new i(e.map));let t,s=e.step.map(n.slice(r));s&&a.maybeStep(s).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],m.push(new i(t,void 0,void 0,m.length+u.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(p=n?e.selection.map(n.slice(r)):e.selection,l=new s(this.items.slice(0,o).append(u.reverse().concat(m)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:l,transform:a,selection:p}}addTransform(e,t,n,r){let p=[],l=this.eventCount,a=this.items,m=!r&&a.length?a.get(a.length-1):null;for(let n=0;n<e.steps.length;n++){let s,o=e.steps[n].invert(e.docs[n]),u=new i(e.mapping.maps[n],o,t);(s=m&&m.merge(u))&&(u=s,n?p.pop():a=a.slice(0,a.length-1)),p.push(u),t&&(l++,t=void 0),r||(m=u)}let u=l-n.depth;return u>o&&(a=function(e,t){let n;return e.forEach(((e,s)=>{if(e.selection&&0==t--)return n=s,!1})),e.slice(n)}(a,u),l-=u),new s(a.append(p),l)}remapping(e,n){let s=new t.Mapping;return this.items.forEach(((t,n)=>{let i=null!=t.mirrorOffset&&n-t.mirrorOffset>=e?s.maps.length-t.mirrorOffset:void 0;s.appendMap(t.map,i)}),e,n),s}addMaps(e){return 0==this.eventCount?this:new s(this.items.append(e.map((e=>new i(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,p=e.steps.length,l=this.eventCount;this.items.forEach((e=>{e.selection&&l--}),r);let a=t;this.items.forEach((t=>{let s=o.getMirror(--a);if(null==s)return;p=Math.min(p,s);let r=o.maps[s];if(t.step){let p=e.steps[s].invert(e.docs[s]),m=t.selection&&t.selection.map(o.slice(a+1,s));m&&l++,n.push(new i(r,p,m))}else n.push(new i(r))}),r);let m=[];for(let e=t;e<p;e++)m.push(new i(o.maps[e]));let u=this.items.slice(0,r).append(m).append(n),h=new s(u,l);return h.emptyItemCount()>500&&(h=h.compress(this.items.length-n.length)),h}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,o=[],p=0;return this.items.forEach(((e,s)=>{if(s>=t)o.push(e),e.selection&&p++;else if(e.step){let t=e.step.map(n.slice(r)),s=t&&t.getMap();if(r--,s&&n.appendMap(s,r),t){let l=e.selection&&e.selection.map(n.slice(r));l&&p++;let a,m=new i(s.invert(),t,l),u=o.length-1;(a=o.length&&o[u].merge(m))?o[u]=a:o.push(m)}}else e.map&&r--}),this.items.length,0),new s(e.default.from(o.reverse()),p)}}s.empty=new s(e.default.empty,0);class i{constructor(e,t,n,s){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new i(t.getMap().invert(),t,this.selection)}}}class r{constructor(e,t,n,s,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=s,this.prevComposition=i}}const o=20;function p(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(((e,n,s,i)=>t.push(s,i)));return t}function l(e,t){if(!e)return null;let n=[];for(let s=0;s<e.length;s+=2){let i=t.map(e[s],1),r=t.map(e[s+1],-1);i<=r&&n.push(i,r)}return n}let a=!1,m=null;function u(e){let t=e.plugins;if(m!=t){a=!1,m=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){a=!0;break}}return a}const h=new n.PluginKey("history"),d=new n.PluginKey("closeHistory");function g(e,t){return(n,s)=>{let i=h.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(s){let o=function(e,t,n){let s=u(t),i=h.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,s);if(!o)return null;let p=o.selection.resolve(o.transform.doc),l=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,s),a=new r(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(p).setMeta(h,{redo:n,historyState:a})}(i,n,e);o&&s(t?o.scrollIntoView():o)}return!0}}const c=g(!1,!0),f=g(!0,!0);exports.history=function(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new n.Plugin({key:h,state:{init:()=>new r(s.empty,s.empty,null,0,-1),apply:(t,n,i)=>function(e,t,n,i){let o,a=n.getMeta(h);if(a)return a.historyState;n.getMeta(d)&&(e=new r(e.done,e.undone,null,0,-1));let m=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(m&&m.getMeta(h))return m.getMeta(h).redo?new r(e.done.addTransform(n,void 0,i,u(t)),e.undone,p(n.mapping.maps),e.prevTime,e.prevComposition):new r(e.done,e.undone.addTransform(n,void 0,i,u(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||m&&!1===m.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new r(e.done.rebased(n,o),e.undone.rebased(n,o),l(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new r(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),l(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),a=0==e.prevTime||!m&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-i.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,s)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&s>=t[i]&&(n=!0)})),n}(n,e.prevRanges)),h=m?l(e.prevRanges,n.mapping):p(n.mapping.maps);return new r(e.done.addTransform(n,a?t.selection.getBookmark():void 0,i,u(t)),s.empty,h,n.time,null==o?e.prevComposition:o)}}(n,i,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,s="historyUndo"==n?c:"historyRedo"==n?f:null;return!!s&&(t.preventDefault(),s(e.state,e.dispatch))}}}})},exports.redo=f,exports.undo=c;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../node_modules/prosemirror-history/dist/index.js"],"sourcesContent":["import RopeSequence from 'rope-sequence';\nimport { Mapping } from 'prosemirror-transform';\nimport { PluginKey, Plugin } from 'prosemirror-state';\n\n// ProseMirror's history isn't simply a way to roll back to a previous\n// state, because ProseMirror supports applying changes without adding\n// them to the history (for example during collaboration).\n//\n// To this end, each 'Branch' (one for the undo history and one for\n// the redo history) keeps an array of 'Items', which can optionally\n// hold a step (an actual undoable change), and always hold a position\n// map (which is needed to move changes below them to apply to the\n// current document).\n//\n// An item that has both a step and a selection bookmark is the start\n// of an 'event' — a group of changes that will be undone or redone at\n// once. (It stores only the bookmark, since that way we don't have to\n// provide a document until the selection is actually applied, which\n// is useful when compressing.)\n// Used to schedule history compression\nconst max_empty_items = 500;\nclass Branch {\n constructor(items, eventCount) {\n this.items = items;\n this.eventCount = eventCount;\n }\n // Pop the latest event off the branch's history and apply it\n // to a document transform.\n popEvent(state, preserveItems) {\n if (this.eventCount == 0)\n return null;\n let end = this.items.length;\n for (;; end--) {\n let next = this.items.get(end - 1);\n if (next.selection) {\n --end;\n break;\n }\n }\n let remap, mapFrom;\n if (preserveItems) {\n remap = this.remapping(end, this.items.length);\n mapFrom = remap.maps.length;\n }\n let transform = state.tr;\n let selection, remaining;\n let addAfter = [], addBefore = [];\n this.items.forEach((item, i) => {\n if (!item.step) {\n if (!remap) {\n remap = this.remapping(end, i + 1);\n mapFrom = remap.maps.length;\n }\n mapFrom--;\n addBefore.push(item);\n return;\n }\n if (remap) {\n addBefore.push(new Item(item.map));\n let step = item.step.map(remap.slice(mapFrom)), map;\n if (step && transform.maybeStep(step).doc) {\n map = transform.mapping.maps[transform.mapping.maps.length - 1];\n addAfter.push(new Item(map, undefined, undefined, addAfter.length + addBefore.length));\n }\n mapFrom--;\n if (map)\n remap.appendMap(map, mapFrom);\n }\n else {\n transform.maybeStep(item.step);\n }\n if (item.selection) {\n selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;\n remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);\n return false;\n }\n }, this.items.length, 0);\n return { remaining: remaining, transform, selection: selection };\n }\n // Create a new branch with the given transform added.\n addTransform(transform, selection, histOptions, preserveItems) {\n let newItems = [], eventCount = this.eventCount;\n let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;\n for (let i = 0; i < transform.steps.length; i++) {\n let step = transform.steps[i].invert(transform.docs[i]);\n let item = new Item(transform.mapping.maps[i], step, selection), merged;\n if (merged = lastItem && lastItem.merge(item)) {\n item = merged;\n if (i)\n newItems.pop();\n else\n oldItems = oldItems.slice(0, oldItems.length - 1);\n }\n newItems.push(item);\n if (selection) {\n eventCount++;\n selection = undefined;\n }\n if (!preserveItems)\n lastItem = item;\n }\n let overflow = eventCount - histOptions.depth;\n if (overflow > DEPTH_OVERFLOW) {\n oldItems = cutOffEvents(oldItems, overflow);\n eventCount -= overflow;\n }\n return new Branch(oldItems.append(newItems), eventCount);\n }\n remapping(from, to) {\n let maps = new Mapping;\n this.items.forEach((item, i) => {\n let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from\n ? maps.maps.length - item.mirrorOffset : undefined;\n maps.appendMap(item.map, mirrorPos);\n }, from, to);\n return maps;\n }\n addMaps(array) {\n if (this.eventCount == 0)\n return this;\n return new Branch(this.items.append(array.map(map => new Item(map))), this.eventCount);\n }\n // When the collab module receives remote changes, the history has\n // to know about those, so that it can adjust the steps that were\n // rebased on top of the remote changes, and include the position\n // maps for the remote changes in its array of items.\n rebased(rebasedTransform, rebasedCount) {\n if (!this.eventCount)\n return this;\n let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);\n let mapping = rebasedTransform.mapping;\n let newUntil = rebasedTransform.steps.length;\n let eventCount = this.eventCount;\n this.items.forEach(item => { if (item.selection)\n eventCount--; }, start);\n let iRebased = rebasedCount;\n this.items.forEach(item => {\n let pos = mapping.getMirror(--iRebased);\n if (pos == null)\n return;\n newUntil = Math.min(newUntil, pos);\n let map = mapping.maps[pos];\n if (item.step) {\n let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);\n let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));\n if (selection)\n eventCount++;\n rebasedItems.push(new Item(map, step, selection));\n }\n else {\n rebasedItems.push(new Item(map));\n }\n }, start);\n let newMaps = [];\n for (let i = rebasedCount; i < newUntil; i++)\n newMaps.push(new Item(mapping.maps[i]));\n let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);\n let branch = new Branch(items, eventCount);\n if (branch.emptyItemCount() > max_empty_items)\n branch = branch.compress(this.items.length - rebasedItems.length);\n return branch;\n }\n emptyItemCount() {\n let count = 0;\n this.items.forEach(item => { if (!item.step)\n count++; });\n return count;\n }\n // Compressing a branch means rewriting it to push the air (map-only\n // items) out. During collaboration, these naturally accumulate\n // because each remote change adds one. The `upto` argument is used\n // to ensure that only the items below a given level are compressed,\n // because `rebased` relies on a clean, untouched set of items in\n // order to associate old items with rebased steps.\n compress(upto = this.items.length) {\n let remap = this.remapping(0, upto), mapFrom = remap.maps.length;\n let items = [], events = 0;\n this.items.forEach((item, i) => {\n if (i >= upto) {\n items.push(item);\n if (item.selection)\n events++;\n }\n else if (item.step) {\n let step = item.step.map(remap.slice(mapFrom)), map = step && step.getMap();\n mapFrom--;\n if (map)\n remap.appendMap(map, mapFrom);\n if (step) {\n let selection = item.selection && item.selection.map(remap.slice(mapFrom));\n if (selection)\n events++;\n let newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;\n if (merged = items.length && items[last].merge(newItem))\n items[last] = merged;\n else\n items.push(newItem);\n }\n }\n else if (item.map) {\n mapFrom--;\n }\n }, this.items.length, 0);\n return new Branch(RopeSequence.from(items.reverse()), events);\n }\n}\nBranch.empty = new Branch(RopeSequence.empty, 0);\nfunction cutOffEvents(items, n) {\n let cutPoint;\n items.forEach((item, i) => {\n if (item.selection && (n-- == 0)) {\n cutPoint = i;\n return false;\n }\n });\n return items.slice(cutPoint);\n}\nclass Item {\n constructor(\n // The (forward) step map for this item.\n map, \n // The inverted step\n step, \n // If this is non-null, this item is the start of a group, and\n // this selection is the starting selection for the group (the one\n // that was active before the first step was applied)\n selection, \n // If this item is the inverse of a previous mapping on the stack,\n // this points at the inverse's offset\n mirrorOffset) {\n this.map = map;\n this.step = step;\n this.selection = selection;\n this.mirrorOffset = mirrorOffset;\n }\n merge(other) {\n if (this.step && other.step && !other.selection) {\n let step = other.step.merge(this.step);\n if (step)\n return new Item(step.getMap().invert(), step, this.selection);\n }\n }\n}\n// The value of the state field that tracks undo/redo history for that\n// state. Will be stored in the plugin state when the history plugin\n// is active.\nclass HistoryState {\n constructor(done, undone, prevRanges, prevTime, prevComposition) {\n this.done = done;\n this.undone = undone;\n this.prevRanges = prevRanges;\n this.prevTime = prevTime;\n this.prevComposition = prevComposition;\n }\n}\nconst DEPTH_OVERFLOW = 20;\n// Record a transformation in undo history.\nfunction applyTransaction(history, state, tr, options) {\n let historyTr = tr.getMeta(historyKey), rebased;\n if (historyTr)\n return historyTr.historyState;\n if (tr.getMeta(closeHistoryKey))\n history = new HistoryState(history.done, history.undone, null, 0, -1);\n let appended = tr.getMeta(\"appendedTransaction\");\n if (tr.steps.length == 0) {\n return history;\n }\n else if (appended && appended.getMeta(historyKey)) {\n if (appended.getMeta(historyKey).redo)\n return new HistoryState(history.done.addTransform(tr, undefined, options, mustPreserveItems(state)), history.undone, rangesFor(tr.mapping.maps), history.prevTime, history.prevComposition);\n else\n return new HistoryState(history.done, history.undone.addTransform(tr, undefined, options, mustPreserveItems(state)), null, history.prevTime, history.prevComposition);\n }\n else if (tr.getMeta(\"addToHistory\") !== false && !(appended && appended.getMeta(\"addToHistory\") === false)) {\n // Group transforms that occur in quick succession into one event.\n let composition = tr.getMeta(\"composition\");\n let newGroup = history.prevTime == 0 ||\n (!appended && history.prevComposition != composition &&\n (history.prevTime < (tr.time || 0) - options.newGroupDelay || !isAdjacentTo(tr, history.prevRanges)));\n let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps);\n return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : undefined, options, mustPreserveItems(state)), Branch.empty, prevRanges, tr.time, composition == null ? history.prevComposition : composition);\n }\n else if (rebased = tr.getMeta(\"rebased\")) {\n // Used by the collab module to tell the history that some of its\n // content has been rebased.\n return new HistoryState(history.done.rebased(tr, rebased), history.undone.rebased(tr, rebased), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n }\n else {\n return new HistoryState(history.done.addMaps(tr.mapping.maps), history.undone.addMaps(tr.mapping.maps), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n }\n}\nfunction isAdjacentTo(transform, prevRanges) {\n if (!prevRanges)\n return false;\n if (!transform.docChanged)\n return true;\n let adjacent = false;\n transform.mapping.maps[0].forEach((start, end) => {\n for (let i = 0; i < prevRanges.length; i += 2)\n if (start <= prevRanges[i + 1] && end >= prevRanges[i])\n adjacent = true;\n });\n return adjacent;\n}\nfunction rangesFor(maps) {\n let result = [];\n for (let i = maps.length - 1; i >= 0 && result.length == 0; i--)\n maps[i].forEach((_from, _to, from, to) => result.push(from, to));\n return result;\n}\nfunction mapRanges(ranges, mapping) {\n if (!ranges)\n return null;\n let result = [];\n for (let i = 0; i < ranges.length; i += 2) {\n let from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);\n if (from <= to)\n result.push(from, to);\n }\n return result;\n}\n// Apply the latest event from one branch to the document and shift the event\n// onto the other branch.\nfunction histTransaction(history, state, redo) {\n let preserveItems = mustPreserveItems(state);\n let histOptions = historyKey.get(state).spec.config;\n let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);\n if (!pop)\n return null;\n let selection = pop.selection.resolve(pop.transform.doc);\n let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);\n let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0, -1);\n return pop.transform.setSelection(selection).setMeta(historyKey, { redo, historyState: newHist });\n}\nlet cachedPreserveItems = false, cachedPreserveItemsPlugins = null;\n// Check whether any plugin in the given state has a\n// `historyPreserveItems` property in its spec, in which case we must\n// preserve steps exactly as they came in, so that they can be\n// rebased.\nfunction mustPreserveItems(state) {\n let plugins = state.plugins;\n if (cachedPreserveItemsPlugins != plugins) {\n cachedPreserveItems = false;\n cachedPreserveItemsPlugins = plugins;\n for (let i = 0; i < plugins.length; i++)\n if (plugins[i].spec.historyPreserveItems) {\n cachedPreserveItems = true;\n break;\n }\n }\n return cachedPreserveItems;\n}\n/**\nSet a flag on the given transaction that will prevent further steps\nfrom being appended to an existing history event (so that they\nrequire a separate undo command to undo).\n*/\nfunction closeHistory(tr) {\n return tr.setMeta(closeHistoryKey, true);\n}\nconst historyKey = new PluginKey(\"history\");\nconst closeHistoryKey = new PluginKey(\"closeHistory\");\n/**\nReturns a plugin that enables the undo history for an editor. The\nplugin will track undo and redo stacks, which can be used with the\n[`undo`](https://prosemirror.net/docs/ref/#history.undo) and [`redo`](https://prosemirror.net/docs/ref/#history.redo) commands.\n\nYou can set an `\"addToHistory\"` [metadata\nproperty](https://prosemirror.net/docs/ref/#state.Transaction.setMeta) of `false` on a transaction\nto prevent it from being rolled back by undo.\n*/\nfunction history(config = {}) {\n config = { depth: config.depth || 100,\n newGroupDelay: config.newGroupDelay || 500 };\n return new Plugin({\n key: historyKey,\n state: {\n init() {\n return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);\n },\n apply(tr, hist, state) {\n return applyTransaction(hist, state, tr, config);\n }\n },\n config,\n props: {\n handleDOMEvents: {\n beforeinput(view, e) {\n let inputType = e.inputType;\n let command = inputType == \"historyUndo\" ? undo : inputType == \"historyRedo\" ? redo : null;\n if (!command)\n return false;\n e.preventDefault();\n return command(view.state, view.dispatch);\n }\n }\n }\n });\n}\nfunction buildCommand(redo, scroll) {\n return (state, dispatch) => {\n let hist = historyKey.getState(state);\n if (!hist || (redo ? hist.undone : hist.done).eventCount == 0)\n return false;\n if (dispatch) {\n let tr = histTransaction(hist, state, redo);\n if (tr)\n dispatch(scroll ? tr.scrollIntoView() : tr);\n }\n return true;\n };\n}\n/**\nA command function that undoes the last change, if any.\n*/\nconst undo = buildCommand(false, true);\n/**\nA command function that redoes the last undone change, if any.\n*/\nconst redo = buildCommand(true, true);\n/**\nA command function that undoes the last change. Don't scroll the\nselection into view.\n*/\nconst undoNoScroll = buildCommand(false, false);\n/**\nA command function that redoes the last undone change. Don't\nscroll the selection into view.\n*/\nconst redoNoScroll = buildCommand(true, false);\n/**\nThe amount of undoable events available in a given state.\n*/\nfunction undoDepth(state) {\n let hist = historyKey.getState(state);\n return hist ? hist.done.eventCount : 0;\n}\n/**\nThe amount of redoable events available in a given editor state.\n*/\nfunction redoDepth(state) {\n let hist = historyKey.getState(state);\n return hist ? hist.undone.eventCount : 0;\n}\n\nexport { closeHistory, history, redo, redoDepth, redoNoScroll, undo, undoDepth, undoNoScroll };\n"],"names":["Branch","constructor","items","eventCount","this","popEvent","state","preserveItems","remap","mapFrom","end","length","get","selection","remapping","maps","remaining","transform","tr","addAfter","addBefore","forEach","item","i","step","push","Item","map","slice","maybeStep","doc","mapping","undefined","appendMap","append","reverse","concat","addTransform","histOptions","newItems","oldItems","lastItem","steps","merged","invert","docs","merge","pop","overflow","depth","DEPTH_OVERFLOW","n","cutPoint","cutOffEvents","from","to","Mapping","mirrorPos","mirrorOffset","addMaps","array","rebased","rebasedTransform","rebasedCount","rebasedItems","start","Math","max","newUntil","iRebased","pos","getMirror","min","newMaps","branch","emptyItemCount","compress","count","upto","events","getMap","newItem","last","RopeSequence","empty","other","HistoryState","done","undone","prevRanges","prevTime","prevComposition","rangesFor","result","_from","_to","mapRanges","ranges","cachedPreserveItems","cachedPreserveItemsPlugins","mustPreserveItems","plugins","spec","historyPreserveItems","historyKey","PluginKey","closeHistoryKey","history","config","newGroupDelay","Plugin","key","init","apply","hist","options","historyTr","getMeta","historyState","appended","redo","composition","newGroup","time","docChanged","adjacent","isAdjacentTo","getBookmark","applyTransaction","props","handleDOMEvents","beforeinput","view","e","inputType","command","undo","preventDefault","dispatch","buildCommand","scroll","getState","resolve","added","newHist","setSelection","setMeta","histTransaction","scrollIntoView"],"mappings":"mMAqBA,MAAMA,EACF,WAAAC,CAAYC,EAAOC,GACfC,KAAKF,MAAQA,EACbE,KAAKD,WAAaA,CACrB,CAGD,QAAAE,CAASC,EAAOC,GACZ,GAAuB,GAAnBH,KAAKD,WACL,OAAO,KACX,IAQIK,EAAOC,EARPC,EAAMN,KAAKF,MAAMS,OACrB,MAAQD,IAAO,CAEX,GADWN,KAAKF,MAAMU,IAAIF,EAAM,GACvBG,UAAW,GACdH,EACF,KACH,CACJ,CAEGH,IACAC,EAAQJ,KAAKU,UAAUJ,EAAKN,KAAKF,MAAMS,QACvCF,EAAUD,EAAMO,KAAKJ,QAEzB,IACIE,EAAWG,EADXC,EAAYX,EAAMY,GAElBC,EAAW,GAAIC,EAAY,GA+B/B,OA9BAhB,KAAKF,MAAMmB,SAAQ,CAACC,EAAMC,KACtB,IAAKD,EAAKE,KAON,OANKhB,IACDA,EAAQJ,KAAKU,UAAUJ,EAAKa,EAAI,GAChCd,EAAUD,EAAMO,KAAKJ,QAEzBF,SACAW,EAAUK,KAAKH,GAGnB,GAAId,EAAO,CACPY,EAAUK,KAAK,IAAIC,EAAKJ,EAAKK,MAC7B,IAAgDA,EAA5CH,EAAOF,EAAKE,KAAKG,IAAInB,EAAMoB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AAIlC,EAAYkC,EAAIlC,UAAUiI,QAAQ/F,EAAI9B,UAAUa,KAChDiH,GAASvB,EAAOb,EAAQpB,KAAOoB,EAAQnB,QAAQnD,aAAaU,EAAI9B,UAAWX,EAAMO,UAAUkH,cAAezF,EAAa/B,GACvHyI,EAAU,IAAI1D,EAAakC,EAAOuB,EAAQhG,EAAI/B,UAAWwG,EAAOzE,EAAI/B,UAAY+H,EAAO,KAAM,GAAI,GACrG,OAAOhG,EAAI9B,UAAUgI,aAAapI,GAAWqI,QAAQ1C,EAAY,CAAEgB,OAAMF,aAAc0B,GAC3F,CAwEqBG,CAAgBjC,EAAM5G,EAAOkH,GAClCtG,GACAwH,EAASE,EAAS1H,EAAGkI,iBAAmBlI,EAC/C,CACD,OAAO,CAAI,CAEnB,CAIK,MAACsH,EAAOG,GAAa,GAAO,GAI3BnB,EAAOmB,GAAa,GAAM"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../node_modules/prosemirror-history/dist/index.js"],"sourcesContent":["import RopeSequence from 'rope-sequence';\nimport { Mapping } from 'prosemirror-transform';\nimport { PluginKey, Plugin } from 'prosemirror-state';\n\n// ProseMirror's history isn't simply a way to roll back to a previous\n// state, because ProseMirror supports applying changes without adding\n// them to the history (for example during collaboration).\n//\n// To this end, each 'Branch' (one for the undo history and one for\n// the redo history) keeps an array of 'Items', which can optionally\n// hold a step (an actual undoable change), and always hold a position\n// map (which is needed to move changes below them to apply to the\n// current document).\n//\n// An item that has both a step and a selection bookmark is the start\n// of an 'event' — a group of changes that will be undone or redone at\n// once. (It stores only the bookmark, since that way we don't have to\n// provide a document until the selection is actually applied, which\n// is useful when compressing.)\n// Used to schedule history compression\nconst max_empty_items = 500;\nclass Branch {\n constructor(items, eventCount) {\n this.items = items;\n this.eventCount = eventCount;\n }\n // Pop the latest event off the branch's history and apply it\n // to a document transform.\n popEvent(state, preserveItems) {\n if (this.eventCount == 0)\n return null;\n let end = this.items.length;\n for (;; end--) {\n let next = this.items.get(end - 1);\n if (next.selection) {\n --end;\n break;\n }\n }\n let remap, mapFrom;\n if (preserveItems) {\n remap = this.remapping(end, this.items.length);\n mapFrom = remap.maps.length;\n }\n let transform = state.tr;\n let selection, remaining;\n let addAfter = [], addBefore = [];\n this.items.forEach((item, i) => {\n if (!item.step) {\n if (!remap) {\n remap = this.remapping(end, i + 1);\n mapFrom = remap.maps.length;\n }\n mapFrom--;\n addBefore.push(item);\n return;\n }\n if (remap) {\n addBefore.push(new Item(item.map));\n let step = item.step.map(remap.slice(mapFrom)), map;\n if (step && transform.maybeStep(step).doc) {\n map = transform.mapping.maps[transform.mapping.maps.length - 1];\n addAfter.push(new Item(map, undefined, undefined, addAfter.length + addBefore.length));\n }\n mapFrom--;\n if (map)\n remap.appendMap(map, mapFrom);\n }\n else {\n transform.maybeStep(item.step);\n }\n if (item.selection) {\n selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;\n remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);\n return false;\n }\n }, this.items.length, 0);\n return { remaining: remaining, transform, selection: selection };\n }\n // Create a new branch with the given transform added.\n addTransform(transform, selection, histOptions, preserveItems) {\n let newItems = [], eventCount = this.eventCount;\n let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;\n for (let i = 0; i < transform.steps.length; i++) {\n let step = transform.steps[i].invert(transform.docs[i]);\n let item = new Item(transform.mapping.maps[i], step, selection), merged;\n if (merged = lastItem && lastItem.merge(item)) {\n item = merged;\n if (i)\n newItems.pop();\n else\n oldItems = oldItems.slice(0, oldItems.length - 1);\n }\n newItems.push(item);\n if (selection) {\n eventCount++;\n selection = undefined;\n }\n if (!preserveItems)\n lastItem = item;\n }\n let overflow = eventCount - histOptions.depth;\n if (overflow > DEPTH_OVERFLOW) {\n oldItems = cutOffEvents(oldItems, overflow);\n eventCount -= overflow;\n }\n return new Branch(oldItems.append(newItems), eventCount);\n }\n remapping(from, to) {\n let maps = new Mapping;\n this.items.forEach((item, i) => {\n let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from\n ? maps.maps.length - item.mirrorOffset : undefined;\n maps.appendMap(item.map, mirrorPos);\n }, from, to);\n return maps;\n }\n addMaps(array) {\n if (this.eventCount == 0)\n return this;\n return new Branch(this.items.append(array.map(map => new Item(map))), this.eventCount);\n }\n // When the collab module receives remote changes, the history has\n // to know about those, so that it can adjust the steps that were\n // rebased on top of the remote changes, and include the position\n // maps for the remote changes in its array of items.\n rebased(rebasedTransform, rebasedCount) {\n if (!this.eventCount)\n return this;\n let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);\n let mapping = rebasedTransform.mapping;\n let newUntil = rebasedTransform.steps.length;\n let eventCount = this.eventCount;\n this.items.forEach(item => { if (item.selection)\n eventCount--; }, start);\n let iRebased = rebasedCount;\n this.items.forEach(item => {\n let pos = mapping.getMirror(--iRebased);\n if (pos == null)\n return;\n newUntil = Math.min(newUntil, pos);\n let map = mapping.maps[pos];\n if (item.step) {\n let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);\n let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));\n if (selection)\n eventCount++;\n rebasedItems.push(new Item(map, step, selection));\n }\n else {\n rebasedItems.push(new Item(map));\n }\n }, start);\n let newMaps = [];\n for (let i = rebasedCount; i < newUntil; i++)\n newMaps.push(new Item(mapping.maps[i]));\n let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);\n let branch = new Branch(items, eventCount);\n if (branch.emptyItemCount() > max_empty_items)\n branch = branch.compress(this.items.length - rebasedItems.length);\n return branch;\n }\n emptyItemCount() {\n let count = 0;\n this.items.forEach(item => { if (!item.step)\n count++; });\n return count;\n }\n // Compressing a branch means rewriting it to push the air (map-only\n // items) out. During collaboration, these naturally accumulate\n // because each remote change adds one. The `upto` argument is used\n // to ensure that only the items below a given level are compressed,\n // because `rebased` relies on a clean, untouched set of items in\n // order to associate old items with rebased steps.\n compress(upto = this.items.length) {\n let remap = this.remapping(0, upto), mapFrom = remap.maps.length;\n let items = [], events = 0;\n this.items.forEach((item, i) => {\n if (i >= upto) {\n items.push(item);\n if (item.selection)\n events++;\n }\n else if (item.step) {\n let step = item.step.map(remap.slice(mapFrom)), map = step && step.getMap();\n mapFrom--;\n if (map)\n remap.appendMap(map, mapFrom);\n if (step) {\n let selection = item.selection && item.selection.map(remap.slice(mapFrom));\n if (selection)\n events++;\n let newItem = new Item(map.invert(), step, selection), merged, last = items.length - 1;\n if (merged = items.length && items[last].merge(newItem))\n items[last] = merged;\n else\n items.push(newItem);\n }\n }\n else if (item.map) {\n mapFrom--;\n }\n }, this.items.length, 0);\n return new Branch(RopeSequence.from(items.reverse()), events);\n }\n}\nBranch.empty = new Branch(RopeSequence.empty, 0);\nfunction cutOffEvents(items, n) {\n let cutPoint;\n items.forEach((item, i) => {\n if (item.selection && (n-- == 0)) {\n cutPoint = i;\n return false;\n }\n });\n return items.slice(cutPoint);\n}\nclass Item {\n constructor(\n // The (forward) step map for this item.\n map, \n // The inverted step\n step, \n // If this is non-null, this item is the start of a group, and\n // this selection is the starting selection for the group (the one\n // that was active before the first step was applied)\n selection, \n // If this item is the inverse of a previous mapping on the stack,\n // this points at the inverse's offset\n mirrorOffset) {\n this.map = map;\n this.step = step;\n this.selection = selection;\n this.mirrorOffset = mirrorOffset;\n }\n merge(other) {\n if (this.step && other.step && !other.selection) {\n let step = other.step.merge(this.step);\n if (step)\n return new Item(step.getMap().invert(), step, this.selection);\n }\n }\n}\n// The value of the state field that tracks undo/redo history for that\n// state. Will be stored in the plugin state when the history plugin\n// is active.\nclass HistoryState {\n constructor(done, undone, prevRanges, prevTime, prevComposition) {\n this.done = done;\n this.undone = undone;\n this.prevRanges = prevRanges;\n this.prevTime = prevTime;\n this.prevComposition = prevComposition;\n }\n}\nconst DEPTH_OVERFLOW = 20;\n// Record a transformation in undo history.\nfunction applyTransaction(history, state, tr, options) {\n let historyTr = tr.getMeta(historyKey), rebased;\n if (historyTr)\n return historyTr.historyState;\n if (tr.getMeta(closeHistoryKey))\n history = new HistoryState(history.done, history.undone, null, 0, -1);\n let appended = tr.getMeta(\"appendedTransaction\");\n if (tr.steps.length == 0) {\n return history;\n }\n else if (appended && appended.getMeta(historyKey)) {\n if (appended.getMeta(historyKey).redo)\n return new HistoryState(history.done.addTransform(tr, undefined, options, mustPreserveItems(state)), history.undone, rangesFor(tr.mapping.maps), history.prevTime, history.prevComposition);\n else\n return new HistoryState(history.done, history.undone.addTransform(tr, undefined, options, mustPreserveItems(state)), null, history.prevTime, history.prevComposition);\n }\n else if (tr.getMeta(\"addToHistory\") !== false && !(appended && appended.getMeta(\"addToHistory\") === false)) {\n // Group transforms that occur in quick succession into one event.\n let composition = tr.getMeta(\"composition\");\n let newGroup = history.prevTime == 0 ||\n (!appended && history.prevComposition != composition &&\n (history.prevTime < (tr.time || 0) - options.newGroupDelay || !isAdjacentTo(tr, history.prevRanges)));\n let prevRanges = appended ? mapRanges(history.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps);\n return new HistoryState(history.done.addTransform(tr, newGroup ? state.selection.getBookmark() : undefined, options, mustPreserveItems(state)), Branch.empty, prevRanges, tr.time, composition == null ? history.prevComposition : composition);\n }\n else if (rebased = tr.getMeta(\"rebased\")) {\n // Used by the collab module to tell the history that some of its\n // content has been rebased.\n return new HistoryState(history.done.rebased(tr, rebased), history.undone.rebased(tr, rebased), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n }\n else {\n return new HistoryState(history.done.addMaps(tr.mapping.maps), history.undone.addMaps(tr.mapping.maps), mapRanges(history.prevRanges, tr.mapping), history.prevTime, history.prevComposition);\n }\n}\nfunction isAdjacentTo(transform, prevRanges) {\n if (!prevRanges)\n return false;\n if (!transform.docChanged)\n return true;\n let adjacent = false;\n transform.mapping.maps[0].forEach((start, end) => {\n for (let i = 0; i < prevRanges.length; i += 2)\n if (start <= prevRanges[i + 1] && end >= prevRanges[i])\n adjacent = true;\n });\n return adjacent;\n}\nfunction rangesFor(maps) {\n let result = [];\n for (let i = maps.length - 1; i >= 0 && result.length == 0; i--)\n maps[i].forEach((_from, _to, from, to) => result.push(from, to));\n return result;\n}\nfunction mapRanges(ranges, mapping) {\n if (!ranges)\n return null;\n let result = [];\n for (let i = 0; i < ranges.length; i += 2) {\n let from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);\n if (from <= to)\n result.push(from, to);\n }\n return result;\n}\n// Apply the latest event from one branch to the document and shift the event\n// onto the other branch.\nfunction histTransaction(history, state, redo) {\n let preserveItems = mustPreserveItems(state);\n let histOptions = historyKey.get(state).spec.config;\n let pop = (redo ? history.undone : history.done).popEvent(state, preserveItems);\n if (!pop)\n return null;\n let selection = pop.selection.resolve(pop.transform.doc);\n let added = (redo ? history.done : history.undone).addTransform(pop.transform, state.selection.getBookmark(), histOptions, preserveItems);\n let newHist = new HistoryState(redo ? added : pop.remaining, redo ? pop.remaining : added, null, 0, -1);\n return pop.transform.setSelection(selection).setMeta(historyKey, { redo, historyState: newHist });\n}\nlet cachedPreserveItems = false, cachedPreserveItemsPlugins = null;\n// Check whether any plugin in the given state has a\n// `historyPreserveItems` property in its spec, in which case we must\n// preserve steps exactly as they came in, so that they can be\n// rebased.\nfunction mustPreserveItems(state) {\n let plugins = state.plugins;\n if (cachedPreserveItemsPlugins != plugins) {\n cachedPreserveItems = false;\n cachedPreserveItemsPlugins = plugins;\n for (let i = 0; i < plugins.length; i++)\n if (plugins[i].spec.historyPreserveItems) {\n cachedPreserveItems = true;\n break;\n }\n }\n return cachedPreserveItems;\n}\n/**\nSet a flag on the given transaction that will prevent further steps\nfrom being appended to an existing history event (so that they\nrequire a separate undo command to undo).\n*/\nfunction closeHistory(tr) {\n return tr.setMeta(closeHistoryKey, true);\n}\nconst historyKey = new PluginKey(\"history\");\nconst closeHistoryKey = new PluginKey(\"closeHistory\");\n/**\nReturns a plugin that enables the undo history for an editor. The\nplugin will track undo and redo stacks, which can be used with the\n[`undo`](https://prosemirror.net/docs/ref/#history.undo) and [`redo`](https://prosemirror.net/docs/ref/#history.redo) commands.\n\nYou can set an `\"addToHistory\"` [metadata\nproperty](https://prosemirror.net/docs/ref/#state.Transaction.setMeta) of `false` on a transaction\nto prevent it from being rolled back by undo.\n*/\nfunction history(config = {}) {\n config = { depth: config.depth || 100,\n newGroupDelay: config.newGroupDelay || 500 };\n return new Plugin({\n key: historyKey,\n state: {\n init() {\n return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);\n },\n apply(tr, hist, state) {\n return applyTransaction(hist, state, tr, config);\n }\n },\n config,\n props: {\n handleDOMEvents: {\n beforeinput(view, e) {\n let inputType = e.inputType;\n let command = inputType == \"historyUndo\" ? undo : inputType == \"historyRedo\" ? redo : null;\n if (!command)\n return false;\n e.preventDefault();\n return command(view.state, view.dispatch);\n }\n }\n }\n });\n}\nfunction buildCommand(redo, scroll) {\n return (state, dispatch) => {\n let hist = historyKey.getState(state);\n if (!hist || (redo ? hist.undone : hist.done).eventCount == 0)\n return false;\n if (dispatch) {\n let tr = histTransaction(hist, state, redo);\n if (tr)\n dispatch(scroll ? tr.scrollIntoView() : tr);\n }\n return true;\n };\n}\n/**\nA command function that undoes the last change, if any.\n*/\nconst undo = buildCommand(false, true);\n/**\nA command function that redoes the last undone change, if any.\n*/\nconst redo = buildCommand(true, true);\n/**\nA command function that undoes the last change. Don't scroll the\nselection into view.\n*/\nconst undoNoScroll = buildCommand(false, false);\n/**\nA command function that redoes the last undone change. Don't\nscroll the selection into view.\n*/\nconst redoNoScroll = buildCommand(true, false);\n/**\nThe amount of undoable events available in a given state.\n*/\nfunction undoDepth(state) {\n let hist = historyKey.getState(state);\n return hist ? hist.done.eventCount : 0;\n}\n/**\nThe amount of redoable events available in a given editor state.\n*/\nfunction redoDepth(state) {\n let hist = historyKey.getState(state);\n return hist ? hist.undone.eventCount : 0;\n}\n\nexport { closeHistory, history, redo, redoDepth, redoNoScroll, undo, undoDepth, undoNoScroll };\n"],"names":["Branch","constructor","items","eventCount","this","popEvent","state","preserveItems","remap","mapFrom","end","length","get","selection","remapping","maps","remaining","transform","tr","addAfter","addBefore","forEach","item","i","step","push","Item","map","slice","maybeStep","doc","mapping","undefined","appendMap","append","reverse","concat","addTransform","histOptions","newItems","oldItems","lastItem","steps","merged","invert","docs","merge","pop","overflow","depth","DEPTH_OVERFLOW","n","cutPoint","cutOffEvents","from","to","Mapping","mirrorPos","mirrorOffset","addMaps","array","rebased","rebasedTransform","rebasedCount","rebasedItems","start","Math","max","newUntil","iRebased","pos","getMirror","min","newMaps","branch","emptyItemCount","compress","count","upto","events","getMap","newItem","last","RopeSequence","empty","other","HistoryState","done","undone","prevRanges","prevTime","prevComposition","rangesFor","result","_from","_to","mapRanges","ranges","cachedPreserveItems","cachedPreserveItemsPlugins","mustPreserveItems","plugins","spec","historyPreserveItems","historyKey","PluginKey","closeHistoryKey","buildCommand","redo","scroll","dispatch","hist","getState","history","config","resolve","added","getBookmark","newHist","setSelection","setMeta","historyState","histTransaction","scrollIntoView","undo","newGroupDelay","Plugin","key","init","apply","options","historyTr","getMeta","appended","composition","newGroup","time","docChanged","adjacent","isAdjacentTo","applyTransaction","props","handleDOMEvents","beforeinput","view","e","inputType","command","preventDefault"],"mappings":"iOAqBA,MAAMA,EACF,WAAAC,CAAYC,EAAOC,GACfC,KAAKF,MAAQA,EACbE,KAAKD,WAAaA,CACrB,CAGD,QAAAE,CAASC,EAAOC,GACZ,GAAuB,GAAnBH,KAAKD,WACL,OAAO,KACX,IAQIK,EAAOC,EARPC,EAAMN,KAAKF,MAAMS,OACrB,MAAQD,IAAO,CAEX,GADWN,KAAKF,MAAMU,IAAIF,EAAM,GACvBG,UAAW,GACdH,EACF,KACH,CACJ,CAEGH,IACAC,EAAQJ,KAAKU,UAAUJ,EAAKN,KAAKF,MAAMS,QACvCF,EAAUD,EAAMO,KAAKJ,QAEzB,IACIE,EAAWG,EADXC,EAAYX,EAAMY,GAElBC,EAAW,GAAIC,EAAY,GA+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AAWwE,GAC7B,IAAKA,EACD,OAAO,EACX,IAAKxE,EAAUwH,WACX,OAAO,EACX,IAAIC,GAAW,EAMf,OALAzH,EAAUc,QAAQhB,KAAK,GAAGM,SAAQ,CAAC4C,EAAOvD,KACtC,IAAK,IAAIa,EAAI,EAAGA,EAAIkE,EAAW9E,OAAQY,GAAK,EACpC0C,GAASwB,EAAWlE,EAAI,IAAMb,GAAO+E,EAAWlE,KAChDmH,GAAW,EAAI,IAEpBA,CACX,CAzB+EC,CAAazH,EAAI+F,EAAQxB,aAC5FA,EAAa4C,EAAWrC,EAAUiB,EAAQxB,WAAYvE,EAAGa,SAAW6D,EAAU1E,EAAGa,QAAQhB,MAC7F,OAAO,IAAIuE,EAAa2B,EAAQ1B,KAAKlD,aAAanB,EAAIqH,EAAWjI,EAAMO,UAAUwG,mBAAgBrF,EAAWkG,EAAS9B,EAAkB9F,IAASN,EAAOoF,MAAOK,EAAYvE,EAAGsH,KAAqB,MAAfF,EAAsBrB,EAAQtB,gBAAkB2C,EACtO,CASL,CA2FuBM,CAAiB7B,EAAMzG,EAAOY,EAAIgG,IAGjDA,SACA2B,MAAO,CACHC,gBAAiB,CACb,WAAAC,CAAYC,EAAMC,GACd,IAAIC,EAAYD,EAAEC,UACdC,EAAuB,eAAbD,EAA6BtB,EAAoB,eAAbsB,EAA6BtC,EAAO,KACtF,QAAKuC,IAELF,EAAEG,iBACKD,EAAQH,EAAK1I,MAAO0I,EAAKlC,UACnC,KAIjB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../w3c-keyname/index.js"),t=require("../../prosemirror-state/dist/index.js");const r="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function i(e){let t,i,n,l,s=e.split(/-(?!$)/),a=s[s.length-1];"Space"==a&&(a=" ");for(let e=0;e<s.length-1;e++){let a=s[e];if(/^(cmd|meta|m)$/i.test(a))l=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))n=!0;else{if(!/^mod$/i.test(a))throw new Error("Unrecognized modifier name: "+a);r?l=!0:i=!0}}return t&&(a="Alt-"+a),i&&(a="Ctrl-"+a),l&&(a="Meta-"+a),n&&(a="Shift-"+a),a}function n(e,t,r=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),r&&t.shiftKey&&(e="Shift-"+e),e}function l(t){let r=function(e){let t=Object.create(null);for(let r in e)t[i(r)]=e[r];return t}(t);return function(t,i){let l,s=e.keyName(i),a=r[n(s,i)];if(a&&a(t.state,t.dispatch,t))return!0;if(1==s.length&&" "!=s){if(i.shiftKey){let e=r[n(s,i,!1)];if(e&&e(t.state,t.dispatch,t))return!0}if((i.shiftKey||i.altKey||i.metaKey||s.charCodeAt(0)>127)&&(l=e.base[i.keyCode])&&l!=s){let e=r[n(l,i)];if(e&&e(t.state,t.dispatch,t))return!0}}return!1}}exports.keydownHandler=l,exports.keymap=function(e){return new t.Plugin({props:{handleKeyDown:l(e)}})};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../node_modules/prosemirror-keymap/dist/index.js"],"sourcesContent":["import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\n\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : false;\nfunction normalizeKeyName(name) {\n let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];\n if (result == \"Space\")\n result = \" \";\n let alt, ctrl, shift, meta;\n for (let i = 0; i < parts.length - 1; i++) {\n let mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod))\n meta = true;\n else if (/^a(lt)?$/i.test(mod))\n alt = true;\n else if (/^(c|ctrl|control)$/i.test(mod))\n ctrl = true;\n else if (/^s(hift)?$/i.test(mod))\n shift = true;\n else if (/^mod$/i.test(mod)) {\n if (mac)\n meta = true;\n else\n ctrl = true;\n }\n else\n throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt)\n result = \"Alt-\" + result;\n if (ctrl)\n result = \"Ctrl-\" + result;\n if (meta)\n result = \"Meta-\" + result;\n if (shift)\n result = \"Shift-\" + result;\n return result;\n}\nfunction normalize(map) {\n let copy = Object.create(null);\n for (let prop in map)\n copy[normalizeKeyName(prop)] = map[prop];\n return copy;\n}\nfunction modifiers(name, event, shift = true) {\n if (event.altKey)\n name = \"Alt-\" + name;\n if (event.ctrlKey)\n name = \"Ctrl-\" + name;\n if (event.metaKey)\n name = \"Meta-\" + name;\n if (shift && event.shiftKey)\n name = \"Shift-\" + name;\n return name;\n}\n/**\nCreate a keymap plugin for the given set of bindings.\n\nBindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style\nfunctions, which will be called with `(EditorState, dispatch,\nEditorView)` arguments, and should return true when they've handled\nthe key. Note that the view argument isn't part of the command\nprotocol, but can be used as an escape hatch if a binding needs to\ndirectly interact with the UI.\n\nKey names may be strings like `\"Shift-Ctrl-Enter\"`—a key\nidentifier prefixed with zero or more modifiers. Key identifiers\nare based on the strings that can appear in\n[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\nUse lowercase letters to refer to letter keys (or uppercase letters\nif you want shift to be held). You may use `\"Space\"` as an alias\nfor the `\" \"` name.\n\nModifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n`Meta-`) are recognized. For characters that are created by holding\nshift, the `Shift-` prefix is implied, and should not be added\nexplicitly.\n\nYou can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\nother platforms.\n\nYou can add multiple keymap plugins to an editor. The order in\nwhich they appear determines their precedence (the ones early in\nthe array get to dispatch first).\n*/\nfunction keymap(bindings) {\n return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });\n}\n/**\nGiven a set of bindings (using the same format as\n[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown\nhandler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.\n*/\nfunction keydownHandler(bindings) {\n let map = normalize(bindings);\n return function (view, event) {\n let name = keyName(event), baseName, direct = map[modifiers(name, event)];\n if (direct && direct(view.state, view.dispatch, view))\n return true;\n // A character key\n if (name.length == 1 && name != \" \") {\n if (event.shiftKey) {\n // In case the name was already modified by shift, try looking\n // it up without its shift modifier\n let noShift = map[modifiers(name, event, false)];\n if (noShift && noShift(view.state, view.dispatch, view))\n return true;\n }\n if ((event.shiftKey || event.altKey || event.metaKey || name.charCodeAt(0) > 127) &&\n (baseName = base[event.keyCode]) && baseName != name) {\n // Try falling back to the keyCode when there's a modifier\n // active or the character produced isn't ASCII, and our table\n // produces a different name from the the keyCode. See #668,\n // #1060\n let fromCode = map[modifiers(baseName, event)];\n if (fromCode && fromCode(view.state, view.dispatch, view))\n return true;\n }\n }\n return false;\n };\n}\n\nexport { keydownHandler, keymap };\n"],"names":["mac","navigator","test","platform","normalizeKeyName","name","alt","ctrl","shift","meta","parts","split","result","length","i","mod","Error","modifiers","event","altKey","ctrlKey","metaKey","shiftKey","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../node_modules/prosemirror-keymap/dist/index.js"],"sourcesContent":["import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\n\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : false;\nfunction normalizeKeyName(name) {\n let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];\n if (result == \"Space\")\n result = \" \";\n let alt, ctrl, shift, meta;\n for (let i = 0; i < parts.length - 1; i++) {\n let mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod))\n meta = true;\n else if (/^a(lt)?$/i.test(mod))\n alt = true;\n else if (/^(c|ctrl|control)$/i.test(mod))\n ctrl = true;\n else if (/^s(hift)?$/i.test(mod))\n shift = true;\n else if (/^mod$/i.test(mod)) {\n if (mac)\n meta = true;\n else\n ctrl = true;\n }\n else\n throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt)\n result = \"Alt-\" + result;\n if (ctrl)\n result = \"Ctrl-\" + result;\n if (meta)\n result = \"Meta-\" + result;\n if (shift)\n result = \"Shift-\" + result;\n return result;\n}\nfunction normalize(map) {\n let copy = Object.create(null);\n for (let prop in map)\n copy[normalizeKeyName(prop)] = map[prop];\n return copy;\n}\nfunction modifiers(name, event, shift = true) {\n if (event.altKey)\n name = \"Alt-\" + name;\n if (event.ctrlKey)\n name = \"Ctrl-\" + name;\n if (event.metaKey)\n name = \"Meta-\" + name;\n if (shift && event.shiftKey)\n name = \"Shift-\" + name;\n return name;\n}\n/**\nCreate a keymap plugin for the given set of bindings.\n\nBindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style\nfunctions, which will be called with `(EditorState, dispatch,\nEditorView)` arguments, and should return true when they've handled\nthe key. Note that the view argument isn't part of the command\nprotocol, but can be used as an escape hatch if a binding needs to\ndirectly interact with the UI.\n\nKey names may be strings like `\"Shift-Ctrl-Enter\"`—a key\nidentifier prefixed with zero or more modifiers. Key identifiers\nare based on the strings that can appear in\n[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\nUse lowercase letters to refer to letter keys (or uppercase letters\nif you want shift to be held). You may use `\"Space\"` as an alias\nfor the `\" \"` name.\n\nModifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n`Meta-`) are recognized. For characters that are created by holding\nshift, the `Shift-` prefix is implied, and should not be added\nexplicitly.\n\nYou can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\nother platforms.\n\nYou can add multiple keymap plugins to an editor. The order in\nwhich they appear determines their precedence (the ones early in\nthe array get to dispatch first).\n*/\nfunction keymap(bindings) {\n return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });\n}\n/**\nGiven a set of bindings (using the same format as\n[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown\nhandler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.\n*/\nfunction keydownHandler(bindings) {\n let map = normalize(bindings);\n return function (view, event) {\n let name = keyName(event), baseName, direct = map[modifiers(name, event)];\n if (direct && direct(view.state, view.dispatch, view))\n return true;\n // A character key\n if (name.length == 1 && name != \" \") {\n if (event.shiftKey) {\n // In case the name was already modified by shift, try looking\n // it up without its shift modifier\n let noShift = map[modifiers(name, event, false)];\n if (noShift && noShift(view.state, view.dispatch, view))\n return true;\n }\n if ((event.shiftKey || event.altKey || event.metaKey || name.charCodeAt(0) > 127) &&\n (baseName = base[event.keyCode]) && baseName != name) {\n // Try falling back to the keyCode when there's a modifier\n // active or the character produced isn't ASCII, and our table\n // produces a different name from the the keyCode. See #668,\n // #1060\n let fromCode = map[modifiers(baseName, event)];\n if (fromCode && fromCode(view.state, view.dispatch, view))\n return true;\n }\n }\n return false;\n };\n}\n\nexport { keydownHandler, keymap };\n"],"names":["mac","navigator","test","platform","normalizeKeyName","name","alt","ctrl","shift","meta","parts","split","result","length","i","mod","Error","modifiers","event","altKey","ctrlKey","metaKey","shiftKey","keydownHandler","bindings","map","copy","Object","create","prop","normalize","view","baseName","keyName","direct","state","dispatch","noShift","charCodeAt","base","keyCode","fromCode","Plugin","props","handleKeyDown"],"mappings":"mKAGA,MAAMA,EAA0B,oBAAbC,WAA2B,qBAAqBC,KAAKD,UAAUE,UAClF,SAASC,EAAiBC,GACtB,IAGIC,EAAKC,EAAMC,EAAOC,EAHlBC,EAAQL,EAAKM,MAAM,UAAWC,EAASF,EAAMA,EAAMG,OAAS,GAClD,SAAVD,IACAA,EAAS,KAEb,IAAK,IAAIE,EAAI,EAAGA,EA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EAAMI,UAAYJ,EAAMC,QAAUD,EAAMG,SAAWhB,EAAKiC,WAAW,GAAK,OACxEN,EAAWO,EAAIA,KAACrB,EAAMsB,WAAaR,GAAY3B,EAAM,CAKtD,IAAIoC,EAAWhB,EAAIR,EAAUe,EAAUd,IACvC,GAAIuB,GAAYA,EAASV,EAAKI,MAAOJ,EAAKK,SAAUL,GAChD,OAAO,CACd,CACJ,CACD,OAAO,CACf,CACA,yCApCA,SAAgBP,GACZ,OAAO,IAAIkB,EAAAA,OAAO,CAAEC,MAAO,CAAEC,cAAerB,EAAeC,KAC/D"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../../orderedmap/dist/index.js";function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let s=t.child(i),o=n.child(i);if(s!=o){if(!s.sameMarkup(o))return r;if(s.isText&&s.text!=o.text){for(let t=0;s.text[t]==o.text[t];t++)r++;return r}if(s.content.size||o.content.size){let t=e(s.content,o.content,r+1);if(null!=t)return t}r+=s.nodeSize}else r+=s.nodeSize}}function n(t,e,r,i){for(let s=t.childCount,o=e.childCount;;){if(0==s||0==o)return s==o?null:{a:r,b:i};let h=t.child(--s),l=e.child(--o),a=h.nodeSize;if(h!=l){if(!h.sameMarkup(l))return{a:r,b:i};if(h.isText&&h.text!=l.text){let t=0,e=Math.min(h.text.length,l.text.length);for(;t<e&&h.text[h.text.length-t-1]==l.text[l.text.length-t-1];)t++,r--,i--;return{a:r,b:i}}if(h.content.size||l.content.size){let t=n(h.content,l.content,r-1,i-1);if(t)return t}r-=a,i-=a}else r-=a,i-=a}}class r{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,n,r=0,i){for(let s=0,o=0;o<e;s++){let h=this.content[s],l=o+h.nodeSize;if(l>t&&!1!==n(h,r+o,i||null,s)&&h.content.size){let i=o+1;h.nodesBetween(Math.max(0,t-i),Math.min(h.content.size,e-i),n,r+i)}o=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let i="",s=!0;return this.nodesBetween(t,e,((o,h)=>{let l=o.isText?o.text.slice(Math.max(t,h)-h,e-h):o.isLeaf?r?"function"==typeof r?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&n&&(s?s=!1:i+=n),i+=l}),0),i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,i=this.content.slice(),s=0;for(e.isText&&e.sameMarkup(n)&&(i[i.length-1]=e.withText(e.text+n.text),s=1);s<t.content.length;s++)i.push(t.content[s]);return new r(i,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let n=[],i=0;if(e>t)for(let r=0,s=0;s<e;r++){let o=this.content[r],h=s+o.nodeSize;h>t&&((s<t||h>e)&&(o=o.isText?o.cut(Math.max(0,t-s),Math.min(o.text.length,e-s)):o.cut(Math.max(0,t-s-1),Math.min(o.content.size,e-s-1))),n.push(o),i+=o.nodeSize),s=h}return new r(n,i)}cutByIndex(t,e){return t==e?r.empty:0==t&&e==this.content.length?this:new r(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let i=this.content.slice(),s=this.size+e.nodeSize-n.nodeSize;return i[t]=e,new r(i,s)}addToStart(t){return new r([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new r(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,n=0){return e(this,t,n)}findDiffEnd(t,e=this.size,r=t.size){return n(this,t,e,r)}findIndex(t,e=-1){if(0==t)return s(0,t);if(t==this.size)return s(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=r+this.child(n).nodeSize;if(i>=t)return i==t||e>0?s(n+1,i):s(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return r.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new r(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return r.empty;let e,n=0;for(let r=0;r<t.length;r++){let i=t[r];n+=i.nodeSize,r&&i.isText&&t[r-1].sameMarkup(i)?(e||(e=t.slice(0,r)),e[e.length-1]=i.withText(e[e.length-1].text+i.text)):e&&e.push(i)}return new r(e||t,n)}static from(t){if(!t)return r.empty;if(t instanceof r)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new r([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}r.empty=new r([],0);const i={index:0,offset:0};function s(t,e){return i.index=t,i.offset=e,i}function o(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!o(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!o(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}class h{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let i=t[r];if(this.eq(i))return t;if(this.type.excludes(i.type))e||(e=t.slice(0,r));else{if(i.type.excludes(this.type))return t;!n&&i.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(i)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&o(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);let r=n.create(e.attrs);return n.checkAttrs(r.attrs),r}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return h.none;if(t instanceof h)return[t];let e=t.slice();return e.sort(((t,e)=>t.type.rank-e.type.rank)),e}}h.none=[];class l extends Error{}class a{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=p(this.content,t+this.openStart,e);return n&&new a(n,this.openStart,this.openEnd)}removeBetween(t,e){return new a(c(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return a.empty;let n=e.openStart||0,i=e.openEnd||0;if("number"!=typeof n||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new a(r.fromJSON(t,e.content),n,i)}static maxOpen(t,e=!0){let n=0,r=0;for(let r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)r++;return new a(t,n,r)}}function c(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:h}=t.findIndex(n);if(i==e||s.isText){if(h!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(c(s.content,e-i-1,n-i-1)))}function p(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let h=p(o.content,e-s-1,n);return h&&t.replaceChild(i,o.copy(h))}function u(t,e,n){if(n.openStart>t.depth)throw new l("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new l("Inconsistent open depths");return f(t,e,n,0)}function f(t,e,n,i){let s=t.index(i),o=t.node(i);if(s==e.index(i)&&i<t.depth-n.openStart){let r=f(t,e,n,i+1);return o.copy(o.content.replaceChild(s,r))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=i||e.depth!=i){let{start:s,end:h}=function(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let t=n-1;t>=0;t--)i=e.node(t).copy(r.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}(n,t);return y(o,k(t,s,h,e,i))}{let r=t.parent,i=r.content;return y(r,i.cut(0,t.parentOffset).append(n.content).append(i.cut(e.parentOffset)))}}return y(o,w(t,e,i))}function d(t,e){if(!e.type.compatibleContent(t.type))throw new l("Cannot join "+e.type.name+" onto "+t.type.name)}function m(t,e,n){let r=t.node(n);return d(r,e.node(n)),r}function g(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function x(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(g(t.nodeAfter,r),s++));for(let t=s;t<o;t++)g(i.child(t),r);e&&e.depth==n&&e.textOffset&&g(e.nodeBefore,r)}function y(t,e){return t.type.checkContent(e),t.copy(e)}function k(t,e,n,i,s){let o=t.depth>s&&m(t,e,s+1),h=i.depth>s&&m(n,i,s+1),l=[];return x(null,t,s,l),o&&h&&e.index(s)==n.index(s)?(d(o,h),g(y(o,k(t,e,n,i,s+1)),l)):(o&&g(y(o,w(t,e,s+1)),l),x(e,n,s,l),h&&g(y(h,w(n,i,s+1)),l)),x(i,null,s,l),new r(l)}function w(t,e,n){let i=[];if(x(null,t,n,i),t.depth>n){g(y(m(t,e,n+1),w(t,e,n+1)),i)}return x(e,null,n,i),new r(i)}a.empty=new a(r.empty,0,0);class S{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)r+=n.child(e).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return h.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let i=n.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new O(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],r=0,i=e;for(let e=t;;){let{index:t,offset:s}=e.content.findIndex(i),o=i-s;if(n.push(e,t,r+s),!o)break;if(e=e.child(t),e.isText)break;i=o-1,r+=s+1}return new S(e,n,i)}static resolveCached(t,e){let n=E.get(t);if(n)for(let t=0;t<n.elts.length;t++){let r=n.elts[t];if(r.pos==e)return r}else E.set(t,n=new b);let r=n.elts[n.i]=S.resolve(t,e);return n.i=(n.i+1)%C,r}}class b{constructor(){this.elts=[],this.i=0}}const C=12,E=new WeakMap;class O{constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const v=Object.create(null);class T{constructor(t,e,n,i=h.none){this.type=t,this.attrs=e,this.marks=i,this.content=n||r.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n,r=0){this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&o(this.attrs,e||t.defaultAttrs||v)&&h.sameSet(this.marks,n||h.none)}copy(t=null){return t==this.content?this:new T(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new T(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,n=!1){if(t==e)return a.empty;let r=this.resolve(t),i=this.resolve(e),s=n?0:r.sharedDepth(e),o=r.start(s),h=r.node(s).content.cut(r.pos-o,i.pos-o);return new a(h,r.depth-s,i.depth-s)}replace(t,e,n){return u(this.resolve(t),this.resolve(e),n)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(n),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return S.resolveCached(this,t)}resolveNoCache(t){return S.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),A(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=r.empty,i=0,s=n.childCount){let o=this.contentMatchAt(t).matchFragment(n,i,s),h=o&&o.matchFragment(this.content,e);if(!h||!h.validEnd)return!1;for(let t=i;t<s;t++)if(!this.type.allowsMarks(n.child(t).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(t).matchType(n),s=i&&i.matchFragment(this.content,e);return!!s&&s.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=h.none;for(let e=0;e<this.marks.length;e++){let n=this.marks[e];n.type.checkAttrs(n.attrs),t=n.addToSet(t)}if(!h.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let i=r.fromJSON(t,e.content),s=t.nodeType(e.type).create(e.attrs,i,n);return s.type.checkAttrs(s.attrs),s}}T.prototype.text=void 0;class M extends T{constructor(t,e,n,r){if(super(t,e,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):A(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new M(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new M(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function A(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class z{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new N(t,e);if(null==n.next)return z.empty;let r=I(n);n.next&&n.err("Unexpected trailing text");let i=function(t){let e=Object.create(null);return n(J(t,0));function n(r){let i=[];r.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);J(t,n).forEach((t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)}))}))}));let s=e[r.join(",")]=new z(r.indexOf(t.length-1)>-1);for(let t=0;t<i.length;t++){let r=i[t][1].sort(P);s.next.push({type:i[t][0],next:e[r.join(",")]||n(r)})}return s}}(function(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let i={term:r,to:n};return e[t].push(i),i}function i(t,e){t.forEach((t=>t.to=e))}function s(t,e){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(s(n,e))),[]);if("seq"!=t.type){if("star"==t.type){let o=n();return r(e,o),i(s(t.expr,o),o),[r(o)]}if("plus"==t.type){let o=n();return i(s(t.expr,e),o),i(s(t.expr,o),o),[r(o)]}if("opt"==t.type)return[r(e)].concat(s(t.expr,e));if("range"==t.type){let o=e;for(let e=0;e<t.min;e++){let e=n();i(s(t.expr,o),e),o=e}if(-1==t.max)i(s(t.expr,o),o);else for(let e=t.min;e<t.max;e++){let e=n();r(o,e),i(s(t.expr,o),e),o=e}return[r(o)]}if("name"==t.type)return[r(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let o=s(t.exprs[r],e);if(r==t.exprs.length-1)return o;i(o,e=n())}}}(r));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],i=!t.validEnd,s=[];for(let e=0;e<t.next.length;e++){let{type:n,next:o}=t.next[e];s.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(o)&&r.push(o)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let i=e;r&&i<n;i++)r=r.matchType(t.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let i=[this];return function s(o,h){let l=o.matchFragment(t,n);if(l&&(!e||l.validEnd))return r.from(h.map((t=>t.createAndFill())));for(let t=0;t<o.next.length;t++){let{type:e,next:n}=o.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==i.indexOf(n)){i.push(n);let t=s(n,h.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<i.next.length;t++){let{type:s,next:o}=i.next[t];s.isLeaf||s.hasRequiredAttrs()||s.name in e||r.type&&!o.validEnd||(n.push({match:s.contentMatch,type:s,via:r}),e[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map(((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let n=0;n<e.next.length;n++)r+=(n?", ":"")+e.next[n].type.name+"->"+t.indexOf(e.next[n].next);return r})).join("\n")}}z.empty=new z(!0);class N{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function I(t){let e=[];do{e.push(R(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function R(t){let e=[];do{e.push(F(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function F(t){let e=function(t){if(t.eat("(")){let e=I(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let t in n){let r=n[t];r.isInGroup(e)&&i.push(r)}0==i.length&&t.err("No node type or group '"+e+"' found");return i}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=D(t,e)}return e}function B(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function D(t,e){let n=B(t),r=n;return t.eat(",")&&(r="}"!=t.next?B(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function P(t,e){return e-t}function J(t,e){let n=[];return function e(r){let i=t[r];if(1==i.length&&!i[0].term)return e(i[0].to);n.push(r);for(let t=0;t<i.length;t++){let{term:r,to:s}=i[t];r||-1!=n.indexOf(s)||e(s)}}(e),n.sort(P)}function j(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function q(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(void 0===i){let e=t[r];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=e.default}n[r]=i}return n}function $(t,e,n,r){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in t){let r=t[n];r.validate&&r.validate(e[n])}}function L(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new U(t,r,e[r]);return n}class W{constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=L(t,n.attrs),this.defaultAttrs=j(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==z.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:q(this.attrs,t)}create(t=null,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new T(this,this.computeAttrs(t),r.from(e),h.setFrom(n))}createChecked(t=null,e,n){return e=r.from(e),this.checkContent(e),new T(this,this.computeAttrs(t),e,h.setFrom(n))}createAndFill(t=null,e,n){if(t=this.computeAttrs(t),(e=r.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let i=this.contentMatch.matchFragment(e),s=i&&i.fillBefore(r.empty,!0);return s?new T(this,t,e.append(s),h.setFrom(n)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){$(this.attrs,t,"node",this.name)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:h.none:t}static compile(t,e){let n=Object.create(null);t.forEach(((t,r)=>n[t]=new W(t,e,r)));let r=e.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let t in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class U{constructor(t,e,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(t,e,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}(t,e,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class G{constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=L(t,r.attrs),this.excluded=null;let i=j(this.attrs);this.instance=i?new h(this,i):null}create(t=null){return!t&&this.instance?this.instance:new h(this,q(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach(((t,i)=>n[t]=new G(t,r++,e,i))),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){$(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class V{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let t in e)n[t]=e[t];n.nodes=t.from(e.nodes),n.marks=t.from(e.marks||{}),this.nodes=W.compile(this.spec.nodes,this),this.marks=G.compile(this.spec.marks,this);let r=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],n=e.spec.content||"",i=e.spec.marks;if(e.contentMatch=r[n]||(r[n]=z.parse(n,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==i?null:i?_(this,i.split(" ")):""!=i&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:_(this,n.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(t,e=null,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof W))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new M(n,n.defaultAttrs,t,h.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return T.fromJSON(this,t)}markFromJSON(t){return h.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function _(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let e in t.marks){let r=t.marks[e];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=r)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class H{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let n=this.matchedStyles=[];e.forEach((t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];n.indexOf(e)<0&&n.push(e),this.styles.push(t)}})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new tt(this,e,!1);return n.addAll(t,h.none,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new tt(this,e,!0);return n.addAll(t,h.none,e.from,e.to),a.maxOpen(n.finish())}matchTag(t,e,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(et(t,n.tag)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],s=r.style;if(!(0!=s.indexOf(t)||r.context&&!n.matchesContext(r.context)||s.length>t.length&&(61!=s.charCodeAt(t.length)||s.slice(t.length+1)!=e))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r];if((null==t.priority?50:t.priority)<n)break}e.splice(r,0,t)}for(let e in t.marks){let r=t.marks[e].spec.parseDOM;r&&r.forEach((t=>{n(t=nt(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let r=t.nodes[e].spec.parseDOM;r&&r.forEach((t=>{n(t=nt(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new H(t,H.schemaRules(t)))}}const K={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},Q={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},X={ol:!0,ul:!0};function Y(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class Z{constructor(t,e,n,r,i,s){this.type=t,this.attrs=e,this.marks=n,this.solid=r,this.options=s,this.content=[],this.activeMarks=h.none,this.match=i||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(r.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=r.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(r.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!K.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class tt{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,i=e.topNode,s=Y(null,e.preserveWhitespace,0)|(n?4:0);r=i?new Z(i.type,i.attrs,h.none,!0,e.topMatch||i.type.contentMatch,s):new Z(n?null:t.schema.topNodeType,null,h.none,!0,null,s),this.nodes=[r],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let n=t.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0;if("full"===i||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(i)n="full"!==i?n.replace(/\r?\n|\r/g," "):n.replace(/\r\n?/g,"\n");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let e=r.content[r.content.length-1],i=t.previousSibling;(!e||i&&"BR"==i.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),e),this.findInText(t)}else this.findInside(t)}addElement(t,e,n){let r=this.localPreserveWS,i=this.top;("PRE"==t.tagName||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s,o=t.nodeName.toLowerCase();X.hasOwnProperty(o)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&X.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let h=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(s=this.parser.matchTag(t,this,n));t:if(h?h.ignore:Q.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,e);else if(!h||h.skip||h.closeParent){h&&h.closeParent?this.open=Math.max(0,this.open-1):h&&h.skip.nodeType&&(t=h.skip);let n,r=this.needsBlock;if(K.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);break t}let s=h&&h.skip?e:this.readStyles(t,e);s&&this.addAll(t,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(t,e);n&&this.addElementByRule(t,h,n,!1===h.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e)}readStyles(t,e){let n=t.style;if(n&&n.length)for(let t=0;t<this.parser.matchedStyles.length;t++){let r=this.parser.matchedStyles[t],i=n.getPropertyValue(r);if(i)for(let t;;){let n=this.parser.matchStyle(r,i,this,t);if(!n)break;if(n.ignore)return null;if(e=n.clearMark?e.filter((t=>!n.clearMark(t))):e.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;t=n}}return e}addElementByRule(t,e,n,r){let i,s;if(e.node)if(s=this.parser.schema.nodes[e.node],s.isLeaf)this.insertNode(s.create(e.attrs),n)||this.leafFallback(t,n);else{let t=this.enter(s,e.attrs||null,n,e.preserveWhitespace);t&&(i=!0,n=t)}else{let t=this.parser.schema.marks[e.mark];n=n.concat(t.create(e.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(t);else if(r)this.addElement(t,n,r);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t,n)));else{let r=t;"string"==typeof e.contentElement?r=t.querySelector(e.contentElement):"function"==typeof e.contentElement?r=e.contentElement(t):e.contentElement&&(r=e.contentElement),this.findAround(t,r,!0),this.addAll(r,n),this.findAround(t,r,!1)}i&&this.sync(o)&&this.open--}addAll(t,e,n,r){let i=n||0;for(let s=n?t.childNodes[n]:t.firstChild,o=null==r?null:t.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,e);this.findAtPoint(t,i)}findPlace(t,e){let n,r;for(let e=this.open;e>=0;e--){let i=this.nodes[e],s=i.findWrapping(t);if(s&&(!n||n.length>s.length)&&(n=s,r=i,!s.length))break;if(i.solid)break}if(!n)return null;this.sync(r);for(let t=0;t<n.length;t++)e=this.enterInner(n[t],null,e,!1);return e}insertNode(t,e){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&(e=this.enterInner(t,null,e))}let n=this.findPlace(t,e);if(n){this.closeExtra();let e=this.top;e.match&&(e.match=e.match.matchType(t.type));let r=h.none;for(let i of n.concat(t.marks))(e.type?e.type.allowsMarkType(i.type):rt(i.type,t.type))&&(r=i.addToSet(r));return e.content.push(t.mark(r)),!0}return!1}enter(t,e,n,r){let i=this.findPlace(t.create(e),n);return i&&(i=this.enterInner(t,e,n,!0,r)),i}enterInner(t,e,n,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let o=Y(t,i,s.options);4&s.options&&0==s.content.length&&(o|=4);let l=h.none;return n=n.filter((e=>!(s.type?s.type.allowsMarkType(e.type):rt(e.type,t))||(l=e.addToSet(l),!1))),this.nodes.push(new Z(t,e,l,r,null,o)),this.open++,n}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=1)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)){e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(r?0:1),s=(t,o)=>{for(;t>=0;t--){let h=e[t];if(""==h){if(t==e.length-1||0==t)continue;for(;o>=i;o--)if(s(t-1,o))return!0;return!1}{let t=o>0||0==o&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!t||t.name!=h&&!t.isInGroup(h))return!1;o--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function et(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function nt(t){let e={};for(let n in t)e[n]=t[n];return e}function rt(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=t=>{s.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:i}=t.edge(n);if(r==e)return!0;if(s.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class it{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},n){n||(n=ot(e).createDocumentFragment());let r=n,i=[];return t.forEach((t=>{if(i.length||t.marks.length){let n=0,s=0;for(;n<i.length&&s<t.marks.length;){let e=t.marks[s];if(this.marks[e.type.name]){if(!e.eq(i[n][0])||!1===e.type.spec.spanning)break;n++,s++}else s++}for(;n<i.length;)r=i.pop()[1];for(;s<t.marks.length;){let n=t.marks[s++],o=this.serializeMark(n,t.isInline,e);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(t,e))})),n}serializeNodeInner(t,e){let{dom:n,contentDOM:r}=at(ot(e),this.nodes[t.type.name](t),null,t.attrs);if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t,e={}){let n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let i=this.serializeMark(t.marks[r],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(t,e,n={}){let r=this.marks[t.type.name];return r&&at(ot(n),r(t,e),null,t.attrs)}static renderSpec(t,e,n=null,r){return at(t,e,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new it(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=st(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return st(t.marks)}}function st(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ot(t){return t.document||window.document}const ht=new WeakMap;function lt(t){let e=ht.get(t);return void 0===e&&ht.set(t,e=function(t){let e=null;function n(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])e||(e=[]),e.push(t);else for(let e=0;e<t.length;e++)n(t[e]);else for(let e in t)n(t[e])}return n(t),e}(t)),e}function at(t,e,n,r){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let i,s=e[0];if("string"!=typeof s)throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=lt(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o,h=s.indexOf(" ");h>0&&(n=s.slice(0,h),s=s.slice(h+1));let l=n?t.createElementNS(n,s):t.createElement(s),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){c=2;for(let t in a)if(null!=a[t]){let e=t.indexOf(" ");e>0?l.setAttributeNS(t.slice(0,e),t.slice(e+1),a[t]):l.setAttribute(t,a[t])}}for(let i=c;i<e.length;i++){let s=e[i];if(0===s){if(i<e.length-1||i>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:e,contentDOM:i}=at(t,s,n,r);if(l.appendChild(e),i){if(o)throw new RangeError("Multiple content holes");o=i}}}return{dom:l,contentDOM:o}}export{z as ContentMatch,H as DOMParser,it as DOMSerializer,r as Fragment,h as Mark,G as MarkType,T as Node,O as NodeRange,W as NodeType,l as ReplaceError,S as ResolvedPos,V as Schema,a as Slice};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../orderedmap/dist/index.js");function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let s=t.child(i),o=n.child(i);if(s!=o){if(!s.sameMarkup(o))return r;if(s.isText&&s.text!=o.text){for(let t=0;s.text[t]==o.text[t];t++)r++;return r}if(s.content.size||o.content.size){let t=e(s.content,o.content,r+1);if(null!=t)return t}r+=s.nodeSize}else r+=s.nodeSize}}function n(t,e,r,i){for(let s=t.childCount,o=e.childCount;;){if(0==s||0==o)return s==o?null:{a:r,b:i};let h=t.child(--s),l=e.child(--o),a=h.nodeSize;if(h!=l){if(!h.sameMarkup(l))return{a:r,b:i};if(h.isText&&h.text!=l.text){let t=0,e=Math.min(h.text.length,l.text.length);for(;t<e&&h.text[h.text.length-t-1]==l.text[l.text.length-t-1];)t++,r--,i--;return{a:r,b:i}}if(h.content.size||l.content.size){let t=n(h.content,l.content,r-1,i-1);if(t)return t}r-=a,i-=a}else r-=a,i-=a}}class r{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,n,r=0,i){for(let s=0,o=0;o<e;s++){let h=this.content[s],l=o+h.nodeSize;if(l>t&&!1!==n(h,r+o,i||null,s)&&h.content.size){let i=o+1;h.nodesBetween(Math.max(0,t-i),Math.min(h.content.size,e-i),n,r+i)}o=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let i="",s=!0;return this.nodesBetween(t,e,((o,h)=>{let l=o.isText?o.text.slice(Math.max(t,h)-h,e-h):o.isLeaf?r?"function"==typeof r?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&n&&(s?s=!1:i+=n),i+=l}),0),i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,i=this.content.slice(),s=0;for(e.isText&&e.sameMarkup(n)&&(i[i.length-1]=e.withText(e.text+n.text),s=1);s<t.content.length;s++)i.push(t.content[s]);return new r(i,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let n=[],i=0;if(e>t)for(let r=0,s=0;s<e;r++){let o=this.content[r],h=s+o.nodeSize;h>t&&((s<t||h>e)&&(o=o.isText?o.cut(Math.max(0,t-s),Math.min(o.text.length,e-s)):o.cut(Math.max(0,t-s-1),Math.min(o.content.size,e-s-1))),n.push(o),i+=o.nodeSize),s=h}return new r(n,i)}cutByIndex(t,e){return t==e?r.empty:0==t&&e==this.content.length?this:new r(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let i=this.content.slice(),s=this.size+e.nodeSize-n.nodeSize;return i[t]=e,new r(i,s)}addToStart(t){return new r([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new r(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,n=0){return e(this,t,n)}findDiffEnd(t,e=this.size,r=t.size){return n(this,t,e,r)}findIndex(t,e=-1){if(0==t)return s(0,t);if(t==this.size)return s(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=r+this.child(n).nodeSize;if(i>=t)return i==t||e>0?s(n+1,i):s(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return r.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new r(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return r.empty;let e,n=0;for(let r=0;r<t.length;r++){let i=t[r];n+=i.nodeSize,r&&i.isText&&t[r-1].sameMarkup(i)?(e||(e=t.slice(0,r)),e[e.length-1]=i.withText(e[e.length-1].text+i.text)):e&&e.push(i)}return new r(e||t,n)}static from(t){if(!t)return r.empty;if(t instanceof r)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new r([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}r.empty=new r([],0);const i={index:0,offset:0};function s(t,e){return i.index=t,i.offset=e,i}function o(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!o(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!o(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}class h{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let i=t[r];if(this.eq(i))return t;if(this.type.excludes(i.type))e||(e=t.slice(0,r));else{if(i.type.excludes(this.type))return t;!n&&i.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(i)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&o(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);let r=n.create(e.attrs);return n.checkAttrs(r.attrs),r}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return h.none;if(t instanceof h)return[t];let e=t.slice();return e.sort(((t,e)=>t.type.rank-e.type.rank)),e}}h.none=[];class l extends Error{}class a{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=p(this.content,t+this.openStart,e);return n&&new a(n,this.openStart,this.openEnd)}removeBetween(t,e){return new a(c(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return a.empty;let n=e.openStart||0,i=e.openEnd||0;if("number"!=typeof n||"number"!=typeof i)throw new RangeError("Invalid input for Slice.fromJSON");return new a(r.fromJSON(t,e.content),n,i)}static maxOpen(t,e=!0){let n=0,r=0;for(let r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)r++;return new a(t,n,r)}}function c(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:h}=t.findIndex(n);if(i==e||s.isText){if(h!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(c(s.content,e-i-1,n-i-1)))}function p(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let h=p(o.content,e-s-1,n);return h&&t.replaceChild(i,o.copy(h))}function u(t,e,n){if(n.openStart>t.depth)throw new l("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new l("Inconsistent open depths");return f(t,e,n,0)}function f(t,e,n,i){let s=t.index(i),o=t.node(i);if(s==e.index(i)&&i<t.depth-n.openStart){let r=f(t,e,n,i+1);return o.copy(o.content.replaceChild(s,r))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=i||e.depth!=i){let{start:s,end:h}=function(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let t=n-1;t>=0;t--)i=e.node(t).copy(r.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}(n,t);return y(o,k(t,s,h,e,i))}{let r=t.parent,i=r.content;return y(r,i.cut(0,t.parentOffset).append(n.content).append(i.cut(e.parentOffset)))}}return y(o,w(t,e,i))}function d(t,e){if(!e.type.compatibleContent(t.type))throw new l("Cannot join "+e.type.name+" onto "+t.type.name)}function m(t,e,n){let r=t.node(n);return d(r,e.node(n)),r}function g(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function x(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(g(t.nodeAfter,r),s++));for(let t=s;t<o;t++)g(i.child(t),r);e&&e.depth==n&&e.textOffset&&g(e.nodeBefore,r)}function y(t,e){return t.type.checkContent(e),t.copy(e)}function k(t,e,n,i,s){let o=t.depth>s&&m(t,e,s+1),h=i.depth>s&&m(n,i,s+1),l=[];return x(null,t,s,l),o&&h&&e.index(s)==n.index(s)?(d(o,h),g(y(o,k(t,e,n,i,s+1)),l)):(o&&g(y(o,w(t,e,s+1)),l),x(e,n,s,l),h&&g(y(h,w(n,i,s+1)),l)),x(i,null,s,l),new r(l)}function w(t,e,n){let i=[];if(x(null,t,n,i),t.depth>n){g(y(m(t,e,n+1),w(t,e,n+1)),i)}return x(e,null,n,i),new r(i)}a.empty=new a(r.empty,0,0);class S{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)r+=n.child(e).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return h.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let i=n.marks;for(var s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new E(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],r=0,i=e;for(let e=t;;){let{index:t,offset:s}=e.content.findIndex(i),o=i-s;if(n.push(e,t,r+s),!o)break;if(e=e.child(t),e.isText)break;i=o-1,r+=s+1}return new S(e,n,i)}static resolveCached(t,e){let n=O.get(t);if(n)for(let t=0;t<n.elts.length;t++){let r=n.elts[t];if(r.pos==e)return r}else O.set(t,n=new b);let r=n.elts[n.i]=S.resolve(t,e);return n.i=(n.i+1)%C,r}}class b{constructor(){this.elts=[],this.i=0}}const C=12,O=new WeakMap;class E{constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const v=Object.create(null);class T{constructor(t,e,n,i=h.none){this.type=t,this.attrs=e,this.marks=i,this.content=n||r.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n,r=0){this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&o(this.attrs,e||t.defaultAttrs||v)&&h.sameSet(this.marks,n||h.none)}copy(t=null){return t==this.content?this:new T(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new T(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,n=!1){if(t==e)return a.empty;let r=this.resolve(t),i=this.resolve(e),s=n?0:r.sharedDepth(e),o=r.start(s),h=r.node(s).content.cut(r.pos-o,i.pos-o);return new a(h,r.depth-s,i.depth-s)}replace(t,e,n){return u(this.resolve(t),this.resolve(e),n)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(n),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return S.resolveCached(this,t)}resolveNoCache(t){return S.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(r=!0),!r))),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),A(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=r.empty,i=0,s=n.childCount){let o=this.contentMatchAt(t).matchFragment(n,i,s),h=o&&o.matchFragment(this.content,e);if(!h||!h.validEnd)return!1;for(let t=i;t<s;t++)if(!this.type.allowsMarks(n.child(t).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(t).matchType(n),s=i&&i.matchFragment(this.content,e);return!!s&&s.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=h.none;for(let e=0;e<this.marks.length;e++){let n=this.marks[e];n.type.checkAttrs(n.attrs),t=n.addToSet(t)}if(!h.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let i=r.fromJSON(t,e.content),s=t.nodeType(e.type).create(e.attrs,i,n);return s.type.checkAttrs(s.attrs),s}}T.prototype.text=void 0;class M extends T{constructor(t,e,n,r){if(super(t,e,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):A(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new M(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new M(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function A(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class N{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new z(t,e);if(null==n.next)return N.empty;let r=R(n);n.next&&n.err("Unexpected trailing text");let i=function(t){let e=Object.create(null);return n(J(t,0));function n(r){let i=[];r.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);J(t,n).forEach((t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)}))}))}));let s=e[r.join(",")]=new N(r.indexOf(t.length-1)>-1);for(let t=0;t<i.length;t++){let r=i[t][1].sort(P);s.next.push({type:i[t][0],next:e[r.join(",")]||n(r)})}return s}}(function(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let i={term:r,to:n};return e[t].push(i),i}function i(t,e){t.forEach((t=>t.to=e))}function s(t,e){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(s(n,e))),[]);if("seq"!=t.type){if("star"==t.type){let o=n();return r(e,o),i(s(t.expr,o),o),[r(o)]}if("plus"==t.type){let o=n();return i(s(t.expr,e),o),i(s(t.expr,o),o),[r(o)]}if("opt"==t.type)return[r(e)].concat(s(t.expr,e));if("range"==t.type){let o=e;for(let e=0;e<t.min;e++){let e=n();i(s(t.expr,o),e),o=e}if(-1==t.max)i(s(t.expr,o),o);else for(let e=t.min;e<t.max;e++){let e=n();r(o,e),i(s(t.expr,o),e),o=e}return[r(o)]}if("name"==t.type)return[r(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let o=s(t.exprs[r],e);if(r==t.exprs.length-1)return o;i(o,e=n())}}}(r));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],i=!t.validEnd,s=[];for(let e=0;e<t.next.length;e++){let{type:n,next:o}=t.next[e];s.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(o)&&r.push(o)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let i=e;r&&i<n;i++)r=r.matchType(t.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let i=[this];return function s(o,h){let l=o.matchFragment(t,n);if(l&&(!e||l.validEnd))return r.from(h.map((t=>t.createAndFill())));for(let t=0;t<o.next.length;t++){let{type:e,next:n}=o.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==i.indexOf(n)){i.push(n);let t=s(n,h.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<i.next.length;t++){let{type:s,next:o}=i.next[t];s.isLeaf||s.hasRequiredAttrs()||s.name in e||r.type&&!o.validEnd||(n.push({match:s.contentMatch,type:s,via:r}),e[s.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map(((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let n=0;n<e.next.length;n++)r+=(n?", ":"")+e.next[n].type.name+"->"+t.indexOf(e.next[n].next);return r})).join("\n")}}N.empty=new N(!0);class z{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function R(t){let e=[];do{e.push(I(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function I(t){let e=[];do{e.push(F(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function F(t){let e=function(t){if(t.eat("(")){let e=R(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let t in n){let r=n[t];r.isInGroup(e)&&i.push(r)}0==i.length&&t.err("No node type or group '"+e+"' found");return i}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=D(t,e)}return e}function B(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function D(t,e){let n=B(t),r=n;return t.eat(",")&&(r="}"!=t.next?B(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function P(t,e){return e-t}function J(t,e){let n=[];return function e(r){let i=t[r];if(1==i.length&&!i[0].term)return e(i[0].to);n.push(r);for(let t=0;t<i.length;t++){let{term:r,to:s}=i[t];r||-1!=n.indexOf(s)||e(s)}}(e),n.sort(P)}function j(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function q(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(void 0===i){let e=t[r];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=e.default}n[r]=i}return n}function $(t,e,n,r){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in t){let r=t[n];r.validate&&r.validate(e[n])}}function L(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new U(t,r,e[r]);return n}class W{constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=L(t,n.attrs),this.defaultAttrs=j(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==N.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:q(this.attrs,t)}create(t=null,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new T(this,this.computeAttrs(t),r.from(e),h.setFrom(n))}createChecked(t=null,e,n){return e=r.from(e),this.checkContent(e),new T(this,this.computeAttrs(t),e,h.setFrom(n))}createAndFill(t=null,e,n){if(t=this.computeAttrs(t),(e=r.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let i=this.contentMatch.matchFragment(e),s=i&&i.fillBefore(r.empty,!0);return s?new T(this,t,e.append(s),h.setFrom(n)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){$(this.attrs,t,"node",this.name)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:h.none:t}static compile(t,e){let n=Object.create(null);t.forEach(((t,r)=>n[t]=new W(t,e,r)));let r=e.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let t in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class U{constructor(t,e,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(t,e,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}(t,e,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class _{constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=L(t,r.attrs),this.excluded=null;let i=j(this.attrs);this.instance=i?new h(this,i):null}create(t=null){return!t&&this.instance?this.instance:new h(this,q(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach(((t,i)=>n[t]=new _(t,r++,e,i))),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){$(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}function G(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let e in t.marks){let r=t.marks[e];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=r)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class V{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let n=this.matchedStyles=[];e.forEach((t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];n.indexOf(e)<0&&n.push(e),this.styles.push(t)}})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new Z(this,e,!1);return n.addAll(t,h.none,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new Z(this,e,!0);return n.addAll(t,h.none,e.from,e.to),a.maxOpen(n.finish())}matchTag(t,e,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(tt(t,n.tag)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],s=r.style;if(!(0!=s.indexOf(t)||r.context&&!n.matchesContext(r.context)||s.length>t.length&&(61!=s.charCodeAt(t.length)||s.slice(t.length+1)!=e))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r];if((null==t.priority?50:t.priority)<n)break}e.splice(r,0,t)}for(let e in t.marks){let r=t.marks[e].spec.parseDOM;r&&r.forEach((t=>{n(t=et(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let r=t.nodes[e].spec.parseDOM;r&&r.forEach((t=>{n(t=et(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new V(t,V.schemaRules(t)))}}const H={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},K={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Q={ol:!0,ul:!0};function X(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class Y{constructor(t,e,n,r,i,s){this.type=t,this.attrs=e,this.marks=n,this.solid=r,this.options=s,this.content=[],this.activeMarks=h.none,this.match=i||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(r.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=r.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(r.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!H.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Z{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,i=e.topNode,s=X(null,e.preserveWhitespace,0)|(n?4:0);r=i?new Y(i.type,i.attrs,h.none,!0,e.topMatch||i.type.contentMatch,s):new Y(n?null:t.schema.topNodeType,null,h.none,!0,null,s),this.nodes=[r],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let n=t.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0;if("full"===i||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(i)n="full"!==i?n.replace(/\r?\n|\r/g," "):n.replace(/\r\n?/g,"\n");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let e=r.content[r.content.length-1],i=t.previousSibling;(!e||i&&"BR"==i.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),e),this.findInText(t)}else this.findInside(t)}addElement(t,e,n){let r=this.localPreserveWS,i=this.top;("PRE"==t.tagName||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let s,o=t.nodeName.toLowerCase();Q.hasOwnProperty(o)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&Q.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let h=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(s=this.parser.matchTag(t,this,n));t:if(h?h.ignore:K.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,e);else if(!h||h.skip||h.closeParent){h&&h.closeParent?this.open=Math.max(0,this.open-1):h&&h.skip.nodeType&&(t=h.skip);let n,r=this.needsBlock;if(H.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);break t}let s=h&&h.skip?e:this.readStyles(t,e);s&&this.addAll(t,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(t,e);n&&this.addElementByRule(t,h,n,!1===h.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e)}readStyles(t,e){let n=t.style;if(n&&n.length)for(let t=0;t<this.parser.matchedStyles.length;t++){let r=this.parser.matchedStyles[t],i=n.getPropertyValue(r);if(i)for(let t;;){let n=this.parser.matchStyle(r,i,this,t);if(!n)break;if(n.ignore)return null;if(e=n.clearMark?e.filter((t=>!n.clearMark(t))):e.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;t=n}}return e}addElementByRule(t,e,n,r){let i,s;if(e.node)if(s=this.parser.schema.nodes[e.node],s.isLeaf)this.insertNode(s.create(e.attrs),n)||this.leafFallback(t,n);else{let t=this.enter(s,e.attrs||null,n,e.preserveWhitespace);t&&(i=!0,n=t)}else{let t=this.parser.schema.marks[e.mark];n=n.concat(t.create(e.attrs))}let o=this.top;if(s&&s.isLeaf)this.findInside(t);else if(r)this.addElement(t,n,r);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t,n)));else{let r=t;"string"==typeof e.contentElement?r=t.querySelector(e.contentElement):"function"==typeof e.contentElement?r=e.contentElement(t):e.contentElement&&(r=e.contentElement),this.findAround(t,r,!0),this.addAll(r,n),this.findAround(t,r,!1)}i&&this.sync(o)&&this.open--}addAll(t,e,n,r){let i=n||0;for(let s=n?t.childNodes[n]:t.firstChild,o=null==r?null:t.childNodes[r];s!=o;s=s.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(s,e);this.findAtPoint(t,i)}findPlace(t,e){let n,r;for(let e=this.open;e>=0;e--){let i=this.nodes[e],s=i.findWrapping(t);if(s&&(!n||n.length>s.length)&&(n=s,r=i,!s.length))break;if(i.solid)break}if(!n)return null;this.sync(r);for(let t=0;t<n.length;t++)e=this.enterInner(n[t],null,e,!1);return e}insertNode(t,e){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&(e=this.enterInner(t,null,e))}let n=this.findPlace(t,e);if(n){this.closeExtra();let e=this.top;e.match&&(e.match=e.match.matchType(t.type));let r=h.none;for(let i of n.concat(t.marks))(e.type?e.type.allowsMarkType(i.type):nt(i.type,t.type))&&(r=i.addToSet(r));return e.content.push(t.mark(r)),!0}return!1}enter(t,e,n,r){let i=this.findPlace(t.create(e),n);return i&&(i=this.enterInner(t,e,n,!0,r)),i}enterInner(t,e,n,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let o=X(t,i,s.options);4&s.options&&0==s.content.length&&(o|=4);let l=h.none;return n=n.filter((e=>!(s.type?s.type.allowsMarkType(e.type):nt(e.type,t))||(l=e.addToSet(l),!1))),this.nodes.push(new Y(t,e,l,r,null,o)),this.open++,n}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=1)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)){e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(r?0:1),s=(t,o)=>{for(;t>=0;t--){let h=e[t];if(""==h){if(t==e.length-1||0==t)continue;for(;o>=i;o--)if(s(t-1,o))return!0;return!1}{let t=o>0||0==o&&r?this.nodes[o].type:n&&o>=i?n.node(o-i).type:null;if(!t||t.name!=h&&!t.isInGroup(h))return!1;o--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function tt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function et(t){let e={};for(let n in t)e[n]=t[n];return e}function nt(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=t=>{s.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:i}=t.edge(n);if(r==e)return!0;if(s.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class rt{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},n){n||(n=st(e).createDocumentFragment());let r=n,i=[];return t.forEach((t=>{if(i.length||t.marks.length){let n=0,s=0;for(;n<i.length&&s<t.marks.length;){let e=t.marks[s];if(this.marks[e.type.name]){if(!e.eq(i[n][0])||!1===e.type.spec.spanning)break;n++,s++}else s++}for(;n<i.length;)r=i.pop()[1];for(;s<t.marks.length;){let n=t.marks[s++],o=this.serializeMark(n,t.isInline,e);o&&(i.push([n,r]),r.appendChild(o.dom),r=o.contentDOM||o.dom)}}r.appendChild(this.serializeNodeInner(t,e))})),n}serializeNodeInner(t,e){let{dom:n,contentDOM:r}=lt(st(e),this.nodes[t.type.name](t),null,t.attrs);if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t,e={}){let n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let i=this.serializeMark(t.marks[r],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(t,e,n={}){let r=this.marks[t.type.name];return r&<(st(n),r(t,e),null,t.attrs)}static renderSpec(t,e,n=null,r){return lt(t,e,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new rt(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=it(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return it(t.marks)}}function it(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function st(t){return t.document||window.document}const ot=new WeakMap;function ht(t){let e=ot.get(t);return void 0===e&&ot.set(t,e=function(t){let e=null;function n(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])e||(e=[]),e.push(t);else for(let e=0;e<t.length;e++)n(t[e]);else for(let e in t)n(t[e])}return n(t),e}(t)),e}function lt(t,e,n,r){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let i,s=e[0];if("string"!=typeof s)throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=ht(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o,h=s.indexOf(" ");h>0&&(n=s.slice(0,h),s=s.slice(h+1));let l=n?t.createElementNS(n,s):t.createElement(s),a=e[1],c=1;if(a&&"object"==typeof a&&null==a.nodeType&&!Array.isArray(a)){c=2;for(let t in a)if(null!=a[t]){let e=t.indexOf(" ");e>0?l.setAttributeNS(t.slice(0,e),t.slice(e+1),a[t]):l.setAttribute(t,a[t])}}for(let i=c;i<e.length;i++){let s=e[i];if(0===s){if(i<e.length-1||i>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:e,contentDOM:i}=lt(t,s,n,r);if(l.appendChild(e),i){if(o)throw new RangeError("Multiple content holes");o=i}}}return{dom:l,contentDOM:o}}exports.ContentMatch=N,exports.DOMParser=V,exports.DOMSerializer=rt,exports.Fragment=r,exports.Mark=h,exports.MarkType=_,exports.Node=T,exports.NodeRange=E,exports.NodeType=W,exports.ReplaceError=l,exports.ResolvedPos=S,exports.Schema=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let t in e)n[t]=e[t];n.nodes=t.default.from(e.nodes),n.marks=t.default.from(e.marks||{}),this.nodes=W.compile(this.spec.nodes,this),this.marks=_.compile(this.spec.marks,this);let r=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],n=e.spec.content||"",i=e.spec.marks;if(e.contentMatch=r[n]||(r[n]=N.parse(n,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==i?null:i?G(this,i.split(" ")):""!=i&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:G(this,n.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(t,e=null,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof W))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new M(n,n.defaultAttrs,t,h.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return T.fromJSON(this,t)}markFromJSON(t){return h.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}},exports.Slice=a;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|