@instincthub/react-ui 0.1.63 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -3
- package/dist/_virtual/_rollupPluginBabelHelpers.js +2 -2
- package/dist/node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-center.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-center.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-left.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-left.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-right.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-right.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-down.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-down.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-left.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-left.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-right.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-right.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-up.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-up.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/ban.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/ban.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/baseline.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/baseline.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/file-text.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/file-text.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/film.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/film.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/grip-horizontal.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/grip-horizontal.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading-1.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading-1.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/highlighter.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/highlighter.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/lightbulb.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/lightbulb.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/link-2.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/link-2.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/monitor-play.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/monitor-play.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mouse-pointer-click.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mouse-pointer-click.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/music.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/music.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paint-bucket.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paint-bucket.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/palette.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/palette.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-left.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-left.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-top.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-top.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paperclip.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paperclip.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/remove-formatting.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/remove-formatting.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings-2.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings-2.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/square-chevron-right.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/square-chevron-right.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/type.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/type.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/upload.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/upload.js.map +1 -1
- package/dist/src/assets/css/ui/ihub-text-editor-blocks.css +951 -0
- package/dist/src/assets/css/ui/ui-index.css +1 -0
- package/dist/src/components/ui/ComponentLists.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/IHubTextEditor.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/blocks/BlockHandle.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/BlockHandle.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/BlockKeymap.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/BlockKeymap.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/blockLayout.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/blockLayout.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/blockOps.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/blockOps.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/useBlockDrag.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/useBlockDrag.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/BubbleToolbar.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/ColorPalette.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/ColorPalette.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/FloatingAddButton.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/SlashCommandMenu.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/TableToolbar.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/CalloutView.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/CalloutView.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/useDismiss.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/useDismiss.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/commandIcons.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/commandIcons.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaBlockView.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaBlockView.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPreview.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPreview.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/constants.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/constants.js.map +1 -1
- package/dist/src/components/ui/editor/ihub-editor/extensions/ButtonBlock.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/ButtonBlock.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/Callout.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/Callout.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/MediaBlock.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/MediaBlock.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/PreserveStyles.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/PreserveStyles.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/SectionBanner.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/SectionBanner.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/TableExtensions.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/TableExtensions.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/ToggleBlock.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/ToggleBlock.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/colorUtils.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/colorUtils.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/hooks/useIHubEditor.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/hooks/useMediaEmbed.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/hooks/useSurfaceClick.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/hooks/useSurfaceClick.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/table/TableControls.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/table/TableControls.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/table/TableLineMenu.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/table/TableLineMenu.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/table/tableOps.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/table/tableOps.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/table/useTableHover.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/table/useTableHover.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/types.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/types.js.map +1 -1
- package/dist/src/components/ui/editor/ihub-editor/upload/mediaKinds.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/mediaKinds.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/s3Direct.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/s3Direct.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/uploadFile.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/uploadFile.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/uploadRegistry.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/uploadRegistry.js.map +1 -0
- package/dist/src/types/components/ui/editor/ihub-editor/IHubTextEditor.d.ts +1 -1
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/BlockHandle.d.ts +16 -0
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/BlockKeymap.d.ts +11 -0
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/blockLayout.d.ts +37 -0
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/blockOps.d.ts +45 -0
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/useBlockDrag.d.ts +30 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/ColorPalette.d.ts +14 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/FloatingAddButton.d.ts +3 -2
- package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.d.ts +2 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/CalloutView.d.ts +2 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.d.ts +2 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/useDismiss.d.ts +3 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/commandIcons.d.ts +3 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaBlockView.d.ts +6 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.d.ts +10 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaPreview.d.ts +10 -0
- package/dist/src/types/components/ui/editor/ihub-editor/constants.d.ts +5 -1
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/ButtonBlock.d.ts +21 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/Callout.d.ts +20 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/MediaBlock.d.ts +39 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/PreserveStyles.d.ts +6 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/SectionBanner.d.ts +15 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/TableExtensions.d.ts +14 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/ToggleBlock.d.ts +13 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/colorUtils.d.ts +14 -0
- package/dist/src/types/components/ui/editor/ihub-editor/hooks/useIHubEditor.d.ts +8 -2
- package/dist/src/types/components/ui/editor/ihub-editor/hooks/useMediaEmbed.d.ts +2 -1
- package/dist/src/types/components/ui/editor/ihub-editor/hooks/useSurfaceClick.d.ts +28 -0
- package/dist/src/types/components/ui/editor/ihub-editor/index.d.ts +1 -1
- package/dist/src/types/components/ui/editor/ihub-editor/table/TableControls.d.ts +9 -0
- package/dist/src/types/components/ui/editor/ihub-editor/table/TableLineMenu.d.ts +25 -0
- package/dist/src/types/components/ui/editor/ihub-editor/table/tableOps.d.ts +25 -0
- package/dist/src/types/components/ui/editor/ihub-editor/table/useTableHover.d.ts +25 -0
- package/dist/src/types/components/ui/editor/ihub-editor/types.d.ts +83 -2
- package/dist/src/types/components/ui/editor/ihub-editor/upload/mediaKinds.d.ts +32 -0
- package/dist/src/types/components/ui/editor/ihub-editor/upload/s3Direct.d.ts +5 -0
- package/dist/src/types/components/ui/editor/ihub-editor/upload/uploadFile.d.ts +19 -0
- package/dist/src/types/components/ui/editor/ihub-editor/upload/uploadRegistry.d.ts +15 -0
- package/dist/src/types/index.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -4
- package/dist/src/components/ui/editor/ihub-editor/extensions/ImageWithCaption.js +0 -2
- package/dist/src/components/ui/editor/ihub-editor/extensions/ImageWithCaption.js.map +0 -1
- package/dist/src/components/ui/editor/ihub-editor/hooks/useImageUpload.js +0 -2
- package/dist/src/components/ui/editor/ihub-editor/hooks/useImageUpload.js.map +0 -1
- package/dist/src/types/components/ui/editor/ihub-editor/components/ImageBlock.d.ts +0 -12
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/ImageWithCaption.d.ts +0 -14
- package/dist/src/types/components/ui/editor/ihub-editor/hooks/useImageUpload.d.ts +0 -11
package/README.md
CHANGED
|
@@ -82,6 +82,12 @@ Then, build the package using:
|
|
|
82
82
|
npm run rollup
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
Run the unit tests (Vitest with jsdom). Tests live in `__tests__/` folders next to the code they cover (`src/**/__tests__/*.test.ts`):
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
npm test
|
|
89
|
+
```
|
|
90
|
+
|
|
85
91
|
## Linking the Package (For Local Development)
|
|
86
92
|
|
|
87
93
|
To test `@instincthub/react-ui` locally within another project:
|
|
@@ -111,6 +117,8 @@ npm unlink @instincthub/react-ui
|
|
|
111
117
|
| `npm run build` | Build the example Next.js app |
|
|
112
118
|
| `npm run start` | Start the built example app |
|
|
113
119
|
| `npm run rollup` | Build the library for distribution |
|
|
120
|
+
| `npm test` | Run the unit tests once (Vitest + jsdom) |
|
|
121
|
+
| `npm run test:watch` | Run the unit tests in watch mode |
|
|
114
122
|
| `npm run link-ui` | Rebuild and `npm link` for local development (macOS/Linux) |
|
|
115
123
|
| `npm run link-ui-win` | Rebuild and `npm link` for local development (Windows) |
|
|
116
124
|
| `npm run unlink-ui-linux` | Unlink the package (macOS/Linux) |
|
|
@@ -297,6 +305,37 @@ Dropdown menu for actions.
|
|
|
297
305
|
/>
|
|
298
306
|
```
|
|
299
307
|
|
|
308
|
+
#### IHubTextEditor
|
|
309
|
+
|
|
310
|
+
Notion-style rich text editor: slash commands and a "+" block menu, drag-to-reorder blocks (including into banners, callouts and toggles), tables with row/column handles, image/video/audio/PDF/file uploads, embeds, section banners, callouts, toggles, CTA buttons, and pasted HTML (including email templates) that keeps its inline styles.
|
|
311
|
+
|
|
312
|
+
```jsx
|
|
313
|
+
<IHubTextEditor
|
|
314
|
+
content={html}
|
|
315
|
+
onChange={setHtml}
|
|
316
|
+
upload={{ presignEndpoint: `${API_HOST_URL}uploads/presign/`, token }}
|
|
317
|
+
/>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Uploads can come from `onFileUpload`, the `upload` prop, or these environment variables:
|
|
321
|
+
|
|
322
|
+
<!-- AUTO-GENERATED from process.env reads in src/components/ui/editor/ihub-editor/upload -->
|
|
323
|
+
| Variable | Required | Description | Example |
|
|
324
|
+
|----------|----------|-------------|---------|
|
|
325
|
+
| `NEXT_PUBLIC_IHUB_EDITOR_PRESIGN_URL` | No | Presign endpoint: receives `POST { filename, content_type, size, kind }`, returns `{ url, cdnUrl }` (recommended) | `https://api.example.com/uploads/presign/` |
|
|
326
|
+
| `NEXT_PUBLIC_IHUB_EDITOR_UPLOAD_URL` | No | Multipart upload endpoint; JSON response must include `url`, `file`, `location` or `cdnUrl` | `https://api.example.com/uploads/` |
|
|
327
|
+
| `NEXT_PUBLIC_IHUB_EDITOR_DIRECT_S3` | No | `true` to allow direct browser → S3 uploads with the AWS keys below (off by default; the secret key ships to the browser) | `true` |
|
|
328
|
+
| `NEXT_PUBLIC_AWS_BUCKET_NAME` | For direct S3 | Bucket for direct uploads (shared with `FileUploader`) | `instincthub-media` |
|
|
329
|
+
| `NEXT_PUBLIC_AWS_ACCESS_KEY_ID` | For direct S3 | Access key; scope it to `PutObject` on one prefix | — |
|
|
330
|
+
| `NEXT_PUBLIC_AWS_SECRET_ACCESS_KEY` | For direct S3 | Secret key (exposed to the browser) | — |
|
|
331
|
+
| `NEXT_PUBLIC_AWS_REGION` | For direct S3 | Bucket region | `eu-west-2` |
|
|
332
|
+
| `NEXT_PUBLIC_AWS_S3_ENDPOINT_URL` | No | Custom S3-compatible endpoint | `https://s3.example.com` |
|
|
333
|
+
| `NEXT_PUBLIC_IHUB_EDITOR_S3_FOLDER` | No | Key prefix for direct uploads (default `editor`) | `editor` |
|
|
334
|
+
| `NEXT_PUBLIC_IHUB_EDITOR_FILE_URL` | No | Public base URL for uploaded files (falls back to `NEXT_PUBLIC_FILE_URL`, then the bucket URL) | `https://cdn.example.com/` |
|
|
335
|
+
<!-- END AUTO-GENERATED -->
|
|
336
|
+
|
|
337
|
+
Block, table and media styles are in `src/assets/css/ui/ihub-text-editor-blocks.css`, which is included by `ui-index.css`. Full reference: [docs/static-docs/components/IHubTextEditor.md](docs/static-docs/components/IHubTextEditor.md).
|
|
338
|
+
|
|
300
339
|
### Utility Functions
|
|
301
340
|
|
|
302
341
|
#### openToast
|
|
@@ -388,9 +427,10 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
388
427
|
|
|
389
428
|
1. Fork the repository
|
|
390
429
|
2. Create your feature branch: `git checkout -b feature/amazing-feature`
|
|
391
|
-
3.
|
|
392
|
-
4.
|
|
393
|
-
5.
|
|
430
|
+
3. Add or update tests and make sure `npm test` passes
|
|
431
|
+
4. Commit your changes: `git commit -m 'Add some amazing feature'`
|
|
432
|
+
5. Push to the branch: `git push origin feature/amazing-feature`
|
|
433
|
+
6. Open a Pull Request
|
|
394
434
|
|
|
395
435
|
## License
|
|
396
436
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";function
|
|
1
|
+
"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t){if(Array.isArray(t))return t}function r(e){if(Array.isArray(e))return t(e)}function n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t,e,r,n,o,i,u){try{var a=t[i](u),c=a.value}catch(t){return void r(t)}a.done?e(c):Promise.resolve(c).then(n,o)}function i(t,e,r){if(p())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&w(o,r.prototype),o}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,P(n.key),n)}}function a(t,e,r){return(e=P(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=x(t,e);if(n){var o=Object.getOwnPropertyDescriptor(n,e);return o.get?o.get.call(arguments.length<3?t:r):o.value}},c.apply(null,arguments)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function l(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(p=function(){return!!t})()}function s(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function y(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}function b(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function h(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}function m(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return n(t)}function O(){
|
|
2
2
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
-
var
|
|
3
|
+
var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,f=Object.create(c.prototype);return g(f,"_invoke",function(r,n,o){var i,a,c,f=0,l=o||[],p=!1,s={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return i=e,a=0,c=t,s.n=r,u}};function y(r,n){for(a=r,c=n,e=0;!p&&f&&!o&&e<l.length;e++){var o,i=l[e],y=s.p,b=i[2];r>3?(o=b===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=r<2&&y<i[1])?(a=0,s.v=n,s.n=i[1]):y<b&&(o=r<3||i[0]>n||n>b)&&(i[4]=r,i[5]=n,s.n=b,a=0))}if(o||r>1)return u;throw p=!0,n}return function(o,l,b){if(f>1)throw TypeError("Generator is already running");for(p&&1===l&&y(l,b),a=l,c=b;(e=a<2?t:c)||!p;){i||(a?a<3?(a>1&&(s.n=-1),y(a,c)):s.n=c:s.v=c);try{if(f=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=t}else if((e=(p=s.n<0)?c:r.call(n,s))!==u)break}catch(e){i=t,a=1,c=e}finally{f=1}}return{value:e,done:p}}}(r,o,i),!0),f}var u={};function a(){}function c(){}function f(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(g(e={},n,function(){return this}),e),p=f.prototype=a.prototype=Object.create(l);function s(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,g(t,o,"GeneratorFunction")),t.prototype=Object.create(p),t}return c.prototype=f,g(p,"constructor",f),g(f,"constructor",c),c.displayName="GeneratorFunction",g(f,o,"GeneratorFunction"),g(p),g(p,o,"Generator"),g(p,n,function(){return this}),g(p,"toString",function(){return"[object Generator]"}),(O=function(){return{w:i,m:s}})()}function g(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}g=function(t,e,r,n){function i(e,r){g(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},g(t,e,r,n)}function w(t,e){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},w(t,e)}function x(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}function j(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function P(t){var e=j(t,"string");return"symbol"==typeof e?e:e+""}function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function T(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function A(t){var e="function"==typeof Map?new Map:void 0;return A=function(t){if(null===t||!l(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return i(t,arguments,f(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),w(r,t)},A(t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayLikeToArray=t,exports.arrayWithHoles=e,exports.arrayWithoutHoles=r,exports.assertThisInitialized=n,exports.asyncToGenerator=function(t){return function(){var e=this,r=arguments;return new Promise(function(n,i){var u=t.apply(e,r);function a(t){o(u,n,i,a,c,"next",t)}function c(t){o(u,n,i,a,c,"throw",t)}a(void 0)})}},exports.callSuper=function(t,e,r){return e=f(e),m(t,p()?Reflect.construct(e,r||[],f(t).constructor):e.apply(t,r))},exports.classCallCheck=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},exports.construct=i,exports.createClass=function(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},exports.createForOfIteratorHelper=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=T(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}},exports.defineProperty=a,exports.get=c,exports.getPrototypeOf=f,exports.inherits=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&w(t,e)},exports.isNativeFunction=l,exports.isNativeReflectConstruct=p,exports.iterableToArray=s,exports.iterableToArrayLimit=y,exports.nonIterableRest=b,exports.nonIterableSpread=v,exports.objectSpread2=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t},exports.objectWithoutProperties=function(t,e){if(null==t)return{};var r,n,o=h(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o},exports.objectWithoutPropertiesLoose=h,exports.possibleConstructorReturn=m,exports.regenerator=O,exports.regeneratorDefine=g,exports.regeneratorValues=function(t){if(null!=t){var e=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}throw new TypeError(typeof t+" is not iterable")},exports.setPrototypeOf=w,exports.slicedToArray=function(t,r){return e(t)||y(t,r)||T(t,r)||b()},exports.superPropBase=x,exports.superPropGet=function(t,e,r,n){var o=c(f(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof o?function(t){return o.apply(r,t)}:o},exports.taggedTemplateLiteral=function(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))},exports.toArray=function(t){return e(t)||s(t)||T(t)||b()},exports.toConsumableArray=function(t){return r(t)||s(t)||T(t)||v()},exports.toPrimitive=j,exports.toPropertyKey=P,exports.typeof=S,exports.unsupportedIterableToArray=T,exports.wrapNativeSuper=A;
|
|
4
4
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../../../prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js"),e=require("../../../../../prosemirror-view@1.41.3/node_modules/prosemirror-view/dist/index.js"),n=require("../../../../../prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.js"),o=require("../../../../../prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.js"),r=require("../../../../../prosemirror-transform@1.10.5/node_modules/prosemirror-transform/dist/index.js"),s=require("../../../../../prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.js"),i=require("../../../../../prosemirror-schema-list@1.5.1/node_modules/prosemirror-schema-list/dist/index.js");function a(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,s=n.storedMarks,n}}}class c{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:r}=n,s=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,(...t)=>{const n=e(...t)(s);return r.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(r),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:s}=o,i=[],a=!!t,c=t||r.tr,d={...Object.fromEntries(Object.entries(n).map(([t,n])=>[t,(...t)=>{const o=this.buildProps(c,e),r=n(...t)(o);return i.push(r),d}])),run:()=>(a||!e||c.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(c),i.every(t=>!0===t))};return d}createCan(t){const{rawCommands:e,state:n}=this,o=!1,r=t||n.tr,s=this.buildProps(r,o),i=Object.fromEntries(Object.entries(e).map(([t,e])=>[t,(...t)=>e(...t)({...s,dispatch:void 0})]));return{...i,chain:()=>this.createChain(r,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:s}=o,i={tr:t,editor:o,view:s,state:a({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([t,e])=>[t,(...t)=>e(...t)(i)]))}};return i}}class d{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(t=>t.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(t=>t!==e):delete this.callbacks[t]),this}once(t,e){const n=(...o)=>{this.off(t,n),e.apply(this,o)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}}function l(t,e,n){if(void 0===t.config[e]&&t.parent)return l(t.parent,e,n);if("function"==typeof t.config[e]){return t.config[e].bind({...n,parent:t.parent?l(t.parent,e,n):null})}return t.config[e]}function p(t){return{baseExtensions:t.filter(t=>"extension"===t.type),nodeExtensions:t.filter(t=>"node"===t.type),markExtensions:t.filter(t=>"mark"===t.type)}}function u(t){const e=[],{nodeExtensions:n,markExtensions:o}=p(t),r=[...n,...o],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(t=>{const n=l(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage,extensions:r});if(!n)return;n().forEach(t=>{t.types.forEach(n=>{Object.entries(t.attributes).forEach(([t,o])=>{e.push({type:n,name:t,attribute:{...s,...o}})})})})}),r.forEach(t=>{const n={name:t.name,options:t.options,storage:t.storage},o=l(t,"addAttributes",n);if(!o)return;const r=o();Object.entries(r).forEach(([n,o])=>{const r={...s,...o};"function"==typeof(null==r?void 0:r.default)&&(r.default=r.default()),(null==r?void 0:r.isRequired)&&void 0===(null==r?void 0:r.default)&&delete r.default,e.push({type:t.name,name:n,attribute:r})})}),e}function h(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function m(...t){return t.filter(t=>!!t).reduce((t,e)=>{const n={...t};return Object.entries(e).forEach(([t,e])=>{if(n[t])if("class"===t){const o=e?String(e).split(" "):[],r=n[t]?n[t].split(" "):[],s=o.filter(t=>!r.includes(t));n[t]=[...r,...s].join(" ")}else if("style"===t){const o=e?e.split(";").map(t=>t.trim()).filter(Boolean):[],r=n[t]?n[t].split(";").map(t=>t.trim()).filter(Boolean):[],s=new Map;r.forEach(t=>{const[e,n]=t.split(":").map(t=>t.trim());s.set(e,n)}),o.forEach(t=>{const[e,n]=t.split(":").map(t=>t.trim());s.set(e,n)}),n[t]=Array.from(s.entries()).map(([t,e])=>`${t}: ${e}`).join("; ")}else n[t]=e;else n[t]=e}),n},{})}function f(t,e){return e.filter(e=>e.type===t.type.name).filter(t=>t.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]}).reduce((t,e)=>m(t,e),{})}function g(t){return"function"==typeof t}function x(t,e=void 0,...n){return g(t)?e?t.bind(e)(...n):t(...n):t}function y(t={}){return 0===Object.keys(t).length&&t.constructor===Object}function v(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}function b(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===o)return!1;const r=e.reduce((t,e)=>{const o=e.attribute.parseHTML?e.attribute.parseHTML(n):v(n.getAttribute(e.name));return null==o?t:{...t,[e.name]:o}},{});return{...o,...r}}}}function k(t){return Object.fromEntries(Object.entries(t).filter(([t,e])=>("attrs"!==t||!y(e))&&null!=e))}function w(t,e){var n;const r=u(t),{nodeExtensions:s,markExtensions:i}=p(t),a=null===(n=s.find(t=>l(t,"topNode")))||void 0===n?void 0:n.name,c=Object.fromEntries(s.map(n=>{const o=r.filter(t=>t.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e},i=k({...t.reduce((t,e)=>{const o=l(e,"extendNodeSchema",s);return{...t,...o?o(n):{}}},{}),content:x(l(n,"content",s)),marks:x(l(n,"marks",s)),group:x(l(n,"group",s)),inline:x(l(n,"inline",s)),atom:x(l(n,"atom",s)),selectable:x(l(n,"selectable",s)),draggable:x(l(n,"draggable",s)),code:x(l(n,"code",s)),whitespace:x(l(n,"whitespace",s)),linebreakReplacement:x(l(n,"linebreakReplacement",s)),defining:x(l(n,"defining",s)),isolating:x(l(n,"isolating",s)),attrs:Object.fromEntries(o.map(t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]}))}),a=x(l(n,"parseHTML",s));a&&(i.parseDOM=a.map(t=>b(t,o)));const c=l(n,"renderHTML",s);c&&(i.toDOM=t=>c({node:t,HTMLAttributes:f(t,o)}));const d=l(n,"renderText",s);return d&&(i.toText=d),[n.name,i]})),d=Object.fromEntries(i.map(n=>{const o=r.filter(t=>t.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e},i=k({...t.reduce((t,e)=>{const o=l(e,"extendMarkSchema",s);return{...t,...o?o(n):{}}},{}),inclusive:x(l(n,"inclusive",s)),excludes:x(l(n,"excludes",s)),group:x(l(n,"group",s)),spanning:x(l(n,"spanning",s)),code:x(l(n,"code",s)),attrs:Object.fromEntries(o.map(t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]}))}),a=x(l(n,"parseHTML",s));a&&(i.parseDOM=a.map(t=>b(t,o)));const c=l(n,"renderHTML",s);return c&&(i.toDOM=t=>c({mark:t,HTMLAttributes:f(t,o)})),[n.name,i]}));return new o.Schema({topNode:a,nodes:c,marks:d})}function M(t,e){return e.nodes[t]||e.marks[t]||null}function S(t,e){return Array.isArray(e)?e.some(e=>("string"==typeof e?e:e.name)===t.name):e}function E(t,e){const n=o.DOMSerializer.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const O=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(t,e,r,s)=>{var i,a;const c=(null===(a=(i=t.type.spec).toText)||void 0===a?void 0:a.call(i,{node:t,pos:e,parent:r,index:s}))||t.textContent||"%leaf%";n+=t.isAtom&&!t.isText?c:c.slice(0,Math.max(0,o-e))}),n};function C(t){return"[object RegExp]"===Object.prototype.toString.call(t)}class T{constructor(t){this.find=t.find,this.handler=t.handler}}function P(t){var e;const{editor:n,from:o,to:r,text:s,rules:i,plugin:d}=t,{view:l}=n;if(l.composing)return!1;const p=l.state.doc.resolve(o);if(p.parent.type.spec.code||(null===(e=p.nodeBefore||p.nodeAfter)||void 0===e?void 0:e.marks.find(t=>t.type.spec.code)))return!1;let u=!1;const h=O(p)+s;return i.forEach(t=>{if(u)return;const e=((t,e)=>{if(C(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o})(h,t.find);if(!e)return;const i=l.state.tr,p=a({state:l.state,transaction:i}),m={from:o-(e[0].length-s.length),to:r},{commands:f,chain:g,can:x}=new c({editor:n,state:p});null!==t.handler({state:p,range:m,match:e,commands:f,chain:g,can:x})&&i.steps.length&&(i.setMeta(d,{transform:i,from:o,to:r,text:s}),l.dispatch(i),u=!0)}),u}function A(e){const{editor:n,rules:r}=e,s=new t.Plugin({state:{init:()=>null,apply(t,e,i){const a=t.getMeta(s);if(a)return a;const c=t.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:t}=c;"string"==typeof t||(t=E(o.Fragment.from(t),i.schema));const{from:e}=c,a=e+t.length;P({editor:n,from:e,to:a,text:t,rules:r,plugin:s})}),t.selectionSet||t.docChanged?null:e}},props:{handleTextInput:(t,e,o,i)=>P({editor:n,from:e,to:o,text:i,rules:r,plugin:s}),handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:e}=t.state.selection;e&&P({editor:n,from:e.pos,to:e.pos,text:"",rules:r,plugin:s})}),!1)},handleKeyDown(t,e){if("Enter"!==e.key)return!1;const{$cursor:o}=t.state.selection;return!!o&&P({editor:n,from:o.pos,to:o.pos,text:"\n",rules:r,plugin:s})}},isInputRules:!0});return s}function $(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&(t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype)}function j(t,e){const n={...t};return $(t)&&$(e)&&Object.keys(e).forEach(o=>{$(e[o])&&$(t[o])?n[o]=j(t[o],e[o]):n[o]=e[o]}),n}class N{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=x(l(this,"addOptions",{name:this.name}))),this.storage=x(l(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new N(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>j(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new N(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=x(l(e,"addOptions",{name:e.name})),e.storage=x(l(e,"addStorage",{name:e.name,options:e.options})),e}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){const r=o.marks();if(!!!r.find(t=>(null==t?void 0:t.type.name)===e.name))return!1;const s=r.find(t=>(null==t?void 0:t.type.name)===e.name);return s&&n.removeStoredMark(s),n.insertText(" ",o.pos),t.view.dispatch(n),!0}return!1}}function I(t){return"number"==typeof t}class R{constructor(t){this.find=t.find,this.handler=t.handler}}function B(t){const{editor:e,state:n,from:o,to:r,rule:s,pasteEvent:i,dropEvent:a}=t,{commands:d,chain:l,can:p}=new c({editor:e,state:n}),u=[];n.doc.nodesBetween(o,r,(t,e)=>{if(!t.isTextblock||t.type.spec.code)return;const c=Math.max(o,e),h=Math.min(r,e+t.content.size);((t,e,n)=>{if(C(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n}):[]})(t.textBetween(c-e,h-e,void 0,""),s.find,i).forEach(t=>{if(void 0===t.index)return;const e=c+t.index+1,o=e+t[0].length,r={from:n.tr.mapping.map(e),to:n.tr.mapping.map(o)},h=s.handler({state:n,range:r,match:t,commands:d,chain:l,can:p,pasteEvent:i,dropEvent:a});u.push(h)})});return u.every(t=>null!==t)}let D=null;function F(e){const{editor:n,rules:r}=e;let s,i=null,c=!1,d=!1,l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{s="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{s=null}const p=({state:t,from:e,to:o,rule:r,pasteEvt:i})=>{const c=t.tr,d=a({state:t,transaction:c});if(B({editor:n,state:d,from:Math.max(e-1,0),to:o.b-1,rule:r,pasteEvent:i,dropEvent:s})&&c.steps.length){try{s="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{s=null}return l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,c}};return r.map(e=>new t.Plugin({view(t){const e=e=>{var o;i=(null===(o=t.dom.parentElement)||void 0===o?void 0:o.contains(e.target))?t.dom.parentElement:null,i&&(D=n)},o=()=>{D&&(D=null)};return window.addEventListener("dragstart",e),window.addEventListener("dragend",o),{destroy(){window.removeEventListener("dragstart",e),window.removeEventListener("dragend",o)}}},props:{handleDOMEvents:{drop:(t,e)=>{if(d=i===t.dom.parentElement,s=e,!d){const t=D;(null==t?void 0:t.isEditable)&&setTimeout(()=>{const e=t.state.selection;e&&t.commands.deleteRange({from:e.from,to:e.to})},10)}return!1},paste:(t,e)=>{var n;const o=null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/html");return l=e,c=!!(null==o?void 0:o.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const s=t[0],i="paste"===s.getMeta("uiEvent")&&!c,a="drop"===s.getMeta("uiEvent")&&!d,u=s.getMeta("applyPasteRules"),h=!!u;if(!i&&!a&&!h)return;if(h){let{text:t}=u;"string"==typeof t||(t=E(o.Fragment.from(t),r.schema));const{from:n}=u,s=n+t.length,i=(t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(e=n.clipboardData)||void 0===e||e.setData("text/html",t),n})(t);return p({rule:e,state:r,from:n,to:{b:s},pasteEvt:i})}const m=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return I(m)&&f&&m!==f.b?p({rule:e,state:r,from:m,to:f,pasteEvt:l}):void 0}}))}function z(t){const e=t.filter((e,n)=>t.indexOf(e)!==n);return Array.from(new Set(e))}class L{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=L.resolve(t),this.schema=w(this.extensions,e),this.setupExtensions()}static resolve(t){const e=L.sort(L.flatten(t)),n=z(e.map(t=>t.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(t=>`'${t}'`).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map(t=>{const e=l(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...this.flatten(e())]:t}).flat(10)}static sort(t){return t.sort((t,e)=>{const n=l(t,"priority")||100,o=l(e,"priority")||100;return n>o?-1:n<o?1:0})}get commands(){return this.extensions.reduce((t,e)=>{const n=l(e,"addCommands",{name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:M(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=L.sort([...this.extensions].reverse()),o=[],r=[],s=e.map(e=>{const s={name:e.name,options:e.options,storage:e.storage,editor:t,type:M(e.name,this.schema)},i=[],a=l(e,"addKeyboardShortcuts",s);let c={};if("mark"===e.type&&l(e,"exitable",s)&&(c.ArrowRight=()=>N.handleExit({editor:t,mark:e})),a){const e=Object.fromEntries(Object.entries(a()).map(([e,n])=>[e,()=>n({editor:t})]));c={...c,...e}}const d=n.keymap(c);i.push(d);const p=l(e,"addInputRules",s);S(e,t.options.enableInputRules)&&p&&o.push(...p());const u=l(e,"addPasteRules",s);S(e,t.options.enablePasteRules)&&u&&r.push(...u());const h=l(e,"addProseMirrorPlugins",s);if(h){const t=h();i.push(...t)}return i}).flat();return[A({editor:t,rules:o}),...F({editor:t,rules:r}),...s]}get attributes(){return u(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=p(this.extensions);return Object.fromEntries(e.filter(t=>!!l(t,"addNodeView")).map(e=>{const n=this.attributes.filter(t=>t.type===e.name),o={name:e.name,options:e.options,storage:e.storage,editor:t,type:h(e.name,this.schema)},r=l(e,"addNodeView",o);if(!r)return[];return[e.name,(o,s,i,a,c)=>{const d=f(o,n);return r()({node:o,view:s,getPos:i,decorations:a,innerDecorations:c,editor:t,extension:e,HTMLAttributes:d})}]}))}setupExtensions(){this.extensions.forEach(t=>{var e;this.editor.extensionStorage[t.name]=t.storage;const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:M(t.name,this.schema)};if("mark"===t.type){(null===(e=x(l(t,"keepOnSplit",n)))||void 0===e||e)&&this.splittableMarks.push(t.name)}const o=l(t,"onBeforeCreate",n),r=l(t,"onCreate",n),s=l(t,"onUpdate",n),i=l(t,"onSelectionUpdate",n),a=l(t,"onTransaction",n),c=l(t,"onFocus",n),d=l(t,"onBlur",n),p=l(t,"onDestroy",n);o&&this.editor.on("beforeCreate",o),r&&this.editor.on("create",r),s&&this.editor.on("update",s),i&&this.editor.on("selectionUpdate",i),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),p&&this.editor.on("destroy",p)})}}class H{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=x(l(this,"addOptions",{name:this.name}))),this.storage=x(l(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new H(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>j(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new H({...this.config,...t});return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=x(l(e,"addOptions",{name:e.name})),e.storage=x(l(e,"addStorage",{name:e.name,options:e.options})),e}}function V(t,e,n){const{from:o,to:r}=e,{blockSeparator:s="\n\n",textSerializers:i={}}=n||{};let a="";return t.nodesBetween(o,r,(t,n,c,d)=>{var l;t.isBlock&&n>o&&(a+=s);const p=null==i?void 0:i[t.type.name];if(p)return c&&(a+=p({node:t,pos:n,parent:c,index:d,range:e})),!1;t.isText&&(a+=null===(l=null==t?void 0:t.text)||void 0===l?void 0:l.slice(Math.max(o,n)-n,r-n))}),a}function _(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}const q=H.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:s}=r,i=Math.min(...s.map(t=>t.$from.pos)),a=Math.max(...s.map(t=>t.$to.pos)),c=_(n);return V(o,{from:i,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}});function K(t,e,n={strict:!0}){const o=Object.keys(e);return!o.length||o.every(o=>n.strict?e[o]===t[o]:C(e[o])?e[o].test(t[o]):e[o]===t[o])}function W(t,e,n={}){return t.find(t=>t.type===e&&K(Object.fromEntries(Object.keys(n).map(e=>[e,t.attrs[e]])),n))}function U(t,e,n={}){return!!W(t,e,n)}function G(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(r.node&&r.node.marks.some(t=>t.type===e)||(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(t=>t.type===e))return;n=n||(null===(o=r.node.marks[0])||void 0===o?void 0:o.attrs);if(!W([...r.node.marks],e,n))return;let s=r.index,i=t.start()+r.offset,a=s+1,c=i+r.node.nodeSize;for(;s>0&&U([...t.parent.child(s-1).marks],e,n);)s-=1,i-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&U([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:i,to:c}}function J(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}function Y(e){return e instanceof t.TextSelection}function Q(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function X(e,n=null){if(!n)return null;const o=t.Selection.atStart(e),r=t.Selection.atEnd(e);if("start"===n||!0===n)return o;if("end"===n)return r;const s=o.from,i=r.to;return"all"===n?t.TextSelection.create(e,Q(0,s,i),Q(e.content.size,s,i)):t.TextSelection.create(e,Q(n,s,i),Q(n,s,i))}function Z(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const tt=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];3===o.nodeType&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):1===o.nodeType&&tt(o)}return t};function et(t){const e=`<body>${t}</body>`,n=(new window.DOMParser).parseFromString(e,"text/html").body;return tt(n)}function nt(t,e,n){if(t instanceof o.Node||t instanceof o.Fragment)return t;n={slice:!0,parseOptions:{},...n};const r="string"==typeof t;if("object"==typeof t&&null!==t)try{if(Array.isArray(t)&&t.length>0)return o.Fragment.fromArray(t.map(t=>e.nodeFromJSON(t)));const r=e.nodeFromJSON(t);return n.errorOnInvalidContent&&r.check(),r}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),nt("",e,n)}if(r){if(n.errorOnInvalidContent){let r=!1,s="";const i=new o.Schema({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:t=>(r=!0,s="string"==typeof t?t:t.outerHTML,null)}]}})});if(n.slice?o.DOMParser.fromSchema(i).parseSlice(et(t),n.parseOptions):o.DOMParser.fromSchema(i).parse(et(t),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}const r=o.DOMParser.fromSchema(e);return n.slice?r.parseSlice(et(t),n.parseOptions).content:r.parse(et(t),n.parseOptions)}return nt("",e,n)}function ot(e,n,o){const s=e.steps.length-1;if(s<n)return;const i=e.steps[s];if(!(i instanceof r.ReplaceStep||i instanceof r.ReplaceAroundStep))return;const a=e.mapping.maps[s];let c=0;a.forEach((t,e,n,o)=>{0===c&&(c=o)}),e.setSelection(t.Selection.near(e.doc.resolve(c),o))}function rt(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function st(t,e,n={}){const{from:o,to:r,empty:s}=t.selection,i=e?h(e,t.schema):null,a=[];t.doc.nodesBetween(o,r,(t,e)=>{if(t.isText)return;const n=Math.max(o,e),s=Math.min(r,e+t.nodeSize);a.push({node:t,from:n,to:s})});const c=r-o,d=a.filter(t=>!i||i.name===t.node.type.name).filter(t=>K(t.node.attrs,n,{strict:!1}));if(s)return!!d.length;return d.reduce((t,e)=>t+e.to-e.from,0)>=c}function it(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function at(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce((e,o)=>(n.includes(o)||(e[o]=t[o]),e),{})}function ct(t,e,n={},o={}){return nt(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}function dt(t,e){const n=J(e,t.schema),{from:o,to:r,empty:s}=t.selection,i=[];s?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,t=>{i.push(...t.marks)});const a=i.find(t=>t.type.name===n.name);return a?{...a.attrs}:{}}function lt(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function pt(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function ut(t){return e=>pt(e.$from,t)}function ht(t,e){return V(t,{from:0,to:t.content.size},e)}function mt(t,e){const n=h(e,t.schema),{from:o,to:r}=t.selection,s=[];t.doc.nodesBetween(o,r,t=>{s.push(t)});const i=s.reverse().find(t=>t.type.name===n.name);return i?{...i.attrs}:{}}function ft(t,e){const n=it("string"==typeof e?e:e.name,t.schema);return"node"===n?mt(t,e):"mark"===n?dt(t,e):{}}function gt(t,e=JSON.stringify){const n={};return t.filter(t=>{const o=e(t);return!Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=!0)})}function xt(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(e=>{const r=G(n.resolve(t),e.type);r&&o.push({mark:e,...r})}):n.nodesBetween(t,e,(t,e)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&o.push(...t.marks.map(n=>({from:e,to:e+t.nodeSize,mark:n})))}),o}function yt(t,e,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const o=t.find(t=>t.type===e&&t.name===n);return!!o&&o.attribute.keepOnSplit}))}function vt(t,e,n={}){const{empty:o,ranges:r}=t.selection,s=e?J(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(t=>!s||s.name===t.type.name).find(t=>K(t.attrs,n,{strict:!1}));let i=0;const a=[];if(r.forEach(({$from:e,$to:n})=>{const o=e.pos,r=n.pos;t.doc.nodesBetween(o,r,(t,e)=>{if(!t.isText&&!t.marks.length)return;const n=Math.max(o,e),s=Math.min(r,e+t.nodeSize);i+=s-n,a.push(...t.marks.map(t=>({mark:t,from:n,to:s})))})}),0===i)return!1;const c=a.filter(t=>!s||s.name===t.mark.type.name).filter(t=>K(t.mark.attrs,n,{strict:!1})).reduce((t,e)=>t+e.to-e.from,0),d=a.filter(t=>!s||t.mark.type!==s&&t.mark.type.excludes(s)).reduce((t,e)=>t+e.to-e.from,0);return(c>0?c+d:c)>=i}function bt(t,e,n={}){if(!e)return st(t,null,n)||vt(t,null,n);const o=it(e,t.schema);return"node"===o?st(t,e,n):"mark"===o&&vt(t,e,n)}function kt(t,e){const{nodeExtensions:n}=p(e),o=n.find(e=>e.name===t);if(!o)return!1;const r=x(l(o,"group",{name:o.name,options:o.options,storage:o.storage}));return"string"==typeof r&&r.split(" ").includes("list")}function wt(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if("hardBreak"===t.type.name)return!0;if(t.isText)return/^\s*$/m.test(null!==(o=t.text)&&void 0!==o?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(e){let o=!0;return t.content.forEach(t=>{!1!==o&&(wt(t,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function Mt(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(t=>null==e?void 0:e.includes(t.type.name));t.tr.ensureMarks(o)}}const St=(t,e)=>{const n=ut(t=>t.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===o)return!0;const s=t.doc.nodeAt(o);return n.node.type!==(null==s?void 0:s.type)||!r.canJoin(t.doc,n.pos)||(t.join(n.pos),!0)},Et=(t,e)=>{const n=ut(t=>t.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(void 0===o)return!0;const s=t.doc.nodeAt(o);return n.node.type!==(null==s?void 0:s.type)||!r.canJoin(t.doc,o)||(t.join(o),!0)};var Ot=Object.freeze({__proto__:null,blur:()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),null===(n=null===window||void 0===window?void 0:window.getSelection())||void 0===n||n.removeAllRanges())}),!0),clearContent:(t=!1)=>({commands:e})=>e.setContent("",t),clearNodes:()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:s}=o;return!n||(s.forEach(({$from:n,$to:o})=>{t.doc.nodesBetween(n.pos,o.pos,(t,n)=>{if(t.type.isText)return;const{doc:o,mapping:s}=e,i=o.resolve(s.map(n)),a=o.resolve(s.map(n+t.nodeSize)),c=i.blockRange(a);if(!c)return;const d=r.liftTarget(c);if(t.type.isTextblock){const{defaultType:t}=i.parent.contentMatchAt(i.index());e.setNodeMarkup(c.start,t)}(d||0===d)&&e.lift(c,d)})}),!0)},command:t=>e=>t(e),createParagraphNear:()=>({state:t,dispatch:e})=>s.createParagraphNear(t,e),cut:(e,n)=>({editor:o,tr:r})=>{const{state:s}=o,i=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const a=r.mapping.map(n);return r.insert(a,i.content),r.setSelection(new t.TextSelection(r.doc.resolve(Math.max(a-1,0)))),!0},deleteCurrentNode:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let n=r.depth;n>0;n-=1){if(r.node(n).type===o.type){if(e){const e=r.before(n),o=r.after(n);t.delete(e,o).scrollIntoView()}return!0}}return!1},deleteNode:t=>({tr:e,state:n,dispatch:o})=>{const r=h(t,n.schema),s=e.selection.$anchor;for(let t=s.depth;t>0;t-=1){if(s.node(t).type===r){if(o){const n=s.before(t),o=s.after(t);e.delete(n,o).scrollIntoView()}return!0}}return!1},deleteRange:t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},deleteSelection:()=>({state:t,dispatch:e})=>s.deleteSelection(t,e),enter:()=>({commands:t})=>t.keyboardShortcut("Enter"),exitCode:()=>({state:t,dispatch:e})=>s.exitCode(t,e),extendMarkRange:(e,n={})=>({tr:o,state:r,dispatch:s})=>{const i=J(e,r.schema),{doc:a,selection:c}=o,{$from:d,from:l,to:p}=c;if(s){const e=G(d,i,n);if(e&&e.from<=l&&e.to>=p){const n=t.TextSelection.create(a,e.from,e.to);o.setSelection(n)}}return!0},first:t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t<n.length;t+=1)if(n[t](e))return!0;return!1},focus:(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(Z()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&o.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())})};if(o.hasFocus()&&null===t||!1===t)return!0;if(s&&null===t&&!Y(n.state.selection))return i(),!0;const a=X(r.doc,t)||n.state.selection,c=n.state.selection.eq(a);return s&&(c||r.setSelection(a),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),i()),!0},forEach:(t,e)=>n=>t.every((t,o)=>e(t,{...n,index:o})),insertContent:(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),insertContentAt:(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var a;if(s){let s;const c=t=>{i.emit("contentError",{editor:i,error:t,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{nt(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(t){c(t)}try{s=nt(e,i.schema,{parseOptions:d,errorOnInvalidContent:null!==(a=n.errorOnInvalidContent)&&void 0!==a?a:i.options.enableContentCheck})}catch(t){return c(t),!1}let{from:l,to:p}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},u=!0,h=!0;if(("type"in s?[s]:s).forEach(t=>{t.check(),u=!!u&&(t.isText&&0===t.marks.length),h=!!h&&t.isBlock}),l===p&&h){const{parent:t}=r.doc.resolve(l);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(l-=1,p+=1)}let m;if(u){if(Array.isArray(e))m=e.map(t=>t.text||"").join("");else if(e instanceof o.Fragment){let t="";e.forEach(e=>{e.text&&(t+=e.text)}),m=t}else m="object"==typeof e&&e&&e.text?e.text:e;r.insertText(m,l,p)}else m=s,r.replaceWith(l,p,m);n.updateSelection&&ot(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:m})}return!0},joinBackward:()=>({state:t,dispatch:e})=>s.joinBackward(t,e),joinDown:()=>({state:t,dispatch:e})=>s.joinDown(t,e),joinForward:()=>({state:t,dispatch:e})=>s.joinForward(t,e),joinItemBackward:()=>({state:t,dispatch:e,tr:n})=>{try{const o=r.joinPoint(t.doc,t.selection.$from.pos,-1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch{return!1}},joinItemForward:()=>({state:t,dispatch:e,tr:n})=>{try{const o=r.joinPoint(t.doc,t.selection.$from.pos,1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch{return!1}},joinTextblockBackward:()=>({state:t,dispatch:e})=>s.joinTextblockBackward(t,e),joinTextblockForward:()=>({state:t,dispatch:e})=>s.joinTextblockForward(t,e),joinUp:()=>({state:t,dispatch:e})=>s.joinUp(t,e),keyboardShortcut:t=>({editor:e,view:n,tr:o,dispatch:r})=>{const s=function(t){const e=t.split(/-(?!$)/);let n,o,r,s,i=e[e.length-1];"Space"===i&&(i=" ");for(let t=0;t<e.length-1;t+=1){const i=e[t];if(/^(cmd|meta|m)$/i.test(i))s=!0;else if(/^a(lt)?$/i.test(i))n=!0;else if(/^(c|ctrl|control)$/i.test(i))o=!0;else if(/^s(hift)?$/i.test(i))r=!0;else{if(!/^mod$/i.test(i))throw new Error(`Unrecognized modifier name: ${i}`);Z()||rt()?s=!0:o=!0}}return n&&(i=`Alt-${i}`),o&&(i=`Ctrl-${i}`),s&&(i=`Meta-${i}`),r&&(i=`Shift-${i}`),i}(t).split(/-(?!$)/),i=s.find(t=>!["Alt","Ctrl","Meta","Shift"].includes(t)),a=new KeyboardEvent("keydown",{key:"Space"===i?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",t=>t(n,a))});return null==c||c.steps.forEach(t=>{const e=t.map(o.mapping);e&&r&&o.maybeStep(e)}),!0},lift:(t,e={})=>({state:n,dispatch:o})=>!!st(n,h(t,n.schema),e)&&s.lift(n,o),liftEmptyBlock:()=>({state:t,dispatch:e})=>s.liftEmptyBlock(t,e),liftListItem:t=>({state:e,dispatch:n})=>{const o=h(t,e.schema);return i.liftListItem(o)(e,n)},newlineInCode:()=>({state:t,dispatch:e})=>s.newlineInCode(t,e),resetAttributes:(t,e)=>({tr:n,state:o,dispatch:r})=>{let s=null,i=null;const a=it("string"==typeof t?t:t.name,o.schema);return!!a&&("node"===a&&(s=h(t,o.schema)),"mark"===a&&(i=J(t,o.schema)),r&&n.selection.ranges.forEach(t=>{o.doc.nodesBetween(t.$from.pos,t.$to.pos,(t,o)=>{s&&s===t.type&&n.setNodeMarkup(o,void 0,at(t.attrs,e)),i&&t.marks.length&&t.marks.forEach(r=>{i===r.type&&n.addMark(o,o+t.nodeSize,i.create(at(r.attrs,e)))})})}),!0)},scrollIntoView:()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:n})=>{if(n){const n=new t.AllSelection(e.doc);e.setSelection(n)}return!0},selectNodeBackward:()=>({state:t,dispatch:e})=>s.selectNodeBackward(t,e),selectNodeForward:()=>({state:t,dispatch:e})=>s.selectNodeForward(t,e),selectParentNode:()=>({state:t,dispatch:e})=>s.selectParentNode(t,e),selectTextblockEnd:()=>({state:t,dispatch:e})=>s.selectTextblockEnd(t,e),selectTextblockStart:()=>({state:t,dispatch:e})=>s.selectTextblockStart(t,e),setContent:(t,e=!1,n={},o={})=>({editor:r,tr:s,dispatch:i,commands:a})=>{var c,d;const{doc:l}=s;if("full"!==n.preserveWhitespace){const a=ct(t,r.schema,n,{errorOnInvalidContent:null!==(c=o.errorOnInvalidContent)&&void 0!==c?c:r.options.enableContentCheck});return i&&s.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!e),!0}return i&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:n,errorOnInvalidContent:null!==(d=o.errorOnInvalidContent)&&void 0!==d?d:r.options.enableContentCheck})},setMark:(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:s}=n,{empty:i,ranges:a}=s,c=J(t,o.schema);if(r)if(i){const t=dt(o,c);n.addStoredMark(c.create({...t,...e}))}else a.forEach(t=>{const r=t.$from.pos,s=t.$to.pos;o.doc.nodesBetween(r,s,(t,o)=>{const i=Math.max(o,r),a=Math.min(o+t.nodeSize,s);t.marks.find(t=>t.type===c)?t.marks.forEach(t=>{c===t.type&&n.addMark(i,a,c.create({...t.attrs,...e}))}):n.addMark(i,a,c.create(e))})});return function(t,e,n){var o;const{selection:r}=e;let s=null;if(Y(r)&&(s=r.$cursor),s){const e=null!==(o=t.storedMarks)&&void 0!==o?o:s.marks();return!!n.isInSet(e)||!e.some(t=>t.type.excludes(n))}const{ranges:i}=r;return i.some(({$from:e,$to:o})=>{let r=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,o.pos,(t,e,o)=>{if(r)return!1;if(t.isInline){const e=!o||o.type.allowsMarkType(n),s=!!n.isInSet(t.marks)||!t.marks.some(t=>t.type.excludes(n));r=e&&s}return!r}),r})}(o,n,c)},setMeta:(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),setNode:(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=h(t,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:t})=>!!s.setBlockType(i,{...a,...e})(n)||t.clearNodes()).command(({state:t})=>s.setBlockType(i,{...a,...e})(t,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:n,dispatch:o})=>{if(o){const{doc:o}=n,r=Q(e,0,o.content.size),s=t.NodeSelection.create(o,r);n.setSelection(s)}return!0},setTextSelection:e=>({tr:n,dispatch:o})=>{if(o){const{doc:o}=n,{from:r,to:s}="number"==typeof e?{from:e,to:e}:e,i=t.TextSelection.atStart(o).from,a=t.TextSelection.atEnd(o).to,c=Q(r,i,a),d=Q(s,i,a),l=t.TextSelection.create(o,c,d);n.setSelection(l)}return!0},sinkListItem:t=>({state:e,dispatch:n})=>{const o=h(t,e.schema);return i.sinkListItem(o)(e,n)},splitBlock:({keepMarks:e=!0}={})=>({tr:n,state:o,dispatch:s,editor:i})=>{const{selection:a,doc:c}=n,{$from:d,$to:l}=a,p=yt(i.extensionManager.attributes,d.node().type.name,d.node().attrs);if(a instanceof t.NodeSelection&&a.node.isBlock)return!(!d.parentOffset||!r.canSplit(c,d.pos))&&(s&&(e&&Mt(o,i.extensionManager.splittableMarks),n.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=0===d.depth?void 0:lt(d.node(-1).contentMatchAt(d.indexAfter(-1)));let m=u&&h?[{type:h,attrs:p}]:void 0,f=r.canSplit(n.doc,n.mapping.map(d.pos),1,m);if(m||f||!r.canSplit(n.doc,n.mapping.map(d.pos),1,h?[{type:h}]:void 0)||(f=!0,m=h?[{type:h,attrs:p}]:void 0),s){if(f&&(a instanceof t.TextSelection&&n.deleteSelection(),n.split(n.mapping.map(d.pos),1,m),h&&!u&&!d.parentOffset&&d.parent.type!==h)){const t=n.mapping.map(d.before()),e=n.doc.resolve(t);d.node(-1).canReplaceWith(e.index(),e.index()+1,h)&&n.setNodeMarkup(n.mapping.map(d.before()),h)}e&&Mt(o,i.extensionManager.splittableMarks),n.scrollIntoView()}return f},splitListItem:(e,n={})=>({tr:s,state:i,dispatch:a,editor:c})=>{var d;const l=h(e,i.schema),{$from:p,$to:u}=i.selection,m=i.selection.node;if(m&&m.isBlock||p.depth<2||!p.sameParent(u))return!1;const f=p.node(-1);if(f.type!==l)return!1;const g=c.extensionManager.attributes;if(0===p.parent.content.size&&p.node(-1).childCount===p.indexAfter(-1)){if(2===p.depth||p.node(-3).type!==l||p.index(-2)!==p.node(-2).childCount-1)return!1;if(a){let e=o.Fragment.empty;const r=p.index(-1)?1:p.index(-2)?2:3;for(let t=p.depth-r;t>=p.depth-3;t-=1)e=o.Fragment.from(p.node(t).copy(e));const i=p.indexAfter(-1)<p.node(-2).childCount?1:p.indexAfter(-2)<p.node(-3).childCount?2:3,a={...yt(g,p.node().type.name,p.node().attrs),...n},c=(null===(d=l.contentMatch.defaultType)||void 0===d?void 0:d.createAndFill(a))||void 0;e=e.append(o.Fragment.from(l.createAndFill(null,c)||void 0));const u=p.before(p.depth-(r-1));s.replace(u,p.after(-i),new o.Slice(e,4-r,0));let h=-1;s.doc.nodesBetween(u,s.doc.content.size,(t,e)=>{if(h>-1)return!1;t.isTextblock&&0===t.content.size&&(h=e+1)}),h>-1&&s.setSelection(t.TextSelection.near(s.doc.resolve(h))),s.scrollIntoView()}return!0}const x=u.pos===p.end()?f.contentMatchAt(0).defaultType:null,y={...yt(g,f.type.name,f.attrs),...n},v={...yt(g,p.node().type.name,p.node().attrs),...n};s.delete(p.pos,u.pos);const b=x?[{type:l,attrs:y},{type:x,attrs:v}]:[{type:l,attrs:y}];if(!r.canSplit(s.doc,p.pos,2))return!1;if(a){const{selection:t,storedMarks:e}=i,{splittableMarks:n}=c.extensionManager,o=e||t.$to.parentOffset&&t.$from.marks();if(s.split(p.pos,2,b).scrollIntoView(),!o||!a)return!0;const r=o.filter(t=>n.includes(t.type.name));s.ensureMarks(r)}return!0},toggleList:(t,e,n,o={})=>({editor:r,tr:s,state:i,dispatch:a,chain:c,commands:d,can:l})=>{const{extensions:p,splittableMarks:u}=r.extensionManager,m=h(t,i.schema),f=h(e,i.schema),{selection:g,storedMarks:x}=i,{$from:y,$to:v}=g,b=y.blockRange(v),k=x||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const w=ut(t=>kt(t.type.name,p))(g);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===m)return d.liftListItem(f);if(kt(w.node.type.name,p)&&m.validContent(w.node.content)&&a)return c().command(()=>(s.setNodeMarkup(w.pos,m),!0)).command(()=>St(s,m)).command(()=>Et(s,m)).run()}return n&&k&&a?c().command(()=>{const t=l().wrapInList(m,o),e=k.filter(t=>u.includes(t.type.name));return s.ensureMarks(e),!!t||d.clearNodes()}).wrapInList(m,o).command(()=>St(s,m)).command(()=>Et(s,m)).run():c().command(()=>!!l().wrapInList(m,o)||d.clearNodes()).wrapInList(m,o).command(()=>St(s,m)).command(()=>Et(s,m)).run()},toggleMark:(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:s=!1}=n,i=J(t,o.schema);return vt(o,i,e)?r.unsetMark(i,{extendEmptyMarkRange:s}):r.setMark(i,e)},toggleNode:(t,e,n={})=>({state:o,commands:r})=>{const s=h(t,o.schema),i=h(e,o.schema),a=st(o,s,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),a?r.setNode(i,c):r.setNode(s,{...c,...n})},toggleWrap:(t,e={})=>({state:n,commands:o})=>{const r=h(t,n.schema);return st(n,r,e)?o.lift(r):o.wrapIn(r,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let s;if(r.spec.isInputRules&&(s=r.getState(t))){if(e){const e=t.tr,n=s.transform;for(let t=n.steps.length-1;t>=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(s.text){const n=e.doc.resolve(s.from).marks();e.replaceWith(s.from,s.to,t.schema.text(s.text,n))}else e.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(e=>{t.removeMark(e.$from.pos,e.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:o,dispatch:r})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=n,c=J(t,o.schema),{$from:d,empty:l,ranges:p}=a;if(!r)return!0;if(l&&i){let{from:t,to:e}=a;const o=null===(s=d.marks().find(t=>t.type===c))||void 0===s?void 0:s.attrs,r=G(d,c,o);r&&(t=r.from,e=r.to),n.removeMark(t,e,c)}else p.forEach(t=>{n.removeMark(t.$from.pos,t.$to.pos,c)});return n.removeStoredMark(c),!0},updateAttributes:(t,e={})=>({tr:n,state:o,dispatch:r})=>{let s=null,i=null;const a=it("string"==typeof t?t:t.name,o.schema);return!!a&&("node"===a&&(s=h(t,o.schema)),"mark"===a&&(i=J(t,o.schema)),r&&n.selection.ranges.forEach(t=>{const r=t.$from.pos,a=t.$to.pos;let c,d,l,p;n.selection.empty?o.doc.nodesBetween(r,a,(t,e)=>{s&&s===t.type&&(l=Math.max(e,r),p=Math.min(e+t.nodeSize,a),c=e,d=t)}):o.doc.nodesBetween(r,a,(t,o)=>{o<r&&s&&s===t.type&&(l=Math.max(o,r),p=Math.min(o+t.nodeSize,a),c=o,d=t),o>=r&&o<=a&&(s&&s===t.type&&n.setNodeMarkup(o,void 0,{...t.attrs,...e}),i&&t.marks.length&&t.marks.forEach(s=>{if(i===s.type){const c=Math.max(o,r),d=Math.min(o+t.nodeSize,a);n.addMark(c,d,i.create({...s.attrs,...e}))}}))}),d&&(void 0!==c&&n.setNodeMarkup(c,void 0,{...d.attrs,...e}),i&&d.marks.length&&d.marks.forEach(t=>{i===t.type&&n.addMark(l,p,i.create({...t.attrs,...e}))}))}),!0)},wrapIn:(t,e={})=>({state:n,dispatch:o})=>{const r=h(t,n.schema);return s.wrapIn(r,e)(n,o)},wrapInList:(t,e={})=>({state:n,dispatch:o})=>{const r=h(t,n.schema);return i.wrapInList(r,e)(n,o)}});const Ct=H.create({name:"commands",addCommands:()=>({...Ot})}),Tt=H.create({name:"drop",addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),Pt=H.create({name:"editable",addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),At=new t.PluginKey("focusEvents"),$t=H.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new t.Plugin({key:At,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const o=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(o),!1},blur:(t,n)=>{e.isFocused=!1;const o=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(o),!1}}}})]}}),jt=H.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:n})=>{const{selection:o,doc:r}=n,{empty:s,$anchor:i}=o,{pos:a,parent:c}=i,d=i.parent.isTextblock&&a>0?n.doc.resolve(a-1):i,l=d.parent.type.spec.isolating,p=i.pos-i.parentOffset,u=l&&1===d.parent.childCount?p===i.pos:t.Selection.atStart(r).from===a;return!(!s||!c.type.isTextblock||c.textContent.length||!u||u&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),n=()=>this.editor.commands.first(({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:n,"Mod-Delete":n,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},s={...o,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":n,"Ctrl-Alt-Backspace":n,"Alt-Delete":n,"Alt-d":n,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Z()||rt()?s:r},addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("clearDocument"),appendTransaction:(e,n,o)=>{if(e.some(t=>t.getMeta("composition")))return;const r=e.some(t=>t.docChanged)&&!n.doc.eq(o.doc),s=e.some(t=>t.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:d,to:l}=n.selection,p=t.Selection.atStart(n.doc).from,u=t.Selection.atEnd(n.doc).to;if(i||!(d===p&&l===u))return;if(!wt(o.doc))return;const h=o.tr,m=a({state:o,transaction:h}),{commands:f}=new c({editor:this.editor,state:m});return f.clearNodes(),h.steps.length?h:void 0}})]}}),Nt=H.create({name:"paste",addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),It=H.create({name:"tabindex",addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Rt{get name(){return this.node.type.name}constructor(t,e,n=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=t,this.editor=e,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return null!==(t=this.actualDepth)&&void 0!==t?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);e=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:e,to:n},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),e=this.resolvedPos.doc.resolve(t);return new Rt(e,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Rt(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Rt(t,this.editor)}get children(){const t=[];return this.node.content.forEach((e,n)=>{const o=e.isBlock&&!e.isTextblock,r=e.isAtom&&!e.isText,s=this.pos+n+(r?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const i=this.resolvedPos.doc.resolve(s);if(!o&&i.depth<=this.depth)return;const a=new Rt(i,this.editor,o,o?e:null);o&&(a.actualDepth=this.depth+1),t.push(new Rt(i,this.editor,o,o?e:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let n=null,o=this.parent;for(;o&&!n;){if(o.node.type.name===t)if(Object.keys(e).length>0){const t=o.node.attrs,n=Object.keys(e);for(let o=0;o<n.length;o+=1){const r=n[o];if(t[r]!==e[r])break}}else n=o;o=o.parent}return n}querySelector(t,e={}){return this.querySelectorAll(t,e,!0)[0]||null}querySelectorAll(t,e={},n=!1){let o=[];if(!this.children||0===this.children.length)return o;const r=Object.keys(e);return this.children.forEach(s=>{if(!(n&&o.length>0)){if(s.node.type.name===t){r.every(t=>e[t]===s.node.attrs[t])&&o.push(s)}n&&o.length>0||(o=o.concat(s.querySelectorAll(t,e,n)))}}),o}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}}function Bt(t,e,n){const o=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(null!==o)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style"+(n?`-${n}`:""),""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}class Dt{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=x(l(this,"addOptions",{name:this.name}))),this.storage=x(l(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Dt(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>j(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new Dt(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=x(l(e,"addOptions",{name:e.name})),e.storage=x(l(e,"addStorage",{name:e.name,options:e.options})),e}}exports.CommandManager=c,exports.Editor=class extends d{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:t,slice:e,moved:n})=>this.options.onDrop(t,e,n)),this.on("paste",({event:t,slice:e})=>this.options.onPaste(t,e)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Bt('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=g(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(t=>{const e="string"==typeof t?`${t}$`:t.key;n=n.filter(t=>!t.key.startsWith(e))}),e.length===n.length)return;const o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[Pt,q.configure({blockSeparator:null===(e=null===(t=this.options.coreExtensionOptions)||void 0===t?void 0:t.clipboardTextSerializer)||void 0===e?void 0:e.blockSeparator}),Ct,$t,jt,It,Tt,Nt].filter(t=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[t.name]):[],...this.options.extensions].filter(t=>["extension","node","mark"].includes(null==t?void 0:t.type));this.extensionManager=new L(n,this)}createCommandManager(){this.commandManager=new c({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var n;let o;try{o=ct(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>"collaboration"!==t.name),this.createExtensionManager()}}),o=ct(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=X(o,this.options.autofocus);this.view=new e.EditorView(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null===(n=this.options.editorProps)||void 0===n?void 0:n.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:t.EditorState.create({doc:o,selection:r||void 0})});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.createNodeViews(),this.prependClass();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach(t=>{var e;return null===(e=this.capturedTransaction)||void 0===e?void 0:e.step(t)}):void(this.capturedTransaction=t);const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=t.getMeta("focus"),r=t.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:t}),r&&this.emit("blur",{editor:this,event:r.event,transaction:t}),t.docChanged&&!t.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return ft(this.state,t)}isActive(t,e){const n="string"==typeof t?t:null,o="string"==typeof t?e:t;return bt(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return E(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e="\n\n",textSerializers:n={}}=t||{};return ht(this.state.doc,{blockSeparator:e,textSerializers:{..._(this.schema),...n}})}get isEmpty(){return wt(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(null===(t=this.view)||void 0===t?void 0:t.docView)}$node(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Rt(e,this)}get $doc(){return this.$pos(0)}},exports.Extension=H,exports.InputRule=T,exports.Mark=N,exports.Node=Dt,exports.NodePos=Rt,exports.PasteRule=R,exports.callOrReturn=x,exports.canInsertNode=function(e,n){const{selection:o}=e,{$from:r}=o;if(o instanceof t.NodeSelection){const t=r.index();return r.parent.canReplaceWith(t,t+1,n)}let s=r.depth;for(;s>=0;){const t=r.index(s);if(r.node(s).contentMatchAt(t).matchType(n))return!0;s-=1}return!1},exports.combineTransactionSteps=function(t,e){const n=new r.Transform(t);return e.forEach(t=>{t.steps.forEach(t=>{n.step(t)})}),n},exports.createChainableState=a,exports.createDocument=ct,exports.createNodeFromContent=nt,exports.createStyleTag=Bt,exports.defaultBlockAt=lt,exports.deleteProps=at,exports.elementFromString=et,exports.escapeForRegEx=function(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},exports.findChildrenInRange=function(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(t,e)=>{n(t)&&o.push({node:t,pos:e})}),o},exports.findDuplicates=z,exports.findParentNode=ut,exports.findParentNodeClosestToPos=pt,exports.fromString=v,exports.getAttributes=ft,exports.getAttributesFromExtensions=u,exports.getChangedRanges=function(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((t,r)=>{const s=[];if(t.ranges.length)t.forEach((t,e)=>{s.push({from:t,to:e})});else{const{from:t,to:e}=n[r];if(void 0===t||void 0===e)return;s.push({from:t,to:e})}s.forEach(({from:t,to:n})=>{const s=e.slice(r).map(t,-1),i=e.slice(r).map(n),a=e.invert().map(s,-1),c=e.invert().map(i);o.push({oldRange:{from:a,to:c},newRange:{from:s,to:i}})})}),function(t){const e=gt(t);return 1===e.length?e:e.filter((t,n)=>!e.filter((t,e)=>e!==n).some(e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))}(o)},exports.getExtensionField=l,exports.getHTMLFromFragment=E,exports.getMarkAttributes=dt,exports.getMarkRange=G,exports.getMarkType=J,exports.getMarksBetween=xt,exports.getNodeAttributes=mt,exports.getNodeType=h,exports.getRenderedAttributes=f,exports.getSchemaByResolvedExtensions=w,exports.getSchemaTypeByName=M,exports.getSchemaTypeNameByName=it,exports.getSplittedAttributes=yt,exports.getText=ht,exports.getTextBetween=V,exports.getTextContentFromNodes=O,exports.getTextSerializersFromSchema=_,exports.injectExtensionAttributesToParseRule=b,exports.inputRulesPlugin=A,exports.isActive=bt,exports.isEmptyObject=y,exports.isExtensionRulesEnabled=S,exports.isFunction=g,exports.isList=kt,exports.isMacOS=rt,exports.isMarkActive=vt,exports.isNodeActive=st,exports.isNodeEmpty=wt,exports.isNodeSelection=function(e){return e instanceof t.NodeSelection},exports.isNumber=I,exports.isPlainObject=$,exports.isRegExp=C,exports.isTextSelection=Y,exports.isiOS=Z,exports.markInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o})=>{const r=x(t.getAttributes,void 0,o);if(!1===r||null===r)return null;const{tr:s}=e,i=o[o.length-1],a=o[0];if(i){const o=a.search(/\S/),c=n.from+a.indexOf(i),d=c+i.length;if(xt(n.from,n.to,e.doc).filter(e=>e.mark.type.excluded.find(n=>n===t.type&&n!==e.mark.type)).filter(t=>t.to>c).length)return null;d<n.to&&s.delete(d,n.to),c>n.from&&s.delete(n.from+o,c);const l=n.from+o+i.length;s.addMark(n.from+o,l,t.type.create(r||{})),s.removeStoredMark(t.type)}}})},exports.markPasteRule=function(t){return new R({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const s=x(t.getAttributes,void 0,o,r);if(!1===s||null===s)return null;const{tr:i}=e,a=o[o.length-1],c=o[0];let d=n.to;if(a){const o=c.search(/\S/),r=n.from+c.indexOf(a),l=r+a.length;if(xt(n.from,n.to,e.doc).filter(e=>e.mark.type.excluded.find(n=>n===t.type&&n!==e.mark.type)).filter(t=>t.to>r).length)return null;l<n.to&&i.delete(l,n.to),r>n.from&&i.delete(n.from+o,r),d=n.from+o+a.length,i.addMark(n.from+o,d,t.type.create(s||{})),i.removeStoredMark(t.type)}}})},exports.mergeAttributes=m,exports.mergeDeep=j,exports.minMax=Q,exports.nodeInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o})=>{const r=x(t.getAttributes,void 0,o)||{},{tr:s}=e,i=n.from;let a=n.to;const c=t.type.create(r);if(o[1]){let t=i+o[0].lastIndexOf(o[1]);t>a?t=a:a=t+o[1].length;const e=o[0][o[0].length-1];s.insertText(e,i+o[0].length-1),s.replaceWith(t,a,c)}else if(o[0]){const e=t.type.isInline?i:i-1;s.insert(e,t.type.create(r)).delete(s.mapping.map(i),s.mapping.map(a))}s.scrollIntoView()}})},exports.nodePasteRule=function(t){return new R({find:t.find,handler({match:e,chain:n,range:o,pasteEvent:r}){const s=x(t.getAttributes,void 0,e,r),i=x(t.getContent,void 0,s);if(!1===s||null===s)return null;const a={type:t.type.name,attrs:s};i&&(a.content=i),e.input&&n().deleteRange(o).insertContentAt(o.from,a)}})},exports.objectIncludes=K,exports.pasteRulesPlugin=F,exports.posToDOMRect=function(t,e,n){const o=t.state.doc.content.size,r=Q(e,0,o),s=Q(n,0,o),i=t.coordsAtPos(r),a=t.coordsAtPos(s,-1),c=Math.min(i.top,a.top),d=Math.max(i.bottom,a.bottom),l=Math.min(i.left,a.left),p=Math.max(i.right,a.right),u={top:c,bottom:d,left:l,right:p,width:p-l,height:d-c,x:l,y:c};return{...u,toJSON:()=>u}},exports.removeDuplicates=gt,exports.resolveFocusPosition=X,exports.selectionToInsertionEnd=ot,exports.splitExtensions=p,exports.textInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o})=>{let r=t.replace,s=n.from;const i=n.to;if(o[1]){const t=o[0].lastIndexOf(o[1]);r+=o[0].slice(t+o[1].length),s+=t;const e=s-i;e>0&&(r=o[0].slice(t-e,t)+r,s=i)}e.tr.insertText(r,s,i)}})},exports.textblockTypeInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o})=>{const r=e.doc.resolve(n.from),s=x(t.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})},exports.wrappingInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o,chain:s})=>{const i=x(t.getAttributes,void 0,o)||{},a=e.tr.delete(n.from,n.to),c=a.doc.resolve(n.from).blockRange(),d=c&&r.findWrapping(c,t.type,i);if(!d)return null;if(a.wrap(c,d),t.keepMarks&&t.editor){const{selection:n,storedMarks:o}=e,{splittableMarks:r}=t.editor.extensionManager,s=o||n.$to.parentOffset&&n.$from.marks();if(s){const t=s.filter(t=>r.includes(t.type.name));a.ensureMarks(t)}}if(t.keepAttributes){const e="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";s().updateAttributes(e,i).run()}const l=a.doc.resolve(n.from-1).nodeBefore;l&&l.type===t.type&&r.canJoin(a.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,l))&&a.join(n.from-1)}})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../../../prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js"),e=require("../../../../../prosemirror-view@1.41.3/node_modules/prosemirror-view/dist/index.js"),n=require("../../../../../prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.js"),o=require("../../../../../prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.js"),r=require("../../../../../prosemirror-transform@1.10.5/node_modules/prosemirror-transform/dist/index.js"),s=require("../../../../../prosemirror-commands@1.7.1/node_modules/prosemirror-commands/dist/index.js"),i=require("../../../../../prosemirror-schema-list@1.5.1/node_modules/prosemirror-schema-list/dist/index.js");function a(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,s=n.storedMarks,n}}}class c{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:r}=n,s=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,(...t)=>{const n=e(...t)(s);return r.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(r),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:s}=o,i=[],a=!!t,c=t||r.tr,d={...Object.fromEntries(Object.entries(n).map(([t,n])=>[t,(...t)=>{const o=this.buildProps(c,e),r=n(...t)(o);return i.push(r),d}])),run:()=>(a||!e||c.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(c),i.every(t=>!0===t))};return d}createCan(t){const{rawCommands:e,state:n}=this,o=!1,r=t||n.tr,s=this.buildProps(r,o),i=Object.fromEntries(Object.entries(e).map(([t,e])=>[t,(...t)=>e(...t)({...s,dispatch:void 0})]));return{...i,chain:()=>this.createChain(r,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:s}=o,i={tr:t,editor:o,view:s,state:a({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([t,e])=>[t,(...t)=>e(...t)(i)]))}};return i}}class d{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(t=>t.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(t=>t!==e):delete this.callbacks[t]),this}once(t,e){const n=(...o)=>{this.off(t,n),e.apply(this,o)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}}function l(t,e,n){if(void 0===t.config[e]&&t.parent)return l(t.parent,e,n);if("function"==typeof t.config[e]){return t.config[e].bind({...n,parent:t.parent?l(t.parent,e,n):null})}return t.config[e]}function p(t){return{baseExtensions:t.filter(t=>"extension"===t.type),nodeExtensions:t.filter(t=>"node"===t.type),markExtensions:t.filter(t=>"mark"===t.type)}}function u(t){const e=[],{nodeExtensions:n,markExtensions:o}=p(t),r=[...n,...o],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(t=>{const n=l(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage,extensions:r});if(!n)return;n().forEach(t=>{t.types.forEach(n=>{Object.entries(t.attributes).forEach(([t,o])=>{e.push({type:n,name:t,attribute:{...s,...o}})})})})}),r.forEach(t=>{const n={name:t.name,options:t.options,storage:t.storage},o=l(t,"addAttributes",n);if(!o)return;const r=o();Object.entries(r).forEach(([n,o])=>{const r={...s,...o};"function"==typeof(null==r?void 0:r.default)&&(r.default=r.default()),(null==r?void 0:r.isRequired)&&void 0===(null==r?void 0:r.default)&&delete r.default,e.push({type:t.name,name:n,attribute:r})})}),e}function h(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function m(...t){return t.filter(t=>!!t).reduce((t,e)=>{const n={...t};return Object.entries(e).forEach(([t,e])=>{if(n[t])if("class"===t){const o=e?String(e).split(" "):[],r=n[t]?n[t].split(" "):[],s=o.filter(t=>!r.includes(t));n[t]=[...r,...s].join(" ")}else if("style"===t){const o=e?e.split(";").map(t=>t.trim()).filter(Boolean):[],r=n[t]?n[t].split(";").map(t=>t.trim()).filter(Boolean):[],s=new Map;r.forEach(t=>{const[e,n]=t.split(":").map(t=>t.trim());s.set(e,n)}),o.forEach(t=>{const[e,n]=t.split(":").map(t=>t.trim());s.set(e,n)}),n[t]=Array.from(s.entries()).map(([t,e])=>`${t}: ${e}`).join("; ")}else n[t]=e;else n[t]=e}),n},{})}function f(t,e){return e.filter(e=>e.type===t.type.name).filter(t=>t.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]}).reduce((t,e)=>m(t,e),{})}function g(t){return"function"==typeof t}function v(t,e=void 0,...n){return g(t)?e?t.bind(e)(...n):t(...n):t}function y(t={}){return 0===Object.keys(t).length&&t.constructor===Object}function x(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}function b(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===o)return!1;const r=e.reduce((t,e)=>{const o=e.attribute.parseHTML?e.attribute.parseHTML(n):x(n.getAttribute(e.name));return null==o?t:{...t,[e.name]:o}},{});return{...o,...r}}}}function k(t){return Object.fromEntries(Object.entries(t).filter(([t,e])=>("attrs"!==t||!y(e))&&null!=e))}function w(t,e){var n;const r=u(t),{nodeExtensions:s,markExtensions:i}=p(t),a=null===(n=s.find(t=>l(t,"topNode")))||void 0===n?void 0:n.name,c=Object.fromEntries(s.map(n=>{const o=r.filter(t=>t.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e},i=k({...t.reduce((t,e)=>{const o=l(e,"extendNodeSchema",s);return{...t,...o?o(n):{}}},{}),content:v(l(n,"content",s)),marks:v(l(n,"marks",s)),group:v(l(n,"group",s)),inline:v(l(n,"inline",s)),atom:v(l(n,"atom",s)),selectable:v(l(n,"selectable",s)),draggable:v(l(n,"draggable",s)),code:v(l(n,"code",s)),whitespace:v(l(n,"whitespace",s)),linebreakReplacement:v(l(n,"linebreakReplacement",s)),defining:v(l(n,"defining",s)),isolating:v(l(n,"isolating",s)),attrs:Object.fromEntries(o.map(t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]}))}),a=v(l(n,"parseHTML",s));a&&(i.parseDOM=a.map(t=>b(t,o)));const c=l(n,"renderHTML",s);c&&(i.toDOM=t=>c({node:t,HTMLAttributes:f(t,o)}));const d=l(n,"renderText",s);return d&&(i.toText=d),[n.name,i]})),d=Object.fromEntries(i.map(n=>{const o=r.filter(t=>t.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e},i=k({...t.reduce((t,e)=>{const o=l(e,"extendMarkSchema",s);return{...t,...o?o(n):{}}},{}),inclusive:v(l(n,"inclusive",s)),excludes:v(l(n,"excludes",s)),group:v(l(n,"group",s)),spanning:v(l(n,"spanning",s)),code:v(l(n,"code",s)),attrs:Object.fromEntries(o.map(t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]}))}),a=v(l(n,"parseHTML",s));a&&(i.parseDOM=a.map(t=>b(t,o)));const c=l(n,"renderHTML",s);return c&&(i.toDOM=t=>c({mark:t,HTMLAttributes:f(t,o)})),[n.name,i]}));return new o.Schema({topNode:a,nodes:c,marks:d})}function M(t,e){return e.nodes[t]||e.marks[t]||null}function S(t,e){return Array.isArray(e)?e.some(e=>("string"==typeof e?e:e.name)===t.name):e}function E(t,e){const n=o.DOMSerializer.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const O=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(t,e,r,s)=>{var i,a;const c=(null===(a=(i=t.type.spec).toText)||void 0===a?void 0:a.call(i,{node:t,pos:e,parent:r,index:s}))||t.textContent||"%leaf%";n+=t.isAtom&&!t.isText?c:c.slice(0,Math.max(0,o-e))}),n};function C(t){return"[object RegExp]"===Object.prototype.toString.call(t)}class T{constructor(t){this.find=t.find,this.handler=t.handler}}function P(t){var e;const{editor:n,from:o,to:r,text:s,rules:i,plugin:d}=t,{view:l}=n;if(l.composing)return!1;const p=l.state.doc.resolve(o);if(p.parent.type.spec.code||(null===(e=p.nodeBefore||p.nodeAfter)||void 0===e?void 0:e.marks.find(t=>t.type.spec.code)))return!1;let u=!1;const h=O(p)+s;return i.forEach(t=>{if(u)return;const e=((t,e)=>{if(C(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o})(h,t.find);if(!e)return;const i=l.state.tr,p=a({state:l.state,transaction:i}),m={from:o-(e[0].length-s.length),to:r},{commands:f,chain:g,can:v}=new c({editor:n,state:p});null!==t.handler({state:p,range:m,match:e,commands:f,chain:g,can:v})&&i.steps.length&&(i.setMeta(d,{transform:i,from:o,to:r,text:s}),l.dispatch(i),u=!0)}),u}function A(e){const{editor:n,rules:r}=e,s=new t.Plugin({state:{init:()=>null,apply(t,e,i){const a=t.getMeta(s);if(a)return a;const c=t.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:t}=c;"string"==typeof t||(t=E(o.Fragment.from(t),i.schema));const{from:e}=c,a=e+t.length;P({editor:n,from:e,to:a,text:t,rules:r,plugin:s})}),t.selectionSet||t.docChanged?null:e}},props:{handleTextInput:(t,e,o,i)=>P({editor:n,from:e,to:o,text:i,rules:r,plugin:s}),handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:e}=t.state.selection;e&&P({editor:n,from:e.pos,to:e.pos,text:"",rules:r,plugin:s})}),!1)},handleKeyDown(t,e){if("Enter"!==e.key)return!1;const{$cursor:o}=t.state.selection;return!!o&&P({editor:n,from:o.pos,to:o.pos,text:"\n",rules:r,plugin:s})}},isInputRules:!0});return s}function N(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&(t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype)}function $(t,e){const n={...t};return N(t)&&N(e)&&Object.keys(e).forEach(o=>{N(e[o])&&N(t[o])?n[o]=$(t[o],e[o]):n[o]=e[o]}),n}class j{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=v(l(this,"addOptions",{name:this.name}))),this.storage=v(l(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new j(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>$(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new j(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=v(l(e,"addOptions",{name:e.name})),e.storage=v(l(e,"addStorage",{name:e.name,options:e.options})),e}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){const r=o.marks();if(!!!r.find(t=>(null==t?void 0:t.type.name)===e.name))return!1;const s=r.find(t=>(null==t?void 0:t.type.name)===e.name);return s&&n.removeStoredMark(s),n.insertText(" ",o.pos),t.view.dispatch(n),!0}return!1}}function I(t){return"number"==typeof t}class R{constructor(t){this.find=t.find,this.handler=t.handler}}function D(t){const{editor:e,state:n,from:o,to:r,rule:s,pasteEvent:i,dropEvent:a}=t,{commands:d,chain:l,can:p}=new c({editor:e,state:n}),u=[];n.doc.nodesBetween(o,r,(t,e)=>{if(!t.isTextblock||t.type.spec.code)return;const c=Math.max(o,e),h=Math.min(r,e+t.content.size);((t,e,n)=>{if(C(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n}):[]})(t.textBetween(c-e,h-e,void 0,""),s.find,i).forEach(t=>{if(void 0===t.index)return;const e=c+t.index+1,o=e+t[0].length,r={from:n.tr.mapping.map(e),to:n.tr.mapping.map(o)},h=s.handler({state:n,range:r,match:t,commands:d,chain:l,can:p,pasteEvent:i,dropEvent:a});u.push(h)})});return u.every(t=>null!==t)}let B=null;function L(e){const{editor:n,rules:r}=e;let s,i=null,c=!1,d=!1,l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{s="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{s=null}const p=({state:t,from:e,to:o,rule:r,pasteEvt:i})=>{const c=t.tr,d=a({state:t,transaction:c});if(D({editor:n,state:d,from:Math.max(e-1,0),to:o.b-1,rule:r,pasteEvent:i,dropEvent:s})&&c.steps.length){try{s="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{s=null}return l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,c}};return r.map(e=>new t.Plugin({view(t){const e=e=>{var o;i=(null===(o=t.dom.parentElement)||void 0===o?void 0:o.contains(e.target))?t.dom.parentElement:null,i&&(B=n)},o=()=>{B&&(B=null)};return window.addEventListener("dragstart",e),window.addEventListener("dragend",o),{destroy(){window.removeEventListener("dragstart",e),window.removeEventListener("dragend",o)}}},props:{handleDOMEvents:{drop:(t,e)=>{if(d=i===t.dom.parentElement,s=e,!d){const t=B;(null==t?void 0:t.isEditable)&&setTimeout(()=>{const e=t.state.selection;e&&t.commands.deleteRange({from:e.from,to:e.to})},10)}return!1},paste:(t,e)=>{var n;const o=null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/html");return l=e,c=!!(null==o?void 0:o.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const s=t[0],i="paste"===s.getMeta("uiEvent")&&!c,a="drop"===s.getMeta("uiEvent")&&!d,u=s.getMeta("applyPasteRules"),h=!!u;if(!i&&!a&&!h)return;if(h){let{text:t}=u;"string"==typeof t||(t=E(o.Fragment.from(t),r.schema));const{from:n}=u,s=n+t.length,i=(t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(e=n.clipboardData)||void 0===e||e.setData("text/html",t),n})(t);return p({rule:e,state:r,from:n,to:{b:s},pasteEvt:i})}const m=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return I(m)&&f&&m!==f.b?p({rule:e,state:r,from:m,to:f,pasteEvt:l}):void 0}}))}function F(t){const e=t.filter((e,n)=>t.indexOf(e)!==n);return Array.from(new Set(e))}class z{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=z.resolve(t),this.schema=w(this.extensions,e),this.setupExtensions()}static resolve(t){const e=z.sort(z.flatten(t)),n=F(e.map(t=>t.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(t=>`'${t}'`).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map(t=>{const e=l(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...this.flatten(e())]:t}).flat(10)}static sort(t){return t.sort((t,e)=>{const n=l(t,"priority")||100,o=l(e,"priority")||100;return n>o?-1:n<o?1:0})}get commands(){return this.extensions.reduce((t,e)=>{const n=l(e,"addCommands",{name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:M(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=z.sort([...this.extensions].reverse()),o=[],r=[],s=e.map(e=>{const s={name:e.name,options:e.options,storage:e.storage,editor:t,type:M(e.name,this.schema)},i=[],a=l(e,"addKeyboardShortcuts",s);let c={};if("mark"===e.type&&l(e,"exitable",s)&&(c.ArrowRight=()=>j.handleExit({editor:t,mark:e})),a){const e=Object.fromEntries(Object.entries(a()).map(([e,n])=>[e,()=>n({editor:t})]));c={...c,...e}}const d=n.keymap(c);i.push(d);const p=l(e,"addInputRules",s);S(e,t.options.enableInputRules)&&p&&o.push(...p());const u=l(e,"addPasteRules",s);S(e,t.options.enablePasteRules)&&u&&r.push(...u());const h=l(e,"addProseMirrorPlugins",s);if(h){const t=h();i.push(...t)}return i}).flat();return[A({editor:t,rules:o}),...L({editor:t,rules:r}),...s]}get attributes(){return u(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=p(this.extensions);return Object.fromEntries(e.filter(t=>!!l(t,"addNodeView")).map(e=>{const n=this.attributes.filter(t=>t.type===e.name),o={name:e.name,options:e.options,storage:e.storage,editor:t,type:h(e.name,this.schema)},r=l(e,"addNodeView",o);if(!r)return[];return[e.name,(o,s,i,a,c)=>{const d=f(o,n);return r()({node:o,view:s,getPos:i,decorations:a,innerDecorations:c,editor:t,extension:e,HTMLAttributes:d})}]}))}setupExtensions(){this.extensions.forEach(t=>{var e;this.editor.extensionStorage[t.name]=t.storage;const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:M(t.name,this.schema)};if("mark"===t.type){(null===(e=v(l(t,"keepOnSplit",n)))||void 0===e||e)&&this.splittableMarks.push(t.name)}const o=l(t,"onBeforeCreate",n),r=l(t,"onCreate",n),s=l(t,"onUpdate",n),i=l(t,"onSelectionUpdate",n),a=l(t,"onTransaction",n),c=l(t,"onFocus",n),d=l(t,"onBlur",n),p=l(t,"onDestroy",n);o&&this.editor.on("beforeCreate",o),r&&this.editor.on("create",r),s&&this.editor.on("update",s),i&&this.editor.on("selectionUpdate",i),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),p&&this.editor.on("destroy",p)})}}class H{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=v(l(this,"addOptions",{name:this.name}))),this.storage=v(l(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new H(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>$(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new H({...this.config,...t});return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=v(l(e,"addOptions",{name:e.name})),e.storage=v(l(e,"addStorage",{name:e.name,options:e.options})),e}}function V(t,e,n){const{from:o,to:r}=e,{blockSeparator:s="\n\n",textSerializers:i={}}=n||{};let a="";return t.nodesBetween(o,r,(t,n,c,d)=>{var l;t.isBlock&&n>o&&(a+=s);const p=null==i?void 0:i[t.type.name];if(p)return c&&(a+=p({node:t,pos:n,parent:c,index:d,range:e})),!1;t.isText&&(a+=null===(l=null==t?void 0:t.text)||void 0===l?void 0:l.slice(Math.max(o,n)-n,r-n))}),a}function _(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}const W=H.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:s}=r,i=Math.min(...s.map(t=>t.$from.pos)),a=Math.max(...s.map(t=>t.$to.pos)),c=_(n);return V(o,{from:i,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}});function q(t,e,n={strict:!0}){const o=Object.keys(e);return!o.length||o.every(o=>n.strict?e[o]===t[o]:C(e[o])?e[o].test(t[o]):e[o]===t[o])}function K(t,e,n={}){return t.find(t=>t.type===e&&q(Object.fromEntries(Object.keys(n).map(e=>[e,t.attrs[e]])),n))}function U(t,e,n={}){return!!K(t,e,n)}function G(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(r.node&&r.node.marks.some(t=>t.type===e)||(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(t=>t.type===e))return;n=n||(null===(o=r.node.marks[0])||void 0===o?void 0:o.attrs);if(!K([...r.node.marks],e,n))return;let s=r.index,i=t.start()+r.offset,a=s+1,c=i+r.node.nodeSize;for(;s>0&&U([...t.parent.child(s-1).marks],e,n);)s-=1,i-=t.parent.child(s).nodeSize;for(;a<t.parent.childCount&&U([...t.parent.child(a).marks],e,n);)c+=t.parent.child(a).nodeSize,a+=1;return{from:i,to:c}}function J(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}function X(e){return e instanceof t.TextSelection}function Y(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Q(e,n=null){if(!n)return null;const o=t.Selection.atStart(e),r=t.Selection.atEnd(e);if("start"===n||!0===n)return o;if("end"===n)return r;const s=o.from,i=r.to;return"all"===n?t.TextSelection.create(e,Y(0,s,i),Y(e.content.size,s,i)):t.TextSelection.create(e,Y(n,s,i),Y(n,s,i))}function Z(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function tt(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const et=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];3===o.nodeType&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):1===o.nodeType&&et(o)}return t};function nt(t){const e=`<body>${t}</body>`,n=(new window.DOMParser).parseFromString(e,"text/html").body;return et(n)}function ot(t,e,n){if(t instanceof o.Node||t instanceof o.Fragment)return t;n={slice:!0,parseOptions:{},...n};const r="string"==typeof t;if("object"==typeof t&&null!==t)try{if(Array.isArray(t)&&t.length>0)return o.Fragment.fromArray(t.map(t=>e.nodeFromJSON(t)));const r=e.nodeFromJSON(t);return n.errorOnInvalidContent&&r.check(),r}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),ot("",e,n)}if(r){if(n.errorOnInvalidContent){let r=!1,s="";const i=new o.Schema({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:t=>(r=!0,s="string"==typeof t?t:t.outerHTML,null)}]}})});if(n.slice?o.DOMParser.fromSchema(i).parseSlice(nt(t),n.parseOptions):o.DOMParser.fromSchema(i).parse(nt(t),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}const r=o.DOMParser.fromSchema(e);return n.slice?r.parseSlice(nt(t),n.parseOptions).content:r.parse(nt(t),n.parseOptions)}return ot("",e,n)}function rt(e,n,o){const s=e.steps.length-1;if(s<n)return;const i=e.steps[s];if(!(i instanceof r.ReplaceStep||i instanceof r.ReplaceAroundStep))return;const a=e.mapping.maps[s];let c=0;a.forEach((t,e,n,o)=>{0===c&&(c=o)}),e.setSelection(t.Selection.near(e.doc.resolve(c),o))}function st(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function it(t,e,n={}){const{from:o,to:r,empty:s}=t.selection,i=e?h(e,t.schema):null,a=[];t.doc.nodesBetween(o,r,(t,e)=>{if(t.isText)return;const n=Math.max(o,e),s=Math.min(r,e+t.nodeSize);a.push({node:t,from:n,to:s})});const c=r-o,d=a.filter(t=>!i||i.name===t.node.type.name).filter(t=>q(t.node.attrs,n,{strict:!1}));if(s)return!!d.length;return d.reduce((t,e)=>t+e.to-e.from,0)>=c}function at(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ct(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce((e,o)=>(n.includes(o)||(e[o]=t[o]),e),{})}function dt(t,e,n={},o={}){return ot(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}function lt(t,e){const n=J(e,t.schema),{from:o,to:r,empty:s}=t.selection,i=[];s?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,t=>{i.push(...t.marks)});const a=i.find(t=>t.type.name===n.name);return a?{...a.attrs}:{}}function pt(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ut(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function ht(t){return e=>ut(e.$from,t)}function mt(t,e){return V(t,{from:0,to:t.content.size},e)}function ft(t,e){const n=h(e,t.schema),{from:o,to:r}=t.selection,s=[];t.doc.nodesBetween(o,r,t=>{s.push(t)});const i=s.reverse().find(t=>t.type.name===n.name);return i?{...i.attrs}:{}}function gt(t,e){const n=at("string"==typeof e?e:e.name,t.schema);return"node"===n?ft(t,e):"mark"===n?lt(t,e):{}}function vt(t,e=JSON.stringify){const n={};return t.filter(t=>{const o=e(t);return!Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=!0)})}function yt(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(e=>{const r=G(n.resolve(t),e.type);r&&o.push({mark:e,...r})}):n.nodesBetween(t,e,(t,e)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&o.push(...t.marks.map(n=>({from:e,to:e+t.nodeSize,mark:n})))}),o}function xt(t,e,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const o=t.find(t=>t.type===e&&t.name===n);return!!o&&o.attribute.keepOnSplit}))}function bt(t,e,n={}){const{empty:o,ranges:r}=t.selection,s=e?J(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(t=>!s||s.name===t.type.name).find(t=>q(t.attrs,n,{strict:!1}));let i=0;const a=[];if(r.forEach(({$from:e,$to:n})=>{const o=e.pos,r=n.pos;t.doc.nodesBetween(o,r,(t,e)=>{if(!t.isText&&!t.marks.length)return;const n=Math.max(o,e),s=Math.min(r,e+t.nodeSize);i+=s-n,a.push(...t.marks.map(t=>({mark:t,from:n,to:s})))})}),0===i)return!1;const c=a.filter(t=>!s||s.name===t.mark.type.name).filter(t=>q(t.mark.attrs,n,{strict:!1})).reduce((t,e)=>t+e.to-e.from,0),d=a.filter(t=>!s||t.mark.type!==s&&t.mark.type.excludes(s)).reduce((t,e)=>t+e.to-e.from,0);return(c>0?c+d:c)>=i}function kt(t,e,n={}){if(!e)return it(t,null,n)||bt(t,null,n);const o=at(e,t.schema);return"node"===o?it(t,e,n):"mark"===o&&bt(t,e,n)}function wt(t,e){const{nodeExtensions:n}=p(e),o=n.find(e=>e.name===t);if(!o)return!1;const r=v(l(o,"group",{name:o.name,options:o.options,storage:o.storage}));return"string"==typeof r&&r.split(" ").includes("list")}function Mt(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if("hardBreak"===t.type.name)return!0;if(t.isText)return/^\s*$/m.test(null!==(o=t.text)&&void 0!==o?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(e){let o=!0;return t.content.forEach(t=>{!1!==o&&(Mt(t,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function St(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(t=>null==e?void 0:e.includes(t.type.name));t.tr.ensureMarks(o)}}const Et=(t,e)=>{const n=ht(t=>t.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===o)return!0;const s=t.doc.nodeAt(o);return n.node.type!==(null==s?void 0:s.type)||!r.canJoin(t.doc,n.pos)||(t.join(n.pos),!0)},Ot=(t,e)=>{const n=ht(t=>t.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(void 0===o)return!0;const s=t.doc.nodeAt(o);return n.node.type!==(null==s?void 0:s.type)||!r.canJoin(t.doc,o)||(t.join(o),!0)};var Ct=Object.freeze({__proto__:null,blur:()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),null===(n=null===window||void 0===window?void 0:window.getSelection())||void 0===n||n.removeAllRanges())}),!0),clearContent:(t=!1)=>({commands:e})=>e.setContent("",t),clearNodes:()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:s}=o;return!n||(s.forEach(({$from:n,$to:o})=>{t.doc.nodesBetween(n.pos,o.pos,(t,n)=>{if(t.type.isText)return;const{doc:o,mapping:s}=e,i=o.resolve(s.map(n)),a=o.resolve(s.map(n+t.nodeSize)),c=i.blockRange(a);if(!c)return;const d=r.liftTarget(c);if(t.type.isTextblock){const{defaultType:t}=i.parent.contentMatchAt(i.index());e.setNodeMarkup(c.start,t)}(d||0===d)&&e.lift(c,d)})}),!0)},command:t=>e=>t(e),createParagraphNear:()=>({state:t,dispatch:e})=>s.createParagraphNear(t,e),cut:(e,n)=>({editor:o,tr:r})=>{const{state:s}=o,i=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const a=r.mapping.map(n);return r.insert(a,i.content),r.setSelection(new t.TextSelection(r.doc.resolve(Math.max(a-1,0)))),!0},deleteCurrentNode:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let n=r.depth;n>0;n-=1){if(r.node(n).type===o.type){if(e){const e=r.before(n),o=r.after(n);t.delete(e,o).scrollIntoView()}return!0}}return!1},deleteNode:t=>({tr:e,state:n,dispatch:o})=>{const r=h(t,n.schema),s=e.selection.$anchor;for(let t=s.depth;t>0;t-=1){if(s.node(t).type===r){if(o){const n=s.before(t),o=s.after(t);e.delete(n,o).scrollIntoView()}return!0}}return!1},deleteRange:t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},deleteSelection:()=>({state:t,dispatch:e})=>s.deleteSelection(t,e),enter:()=>({commands:t})=>t.keyboardShortcut("Enter"),exitCode:()=>({state:t,dispatch:e})=>s.exitCode(t,e),extendMarkRange:(e,n={})=>({tr:o,state:r,dispatch:s})=>{const i=J(e,r.schema),{doc:a,selection:c}=o,{$from:d,from:l,to:p}=c;if(s){const e=G(d,i,n);if(e&&e.from<=l&&e.to>=p){const n=t.TextSelection.create(a,e.from,e.to);o.setSelection(n)}}return!0},first:t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t<n.length;t+=1)if(n[t](e))return!0;return!1},focus:(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(tt()||Z())&&o.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())})};if(o.hasFocus()&&null===t||!1===t)return!0;if(s&&null===t&&!X(n.state.selection))return i(),!0;const a=Q(r.doc,t)||n.state.selection,c=n.state.selection.eq(a);return s&&(c||r.setSelection(a),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),i()),!0},forEach:(t,e)=>n=>t.every((t,o)=>e(t,{...n,index:o})),insertContent:(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),insertContentAt:(t,e,n)=>({tr:r,dispatch:s,editor:i})=>{var a;if(s){let s;const c=t=>{i.emit("contentError",{editor:i,error:t,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{ot(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(t){c(t)}try{s=ot(e,i.schema,{parseOptions:d,errorOnInvalidContent:null!==(a=n.errorOnInvalidContent)&&void 0!==a?a:i.options.enableContentCheck})}catch(t){return c(t),!1}let{from:l,to:p}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},u=!0,h=!0;if(("type"in s?[s]:s).forEach(t=>{t.check(),u=!!u&&(t.isText&&0===t.marks.length),h=!!h&&t.isBlock}),l===p&&h){const{parent:t}=r.doc.resolve(l);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(l-=1,p+=1)}let m;if(u){if(Array.isArray(e))m=e.map(t=>t.text||"").join("");else if(e instanceof o.Fragment){let t="";e.forEach(e=>{e.text&&(t+=e.text)}),m=t}else m="object"==typeof e&&e&&e.text?e.text:e;r.insertText(m,l,p)}else m=s,r.replaceWith(l,p,m);n.updateSelection&&rt(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:m})}return!0},joinBackward:()=>({state:t,dispatch:e})=>s.joinBackward(t,e),joinDown:()=>({state:t,dispatch:e})=>s.joinDown(t,e),joinForward:()=>({state:t,dispatch:e})=>s.joinForward(t,e),joinItemBackward:()=>({state:t,dispatch:e,tr:n})=>{try{const o=r.joinPoint(t.doc,t.selection.$from.pos,-1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch{return!1}},joinItemForward:()=>({state:t,dispatch:e,tr:n})=>{try{const o=r.joinPoint(t.doc,t.selection.$from.pos,1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch{return!1}},joinTextblockBackward:()=>({state:t,dispatch:e})=>s.joinTextblockBackward(t,e),joinTextblockForward:()=>({state:t,dispatch:e})=>s.joinTextblockForward(t,e),joinUp:()=>({state:t,dispatch:e})=>s.joinUp(t,e),keyboardShortcut:t=>({editor:e,view:n,tr:o,dispatch:r})=>{const s=function(t){const e=t.split(/-(?!$)/);let n,o,r,s,i=e[e.length-1];"Space"===i&&(i=" ");for(let t=0;t<e.length-1;t+=1){const i=e[t];if(/^(cmd|meta|m)$/i.test(i))s=!0;else if(/^a(lt)?$/i.test(i))n=!0;else if(/^(c|ctrl|control)$/i.test(i))o=!0;else if(/^s(hift)?$/i.test(i))r=!0;else{if(!/^mod$/i.test(i))throw new Error(`Unrecognized modifier name: ${i}`);tt()||st()?s=!0:o=!0}}return n&&(i=`Alt-${i}`),o&&(i=`Ctrl-${i}`),s&&(i=`Meta-${i}`),r&&(i=`Shift-${i}`),i}(t).split(/-(?!$)/),i=s.find(t=>!["Alt","Ctrl","Meta","Shift"].includes(t)),a=new KeyboardEvent("keydown",{key:"Space"===i?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",t=>t(n,a))});return null==c||c.steps.forEach(t=>{const e=t.map(o.mapping);e&&r&&o.maybeStep(e)}),!0},lift:(t,e={})=>({state:n,dispatch:o})=>!!it(n,h(t,n.schema),e)&&s.lift(n,o),liftEmptyBlock:()=>({state:t,dispatch:e})=>s.liftEmptyBlock(t,e),liftListItem:t=>({state:e,dispatch:n})=>{const o=h(t,e.schema);return i.liftListItem(o)(e,n)},newlineInCode:()=>({state:t,dispatch:e})=>s.newlineInCode(t,e),resetAttributes:(t,e)=>({tr:n,state:o,dispatch:r})=>{let s=null,i=null;const a=at("string"==typeof t?t:t.name,o.schema);return!!a&&("node"===a&&(s=h(t,o.schema)),"mark"===a&&(i=J(t,o.schema)),r&&n.selection.ranges.forEach(t=>{o.doc.nodesBetween(t.$from.pos,t.$to.pos,(t,o)=>{s&&s===t.type&&n.setNodeMarkup(o,void 0,ct(t.attrs,e)),i&&t.marks.length&&t.marks.forEach(r=>{i===r.type&&n.addMark(o,o+t.nodeSize,i.create(ct(r.attrs,e)))})})}),!0)},scrollIntoView:()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:n})=>{if(n){const n=new t.AllSelection(e.doc);e.setSelection(n)}return!0},selectNodeBackward:()=>({state:t,dispatch:e})=>s.selectNodeBackward(t,e),selectNodeForward:()=>({state:t,dispatch:e})=>s.selectNodeForward(t,e),selectParentNode:()=>({state:t,dispatch:e})=>s.selectParentNode(t,e),selectTextblockEnd:()=>({state:t,dispatch:e})=>s.selectTextblockEnd(t,e),selectTextblockStart:()=>({state:t,dispatch:e})=>s.selectTextblockStart(t,e),setContent:(t,e=!1,n={},o={})=>({editor:r,tr:s,dispatch:i,commands:a})=>{var c,d;const{doc:l}=s;if("full"!==n.preserveWhitespace){const a=dt(t,r.schema,n,{errorOnInvalidContent:null!==(c=o.errorOnInvalidContent)&&void 0!==c?c:r.options.enableContentCheck});return i&&s.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!e),!0}return i&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:n,errorOnInvalidContent:null!==(d=o.errorOnInvalidContent)&&void 0!==d?d:r.options.enableContentCheck})},setMark:(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:s}=n,{empty:i,ranges:a}=s,c=J(t,o.schema);if(r)if(i){const t=lt(o,c);n.addStoredMark(c.create({...t,...e}))}else a.forEach(t=>{const r=t.$from.pos,s=t.$to.pos;o.doc.nodesBetween(r,s,(t,o)=>{const i=Math.max(o,r),a=Math.min(o+t.nodeSize,s);t.marks.find(t=>t.type===c)?t.marks.forEach(t=>{c===t.type&&n.addMark(i,a,c.create({...t.attrs,...e}))}):n.addMark(i,a,c.create(e))})});return function(t,e,n){var o;const{selection:r}=e;let s=null;if(X(r)&&(s=r.$cursor),s){const e=null!==(o=t.storedMarks)&&void 0!==o?o:s.marks();return!!n.isInSet(e)||!e.some(t=>t.type.excludes(n))}const{ranges:i}=r;return i.some(({$from:e,$to:o})=>{let r=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,o.pos,(t,e,o)=>{if(r)return!1;if(t.isInline){const e=!o||o.type.allowsMarkType(n),s=!!n.isInSet(t.marks)||!t.marks.some(t=>t.type.excludes(n));r=e&&s}return!r}),r})}(o,n,c)},setMeta:(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),setNode:(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=h(t,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:t})=>!!s.setBlockType(i,{...a,...e})(n)||t.clearNodes()).command(({state:t})=>s.setBlockType(i,{...a,...e})(t,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:n,dispatch:o})=>{if(o){const{doc:o}=n,r=Y(e,0,o.content.size),s=t.NodeSelection.create(o,r);n.setSelection(s)}return!0},setTextSelection:e=>({tr:n,dispatch:o})=>{if(o){const{doc:o}=n,{from:r,to:s}="number"==typeof e?{from:e,to:e}:e,i=t.TextSelection.atStart(o).from,a=t.TextSelection.atEnd(o).to,c=Y(r,i,a),d=Y(s,i,a),l=t.TextSelection.create(o,c,d);n.setSelection(l)}return!0},sinkListItem:t=>({state:e,dispatch:n})=>{const o=h(t,e.schema);return i.sinkListItem(o)(e,n)},splitBlock:({keepMarks:e=!0}={})=>({tr:n,state:o,dispatch:s,editor:i})=>{const{selection:a,doc:c}=n,{$from:d,$to:l}=a,p=xt(i.extensionManager.attributes,d.node().type.name,d.node().attrs);if(a instanceof t.NodeSelection&&a.node.isBlock)return!(!d.parentOffset||!r.canSplit(c,d.pos))&&(s&&(e&&St(o,i.extensionManager.splittableMarks),n.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;const u=l.parentOffset===l.parent.content.size,h=0===d.depth?void 0:pt(d.node(-1).contentMatchAt(d.indexAfter(-1)));let m=u&&h?[{type:h,attrs:p}]:void 0,f=r.canSplit(n.doc,n.mapping.map(d.pos),1,m);if(m||f||!r.canSplit(n.doc,n.mapping.map(d.pos),1,h?[{type:h}]:void 0)||(f=!0,m=h?[{type:h,attrs:p}]:void 0),s){if(f&&(a instanceof t.TextSelection&&n.deleteSelection(),n.split(n.mapping.map(d.pos),1,m),h&&!u&&!d.parentOffset&&d.parent.type!==h)){const t=n.mapping.map(d.before()),e=n.doc.resolve(t);d.node(-1).canReplaceWith(e.index(),e.index()+1,h)&&n.setNodeMarkup(n.mapping.map(d.before()),h)}e&&St(o,i.extensionManager.splittableMarks),n.scrollIntoView()}return f},splitListItem:(e,n={})=>({tr:s,state:i,dispatch:a,editor:c})=>{var d;const l=h(e,i.schema),{$from:p,$to:u}=i.selection,m=i.selection.node;if(m&&m.isBlock||p.depth<2||!p.sameParent(u))return!1;const f=p.node(-1);if(f.type!==l)return!1;const g=c.extensionManager.attributes;if(0===p.parent.content.size&&p.node(-1).childCount===p.indexAfter(-1)){if(2===p.depth||p.node(-3).type!==l||p.index(-2)!==p.node(-2).childCount-1)return!1;if(a){let e=o.Fragment.empty;const r=p.index(-1)?1:p.index(-2)?2:3;for(let t=p.depth-r;t>=p.depth-3;t-=1)e=o.Fragment.from(p.node(t).copy(e));const i=p.indexAfter(-1)<p.node(-2).childCount?1:p.indexAfter(-2)<p.node(-3).childCount?2:3,a={...xt(g,p.node().type.name,p.node().attrs),...n},c=(null===(d=l.contentMatch.defaultType)||void 0===d?void 0:d.createAndFill(a))||void 0;e=e.append(o.Fragment.from(l.createAndFill(null,c)||void 0));const u=p.before(p.depth-(r-1));s.replace(u,p.after(-i),new o.Slice(e,4-r,0));let h=-1;s.doc.nodesBetween(u,s.doc.content.size,(t,e)=>{if(h>-1)return!1;t.isTextblock&&0===t.content.size&&(h=e+1)}),h>-1&&s.setSelection(t.TextSelection.near(s.doc.resolve(h))),s.scrollIntoView()}return!0}const v=u.pos===p.end()?f.contentMatchAt(0).defaultType:null,y={...xt(g,f.type.name,f.attrs),...n},x={...xt(g,p.node().type.name,p.node().attrs),...n};s.delete(p.pos,u.pos);const b=v?[{type:l,attrs:y},{type:v,attrs:x}]:[{type:l,attrs:y}];if(!r.canSplit(s.doc,p.pos,2))return!1;if(a){const{selection:t,storedMarks:e}=i,{splittableMarks:n}=c.extensionManager,o=e||t.$to.parentOffset&&t.$from.marks();if(s.split(p.pos,2,b).scrollIntoView(),!o||!a)return!0;const r=o.filter(t=>n.includes(t.type.name));s.ensureMarks(r)}return!0},toggleList:(t,e,n,o={})=>({editor:r,tr:s,state:i,dispatch:a,chain:c,commands:d,can:l})=>{const{extensions:p,splittableMarks:u}=r.extensionManager,m=h(t,i.schema),f=h(e,i.schema),{selection:g,storedMarks:v}=i,{$from:y,$to:x}=g,b=y.blockRange(x),k=v||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const w=ht(t=>wt(t.type.name,p))(g);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===m)return d.liftListItem(f);if(wt(w.node.type.name,p)&&m.validContent(w.node.content)&&a)return c().command(()=>(s.setNodeMarkup(w.pos,m),!0)).command(()=>Et(s,m)).command(()=>Ot(s,m)).run()}return n&&k&&a?c().command(()=>{const t=l().wrapInList(m,o),e=k.filter(t=>u.includes(t.type.name));return s.ensureMarks(e),!!t||d.clearNodes()}).wrapInList(m,o).command(()=>Et(s,m)).command(()=>Ot(s,m)).run():c().command(()=>!!l().wrapInList(m,o)||d.clearNodes()).wrapInList(m,o).command(()=>Et(s,m)).command(()=>Ot(s,m)).run()},toggleMark:(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:s=!1}=n,i=J(t,o.schema);return bt(o,i,e)?r.unsetMark(i,{extendEmptyMarkRange:s}):r.setMark(i,e)},toggleNode:(t,e,n={})=>({state:o,commands:r})=>{const s=h(t,o.schema),i=h(e,o.schema),a=it(o,s,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),a?r.setNode(i,c):r.setNode(s,{...c,...n})},toggleWrap:(t,e={})=>({state:n,commands:o})=>{const r=h(t,n.schema);return it(n,r,e)?o.lift(r):o.wrapIn(r,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let s;if(r.spec.isInputRules&&(s=r.getState(t))){if(e){const e=t.tr,n=s.transform;for(let t=n.steps.length-1;t>=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(s.text){const n=e.doc.resolve(s.from).marks();e.replaceWith(s.from,s.to,t.schema.text(s.text,n))}else e.delete(s.from,s.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(e=>{t.removeMark(e.$from.pos,e.$to.pos)}),!0},unsetMark:(t,e={})=>({tr:n,state:o,dispatch:r})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=n,c=J(t,o.schema),{$from:d,empty:l,ranges:p}=a;if(!r)return!0;if(l&&i){let{from:t,to:e}=a;const o=null===(s=d.marks().find(t=>t.type===c))||void 0===s?void 0:s.attrs,r=G(d,c,o);r&&(t=r.from,e=r.to),n.removeMark(t,e,c)}else p.forEach(t=>{n.removeMark(t.$from.pos,t.$to.pos,c)});return n.removeStoredMark(c),!0},updateAttributes:(t,e={})=>({tr:n,state:o,dispatch:r})=>{let s=null,i=null;const a=at("string"==typeof t?t:t.name,o.schema);return!!a&&("node"===a&&(s=h(t,o.schema)),"mark"===a&&(i=J(t,o.schema)),r&&n.selection.ranges.forEach(t=>{const r=t.$from.pos,a=t.$to.pos;let c,d,l,p;n.selection.empty?o.doc.nodesBetween(r,a,(t,e)=>{s&&s===t.type&&(l=Math.max(e,r),p=Math.min(e+t.nodeSize,a),c=e,d=t)}):o.doc.nodesBetween(r,a,(t,o)=>{o<r&&s&&s===t.type&&(l=Math.max(o,r),p=Math.min(o+t.nodeSize,a),c=o,d=t),o>=r&&o<=a&&(s&&s===t.type&&n.setNodeMarkup(o,void 0,{...t.attrs,...e}),i&&t.marks.length&&t.marks.forEach(s=>{if(i===s.type){const c=Math.max(o,r),d=Math.min(o+t.nodeSize,a);n.addMark(c,d,i.create({...s.attrs,...e}))}}))}),d&&(void 0!==c&&n.setNodeMarkup(c,void 0,{...d.attrs,...e}),i&&d.marks.length&&d.marks.forEach(t=>{i===t.type&&n.addMark(l,p,i.create({...t.attrs,...e}))}))}),!0)},wrapIn:(t,e={})=>({state:n,dispatch:o})=>{const r=h(t,n.schema);return s.wrapIn(r,e)(n,o)},wrapInList:(t,e={})=>({state:n,dispatch:o})=>{const r=h(t,n.schema);return i.wrapInList(r,e)(n,o)}});const Tt=H.create({name:"commands",addCommands:()=>({...Ct})}),Pt=H.create({name:"drop",addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),At=H.create({name:"editable",addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Nt=new t.PluginKey("focusEvents"),$t=H.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new t.Plugin({key:Nt,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const o=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(o),!1},blur:(t,n)=>{e.isFocused=!1;const o=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(o),!1}}}})]}}),jt=H.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:n})=>{const{selection:o,doc:r}=n,{empty:s,$anchor:i}=o,{pos:a,parent:c}=i,d=i.parent.isTextblock&&a>0?n.doc.resolve(a-1):i,l=d.parent.type.spec.isolating,p=i.pos-i.parentOffset,u=l&&1===d.parent.childCount?p===i.pos:t.Selection.atStart(r).from===a;return!(!s||!c.type.isTextblock||c.textContent.length||!u||u&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),n=()=>this.editor.commands.first(({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:n,"Mod-Delete":n,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},s={...o,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":n,"Ctrl-Alt-Backspace":n,"Alt-Delete":n,"Alt-d":n,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return tt()||st()?s:r},addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("clearDocument"),appendTransaction:(e,n,o)=>{if(e.some(t=>t.getMeta("composition")))return;const r=e.some(t=>t.docChanged)&&!n.doc.eq(o.doc),s=e.some(t=>t.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:d,to:l}=n.selection,p=t.Selection.atStart(n.doc).from,u=t.Selection.atEnd(n.doc).to;if(i||!(d===p&&l===u))return;if(!Mt(o.doc))return;const h=o.tr,m=a({state:o,transaction:h}),{commands:f}=new c({editor:this.editor,state:m});return f.clearNodes(),h.steps.length?h:void 0}})]}}),It=H.create({name:"paste",addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Rt=H.create({name:"tabindex",addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Dt{get name(){return this.node.type.name}constructor(t,e,n=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=t,this.editor=e,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return null!==(t=this.actualDepth)&&void 0!==t?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);e=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:e,to:n},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),e=this.resolvedPos.doc.resolve(t);return new Dt(e,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Dt(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Dt(t,this.editor)}get children(){const t=[];return this.node.content.forEach((e,n)=>{const o=e.isBlock&&!e.isTextblock,r=e.isAtom&&!e.isText,s=this.pos+n+(r?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const i=this.resolvedPos.doc.resolve(s);if(!o&&i.depth<=this.depth)return;const a=new Dt(i,this.editor,o,o?e:null);o&&(a.actualDepth=this.depth+1),t.push(new Dt(i,this.editor,o,o?e:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let n=null,o=this.parent;for(;o&&!n;){if(o.node.type.name===t)if(Object.keys(e).length>0){const t=o.node.attrs,n=Object.keys(e);for(let o=0;o<n.length;o+=1){const r=n[o];if(t[r]!==e[r])break}}else n=o;o=o.parent}return n}querySelector(t,e={}){return this.querySelectorAll(t,e,!0)[0]||null}querySelectorAll(t,e={},n=!1){let o=[];if(!this.children||0===this.children.length)return o;const r=Object.keys(e);return this.children.forEach(s=>{if(!(n&&o.length>0)){if(s.node.type.name===t){r.every(t=>e[t]===s.node.attrs[t])&&o.push(s)}n&&o.length>0||(o=o.concat(s.querySelectorAll(t,e,n)))}}),o}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}}function Bt(t,e,n){const o=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(null!==o)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style"+(n?`-${n}`:""),""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}class Lt{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=v(l(this,"addOptions",{name:this.name}))),this.storage=v(l(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Lt(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>$(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new Lt(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=v(l(e,"addOptions",{name:e.name})),e.storage=v(l(e,"addStorage",{name:e.name,options:e.options})),e}}exports.CommandManager=c,exports.Editor=class extends d{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:t,slice:e,moved:n})=>this.options.onDrop(t,e,n)),this.on("paste",({event:t,slice:e})=>this.options.onPaste(t,e)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Bt('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=g(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(t=>{const e="string"==typeof t?`${t}$`:t.key;n=n.filter(t=>!t.key.startsWith(e))}),e.length===n.length)return;const o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[At,W.configure({blockSeparator:null===(e=null===(t=this.options.coreExtensionOptions)||void 0===t?void 0:t.clipboardTextSerializer)||void 0===e?void 0:e.blockSeparator}),Tt,$t,jt,Rt,Pt,It].filter(t=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[t.name]):[],...this.options.extensions].filter(t=>["extension","node","mark"].includes(null==t?void 0:t.type));this.extensionManager=new z(n,this)}createCommandManager(){this.commandManager=new c({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var n;let o;try{o=dt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>"collaboration"!==t.name),this.createExtensionManager()}}),o=dt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=Q(o,this.options.autofocus);this.view=new e.EditorView(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null===(n=this.options.editorProps)||void 0===n?void 0:n.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:t.EditorState.create({doc:o,selection:r||void 0})});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.createNodeViews(),this.prependClass();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach(t=>{var e;return null===(e=this.capturedTransaction)||void 0===e?void 0:e.step(t)}):void(this.capturedTransaction=t);const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=t.getMeta("focus"),r=t.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:t}),r&&this.emit("blur",{editor:this,event:r.event,transaction:t}),t.docChanged&&!t.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return gt(this.state,t)}isActive(t,e){const n="string"==typeof t?t:null,o="string"==typeof t?e:t;return kt(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return E(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e="\n\n",textSerializers:n={}}=t||{};return mt(this.state.doc,{blockSeparator:e,textSerializers:{..._(this.schema),...n}})}get isEmpty(){return Mt(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(null===(t=this.view)||void 0===t?void 0:t.docView)}$node(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new Dt(e,this)}get $doc(){return this.$pos(0)}},exports.Extension=H,exports.InputRule=T,exports.Mark=j,exports.Node=Lt,exports.NodePos=Dt,exports.NodeView=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var n,o,r,s,i,a,c;const{view:d}=this.editor,l=e.target,p=3===l.nodeType?null===(n=l.parentElement)||void 0===n?void 0:n.closest("[data-drag-handle]"):l.closest("[data-drag-handle]");if(!this.dom||(null===(o=this.contentDOM)||void 0===o?void 0:o.contains(l))||!p)return;let u=0,h=0;if(this.dom!==p){const t=this.dom.getBoundingClientRect(),n=p.getBoundingClientRect(),o=null!==(r=e.offsetX)&&void 0!==r?r:null===(s=e.nativeEvent)||void 0===s?void 0:s.offsetX,c=null!==(i=e.offsetY)&&void 0!==i?i:null===(a=e.nativeEvent)||void 0===a?void 0:a.offsetY;u=n.x-t.x+o,h=n.y-t.y+c}const m=this.dom.cloneNode(!0);null===(c=e.dataTransfer)||void 0===c||c.setDragImage(m,u,h);const f=this.getPos();if("number"!=typeof f)return;const g=t.NodeSelection.create(d.state.doc,f),v=d.state.tr.setSelection(g);d.dispatch(v)}stopEvent(e){var n;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});const o=e.target;if(!(this.dom.contains(o)&&!(null===(n=this.contentDOM)||void 0===n?void 0:n.contains(o))))return!1;const r=e.type.startsWith("drag"),s="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(o.tagName)||o.isContentEditable)&&!s&&!r)return!0;const{isEditable:i}=this.editor,{isDragging:a}=this,c=!!this.node.type.spec.draggable,d=t.NodeSelection.isSelectable(this.node),l="copy"===e.type,p="paste"===e.type,u="cut"===e.type,h="mousedown"===e.type;if(!c&&d&&r&&e.target===this.dom&&e.preventDefault(),c&&r&&!a&&e.target===this.dom)return e.preventDefault(),!1;if(c&&i&&!a&&h){const t=o.closest("[data-drag-handle]");t&&(this.dom===t||this.dom.contains(t))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||s||l||p||u||h&&d)}ignoreMutation(t){if(!this.dom||!this.contentDOM)return!0;if("function"==typeof this.options.ignoreMutation)return this.options.ignoreMutation({mutation:t});if(this.node.isLeaf||this.node.isAtom)return!0;if("selection"===t.type)return!1;if(this.dom.contains(t.target)&&"childList"===t.type&&(tt()||Z())&&this.editor.isFocused){if([...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(t=>t.isContentEditable))return!1}return this.contentDOM===t.target&&"attributes"===t.type||!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return"number"==typeof n&&(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if("number"!=typeof t)return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}},exports.PasteRule=R,exports.callOrReturn=v,exports.canInsertNode=function(e,n){const{selection:o}=e,{$from:r}=o;if(o instanceof t.NodeSelection){const t=r.index();return r.parent.canReplaceWith(t,t+1,n)}let s=r.depth;for(;s>=0;){const t=r.index(s);if(r.node(s).contentMatchAt(t).matchType(n))return!0;s-=1}return!1},exports.combineTransactionSteps=function(t,e){const n=new r.Transform(t);return e.forEach(t=>{t.steps.forEach(t=>{n.step(t)})}),n},exports.createChainableState=a,exports.createDocument=dt,exports.createNodeFromContent=ot,exports.createStyleTag=Bt,exports.defaultBlockAt=pt,exports.deleteProps=ct,exports.elementFromString=nt,exports.escapeForRegEx=function(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")},exports.findChildrenInRange=function(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(t,e)=>{n(t)&&o.push({node:t,pos:e})}),o},exports.findDuplicates=F,exports.findParentNode=ht,exports.findParentNodeClosestToPos=ut,exports.fromString=x,exports.getAttributes=gt,exports.getAttributesFromExtensions=u,exports.getChangedRanges=function(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((t,r)=>{const s=[];if(t.ranges.length)t.forEach((t,e)=>{s.push({from:t,to:e})});else{const{from:t,to:e}=n[r];if(void 0===t||void 0===e)return;s.push({from:t,to:e})}s.forEach(({from:t,to:n})=>{const s=e.slice(r).map(t,-1),i=e.slice(r).map(n),a=e.invert().map(s,-1),c=e.invert().map(i);o.push({oldRange:{from:a,to:c},newRange:{from:s,to:i}})})}),function(t){const e=vt(t);return 1===e.length?e:e.filter((t,n)=>!e.filter((t,e)=>e!==n).some(e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))}(o)},exports.getExtensionField=l,exports.getHTMLFromFragment=E,exports.getMarkAttributes=lt,exports.getMarkRange=G,exports.getMarkType=J,exports.getMarksBetween=yt,exports.getNodeAttributes=ft,exports.getNodeType=h,exports.getRenderedAttributes=f,exports.getSchemaByResolvedExtensions=w,exports.getSchemaTypeByName=M,exports.getSchemaTypeNameByName=at,exports.getSplittedAttributes=xt,exports.getText=mt,exports.getTextBetween=V,exports.getTextContentFromNodes=O,exports.getTextSerializersFromSchema=_,exports.injectExtensionAttributesToParseRule=b,exports.inputRulesPlugin=A,exports.isActive=kt,exports.isEmptyObject=y,exports.isExtensionRulesEnabled=S,exports.isFunction=g,exports.isList=wt,exports.isMacOS=st,exports.isMarkActive=bt,exports.isNodeActive=it,exports.isNodeEmpty=Mt,exports.isNodeSelection=function(e){return e instanceof t.NodeSelection},exports.isNumber=I,exports.isPlainObject=N,exports.isRegExp=C,exports.isTextSelection=X,exports.isiOS=tt,exports.markInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o})=>{const r=v(t.getAttributes,void 0,o);if(!1===r||null===r)return null;const{tr:s}=e,i=o[o.length-1],a=o[0];if(i){const o=a.search(/\S/),c=n.from+a.indexOf(i),d=c+i.length;if(yt(n.from,n.to,e.doc).filter(e=>e.mark.type.excluded.find(n=>n===t.type&&n!==e.mark.type)).filter(t=>t.to>c).length)return null;d<n.to&&s.delete(d,n.to),c>n.from&&s.delete(n.from+o,c);const l=n.from+o+i.length;s.addMark(n.from+o,l,t.type.create(r||{})),s.removeStoredMark(t.type)}}})},exports.markPasteRule=function(t){return new R({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:r})=>{const s=v(t.getAttributes,void 0,o,r);if(!1===s||null===s)return null;const{tr:i}=e,a=o[o.length-1],c=o[0];let d=n.to;if(a){const o=c.search(/\S/),r=n.from+c.indexOf(a),l=r+a.length;if(yt(n.from,n.to,e.doc).filter(e=>e.mark.type.excluded.find(n=>n===t.type&&n!==e.mark.type)).filter(t=>t.to>r).length)return null;l<n.to&&i.delete(l,n.to),r>n.from&&i.delete(n.from+o,r),d=n.from+o+a.length,i.addMark(n.from+o,d,t.type.create(s||{})),i.removeStoredMark(t.type)}}})},exports.mergeAttributes=m,exports.mergeDeep=$,exports.minMax=Y,exports.nodeInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o})=>{const r=v(t.getAttributes,void 0,o)||{},{tr:s}=e,i=n.from;let a=n.to;const c=t.type.create(r);if(o[1]){let t=i+o[0].lastIndexOf(o[1]);t>a?t=a:a=t+o[1].length;const e=o[0][o[0].length-1];s.insertText(e,i+o[0].length-1),s.replaceWith(t,a,c)}else if(o[0]){const e=t.type.isInline?i:i-1;s.insert(e,t.type.create(r)).delete(s.mapping.map(i),s.mapping.map(a))}s.scrollIntoView()}})},exports.nodePasteRule=function(t){return new R({find:t.find,handler({match:e,chain:n,range:o,pasteEvent:r}){const s=v(t.getAttributes,void 0,e,r),i=v(t.getContent,void 0,s);if(!1===s||null===s)return null;const a={type:t.type.name,attrs:s};i&&(a.content=i),e.input&&n().deleteRange(o).insertContentAt(o.from,a)}})},exports.objectIncludes=q,exports.pasteRulesPlugin=L,exports.posToDOMRect=function(t,e,n){const o=t.state.doc.content.size,r=Y(e,0,o),s=Y(n,0,o),i=t.coordsAtPos(r),a=t.coordsAtPos(s,-1),c=Math.min(i.top,a.top),d=Math.max(i.bottom,a.bottom),l=Math.min(i.left,a.left),p=Math.max(i.right,a.right),u={top:c,bottom:d,left:l,right:p,width:p-l,height:d-c,x:l,y:c};return{...u,toJSON:()=>u}},exports.removeDuplicates=vt,exports.resolveFocusPosition=Q,exports.selectionToInsertionEnd=rt,exports.splitExtensions=p,exports.textInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o})=>{let r=t.replace,s=n.from;const i=n.to;if(o[1]){const t=o[0].lastIndexOf(o[1]);r+=o[0].slice(t+o[1].length),s+=t;const e=s-i;e>0&&(r=o[0].slice(t-e,t)+r,s=i)}e.tr.insertText(r,s,i)}})},exports.textblockTypeInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o})=>{const r=e.doc.resolve(n.from),s=v(t.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})},exports.wrappingInputRule=function(t){return new T({find:t.find,handler:({state:e,range:n,match:o,chain:s})=>{const i=v(t.getAttributes,void 0,o)||{},a=e.tr.delete(n.from,n.to),c=a.doc.resolve(n.from).blockRange(),d=c&&r.findWrapping(c,t.type,i);if(!d)return null;if(a.wrap(c,d),t.keepMarks&&t.editor){const{selection:n,storedMarks:o}=e,{splittableMarks:r}=t.editor.extensionManager,s=o||n.$to.parentOffset&&n.$from.marks();if(s){const t=s.filter(t=>r.includes(t.type.name));a.ensureMarks(t)}}if(t.keepAttributes){const e="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";s().updateAttributes(e,i).run()}const l=a.doc.resolve(n.from-1).nodeBefore;l&&l.type===t.type&&r.canJoin(a.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,l))&&a.join(n.from-1)}})};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|