@burdenoff/microfe-support 2026.1013.2 → 2026.1014.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["originalCreateParagraphNear","TextSelection2","originalExitCode","TextSelection3","TextSelection4","TextSelection5","Selection2","Fragment2","originalJoinUp","originalJoinDown","originalJoinBackward","originalJoinForward","joinPoint2","originalCommand","originalCommand2","originalLift","originalLiftEmptyBlock","originalLiftListItem","originalNewlineInCode","originalSelectNodeBackward","originalSelectNodeForward","originalSelectParentNode","originalSelectTextblockEnd","originalSelectTextblockStart","Schema2","NodeSelection2","TextSelection6","originalSinkListItem","NodeSelection3","TextSelection7","Fragment3","TextSelection8","canSplit2","TextSelection9","originalWrapIn","originalWrapInList","DecorationSet2","DecorationSet3","DecorationSet4","NodeSelection4","Plugin2","Fragment4","Plugin3","Fragment5","Plugin4","PluginKey2","Plugin5","PluginKey3","Plugin6","PluginKey4","PluginKey5","Plugin7","Selection3","Plugin8","PluginKey6","Plugin9","PluginKey7","Plugin10","PluginKey8","Plugin11","PluginKey9","ReplaceStep2","Fragment6","canJoin2"],"sources":["../../../../../node_modules/@tiptap/core/dist/index.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\n\n// src/helpers/createChainableState.ts\nfunction createChainableState(config) {\n const { state, transaction } = config;\n let { selection } = transaction;\n let { doc } = transaction;\n let { storedMarks } = transaction;\n return {\n ...state,\n apply: state.apply.bind(state),\n applyTransaction: state.applyTransaction.bind(state),\n plugins: state.plugins,\n schema: state.schema,\n reconfigure: state.reconfigure.bind(state),\n toJSON: state.toJSON.bind(state),\n get storedMarks() {\n return storedMarks;\n },\n get selection() {\n return selection;\n },\n get doc() {\n return doc;\n },\n get tr() {\n selection = transaction.selection;\n doc = transaction.doc;\n storedMarks = transaction.storedMarks;\n return transaction;\n }\n };\n}\n\n// src/CommandManager.ts\nvar CommandManager = class _CommandManager {\n constructor(props) {\n this.editor = props.editor;\n this.rawCommands = this.editor.extensionManager.commands;\n this.customState = props.state;\n }\n get hasCustomState() {\n return !!this.customState;\n }\n get state() {\n return this.customState || this.editor.state;\n }\n get commands() {\n const { rawCommands, editor, state } = this;\n const { view } = editor;\n const { tr } = state;\n const props = this.buildProps(tr);\n return Object.fromEntries(\n Object.entries(rawCommands).map(([name, command2]) => {\n const method = (...args) => {\n const callback = command2(...args)(props);\n if (!tr.getMeta(\"preventDispatch\") && !this.hasCustomState) {\n view.dispatch(tr);\n }\n return callback;\n };\n return [name, method];\n })\n );\n }\n get chain() {\n return () => this.createChain();\n }\n get can() {\n return () => this.createCan();\n }\n createChain(startTr, shouldDispatch = true) {\n const { rawCommands, editor, state } = this;\n const { view } = editor;\n const callbacks = [];\n const hasStartTransaction = !!startTr;\n const tr = startTr || state.tr;\n const run3 = () => {\n if (!hasStartTransaction && shouldDispatch && !tr.getMeta(\"preventDispatch\") && !this.hasCustomState) {\n view.dispatch(tr);\n }\n return callbacks.every((callback) => callback === true);\n };\n const chain = {\n ...Object.fromEntries(\n Object.entries(rawCommands).map(([name, command2]) => {\n const chainedCommand = (...args) => {\n const props = this.buildProps(tr, shouldDispatch);\n const callback = command2(...args)(props);\n callbacks.push(callback);\n return chain;\n };\n return [name, chainedCommand];\n })\n ),\n run: run3\n };\n return chain;\n }\n /**\n * Creates a chain that safely returns `false` when run.\n * @returns A non-dispatching command chain.\n * @example\n * const chain = CommandManager.createFakeChain()\n * chain.focus().run() // false\n */\n static createFakeChain() {\n const chain = new Proxy(\n {},\n {\n get: (_target, property) => {\n if (property === \"then\") {\n return void 0;\n }\n if (property === \"run\") {\n return () => false;\n }\n return () => chain;\n }\n }\n );\n return chain;\n }\n createCan(startTr) {\n const { rawCommands, state } = this;\n const dispatch = false;\n const tr = startTr || state.tr;\n const props = this.buildProps(tr, dispatch);\n const formattedCommands = Object.fromEntries(\n Object.entries(rawCommands).map(([name, command2]) => {\n return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];\n })\n );\n return {\n ...formattedCommands,\n chain: () => this.createChain(tr, dispatch)\n };\n }\n /**\n * Creates capability checks that safely return `false`.\n * @returns A non-dispatching capability checker.\n * @example\n * const can = CommandManager.createFallbackCan()\n * can.focus() // false\n */\n static createFallbackCan() {\n const chain = _CommandManager.createFakeChain();\n const can = new Proxy(\n {\n chain: () => chain\n },\n {\n get: (target, property) => {\n if (property === \"then\") {\n return void 0;\n }\n if (property === \"chain\") {\n return target.chain;\n }\n return () => false;\n }\n }\n );\n return can;\n }\n buildProps(tr, shouldDispatch = true) {\n const { rawCommands, editor, state } = this;\n const { view } = editor;\n const props = {\n tr,\n editor,\n view,\n state: createChainableState({\n state,\n transaction: tr\n }),\n dispatch: shouldDispatch ? () => void 0 : void 0,\n chain: () => this.createChain(tr, shouldDispatch),\n can: () => this.createCan(tr),\n get commands() {\n return Object.fromEntries(\n Object.entries(rawCommands).map(([name, command2]) => {\n return [name, (...args) => command2(...args)(props)];\n })\n );\n }\n };\n return props;\n }\n};\n\n// src/commands/index.ts\nvar commands_exports = {};\n__export(commands_exports, {\n blur: () => blur,\n clearContent: () => clearContent,\n clearNodes: () => clearNodes,\n command: () => command,\n createParagraphNear: () => createParagraphNear,\n cut: () => cut,\n deleteCurrentNode: () => deleteCurrentNode,\n deleteNode: () => deleteNode,\n deleteRange: () => deleteRange,\n deleteSelection: () => deleteSelection,\n enter: () => enter,\n exitCode: () => exitCode,\n extendMarkRange: () => extendMarkRange,\n first: () => first,\n focus: () => focus,\n forEach: () => forEach,\n insertContent: () => insertContent,\n insertContentAt: () => insertContentAt,\n insertDefaultBlock: () => insertDefaultBlock,\n joinBackward: () => joinBackward,\n joinDown: () => joinDown,\n joinForward: () => joinForward,\n joinItemBackward: () => joinItemBackward,\n joinItemForward: () => joinItemForward,\n joinTextblockBackward: () => joinTextblockBackward,\n joinTextblockForward: () => joinTextblockForward,\n joinUp: () => joinUp,\n keyboardShortcut: () => keyboardShortcut,\n lift: () => lift,\n liftEmptyBlock: () => liftEmptyBlock,\n liftListItem: () => liftListItem,\n newlineInCode: () => newlineInCode,\n resetAttributes: () => resetAttributes,\n scrollIntoView: () => scrollIntoView,\n selectAll: () => selectAll,\n selectNodeBackward: () => selectNodeBackward,\n selectNodeForward: () => selectNodeForward,\n selectParentNode: () => selectParentNode,\n selectTextblockEnd: () => selectTextblockEnd,\n selectTextblockStart: () => selectTextblockStart,\n setContent: () => setContent,\n setMark: () => setMark,\n setMeta: () => setMeta,\n setNode: () => setNode,\n setNodeSelection: () => setNodeSelection,\n setTextDirection: () => setTextDirection,\n setTextSelection: () => setTextSelection,\n sinkListItem: () => sinkListItem,\n splitBlock: () => splitBlock,\n splitListItem: () => splitListItem,\n toggleList: () => toggleList,\n toggleMark: () => toggleMark,\n toggleNode: () => toggleNode,\n toggleWrap: () => toggleWrap,\n undoInputRule: () => undoInputRule,\n unsetAllMarks: () => unsetAllMarks,\n unsetMark: () => unsetMark,\n unsetTextDirection: () => unsetTextDirection,\n updateAttributes: () => updateAttributes,\n updateDecorations: () => updateDecorations,\n wrapIn: () => wrapIn,\n wrapInList: () => wrapInList\n});\n\n// src/commands/blur.ts\nvar blur = () => ({ editor, view }) => {\n requestAnimationFrame(() => {\n var _a;\n if (!editor.isDestroyed) {\n ;\n view.dom.blur();\n (_a = window == null ? void 0 : window.getSelection()) == null ? void 0 : _a.removeAllRanges();\n }\n });\n return true;\n};\n\n// src/commands/clearContent.ts\nvar clearContent = (emitUpdate = true) => ({ commands }) => {\n return commands.setContent(\"\", { emitUpdate });\n};\n\n// src/commands/clearNodes.ts\nimport { liftTarget } from \"@tiptap/pm/transform\";\nvar clearNodes = () => ({ state, tr, dispatch }) => {\n const { selection } = tr;\n const { ranges } = selection;\n if (!dispatch) {\n return true;\n }\n ranges.forEach(({ $from, $to }) => {\n state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (node.type.isText) {\n return;\n }\n const { doc, mapping } = tr;\n const $mappedFrom = doc.resolve(mapping.map(pos));\n const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));\n const nodeRange = $mappedFrom.blockRange($mappedTo);\n if (!nodeRange) {\n return;\n }\n const targetLiftDepth = liftTarget(nodeRange);\n if (node.type.isTextblock) {\n const { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());\n tr.setNodeMarkup(nodeRange.start, defaultType);\n }\n if (targetLiftDepth || targetLiftDepth === 0) {\n tr.lift(nodeRange, targetLiftDepth);\n }\n });\n });\n return true;\n};\n\n// src/commands/command.ts\nvar command = (fn) => (props) => {\n return fn(props);\n};\n\n// src/commands/createParagraphNear.ts\nimport { createParagraphNear as originalCreateParagraphNear } from \"@tiptap/pm/commands\";\nvar createParagraphNear = () => ({ state, dispatch }) => {\n return originalCreateParagraphNear(state, dispatch);\n};\n\n// src/commands/cut.ts\nimport { TextSelection } from \"@tiptap/pm/state\";\nvar cut = (originRange, targetPos) => ({ editor, tr }) => {\n const { state } = editor;\n const contentSlice = state.doc.slice(originRange.from, originRange.to);\n tr.deleteRange(originRange.from, originRange.to);\n const newPos = tr.mapping.map(targetPos);\n tr.insert(newPos, contentSlice.content);\n tr.setSelection(new TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));\n return true;\n};\n\n// src/commands/deleteCurrentNode.ts\nvar deleteCurrentNode = () => ({ tr, dispatch }) => {\n const { selection } = tr;\n const currentNode = selection.$anchor.node();\n if (currentNode.content.size > 0) {\n return false;\n }\n const $pos = tr.selection.$anchor;\n for (let depth = $pos.depth; depth > 0; depth -= 1) {\n const node = $pos.node(depth);\n if (node.type === currentNode.type) {\n if (dispatch) {\n const from = $pos.before(depth);\n const to = $pos.after(depth);\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n }\n }\n return false;\n};\n\n// src/helpers/getNodeType.ts\nfunction getNodeType(nameOrType, schema) {\n if (typeof nameOrType === \"string\") {\n if (!schema.nodes[nameOrType]) {\n throw Error(\n `There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`\n );\n }\n return schema.nodes[nameOrType];\n }\n return nameOrType;\n}\n\n// src/commands/deleteNode.ts\nvar deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {\n const type = getNodeType(typeOrName, state.schema);\n const $pos = tr.selection.$anchor;\n for (let depth = $pos.depth; depth > 0; depth -= 1) {\n const node = $pos.node(depth);\n if (node.type === type) {\n if (dispatch) {\n const from = $pos.before(depth);\n const to = $pos.after(depth);\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n }\n }\n return false;\n};\n\n// src/commands/deleteRange.ts\nvar deleteRange = (range) => ({ tr, dispatch }) => {\n const { from, to } = range;\n if (dispatch) {\n tr.delete(from, to);\n }\n return true;\n};\n\n// src/commands/deleteSelection.ts\nimport { TextSelection as TextSelection2 } from \"@tiptap/pm/state\";\nvar hasTextContent = (nodeSpec) => {\n if (!nodeSpec.content) {\n return false;\n }\n const textRegex = /^text(\\*|\\+)/;\n return textRegex.test(nodeSpec.content);\n};\nvar expandSelectionForSide = ($pos, schema, side) => {\n if (!$pos.parent.isInline) {\n return $pos.pos;\n }\n if (side === \"left\" && $pos.pos > $pos.start() || side === \"right\" && $pos.pos < $pos.end()) {\n return $pos.pos;\n }\n const parentContent = schema.nodes[$pos.parent.type.name].spec;\n if (!hasTextContent(parentContent)) {\n return $pos.pos;\n }\n return side === \"left\" ? $pos.start() - 1 : $pos.end() + 1;\n};\nvar expandSelectionForInlineText = ($from, $to, schema) => {\n const from = expandSelectionForSide($from, schema, \"left\");\n const to = expandSelectionForSide($to, schema, \"right\");\n return { from, to };\n};\nvar deleteSelection = () => ({ state, dispatch }) => {\n if (state.selection.empty) {\n return false;\n }\n if (dispatch) {\n const tr = state.tr;\n const { ranges } = state.selection;\n const mapFrom = tr.steps.length;\n ranges.forEach((range) => {\n const mapping = tr.mapping.slice(mapFrom);\n const $from = tr.doc.resolve(mapping.map(range.$from.pos));\n const $to = tr.doc.resolve(mapping.map(range.$to.pos));\n const { from, to } = expandSelectionForInlineText($from, $to, state.schema);\n tr.deleteRange(from, to);\n });\n if (!tr.selection.empty) {\n tr.setSelection(TextSelection2.near(tr.doc.resolve(tr.selection.from)));\n }\n tr.scrollIntoView();\n dispatch(tr);\n }\n return true;\n};\n\n// src/commands/enter.ts\nvar enter = () => ({ commands }) => {\n return commands.keyboardShortcut(\"Enter\");\n};\n\n// src/commands/exitCode.ts\nimport { exitCode as originalExitCode } from \"@tiptap/pm/commands\";\nvar exitCode = () => ({ state, dispatch }) => {\n return originalExitCode(state, dispatch);\n};\n\n// src/commands/extendMarkRange.ts\nimport { TextSelection as TextSelection3 } from \"@tiptap/pm/state\";\n\n// src/utilities/isRegExp.ts\nfunction isRegExp(value) {\n return Object.prototype.toString.call(value) === \"[object RegExp]\";\n}\n\n// src/utilities/objectIncludes.ts\nfunction objectIncludes(object1, object2, options = { strict: true }) {\n const keys = Object.keys(object2);\n if (!keys.length) {\n return true;\n }\n return keys.every((key) => {\n if (options.strict) {\n return object2[key] === object1[key];\n }\n if (isRegExp(object2[key])) {\n return object2[key].test(object1[key]);\n }\n return object2[key] === object1[key];\n });\n}\n\n// src/helpers/getMarkRange.ts\nfunction findMarkInSet(marks, type, attributes = {}) {\n return marks.find((item) => {\n return item.type === type && objectIncludes(\n // Only check equality for the attributes that are provided\n Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])),\n attributes\n );\n });\n}\nfunction isMarkInSet(marks, type, attributes = {}) {\n return !!findMarkInSet(marks, type, attributes);\n}\nfunction getMarkRange($pos, type, attributes) {\n if (!$pos || !type) {\n return;\n }\n let start = $pos.parent.childAfter($pos.parentOffset);\n if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {\n start = $pos.parent.childBefore($pos.parentOffset);\n }\n if (!start.node || !start.node.marks.some((mark2) => mark2.type === type)) {\n return;\n }\n if (!attributes) {\n const firstMark = start.node.marks.find((mark2) => mark2.type === type);\n if (firstMark) {\n attributes = firstMark.attrs;\n }\n }\n const mark = findMarkInSet([...start.node.marks], type, attributes);\n if (!mark) {\n return;\n }\n let startIndex = start.index;\n let startPos = $pos.start() + start.offset;\n let endIndex = startIndex + 1;\n let endPos = startPos + start.node.nodeSize;\n while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {\n startIndex -= 1;\n startPos -= $pos.parent.child(startIndex).nodeSize;\n }\n while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {\n endPos += $pos.parent.child(endIndex).nodeSize;\n endIndex += 1;\n }\n return {\n from: startPos,\n to: endPos\n };\n}\n\n// src/helpers/getMarkType.ts\nfunction getMarkType(nameOrType, schema) {\n if (typeof nameOrType === \"string\") {\n if (!schema.marks[nameOrType]) {\n throw Error(\n `There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`\n );\n }\n return schema.marks[nameOrType];\n }\n return nameOrType;\n}\n\n// src/commands/extendMarkRange.ts\nvar extendMarkRange = (typeOrName, attributes) => ({ tr, state, dispatch }) => {\n const type = getMarkType(typeOrName, state.schema);\n const { doc, selection } = tr;\n const { $from, from, to } = selection;\n if (dispatch) {\n const range = getMarkRange($from, type, attributes);\n if (range && range.from <= from && range.to >= to) {\n const newSelection = TextSelection3.create(doc, range.from, range.to);\n tr.setSelection(newSelection);\n }\n }\n return true;\n};\n\n// src/commands/first.ts\nvar first = (commands) => (props) => {\n const items = typeof commands === \"function\" ? commands(props) : commands;\n for (let i = 0; i < items.length; i += 1) {\n if (items[i](props)) {\n return true;\n }\n }\n return false;\n};\n\n// src/helpers/isTextSelection.ts\nimport { TextSelection as TextSelection4 } from \"@tiptap/pm/state\";\nfunction isTextSelection(value) {\n return value instanceof TextSelection4;\n}\n\n// src/helpers/resolveFocusPosition.ts\nimport { Selection, TextSelection as TextSelection5 } from \"@tiptap/pm/state\";\n\n// src/utilities/minMax.ts\nfunction minMax(value = 0, min = 0, max = 0) {\n return Math.min(Math.max(value, min), max);\n}\n\n// src/helpers/resolveFocusPosition.ts\nfunction resolveFocusPosition(doc, position = null) {\n if (!position) {\n return null;\n }\n const selectionAtStart = Selection.atStart(doc);\n const selectionAtEnd = Selection.atEnd(doc);\n if (position === \"start\" || position === true) {\n return selectionAtStart;\n }\n if (position === \"end\") {\n return selectionAtEnd;\n }\n const minPos = selectionAtStart.from;\n const maxPos = selectionAtEnd.to;\n if (position === \"all\") {\n return TextSelection5.create(\n doc,\n minMax(0, minPos, maxPos),\n minMax(doc.content.size, minPos, maxPos)\n );\n }\n return TextSelection5.create(\n doc,\n minMax(position, minPos, maxPos),\n minMax(position, minPos, maxPos)\n );\n}\n\n// src/utilities/isAndroid.ts\nfunction isAndroid() {\n return [\"Android\"].includes(navigator.platform) || /android/i.test(navigator.userAgent);\n}\n\n// src/utilities/isiOS.ts\nfunction isiOS() {\n return [\"iPad Simulator\", \"iPhone Simulator\", \"iPod Simulator\", \"iPad\", \"iPhone\", \"iPod\"].includes(\n navigator.platform\n ) || // iPad on iOS 13 detection\n navigator.userAgent.includes(\"Mac\") && \"ontouchend\" in document;\n}\n\n// src/utilities/isSafari.ts\nfunction isSafari() {\n return typeof navigator !== \"undefined\" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;\n}\n\n// src/commands/focus.ts\nvar focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {\n options = {\n scrollIntoView: true,\n ...options\n };\n const delayedFocus = () => {\n if (isiOS() || isAndroid()) {\n ;\n view.dom.focus();\n }\n if (isSafari() && !isiOS() && !isAndroid()) {\n ;\n view.dom.focus({ preventScroll: true });\n }\n requestAnimationFrame(() => {\n if (!editor.isDestroyed) {\n view.focus();\n if (options == null ? void 0 : options.scrollIntoView) {\n editor.commands.scrollIntoView();\n }\n }\n });\n };\n try {\n if (view.hasFocus() && position === null || position === false) {\n return true;\n }\n } catch {\n return false;\n }\n if (dispatch && position === null && !isTextSelection(editor.state.selection)) {\n delayedFocus();\n return true;\n }\n const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;\n const isSameSelection = editor.state.selection.eq(selection);\n if (dispatch) {\n if (!isSameSelection) {\n tr.setSelection(selection);\n }\n if (isSameSelection && tr.storedMarks) {\n tr.setStoredMarks(tr.storedMarks);\n }\n delayedFocus();\n }\n return true;\n};\n\n// src/commands/forEach.ts\nvar forEach = (items, fn) => (props) => {\n return items.every((item, index) => fn(item, { ...props, index }));\n};\n\n// src/commands/insertContent.ts\nvar insertContent = (value, options) => ({ tr, commands }) => {\n return commands.insertContentAt(\n { from: tr.selection.from, to: tr.selection.to },\n value,\n options\n );\n};\n\n// src/commands/insertContentAt.ts\nimport { Fragment as Fragment2 } from \"@tiptap/pm/model\";\n\n// src/helpers/createNodeFromContent.ts\nimport { DOMParser, Fragment, Schema } from \"@tiptap/pm/model\";\n\n// src/utilities/elementFromString.ts\nvar removeWhitespaces = (node) => {\n const children = node.childNodes;\n for (let i = children.length - 1; i >= 0; i -= 1) {\n const child = children[i];\n if (child.nodeType === 3 && child.nodeValue && /^(\\n\\s\\s|\\n)$/.test(child.nodeValue)) {\n node.removeChild(child);\n } else if (child.nodeType === 1) {\n removeWhitespaces(child);\n }\n }\n return node;\n};\nfunction elementFromString(value) {\n if (typeof window === \"undefined\") {\n throw new Error(\n \"[tiptap error]: there is no window object available, so this function cannot be used\"\n );\n }\n const wrappedValue = `<body>${value}</body>`;\n const html = new window.DOMParser().parseFromString(wrappedValue, \"text/html\").body;\n return removeWhitespaces(html);\n}\n\n// src/helpers/isProseMirrorContent.ts\nfunction isProseMirrorContent(value) {\n return typeof (value == null ? void 0 : value.nodesBetween) === \"function\";\n}\n\n// src/helpers/createNodeFromContent.ts\nfunction createNodeFromContent(content, schema, options) {\n if (isProseMirrorContent(content)) {\n return content;\n }\n const isJSONContent = typeof content === \"object\" && content !== null;\n options = {\n slice: true,\n parseOptions: {},\n ...options\n };\n const isTextContent = typeof content === \"string\";\n if (isJSONContent) {\n try {\n const isArrayContent = Array.isArray(content) && content.length > 0;\n if (isArrayContent) {\n return Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));\n }\n const node = schema.nodeFromJSON(content);\n if (options.errorOnInvalidContent) {\n node.check();\n }\n return node;\n } catch (error) {\n if (options.errorOnInvalidContent) {\n throw new Error(\"[tiptap error]: Invalid JSON content\", { cause: error });\n }\n console.warn(\"[tiptap warn]: Invalid content.\", \"Passed value:\", content, \"Error:\", error);\n return createNodeFromContent(\"\", schema, options);\n }\n }\n if (isTextContent) {\n if (options.errorOnInvalidContent) {\n let hasInvalidContent = false;\n let invalidContent = \"\";\n const contentCheckSchema = new Schema({\n topNode: schema.spec.topNode,\n marks: schema.spec.marks,\n // Prosemirror's schemas are executed such that: the last to execute, matches last\n // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle\n nodes: schema.spec.nodes.append({\n __tiptap__private__unknown__catch__all__node: {\n content: \"inline*\",\n group: \"block\",\n parseDOM: [\n {\n tag: \"*\",\n getAttrs: (e) => {\n hasInvalidContent = true;\n invalidContent = typeof e === \"string\" ? e : e.outerHTML;\n return null;\n }\n }\n ]\n }\n })\n });\n if (options.slice) {\n DOMParser.fromSchema(contentCheckSchema).parseSlice(\n elementFromString(content),\n options.parseOptions\n );\n } else {\n DOMParser.fromSchema(contentCheckSchema).parse(\n elementFromString(content),\n options.parseOptions\n );\n }\n if (options.errorOnInvalidContent && hasInvalidContent) {\n throw new Error(\"[tiptap error]: Invalid HTML content\", {\n cause: new Error(`Invalid element found: ${invalidContent}`)\n });\n }\n }\n const parser = DOMParser.fromSchema(schema);\n if (options.slice) {\n return parser.parseSlice(elementFromString(content), options.parseOptions).content;\n }\n return parser.parse(elementFromString(content), options.parseOptions);\n }\n return createNodeFromContent(\"\", schema, options);\n}\n\n// src/helpers/isFragment.ts\nfunction isFragment(nodeOrFragment) {\n return !(\"type\" in nodeOrFragment);\n}\n\n// src/helpers/selectionToInsertionEnd.ts\nimport { Selection as Selection2 } from \"@tiptap/pm/state\";\nimport { ReplaceAroundStep, ReplaceStep } from \"@tiptap/pm/transform\";\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n const last = tr.steps.length - 1;\n if (last < startLen) {\n return;\n }\n const step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) {\n return;\n }\n const map = tr.mapping.maps[last];\n let end = 0;\n map.forEach((_from, _to, _newFrom, newTo) => {\n if (end === 0) {\n end = newTo;\n }\n });\n tr.setSelection(Selection2.near(tr.doc.resolve(end), bias));\n}\n\n// src/commands/insertContentAt.ts\nvar insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {\n var _a;\n if (dispatch) {\n options = {\n parseOptions: editor.options.parseOptions,\n updateSelection: true,\n applyInputRules: false,\n applyPasteRules: false,\n ...options\n };\n let content;\n const emitContentError = (error) => {\n editor.emit(\"contentError\", {\n editor,\n error,\n disableCollaboration: () => {\n if (\"collaboration\" in editor.storage && typeof editor.storage.collaboration === \"object\" && editor.storage.collaboration) {\n ;\n editor.storage.collaboration.isDisabled = true;\n }\n }\n });\n };\n const parseOptions = {\n preserveWhitespace: \"full\",\n ...options.parseOptions\n };\n if (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) {\n try {\n createNodeFromContent(value, editor.schema, {\n parseOptions,\n errorOnInvalidContent: true\n });\n } catch (e) {\n emitContentError(e);\n }\n }\n try {\n content = createNodeFromContent(value, editor.schema, {\n parseOptions,\n errorOnInvalidContent: (_a = options.errorOnInvalidContent) != null ? _a : editor.options.enableContentCheck\n });\n } catch (e) {\n emitContentError(e);\n return false;\n }\n let { from, to } = typeof position === \"number\" ? { from: position, to: position } : { from: position.from, to: position.to };\n let isOnlyTextContent = true;\n let isOnlyBlockContent = true;\n const nodes = isFragment(content) ? content.content : [content];\n nodes.forEach((node) => {\n node.check();\n isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;\n isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;\n });\n if (from === to && isOnlyBlockContent) {\n const { parent } = tr.doc.resolve(from);\n const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;\n if (isEmptyTextBlock) {\n from -= 1;\n to += 1;\n }\n }\n let newContent;\n if (isOnlyTextContent) {\n if (Array.isArray(value)) {\n newContent = value.map((item) => item.text || \"\").join(\"\");\n } else if (isProseMirrorContent(value)) {\n newContent = nodes.map((node) => {\n var _a2;\n return (_a2 = node.text) != null ? _a2 : \"\";\n }).join(\"\");\n } else if (typeof value === \"object\" && !!value && !!value.text) {\n newContent = value.text;\n } else {\n newContent = value;\n }\n tr.insertText(newContent, from, to);\n } else {\n newContent = Fragment2.from(nodes);\n const $from = tr.doc.resolve(from);\n const $fromNode = $from.node();\n const fromSelectionAtStart = $from.parentOffset === 0;\n const isTextSelection2 = $fromNode.isText || $fromNode.isTextblock;\n const hasContent = $fromNode.content.size > 0;\n if (fromSelectionAtStart && isTextSelection2 && hasContent && isOnlyBlockContent) {\n from = Math.max(0, from - 1);\n }\n tr.replaceWith(from, to, nodes);\n }\n if (options.updateSelection) {\n selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n }\n if (options.applyInputRules) {\n tr.setMeta(\"applyInputRules\", { from, text: newContent });\n }\n if (options.applyPasteRules) {\n tr.setMeta(\"applyPasteRules\", { from, text: newContent });\n }\n }\n return true;\n};\n\n// src/helpers/defaultBlockAt.ts\nfunction defaultBlockAt(match) {\n for (let i = 0; i < match.edgeCount; i += 1) {\n const { type } = match.edge(i);\n if (type.isTextblock && !type.hasRequiredAttrs()) {\n return type;\n }\n }\n return null;\n}\n\n// src/commands/insertDefaultBlock.ts\nvar insertDefaultBlock = (options = {}) => ({ tr, dispatch, editor }) => {\n const { pos, attrs, content, updateSelection = true } = options;\n let $pos;\n if (typeof pos === \"number\") {\n $pos = tr.doc.resolve(pos);\n } else if (pos) {\n $pos = pos;\n } else {\n $pos = tr.selection.$from;\n }\n const defaultType = defaultBlockAt($pos.parent.contentMatchAt($pos.index()));\n if (!defaultType) {\n return false;\n }\n const validAttrKeys = Object.keys(defaultType.spec.attrs || {});\n const filteredAttrs = attrs ? Object.fromEntries(Object.entries(attrs).filter(([key]) => validAttrKeys.includes(key))) : {};\n let node;\n if (content) {\n const parsed = createNodeFromContent(content, editor.schema);\n node = defaultType.createAndFill(filteredAttrs, parsed);\n } else {\n node = defaultType.createAndFill(filteredAttrs);\n }\n if (!node) {\n return false;\n }\n if (dispatch) {\n tr.insert($pos.pos, node);\n if (updateSelection) {\n selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n }\n }\n return true;\n};\n\n// src/commands/join.ts\nimport {\n joinBackward as originalJoinBackward,\n joinDown as originalJoinDown,\n joinForward as originalJoinForward,\n joinUp as originalJoinUp\n} from \"@tiptap/pm/commands\";\nvar joinUp = () => ({ state, dispatch }) => {\n return originalJoinUp(state, dispatch);\n};\nvar joinDown = () => ({ state, dispatch }) => {\n return originalJoinDown(state, dispatch);\n};\nvar joinBackward = () => ({ state, dispatch }) => {\n return originalJoinBackward(state, dispatch);\n};\nvar joinForward = () => ({ state, dispatch }) => {\n return originalJoinForward(state, dispatch);\n};\n\n// src/commands/joinItemBackward.ts\nimport { joinPoint } from \"@tiptap/pm/transform\";\nvar joinItemBackward = () => ({ state, dispatch, tr }) => {\n try {\n const point = joinPoint(state.doc, state.selection.$from.pos, -1);\n if (point === null || point === void 0) {\n return false;\n }\n tr.join(point, 2);\n if (dispatch) {\n dispatch(tr);\n }\n return true;\n } catch {\n return false;\n }\n};\n\n// src/commands/joinItemForward.ts\nimport { joinPoint as joinPoint2 } from \"@tiptap/pm/transform\";\nvar joinItemForward = () => ({ state, dispatch, tr }) => {\n try {\n const point = joinPoint2(state.doc, state.selection.$from.pos, 1);\n if (point === null || point === void 0) {\n return false;\n }\n tr.join(point, 2);\n if (dispatch) {\n dispatch(tr);\n }\n return true;\n } catch {\n return false;\n }\n};\n\n// src/commands/joinTextblockBackward.ts\nimport { joinTextblockBackward as originalCommand } from \"@tiptap/pm/commands\";\nvar joinTextblockBackward = () => ({ state, dispatch }) => {\n return originalCommand(state, dispatch);\n};\n\n// src/commands/joinTextblockForward.ts\nimport { joinTextblockForward as originalCommand2 } from \"@tiptap/pm/commands\";\nvar joinTextblockForward = () => ({ state, dispatch }) => {\n return originalCommand2(state, dispatch);\n};\n\n// src/utilities/isMacOS.ts\nfunction isMacOS() {\n return typeof navigator !== \"undefined\" ? /Mac/.test(navigator.platform) : false;\n}\n\n// src/commands/keyboardShortcut.ts\nfunction normalizeKeyName(name) {\n const parts = name.split(/-(?!$)/);\n let result = parts[parts.length - 1];\n if (result === \"Space\") {\n result = \" \";\n }\n let alt;\n let ctrl;\n let shift;\n let meta;\n for (let i = 0; i < parts.length - 1; i += 1) {\n const mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) {\n meta = true;\n } else if (/^a(lt)?$/i.test(mod)) {\n alt = true;\n } else if (/^(c|ctrl|control)$/i.test(mod)) {\n ctrl = true;\n } else if (/^s(hift)?$/i.test(mod)) {\n shift = true;\n } else if (/^mod$/i.test(mod)) {\n if (isiOS() || isMacOS()) {\n meta = true;\n } else {\n ctrl = true;\n }\n } else {\n throw new Error(`Unrecognized modifier name: ${mod}`);\n }\n }\n if (alt) {\n result = `Alt-${result}`;\n }\n if (ctrl) {\n result = `Ctrl-${result}`;\n }\n if (meta) {\n result = `Meta-${result}`;\n }\n if (shift) {\n result = `Shift-${result}`;\n }\n return result;\n}\nvar keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {\n const keys = normalizeKeyName(name).split(/-(?!$)/);\n const key = keys.find((item) => ![\"Alt\", \"Ctrl\", \"Meta\", \"Shift\"].includes(item));\n const event = new KeyboardEvent(\"keydown\", {\n key: key === \"Space\" ? \" \" : key,\n altKey: keys.includes(\"Alt\"),\n ctrlKey: keys.includes(\"Ctrl\"),\n metaKey: keys.includes(\"Meta\"),\n shiftKey: keys.includes(\"Shift\"),\n bubbles: true,\n cancelable: true\n });\n const capturedTransaction = editor.captureTransaction(() => {\n view.someProp(\"handleKeyDown\", (f) => f(view, event));\n });\n capturedTransaction == null ? void 0 : capturedTransaction.steps.forEach((step) => {\n const newStep = step.map(tr.mapping);\n if (newStep && dispatch) {\n tr.maybeStep(newStep);\n }\n });\n return true;\n};\n\n// src/commands/lift.ts\nimport { lift as originalLift } from \"@tiptap/pm/commands\";\n\n// src/helpers/isNodeActive.ts\nfunction isNodeActive(state, typeOrName, attributes = {}) {\n const { from, to, empty } = state.selection;\n const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;\n const nodeRanges = [];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isText) {\n return;\n }\n const relativeFrom = Math.max(from, pos);\n const relativeTo = Math.min(to, pos + node.nodeSize);\n nodeRanges.push({\n node,\n from: relativeFrom,\n to: relativeTo\n });\n });\n const selectionRange = to - from;\n const matchedNodeRanges = nodeRanges.filter((nodeRange) => {\n if (!type) {\n return true;\n }\n return type.name === nodeRange.node.type.name;\n }).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));\n if (empty) {\n return !!matchedNodeRanges.length;\n }\n const range = matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0);\n return range >= selectionRange;\n}\n\n// src/commands/lift.ts\nvar lift = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n const type = getNodeType(typeOrName, state.schema);\n const isActive2 = isNodeActive(state, type, attributes);\n if (!isActive2) {\n return false;\n }\n return originalLift(state, dispatch);\n};\n\n// src/commands/liftEmptyBlock.ts\nimport { liftEmptyBlock as originalLiftEmptyBlock } from \"@tiptap/pm/commands\";\nvar liftEmptyBlock = () => ({ state, dispatch }) => {\n return originalLiftEmptyBlock(state, dispatch);\n};\n\n// src/commands/liftListItem.ts\nimport { liftListItem as originalLiftListItem } from \"@tiptap/pm/schema-list\";\nvar liftListItem = (typeOrName) => ({ state, dispatch }) => {\n const type = getNodeType(typeOrName, state.schema);\n return originalLiftListItem(type)(state, dispatch);\n};\n\n// src/commands/newlineInCode.ts\nimport { newlineInCode as originalNewlineInCode } from \"@tiptap/pm/commands\";\nvar newlineInCode = () => ({ state, dispatch }) => {\n return originalNewlineInCode(state, dispatch);\n};\n\n// src/helpers/getSchemaTypeNameByName.ts\nfunction getSchemaTypeNameByName(name, schema) {\n if (schema.nodes[name]) {\n return \"node\";\n }\n if (schema.marks[name]) {\n return \"mark\";\n }\n return null;\n}\n\n// src/utilities/deleteProps.ts\nfunction deleteProps(obj, propOrProps) {\n const props = typeof propOrProps === \"string\" ? [propOrProps] : propOrProps;\n return Object.keys(obj).reduce((newObj, prop) => {\n if (!props.includes(prop)) {\n newObj[prop] = obj[prop];\n }\n return newObj;\n }, {});\n}\n\n// src/commands/resetAttributes.ts\nvar resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {\n let nodeType = null;\n let markType = null;\n const schemaType = getSchemaTypeNameByName(\n typeof typeOrName === \"string\" ? typeOrName : typeOrName.name,\n state.schema\n );\n if (!schemaType) {\n return false;\n }\n if (schemaType === \"node\") {\n nodeType = getNodeType(typeOrName, state.schema);\n }\n if (schemaType === \"mark\") {\n markType = getMarkType(typeOrName, state.schema);\n }\n let canReset = false;\n tr.selection.ranges.forEach((range) => {\n state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {\n if (nodeType && nodeType === node.type) {\n canReset = true;\n if (dispatch) {\n tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));\n }\n }\n if (markType && node.marks.length) {\n node.marks.forEach((mark) => {\n if (markType === mark.type) {\n canReset = true;\n if (dispatch) {\n tr.addMark(\n pos,\n pos + node.nodeSize,\n markType.create(deleteProps(mark.attrs, attributes))\n );\n }\n }\n });\n }\n });\n });\n return canReset;\n};\n\n// src/commands/scrollIntoView.ts\nvar scrollIntoView = () => ({ tr, dispatch }) => {\n if (dispatch) {\n tr.scrollIntoView();\n }\n return true;\n};\n\n// src/commands/selectAll.ts\nimport { AllSelection } from \"@tiptap/pm/state\";\nvar selectAll = () => ({ tr, dispatch }) => {\n if (dispatch) {\n const selection = new AllSelection(tr.doc);\n tr.setSelection(selection);\n }\n return true;\n};\n\n// src/commands/selectNodeBackward.ts\nimport { selectNodeBackward as originalSelectNodeBackward } from \"@tiptap/pm/commands\";\nvar selectNodeBackward = () => ({ state, dispatch }) => {\n return originalSelectNodeBackward(state, dispatch);\n};\n\n// src/commands/selectNodeForward.ts\nimport { selectNodeForward as originalSelectNodeForward } from \"@tiptap/pm/commands\";\nvar selectNodeForward = () => ({ state, dispatch }) => {\n return originalSelectNodeForward(state, dispatch);\n};\n\n// src/commands/selectParentNode.ts\nimport { selectParentNode as originalSelectParentNode } from \"@tiptap/pm/commands\";\nvar selectParentNode = () => ({ state, dispatch }) => {\n return originalSelectParentNode(state, dispatch);\n};\n\n// src/commands/selectTextblockEnd.ts\nimport { selectTextblockEnd as originalSelectTextblockEnd } from \"@tiptap/pm/commands\";\nvar selectTextblockEnd = () => ({ state, dispatch }) => {\n return originalSelectTextblockEnd(state, dispatch);\n};\n\n// src/commands/selectTextblockStart.ts\nimport { selectTextblockStart as originalSelectTextblockStart } from \"@tiptap/pm/commands\";\nvar selectTextblockStart = () => ({ state, dispatch }) => {\n return originalSelectTextblockStart(state, dispatch);\n};\n\n// src/helpers/createDocument.ts\nfunction createDocument(content, schema, parseOptions = {}, options = {}) {\n return createNodeFromContent(content, schema, {\n slice: false,\n parseOptions,\n errorOnInvalidContent: options.errorOnInvalidContent\n });\n}\n\n// src/commands/setContent.ts\nvar setContent = (content, { errorOnInvalidContent, emitUpdate = true, parseOptions = {} } = {}) => ({ editor, tr, dispatch, commands }) => {\n const { doc } = tr;\n if (parseOptions.preserveWhitespace !== \"full\") {\n const document2 = createDocument(content, editor.schema, parseOptions, {\n errorOnInvalidContent: errorOnInvalidContent != null ? errorOnInvalidContent : editor.options.enableContentCheck\n });\n if (dispatch) {\n const nodes = isFragment(document2) ? document2.content : [document2];\n tr.replaceWith(0, doc.content.size, nodes).setMeta(\"preventUpdate\", !emitUpdate);\n }\n return true;\n }\n if (dispatch) {\n tr.setMeta(\"preventUpdate\", !emitUpdate);\n }\n return commands.insertContentAt({ from: 0, to: doc.content.size }, content, {\n parseOptions,\n errorOnInvalidContent: errorOnInvalidContent != null ? errorOnInvalidContent : editor.options.enableContentCheck\n });\n};\n\n// src/helpers/getMarkAttributes.ts\nfunction getMarkAttributes(state, typeOrName) {\n const type = getMarkType(typeOrName, state.schema);\n const { from, to, empty } = state.selection;\n const marks = [];\n if (empty) {\n if (state.storedMarks) {\n marks.push(...state.storedMarks);\n }\n marks.push(...state.selection.$head.marks());\n } else {\n state.doc.nodesBetween(from, to, (node) => {\n marks.push(...node.marks);\n });\n }\n const mark = marks.find((markItem) => markItem.type.name === type.name);\n if (!mark) {\n return {};\n }\n return { ...mark.attrs };\n}\n\n// src/helpers/combineTransactionSteps.ts\nimport { Transform } from \"@tiptap/pm/transform\";\nfunction combineTransactionSteps(oldDoc, transactions) {\n const transform = new Transform(oldDoc);\n transactions.forEach((transaction) => {\n transaction.steps.forEach((step) => {\n transform.step(step);\n });\n });\n return transform;\n}\n\n// src/helpers/findChildren.ts\nfunction findChildren(node, predicate) {\n const nodesWithPos = [];\n node.descendants((child, pos) => {\n if (predicate(child)) {\n nodesWithPos.push({\n node: child,\n pos\n });\n }\n });\n return nodesWithPos;\n}\n\n// src/helpers/findChildrenInRange.ts\nfunction findChildrenInRange(node, range, predicate) {\n const nodesWithPos = [];\n node.nodesBetween(range.from, range.to, (child, pos) => {\n if (predicate(child)) {\n nodesWithPos.push({\n node: child,\n pos\n });\n }\n });\n return nodesWithPos;\n}\n\n// src/helpers/findParentNodeClosestToPos.ts\nfunction findParentNodeClosestToPos($pos, predicate) {\n for (let i = $pos.depth; i > 0; i -= 1) {\n const node = $pos.node(i);\n if (predicate(node)) {\n return {\n pos: i > 0 ? $pos.before(i) : 0,\n start: $pos.start(i),\n depth: i,\n node\n };\n }\n }\n}\n\n// src/helpers/findParentNode.ts\nfunction findParentNode(predicate) {\n return (selection) => findParentNodeClosestToPos(selection.$from, predicate);\n}\n\n// src/helpers/getExtensionField.ts\nfunction getExtensionField(extension, field, context) {\n if (extension.config[field] === void 0 && extension.parent) {\n return getExtensionField(extension.parent, field, context);\n }\n if (typeof extension.config[field] === \"function\") {\n const value = extension.config[field].bind({\n ...context,\n parent: extension.parent ? getExtensionField(extension.parent, field, context) : null\n });\n return value;\n }\n return extension.config[field];\n}\n\n// src/helpers/flattenExtensions.ts\nfunction flattenExtensions(extensions) {\n return extensions.map((extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const addExtensions = getExtensionField(\n extension,\n \"addExtensions\",\n context\n );\n if (addExtensions) {\n return [extension, ...flattenExtensions(addExtensions())];\n }\n return extension;\n }).flat(10);\n}\n\n// src/helpers/generateHTML.ts\nimport { Node } from \"@tiptap/pm/model\";\n\n// src/helpers/getHTMLFromFragment.ts\nimport { DOMSerializer } from \"@tiptap/pm/model\";\nfunction getHTMLFromFragment(fragment, schema) {\n const documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);\n const temporaryDocument = document.implementation.createHTMLDocument();\n const container = temporaryDocument.createElement(\"div\");\n container.appendChild(documentFragment);\n return container.innerHTML;\n}\n\n// src/helpers/getSchemaByResolvedExtensions.ts\nimport { Schema as Schema2 } from \"@tiptap/pm/model\";\n\n// src/utilities/isFunction.ts\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\n\n// src/utilities/callOrReturn.ts\nfunction callOrReturn(value, context = void 0, ...props) {\n if (isFunction(value)) {\n if (context) {\n return value.bind(context)(...props);\n }\n return value(...props);\n }\n return value;\n}\n\n// src/utilities/isEmptyObject.ts\nfunction isEmptyObject(value = {}) {\n return Object.keys(value).length === 0 && value.constructor === Object;\n}\n\n// src/helpers/splitExtensions.ts\nfunction splitExtensions(extensions) {\n const baseExtensions = extensions.filter(\n (extension) => extension.type === \"extension\"\n );\n const nodeExtensions = extensions.filter((extension) => extension.type === \"node\");\n const markExtensions = extensions.filter((extension) => extension.type === \"mark\");\n return {\n baseExtensions,\n nodeExtensions,\n markExtensions\n };\n}\n\n// src/helpers/getAttributesFromExtensions.ts\nfunction getAttributesFromExtensions(extensions) {\n const extensionAttributes = [];\n const { nodeExtensions, markExtensions } = splitExtensions(extensions);\n const nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];\n const defaultAttribute = {\n default: null,\n validate: void 0,\n rendered: true,\n renderHTML: null,\n parseHTML: null,\n keepOnSplit: true,\n isRequired: false\n };\n const nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== \"text\").map((ext) => ext.name);\n const markExtensionTypes = markExtensions.map((ext) => ext.name);\n const allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];\n extensions.forEach((extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n extensions: nodeAndMarkExtensions\n };\n const addGlobalAttributes = getExtensionField(\n extension,\n \"addGlobalAttributes\",\n context\n );\n if (!addGlobalAttributes) {\n return;\n }\n const globalAttributes = addGlobalAttributes();\n globalAttributes.forEach((globalAttribute) => {\n let resolvedTypes;\n if (Array.isArray(globalAttribute.types)) {\n resolvedTypes = globalAttribute.types;\n } else if (globalAttribute.types === \"*\") {\n resolvedTypes = allExtensionTypes;\n } else if (globalAttribute.types === \"nodes\") {\n resolvedTypes = nodeExtensionTypes;\n } else if (globalAttribute.types === \"marks\") {\n resolvedTypes = markExtensionTypes;\n } else {\n resolvedTypes = [];\n }\n resolvedTypes.forEach((type) => {\n Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {\n extensionAttributes.push({\n type,\n name,\n attribute: {\n ...defaultAttribute,\n ...attribute\n }\n });\n });\n });\n });\n });\n nodeAndMarkExtensions.forEach((extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const addAttributes = getExtensionField(extension, \"addAttributes\", context);\n if (!addAttributes) {\n return;\n }\n const attributes = addAttributes();\n Object.entries(attributes).forEach(([name, attribute]) => {\n const mergedAttr = {\n ...defaultAttribute,\n ...attribute\n };\n if (typeof (mergedAttr == null ? void 0 : mergedAttr.default) === \"function\") {\n mergedAttr.default = mergedAttr.default();\n }\n if ((mergedAttr == null ? void 0 : mergedAttr.isRequired) && (mergedAttr == null ? void 0 : mergedAttr.default) === void 0) {\n delete mergedAttr.default;\n }\n extensionAttributes.push({\n type: extension.name,\n name,\n attribute: mergedAttr\n });\n });\n });\n return extensionAttributes;\n}\n\n// src/utilities/mergeAttributes.ts\nfunction splitStyleDeclarations(styles) {\n const result = [];\n let current = \"\";\n let inSingleQuote = false;\n let inDoubleQuote = false;\n let parenDepth = 0;\n const length = styles.length;\n for (let i = 0; i < length; i += 1) {\n const char = styles[i];\n if (char === \"'\" && !inDoubleQuote) {\n inSingleQuote = !inSingleQuote;\n current += char;\n continue;\n }\n if (char === '\"' && !inSingleQuote) {\n inDoubleQuote = !inDoubleQuote;\n current += char;\n continue;\n }\n if (!inSingleQuote && !inDoubleQuote) {\n if (char === \"(\") {\n parenDepth += 1;\n current += char;\n continue;\n }\n if (char === \")\" && parenDepth > 0) {\n parenDepth -= 1;\n current += char;\n continue;\n }\n if (char === \";\" && parenDepth === 0) {\n result.push(current);\n current = \"\";\n continue;\n }\n }\n current += char;\n }\n if (current) {\n result.push(current);\n }\n return result;\n}\nfunction parseStyleEntries(styles) {\n const pairs = [];\n const declarations = splitStyleDeclarations(styles || \"\");\n const numDeclarations = declarations.length;\n for (let i = 0; i < numDeclarations; i += 1) {\n const declaration = declarations[i];\n const firstColonIndex = declaration.indexOf(\":\");\n if (firstColonIndex === -1) {\n continue;\n }\n const property = declaration.slice(0, firstColonIndex).trim();\n const value = declaration.slice(firstColonIndex + 1).trim();\n if (property && value) {\n pairs.push([property, value]);\n }\n }\n return pairs;\n}\nfunction mergeAttributes(...objects) {\n return objects.filter((item) => !!item).reduce((items, item) => {\n const mergedAttributes = { ...items };\n Object.entries(item).forEach(([key, value]) => {\n const exists = mergedAttributes[key];\n if (!exists) {\n mergedAttributes[key] = value;\n return;\n }\n if (key === \"class\") {\n const valueClasses = value ? String(value).split(\" \") : [];\n const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(\" \") : [];\n const insertClasses = valueClasses.filter(\n (valueClass) => !existingClasses.includes(valueClass)\n );\n mergedAttributes[key] = [...existingClasses, ...insertClasses].join(\" \");\n } else if (key === \"style\") {\n const styleMap = new Map([\n ...parseStyleEntries(mergedAttributes[key]),\n ...parseStyleEntries(value)\n ]);\n mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join(\"; \");\n } else {\n mergedAttributes[key] = value;\n }\n });\n return mergedAttributes;\n }, {});\n}\n\n// src/helpers/getRenderedAttributes.ts\nfunction getRenderedAttributes(nodeOrMark, extensionAttributes) {\n return extensionAttributes.filter((attribute) => attribute.type === nodeOrMark.type.name).filter((item) => item.attribute.rendered).map((item) => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: nodeOrMark.attrs[item.name]\n };\n }\n return item.attribute.renderHTML(nodeOrMark.attrs) || {};\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\n\n// src/utilities/fromString.ts\nfunction fromString(value) {\n if (typeof value !== \"string\") {\n return value;\n }\n if (value.match(/^[+-]?(?:\\d*\\.)?\\d+$/)) {\n return Number(value);\n }\n if (value === \"true\") {\n return true;\n }\n if (value === \"false\") {\n return false;\n }\n return value;\n}\n\n// src/helpers/injectExtensionAttributesToParseRule.ts\nfunction injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {\n if (\"style\" in parseRule) {\n return parseRule;\n }\n return {\n ...parseRule,\n getAttrs: (node) => {\n const oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;\n if (oldAttributes === false) {\n return false;\n }\n const newAttributes = extensionAttributes.reduce((items, item) => {\n const value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));\n if (value === null || value === void 0) {\n return items;\n }\n return {\n ...items,\n [item.name]: value\n };\n }, {});\n return { ...oldAttributes, ...newAttributes };\n }\n };\n}\n\n// src/helpers/getSchemaByResolvedExtensions.ts\nfunction cleanUpSchemaItem(data) {\n return Object.fromEntries(\n // @ts-ignore\n Object.entries(data).filter(([key, value]) => {\n if (key === \"attrs\" && isEmptyObject(value)) {\n return false;\n }\n return value !== null && value !== void 0;\n })\n );\n}\nfunction buildAttributeSpec(extensionAttribute) {\n var _a, _b;\n const spec = {};\n if (!((_a = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _a.isRequired) && \"default\" in ((extensionAttribute == null ? void 0 : extensionAttribute.attribute) || {})) {\n spec.default = extensionAttribute.attribute.default;\n }\n if (((_b = extensionAttribute == null ? void 0 : extensionAttribute.attribute) == null ? void 0 : _b.validate) !== void 0) {\n spec.validate = extensionAttribute.attribute.validate;\n }\n return [extensionAttribute.name, spec];\n}\nfunction getSchemaByResolvedExtensions(extensions, editor) {\n var _a;\n const allAttributes = getAttributesFromExtensions(extensions);\n const { nodeExtensions, markExtensions } = splitExtensions(extensions);\n const topNode = (_a = nodeExtensions.find((extension) => getExtensionField(extension, \"topNode\"))) == null ? void 0 : _a.name;\n const nodes = Object.fromEntries(\n nodeExtensions.map((extension) => {\n const extensionAttributes = allAttributes.filter(\n (attribute) => attribute.type === extension.name\n );\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor\n };\n const extraNodeFields = extensions.reduce((fields, e) => {\n const extendNodeSchema = getExtensionField(\n e,\n \"extendNodeSchema\",\n context\n );\n return {\n ...fields,\n ...extendNodeSchema ? extendNodeSchema(extension) : {}\n };\n }, {});\n const schema = cleanUpSchemaItem({\n ...extraNodeFields,\n content: callOrReturn(\n getExtensionField(extension, \"content\", context)\n ),\n marks: callOrReturn(getExtensionField(extension, \"marks\", context)),\n group: callOrReturn(getExtensionField(extension, \"group\", context)),\n inline: callOrReturn(getExtensionField(extension, \"inline\", context)),\n atom: callOrReturn(getExtensionField(extension, \"atom\", context)),\n selectable: callOrReturn(\n getExtensionField(extension, \"selectable\", context)\n ),\n draggable: callOrReturn(\n getExtensionField(extension, \"draggable\", context)\n ),\n code: callOrReturn(getExtensionField(extension, \"code\", context)),\n whitespace: callOrReturn(\n getExtensionField(extension, \"whitespace\", context)\n ),\n linebreakReplacement: callOrReturn(\n getExtensionField(\n extension,\n \"linebreakReplacement\",\n context\n )\n ),\n defining: callOrReturn(\n getExtensionField(extension, \"defining\", context)\n ),\n isolating: callOrReturn(\n getExtensionField(extension, \"isolating\", context)\n ),\n attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))\n });\n const parseHTML = callOrReturn(\n getExtensionField(extension, \"parseHTML\", context)\n );\n if (parseHTML) {\n schema.parseDOM = parseHTML.map(\n (parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)\n );\n }\n const renderHTML = getExtensionField(\n extension,\n \"renderHTML\",\n context\n );\n if (renderHTML) {\n schema.toDOM = (node) => renderHTML({\n node,\n HTMLAttributes: getRenderedAttributes(node, extensionAttributes)\n });\n }\n const renderText = getExtensionField(\n extension,\n \"renderText\",\n context\n );\n if (renderText) {\n schema.toText = renderText;\n }\n return [extension.name, schema];\n })\n );\n const marks = Object.fromEntries(\n markExtensions.map((extension) => {\n const extensionAttributes = allAttributes.filter(\n (attribute) => attribute.type === extension.name\n );\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor\n };\n const extraMarkFields = extensions.reduce((fields, e) => {\n const extendMarkSchema = getExtensionField(\n e,\n \"extendMarkSchema\",\n context\n );\n return {\n ...fields,\n ...extendMarkSchema ? extendMarkSchema(extension) : {}\n };\n }, {});\n const schema = cleanUpSchemaItem({\n ...extraMarkFields,\n inclusive: callOrReturn(\n getExtensionField(extension, \"inclusive\", context)\n ),\n excludes: callOrReturn(\n getExtensionField(extension, \"excludes\", context)\n ),\n group: callOrReturn(getExtensionField(extension, \"group\", context)),\n spanning: callOrReturn(\n getExtensionField(extension, \"spanning\", context)\n ),\n code: callOrReturn(getExtensionField(extension, \"code\", context)),\n attrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))\n });\n const parseHTML = callOrReturn(\n getExtensionField(extension, \"parseHTML\", context)\n );\n if (parseHTML) {\n schema.parseDOM = parseHTML.map(\n (parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes)\n );\n }\n const renderHTML = getExtensionField(\n extension,\n \"renderHTML\",\n context\n );\n if (renderHTML) {\n schema.toDOM = (mark) => renderHTML({\n mark,\n HTMLAttributes: getRenderedAttributes(mark, extensionAttributes)\n });\n }\n return [extension.name, schema];\n })\n );\n return new Schema2({\n topNode,\n nodes,\n marks\n });\n}\n\n// src/utilities/findDuplicates.ts\nfunction findDuplicates(items) {\n const filtered = items.filter((el, index) => items.indexOf(el) !== index);\n return Array.from(new Set(filtered));\n}\n\n// src/helpers/sortExtensions.ts\nfunction sortExtensions(extensions) {\n const defaultPriority = 100;\n return extensions.sort((a, b) => {\n const priorityA = getExtensionField(a, \"priority\") || defaultPriority;\n const priorityB = getExtensionField(b, \"priority\") || defaultPriority;\n if (priorityA > priorityB) {\n return -1;\n }\n if (priorityA < priorityB) {\n return 1;\n }\n return 0;\n });\n}\n\n// src/helpers/resolveExtensions.ts\nfunction resolveExtensions(extensions) {\n const resolvedExtensions = sortExtensions(flattenExtensions(extensions));\n const duplicatedNames = findDuplicates(resolvedExtensions.map((extension) => extension.name));\n if (duplicatedNames.length) {\n console.warn(\n `[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map((item) => `'${item}'`).join(\", \")}]. This can lead to issues.`\n );\n }\n return resolvedExtensions;\n}\n\n// src/helpers/getSchema.ts\nfunction getSchema(extensions, editor) {\n const resolvedExtensions = resolveExtensions(extensions);\n return getSchemaByResolvedExtensions(resolvedExtensions, editor);\n}\n\n// src/helpers/generateHTML.ts\nfunction generateHTML(doc, extensions) {\n const schema = getSchema(extensions);\n const contentNode = Node.fromJSON(schema, doc);\n return getHTMLFromFragment(contentNode.content, schema);\n}\n\n// src/helpers/generateJSON.ts\nimport { DOMParser as DOMParser2 } from \"@tiptap/pm/model\";\nfunction generateJSON(html, extensions) {\n const schema = getSchema(extensions);\n const dom = elementFromString(html);\n return DOMParser2.fromSchema(schema).parse(dom).toJSON();\n}\n\n// src/helpers/generateText.ts\nimport { Node as Node2 } from \"@tiptap/pm/model\";\n\n// src/helpers/getTextBetween.ts\nfunction getTextBetween(startNode, range, options) {\n const { from, to } = range;\n const { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n let text = \"\";\n startNode.nodesBetween(from, to, (node, pos, parent, index) => {\n var _a;\n if (node.isBlock && pos > from) {\n text += blockSeparator;\n }\n const textSerializer = textSerializers == null ? void 0 : textSerializers[node.type.name];\n if (textSerializer) {\n if (parent) {\n text += textSerializer({\n node,\n pos,\n parent,\n index,\n range\n });\n }\n return false;\n }\n if (node.isText) {\n text += (_a = node == null ? void 0 : node.text) == null ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos);\n }\n });\n return text;\n}\n\n// src/helpers/getText.ts\nfunction getText(node, options) {\n const range = {\n from: 0,\n to: node.content.size\n };\n return getTextBetween(node, range, options);\n}\n\n// src/helpers/getTextSerializersFromSchema.ts\nfunction getTextSerializersFromSchema(schema) {\n return Object.fromEntries(\n Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText])\n );\n}\n\n// src/helpers/generateText.ts\nfunction generateText(doc, extensions, options) {\n const { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n const schema = getSchema(extensions);\n const contentNode = Node2.fromJSON(schema, doc);\n return getText(contentNode, {\n blockSeparator,\n textSerializers: {\n ...getTextSerializersFromSchema(schema),\n ...textSerializers\n }\n });\n}\n\n// src/helpers/getNodeAttributes.ts\nfunction getNodeAttributes(state, typeOrName) {\n const type = getNodeType(typeOrName, state.schema);\n const { from, to } = state.selection;\n const nodes = [];\n state.doc.nodesBetween(from, to, (node2) => {\n nodes.push(node2);\n });\n const node = nodes.reverse().find((nodeItem) => nodeItem.type.name === type.name);\n if (!node) {\n return {};\n }\n return { ...node.attrs };\n}\n\n// src/helpers/getAttributes.ts\nfunction getAttributes(state, typeOrName) {\n const schemaType = getSchemaTypeNameByName(\n typeof typeOrName === \"string\" ? typeOrName : typeOrName.name,\n state.schema\n );\n if (schemaType === \"node\") {\n return getNodeAttributes(state, typeOrName);\n }\n if (schemaType === \"mark\") {\n return getMarkAttributes(state, typeOrName);\n }\n return {};\n}\n\n// src/utilities/removeDuplicates.ts\nfunction removeDuplicates(array, by = JSON.stringify) {\n const seen = {};\n return array.filter((item) => {\n const key = by(item);\n return Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;\n });\n}\n\n// src/helpers/getChangedRanges.ts\nfunction simplifyChangedRanges(changes) {\n const uniqueChanges = removeDuplicates(changes);\n return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {\n const rest = uniqueChanges.filter((_, i) => i !== index);\n return !rest.some((otherChange) => {\n return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;\n });\n });\n}\nfunction getChangedRanges(transform) {\n const { mapping, steps } = transform;\n const changes = [];\n mapping.maps.forEach((stepMap, index) => {\n const ranges = [];\n if (!stepMap.ranges.length) {\n const { from, to } = steps[index];\n if (from === void 0 || to === void 0) {\n return;\n }\n ranges.push({ from, to });\n } else {\n stepMap.forEach((from, to) => {\n ranges.push({ from, to });\n });\n }\n ranges.forEach(({ from, to }) => {\n const newStart = mapping.slice(index).map(from, -1);\n const newEnd = mapping.slice(index).map(to);\n const oldStart = mapping.invert().map(newStart, -1);\n const oldEnd = mapping.invert().map(newEnd);\n changes.push({\n oldRange: {\n from: oldStart,\n to: oldEnd\n },\n newRange: {\n from: newStart,\n to: newEnd\n }\n });\n });\n });\n return simplifyChangedRanges(changes);\n}\n\n// src/helpers/getDebugJSON.ts\nfunction getDebugJSON(node, startOffset = 0) {\n const isTopNode = node.type === node.type.schema.topNodeType;\n const increment = isTopNode ? 0 : 1;\n const from = startOffset;\n const to = from + node.nodeSize;\n const marks = node.marks.map((mark) => {\n const output2 = {\n type: mark.type.name\n };\n if (Object.keys(mark.attrs).length) {\n output2.attrs = { ...mark.attrs };\n }\n return output2;\n });\n const attrs = { ...node.attrs };\n const output = {\n type: node.type.name,\n from,\n to\n };\n if (Object.keys(attrs).length) {\n output.attrs = attrs;\n }\n if (marks.length) {\n output.marks = marks;\n }\n if (node.content.childCount) {\n output.content = [];\n node.forEach((child, offset) => {\n var _a;\n (_a = output.content) == null ? void 0 : _a.push(getDebugJSON(child, startOffset + offset + increment));\n });\n }\n if (node.text) {\n output.text = node.text;\n }\n return output;\n}\n\n// src/helpers/getMarksBetween.ts\nfunction getMarksBetween(from, to, doc) {\n const marks = [];\n if (from === to) {\n doc.resolve(from).marks().forEach((mark) => {\n const $pos = doc.resolve(from);\n const range = getMarkRange($pos, mark.type);\n if (!range) {\n return;\n }\n marks.push({\n mark,\n ...range\n });\n });\n } else {\n doc.nodesBetween(from, to, (node, pos) => {\n if (!node || (node == null ? void 0 : node.nodeSize) === void 0) {\n return;\n }\n marks.push(\n ...node.marks.map((mark) => ({\n from: pos,\n to: pos + node.nodeSize,\n mark\n }))\n );\n });\n }\n return marks;\n}\n\n// src/helpers/getNodeAtPosition.ts\nvar getNodeAtPosition = (state, typeOrName, pos, maxDepth = 20) => {\n const $pos = state.doc.resolve(pos);\n let currentDepth = maxDepth;\n let node = null;\n while (currentDepth > 0 && node === null) {\n const currentNode = $pos.node(currentDepth);\n if ((currentNode == null ? void 0 : currentNode.type.name) === typeOrName) {\n node = currentNode;\n } else {\n currentDepth -= 1;\n }\n }\n return [node, currentDepth];\n};\n\n// src/helpers/getPreviousBlockSibling.ts\nvar getPreviousBlockSibling = ($pos) => {\n const parentDepth = $pos.depth - 1;\n if (parentDepth < 0) return null;\n const index = $pos.index(parentDepth);\n if (index === 0) return null;\n return $pos.node(parentDepth).child(index - 1);\n};\n\n// src/helpers/getSchemaTypeByName.ts\nfunction getSchemaTypeByName(name, schema) {\n return schema.nodes[name] || schema.marks[name] || null;\n}\n\n// src/helpers/getSplittedAttributes.ts\nfunction getSplittedAttributes(extensionAttributes, typeName, attributes) {\n return Object.fromEntries(\n Object.entries(attributes).filter(([name]) => {\n const extensionAttribute = extensionAttributes.find((item) => {\n return item.type === typeName && item.name === name;\n });\n if (!extensionAttribute) {\n return false;\n }\n return extensionAttribute.attribute.keepOnSplit;\n })\n );\n}\n\n// src/helpers/getTextContentFromNodes.ts\nvar getTextContentFromNodes = ($from, maxMatch = 500) => {\n let textBefore = \"\";\n const sliceEndPos = $from.parentOffset;\n $from.parent.nodesBetween(\n Math.max(0, sliceEndPos - maxMatch),\n sliceEndPos,\n (node, pos, parent, index) => {\n var _a, _b;\n const chunk = ((_b = (_a = node.type.spec).toText) == null ? void 0 : _b.call(_a, {\n node,\n pos,\n parent,\n index\n })) || node.textContent || \"%leaf%\";\n textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));\n }\n );\n return textBefore;\n};\n\n// src/helpers/isMarkActive.ts\nfunction isMarkActive(state, typeOrName, attributes = {}) {\n const { empty, ranges } = state.selection;\n const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;\n if (empty) {\n return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {\n if (!type) {\n return true;\n }\n return type.name === mark.type.name;\n }).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));\n }\n let selectionRange = 0;\n const markRanges = [];\n ranges.forEach(({ $from, $to }) => {\n const from = $from.pos;\n const to = $to.pos;\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (type && node.inlineContent && !node.type.allowsMarkType(type)) {\n return false;\n }\n if (!node.isText && !node.marks.length) {\n return;\n }\n const relativeFrom = Math.max(from, pos);\n const relativeTo = Math.min(to, pos + node.nodeSize);\n const range2 = relativeTo - relativeFrom;\n selectionRange += range2;\n markRanges.push(\n ...node.marks.map((mark) => ({\n mark,\n from: relativeFrom,\n to: relativeTo\n }))\n );\n });\n });\n if (selectionRange === 0) {\n return false;\n }\n const matchedRange = markRanges.filter((markRange) => {\n if (!type) {\n return true;\n }\n return type.name === markRange.mark.type.name;\n }).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n const excludedRange = markRanges.filter((markRange) => {\n if (!type) {\n return true;\n }\n return markRange.mark.type !== type && markRange.mark.type.excludes(type);\n }).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n const range = matchedRange > 0 ? matchedRange + excludedRange : matchedRange;\n return range >= selectionRange;\n}\n\n// src/helpers/isActive.ts\nfunction isActive(state, name, attributes = {}) {\n if (!name) {\n return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);\n }\n const schemaType = getSchemaTypeNameByName(name, state.schema);\n if (schemaType === \"node\") {\n return isNodeActive(state, name, attributes);\n }\n if (schemaType === \"mark\") {\n return isMarkActive(state, name, attributes);\n }\n return false;\n}\n\n// src/helpers/isAtEndOfNode.ts\nvar isAtEndOfNode = (state, nodeType) => {\n const { $from, $to, $anchor } = state.selection;\n if (nodeType) {\n const parentNode = findParentNode((node) => node.type.name === nodeType)(state.selection);\n if (!parentNode) {\n return false;\n }\n const $parentPos = state.doc.resolve(parentNode.pos + 1);\n if ($anchor.pos + 1 === $parentPos.end()) {\n return true;\n }\n return false;\n }\n if ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) {\n return false;\n }\n return true;\n};\n\n// src/helpers/isAtStartOfNode.ts\nvar isAtStartOfNode = (state) => {\n const { $from, $to } = state.selection;\n if ($from.parentOffset > 0 || $from.pos !== $to.pos) {\n return false;\n }\n return true;\n};\n\n// src/helpers/isExtensionRulesEnabled.ts\nfunction isExtensionRulesEnabled(extension, enabled) {\n if (Array.isArray(enabled)) {\n return enabled.some((enabledExtension) => {\n const name = typeof enabledExtension === \"string\" ? enabledExtension : enabledExtension.name;\n return name === extension.name;\n });\n }\n return enabled;\n}\n\n// src/helpers/isList.ts\nfunction isList(name, extensions) {\n const { nodeExtensions } = splitExtensions(extensions);\n const extension = nodeExtensions.find((item) => item.name === name);\n if (!extension) {\n return false;\n }\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const group = callOrReturn(getExtensionField(extension, \"group\", context));\n if (typeof group !== \"string\") {\n return false;\n }\n return group.split(\" \").includes(\"list\");\n}\n\n// src/helpers/isNodeEmpty.ts\nfunction isNodeEmpty(node, {\n checkChildren = true,\n ignoreWhitespace = false\n} = {}) {\n var _a;\n if (ignoreWhitespace) {\n if (node.type.name === \"hardBreak\") {\n return true;\n }\n if (node.isText) {\n return !/\\S/.test((_a = node.text) != null ? _a : \"\");\n }\n }\n if (node.isText) {\n return !node.text;\n }\n if (node.isAtom || node.isLeaf) {\n return false;\n }\n if (node.content.childCount === 0) {\n return true;\n }\n if (checkChildren) {\n let isContentEmpty = true;\n node.content.forEach((childNode) => {\n if (isContentEmpty === false) {\n return;\n }\n if (!isNodeEmpty(childNode, { ignoreWhitespace, checkChildren })) {\n isContentEmpty = false;\n }\n });\n return isContentEmpty;\n }\n return false;\n}\n\n// src/helpers/isNodeSelection.ts\nimport { NodeSelection } from \"@tiptap/pm/state\";\nfunction isNodeSelection(value) {\n return value instanceof NodeSelection;\n}\n\n// src/helpers/isNodeViewSelected.ts\nfunction isNodeViewSelected({\n selection,\n pos,\n nodeSize,\n selectedOnTextSelection = false\n}) {\n const { from, to } = selection;\n if (from <= pos && to >= pos + nodeSize) {\n return true;\n }\n if (selectedOnTextSelection && isTextSelection(selection) && from > pos && to < pos + nodeSize) {\n return true;\n }\n return false;\n}\n\n// src/helpers/isProseMirrorStep.ts\nfunction isProseMirrorStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (typeof step.apply !== \"function\" || typeof step.getMap !== \"function\" || typeof step.invert !== \"function\" || typeof step.map !== \"function\" || typeof step.merge !== \"function\" || typeof step.toJSON !== \"function\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorAddMarkStep.ts\nfunction isProseMirrorAddMarkStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (!isProseMirrorStep(step)) {\n return false;\n }\n const json = step.toJSON();\n if (json === null || typeof json !== \"object\" || json.stepType !== \"addMark\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorAddNodeMarkStep.ts\nfunction isProseMirrorAddNodeMarkStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (!isProseMirrorStep(step)) {\n return false;\n }\n const json = step.toJSON();\n if (json === null || typeof json !== \"object\" || json.stepType !== \"addNodeMark\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorAttrStep.ts\nfunction isProseMirrorAttrStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (!isProseMirrorStep(step)) {\n return false;\n }\n const json = step.toJSON();\n if (json === null || typeof json !== \"object\" || json.stepType !== \"attr\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorCellSelection.ts\nfunction isProseMirrorCellSelection(selection) {\n if (selection === null || typeof selection !== \"object\") {\n return false;\n }\n return \"forEachCell\" in selection && typeof selection.forEachCell === \"function\";\n}\n\n// src/helpers/isProseMirrorDocAttrStep.ts\nfunction isProseMirrorDocAttrStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (!isProseMirrorStep(step)) {\n return false;\n }\n const json = step.toJSON();\n if (json === null || typeof json !== \"object\" || json.stepType !== \"docAttr\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorFragment.ts\nfunction isProseMirrorFragment(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const fragment = value;\n if (!Array.isArray(fragment.content) || typeof fragment.size !== \"number\" || typeof fragment.nodesBetween !== \"function\" || typeof fragment.descendants !== \"function\" || typeof fragment.textBetween !== \"function\" || typeof fragment.append !== \"function\" || typeof fragment.cut !== \"function\" || typeof fragment.eq !== \"function\" || typeof fragment.child !== \"function\" || typeof fragment.forEach !== \"function\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorNodeSelection.ts\nfunction isProseMirrorNodeSelection(selection) {\n if (selection === null || typeof selection !== \"object\") {\n return false;\n }\n return \"node\" in selection && selection.node != null;\n}\n\n// src/helpers/isProseMirrorRemoveMarkStep.ts\nfunction isProseMirrorRemoveMarkStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (!isProseMirrorStep(step)) {\n return false;\n }\n const json = step.toJSON();\n if (json === null || typeof json !== \"object\" || json.stepType !== \"removeMark\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorRemoveNodeMarkStep.ts\nfunction isProseMirrorRemoveNodeMarkStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (!isProseMirrorStep(step)) {\n return false;\n }\n const json = step.toJSON();\n if (json === null || typeof json !== \"object\" || json.stepType !== \"removeNodeMark\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorReplaceAroundStep.ts\nfunction isProseMirrorReplaceAroundStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (!isProseMirrorStep(step)) {\n return false;\n }\n const json = step.toJSON();\n if (json === null || typeof json !== \"object\" || json.stepType !== \"replaceAround\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorReplaceStep.ts\nfunction isProseMirrorReplaceStep(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const step = value;\n if (!isProseMirrorStep(step)) {\n return false;\n }\n const json = step.toJSON();\n if (json === null || typeof json !== \"object\" || json.stepType !== \"replace\") {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorSlice.ts\nfunction isProseMirrorSlice(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const slice = value;\n const openStartIsNumber = Number.isInteger(slice.openStart) && slice.openStart >= 0;\n const openEndIsNumber = Number.isInteger(slice.openEnd) && slice.openEnd >= 0;\n const sliceHasRequiredProperties = typeof slice.size === \"number\" && typeof slice.eq === \"function\" && typeof slice.toJSON === \"function\";\n if (!openStartIsNumber || !openEndIsNumber || !sliceHasRequiredProperties) {\n return false;\n }\n const content = slice.content;\n if (content === null || typeof content !== \"object\") {\n return false;\n }\n const fragment = content;\n if (!isProseMirrorFragment(fragment)) {\n return false;\n }\n return true;\n}\n\n// src/helpers/isProseMirrorStepResult.ts\nfunction isProseMirrorStepResult(value) {\n if (value === null || typeof value !== \"object\") {\n return false;\n }\n const result = value;\n const isValidDoc = result.doc !== null && typeof result.doc === \"object\" && result.failed === null;\n const isValidFailed = typeof result.failed === \"string\" && result.doc === null;\n if (!isValidDoc && !isValidFailed) {\n return false;\n }\n return true;\n}\n\n// src/helpers/MappablePosition.ts\nvar MappablePosition = class _MappablePosition {\n constructor(position) {\n this.position = position;\n }\n /**\n * Creates a MappablePosition from a JSON object.\n */\n static fromJSON(json) {\n return new _MappablePosition(json.position);\n }\n /**\n * Converts the MappablePosition to a JSON object.\n */\n toJSON() {\n return {\n position: this.position\n };\n }\n};\nfunction getUpdatedPosition(position, transaction) {\n const mapResult = transaction.mapping.mapResult(position.position);\n return {\n position: new MappablePosition(mapResult.pos),\n mapResult\n };\n}\nfunction createMappablePosition(position) {\n return new MappablePosition(position);\n}\n\n// src/helpers/posToDOMRect.ts\nfunction posToDOMRect(view, from, to) {\n const minPos = 0;\n const maxPos = view.state.doc.content.size;\n const resolvedFrom = minMax(from, minPos, maxPos);\n const resolvedEnd = minMax(to, minPos, maxPos);\n const start = view.coordsAtPos(resolvedFrom);\n const end = view.coordsAtPos(resolvedEnd, -1);\n const top = Math.min(start.top, end.top);\n const bottom = Math.max(start.bottom, end.bottom);\n const left = Math.min(start.left, end.left);\n const right = Math.max(start.right, end.right);\n const width = right - left;\n const height = bottom - top;\n const x = left;\n const y = top;\n const data = {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x,\n y\n };\n return {\n ...data,\n toJSON: () => data\n };\n}\n\n// src/helpers/rewriteUnknownContent.ts\nfunction rewriteUnknownContentInner({\n json,\n validMarks,\n validNodes,\n options,\n rewrittenContent = []\n}) {\n if (json.marks && Array.isArray(json.marks)) {\n json.marks = json.marks.filter((mark) => {\n if (mark === null || mark === void 0) {\n return false;\n }\n const name = typeof mark === \"string\" ? mark : mark.type;\n if (validMarks.has(name)) {\n return true;\n }\n rewrittenContent.push({\n original: JSON.parse(JSON.stringify(mark)),\n unsupported: name\n });\n return false;\n });\n }\n if (json.content && Array.isArray(json.content)) {\n json.content = json.content.map((value) => {\n if (value === null || value === void 0) {\n return null;\n }\n return rewriteUnknownContentInner({\n json: value,\n validMarks,\n validNodes,\n options,\n rewrittenContent\n }).json;\n }).filter((a) => a !== null && a !== void 0);\n }\n if (json.type && !validNodes.has(json.type)) {\n rewrittenContent.push({\n original: JSON.parse(JSON.stringify(json)),\n unsupported: json.type\n });\n if (json.content && Array.isArray(json.content) && (options == null ? void 0 : options.fallbackToParagraph) !== false) {\n json.type = \"paragraph\";\n return {\n json,\n rewrittenContent\n };\n }\n return {\n json: null,\n rewrittenContent\n };\n }\n return { json, rewrittenContent };\n}\nfunction rewriteUnknownContent(json, schema, options) {\n return rewriteUnknownContentInner({\n json,\n validNodes: new Set(Object.keys(schema.nodes)),\n validMarks: new Set(Object.keys(schema.marks)),\n options\n });\n}\n\n// src/commands/setMark.ts\nfunction canSetMark(state, tr, newMarkType) {\n var _a;\n const { selection } = tr;\n let cursor = null;\n if (isTextSelection(selection)) {\n cursor = selection.$cursor;\n }\n if (cursor) {\n const currentMarks = (_a = state.storedMarks) != null ? _a : cursor.marks();\n const parentAllowsMarkType = cursor.parent.type.allowsMarkType(newMarkType);\n return parentAllowsMarkType && (!!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType)));\n }\n const { ranges } = selection;\n return ranges.some(({ $from, $to }) => {\n let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;\n state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {\n if (someNodeSupportsMark) {\n return false;\n }\n if (node.isInline) {\n const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);\n const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));\n someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;\n }\n return !someNodeSupportsMark;\n });\n return someNodeSupportsMark;\n });\n}\nvar setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {\n const { selection } = tr;\n const { empty, ranges } = selection;\n const type = getMarkType(typeOrName, state.schema);\n if (dispatch) {\n if (empty) {\n const oldAttributes = getMarkAttributes(state, type);\n tr.addStoredMark(\n type.create({\n ...oldAttributes,\n ...attributes\n })\n );\n } else {\n ranges.forEach((range) => {\n const from = range.$from.pos;\n const to = range.$to.pos;\n state.doc.nodesBetween(from, to, (node, pos) => {\n const trimmedFrom = Math.max(pos, from);\n const trimmedTo = Math.min(pos + node.nodeSize, to);\n const someHasMark = node.marks.find((mark) => mark.type === type);\n if (someHasMark) {\n node.marks.forEach((mark) => {\n if (type === mark.type) {\n tr.addMark(\n trimmedFrom,\n trimmedTo,\n type.create({\n ...mark.attrs,\n ...attributes\n })\n );\n }\n });\n } else {\n tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));\n }\n });\n });\n }\n }\n return canSetMark(state, tr, type);\n};\n\n// src/commands/setMeta.ts\nvar setMeta = (key, value) => ({ tr }) => {\n tr.setMeta(key, value);\n return true;\n};\n\n// src/commands/setNode.ts\nimport { setBlockType } from \"@tiptap/pm/commands\";\nvar setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {\n const type = getNodeType(typeOrName, state.schema);\n let attributesToCopy;\n if (state.selection.$anchor.sameParent(state.selection.$head)) {\n attributesToCopy = state.selection.$anchor.parent.attrs;\n }\n if (!type.isTextblock) {\n console.warn('[tiptap warn]: Currently \"setNode()\" only supports text block nodes.');\n return false;\n }\n return chain().command(({ commands }) => {\n const canSetBlock = setBlockType(type, { ...attributesToCopy, ...attributes })(state);\n if (canSetBlock) {\n return true;\n }\n return commands.clearNodes();\n }).command(({ state: updatedState }) => {\n return setBlockType(type, { ...attributesToCopy, ...attributes })(updatedState, dispatch);\n }).run();\n};\n\n// src/commands/setNodeSelection.ts\nimport { NodeSelection as NodeSelection2 } from \"@tiptap/pm/state\";\nvar setNodeSelection = (position) => ({ tr, dispatch }) => {\n if (dispatch) {\n const { doc } = tr;\n const from = minMax(position, 0, doc.content.size);\n const selection = NodeSelection2.create(doc, from);\n tr.setSelection(selection);\n }\n return true;\n};\n\n// src/commands/setTextDirection.ts\nvar setTextDirection = (direction, position) => ({ tr, state, dispatch }) => {\n const { selection } = state;\n let from;\n let to;\n if (typeof position === \"number\") {\n from = position;\n to = position;\n } else if (position && \"from\" in position && \"to\" in position) {\n from = position.from;\n to = position.to;\n } else {\n from = selection.from;\n to = selection.to;\n }\n if (dispatch) {\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isText) {\n return;\n }\n tr.setNodeMarkup(pos, void 0, {\n ...node.attrs,\n dir: direction\n });\n });\n }\n return true;\n};\n\n// src/commands/setTextSelection.ts\nimport { TextSelection as TextSelection6 } from \"@tiptap/pm/state\";\nvar setTextSelection = (position) => ({ tr, dispatch }) => {\n if (dispatch) {\n const { doc } = tr;\n const { from, to } = typeof position === \"number\" ? { from: position, to: position } : position;\n const minPos = TextSelection6.atStart(doc).from;\n const maxPos = TextSelection6.atEnd(doc).to;\n const resolvedFrom = minMax(from, minPos, maxPos);\n const resolvedEnd = minMax(to, minPos, maxPos);\n const selection = TextSelection6.create(doc, resolvedFrom, resolvedEnd);\n tr.setSelection(selection);\n }\n return true;\n};\n\n// src/commands/sinkListItem.ts\nimport { sinkListItem as originalSinkListItem } from \"@tiptap/pm/schema-list\";\nvar sinkListItem = (typeOrName) => ({ state, dispatch }) => {\n const type = getNodeType(typeOrName, state.schema);\n return originalSinkListItem(type)(state, dispatch);\n};\n\n// src/commands/splitBlock.ts\nimport { NodeSelection as NodeSelection3, TextSelection as TextSelection7 } from \"@tiptap/pm/state\";\nimport { canSplit } from \"@tiptap/pm/transform\";\nfunction ensureMarks(state, splittableMarks) {\n const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n if (marks) {\n const filteredMarks = marks.filter((mark) => splittableMarks == null ? void 0 : splittableMarks.includes(mark.type.name));\n state.tr.ensureMarks(filteredMarks);\n }\n}\nvar splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {\n const { selection, doc } = tr;\n const { $from, $to } = selection;\n const extensionAttributes = editor.extensionManager.attributes;\n const newAttributes = getSplittedAttributes(\n extensionAttributes,\n $from.node().type.name,\n $from.node().attrs\n );\n if (selection instanceof NodeSelection3 && selection.node.isBlock) {\n if (!$from.parentOffset || !canSplit(doc, $from.pos)) {\n return false;\n }\n if (dispatch) {\n if (keepMarks) {\n ensureMarks(state, editor.extensionManager.splittableMarks);\n }\n tr.split($from.pos).scrollIntoView();\n }\n return true;\n }\n if (!$from.parent.isBlock) {\n return false;\n }\n const atEnd = $to.parentOffset === $to.parent.content.size;\n const deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));\n let types = atEnd && deflt ? [\n {\n type: deflt,\n attrs: newAttributes\n }\n ] : void 0;\n let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);\n if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {\n can = true;\n types = deflt ? [\n {\n type: deflt,\n attrs: newAttributes\n }\n ] : void 0;\n }\n if (dispatch) {\n if (can) {\n if (selection instanceof TextSelection7) {\n tr.deleteSelection();\n }\n tr.split(tr.mapping.map($from.pos), 1, types);\n if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {\n const first2 = tr.mapping.map($from.before());\n const $first = tr.doc.resolve(first2);\n if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {\n tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);\n }\n }\n }\n if (keepMarks) {\n ensureMarks(state, editor.extensionManager.splittableMarks);\n }\n tr.scrollIntoView();\n }\n return can;\n};\n\n// src/commands/splitListItem.ts\nimport { Fragment as Fragment3, Slice } from \"@tiptap/pm/model\";\nimport { TextSelection as TextSelection8 } from \"@tiptap/pm/state\";\nimport { canSplit as canSplit2 } from \"@tiptap/pm/transform\";\nvar splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {\n var _a;\n const type = getNodeType(typeOrName, state.schema);\n const { $from, $to } = state.selection;\n const node = state.selection.node;\n if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {\n return false;\n }\n const grandParent = $from.node(-1);\n if (grandParent.type !== type) {\n return false;\n }\n const extensionAttributes = editor.extensionManager.attributes;\n if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {\n if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) {\n return false;\n }\n if (dispatch) {\n let wrap = Fragment3.empty;\n const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {\n wrap = Fragment3.from($from.node(d).copy(wrap));\n }\n const depthAfter = (\n // oxlint-disable-next-line no-nested-ternary\n $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3\n );\n const newNextTypeAttributes2 = {\n ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n ...overrideAttrs\n };\n const nextType2 = ((_a = type.contentMatch.defaultType) == null ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;\n wrap = wrap.append(Fragment3.from(type.createAndFill(null, nextType2) || void 0));\n const start = $from.before($from.depth - (depthBefore - 1));\n tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n let sel = -1;\n tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {\n if (sel > -1) {\n return false;\n }\n if (n.isTextblock && n.content.size === 0) {\n sel = pos + 1;\n }\n });\n if (sel > -1) {\n tr.setSelection(TextSelection8.near(tr.doc.resolve(sel)));\n }\n tr.scrollIntoView();\n }\n return true;\n }\n const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n const newTypeAttributes = {\n ...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),\n ...overrideAttrs\n };\n const newNextTypeAttributes = {\n ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n ...overrideAttrs\n };\n tr.delete($from.pos, $to.pos);\n const types = nextType ? [\n { type, attrs: newTypeAttributes },\n { type: nextType, attrs: newNextTypeAttributes }\n ] : [{ type, attrs: newTypeAttributes }];\n if (!canSplit2(tr.doc, $from.pos, 2)) {\n return false;\n }\n if (dispatch) {\n const { selection, storedMarks } = state;\n const { splittableMarks } = editor.extensionManager;\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n tr.split($from.pos, 2, types).scrollIntoView();\n if (!marks || !dispatch) {\n return true;\n }\n const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n }\n return true;\n};\n\n// src/commands/toggleList.ts\nimport { TextSelection as TextSelection9 } from \"@tiptap/pm/state\";\nimport { canJoin } from \"@tiptap/pm/transform\";\nfunction normalizeListType(type) {\n return !type || type === \"1\" ? null : type;\n}\nfunction areListTypesCompatible(typeA, typeB) {\n return normalizeListType(typeA) === normalizeListType(typeB);\n}\nvar joinListBackwards = (tr, listType) => {\n const list = findParentNode((node) => node.type === listType)(tr.selection);\n if (!list) {\n return true;\n }\n const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);\n if (before === void 0) {\n return true;\n }\n const nodeBefore = tr.doc.nodeAt(before);\n const canJoinBackwards = list.node.type === (nodeBefore == null ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos);\n if (!canJoinBackwards) {\n return true;\n }\n if (!areListTypesCompatible(list.node.attrs.type, nodeBefore == null ? void 0 : nodeBefore.attrs.type)) {\n return true;\n }\n tr.join(list.pos);\n return true;\n};\nvar joinListForwards = (tr, listType) => {\n const list = findParentNode((node) => node.type === listType)(tr.selection);\n if (!list) {\n return true;\n }\n const after = tr.doc.resolve(list.start).after(list.depth);\n if (after === void 0) {\n return true;\n }\n const nodeAfter = tr.doc.nodeAt(after);\n const canJoinForwards = list.node.type === (nodeAfter == null ? void 0 : nodeAfter.type) && canJoin(tr.doc, after);\n if (!canJoinForwards) {\n return true;\n }\n if (!areListTypesCompatible(list.node.attrs.type, nodeAfter == null ? void 0 : nodeAfter.attrs.type)) {\n return true;\n }\n tr.join(after);\n return true;\n};\nfunction createInnerSelectionForWholeDocList(tr) {\n const doc = tr.doc;\n const list = doc.firstChild;\n if (!list) {\n return null;\n }\n const $start = doc.resolve(1);\n const $end = doc.resolve(list.nodeSize - 1);\n return TextSelection9.between($start, $end);\n}\nvar toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {\n const { extensions, splittableMarks } = editor.extensionManager;\n const listType = getNodeType(listTypeOrName, state.schema);\n const itemType = getNodeType(itemTypeOrName, state.schema);\n const { selection, storedMarks } = state;\n const { $from, $to } = selection;\n const range = $from.blockRange($to);\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n if (!range) {\n return false;\n }\n const parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);\n const isAllSelection = selection.from === 0 && selection.to === state.doc.content.size;\n const topLevelNodes = state.doc.content.content;\n const soleTopLevelNode = topLevelNodes.length === 1 ? topLevelNodes[0] : null;\n const allSelectionList = isAllSelection && soleTopLevelNode && isList(soleTopLevelNode.type.name, extensions) ? {\n node: soleTopLevelNode,\n pos: 0,\n depth: 0\n } : null;\n const currentList = parentList != null ? parentList : allSelectionList;\n const isInsideExistingList = !!parentList && range.depth >= 1 && range.depth - parentList.depth <= 1;\n const hasWholeDocSelectedList = !!allSelectionList;\n if ((isInsideExistingList || hasWholeDocSelectedList) && currentList) {\n if (currentList.node.type === listType) {\n if (isAllSelection && hasWholeDocSelectedList) {\n return chain().command(({ tr: trx, dispatch: disp }) => {\n const nextSelection = createInnerSelectionForWholeDocList(trx);\n if (!nextSelection) {\n return false;\n }\n trx.setSelection(nextSelection);\n if (disp) {\n disp(trx);\n }\n return true;\n }).liftListItem(itemType).run();\n }\n return commands.liftListItem(itemType);\n }\n if (isList(currentList.node.type.name, extensions) && listType.validContent(currentList.node.content)) {\n return chain().command(() => {\n tr.setNodeMarkup(currentList.pos, listType);\n return true;\n }).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n }\n }\n if (!keepMarks || !marks || !dispatch) {\n return chain().command(() => {\n const canWrapInList = can().wrapInList(listType, attributes);\n if (canWrapInList) {\n return true;\n }\n return commands.clearNodes();\n }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n }\n return chain().command(() => {\n const canWrapInList = can().wrapInList(listType, attributes);\n const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n if (canWrapInList) {\n return true;\n }\n return commands.clearNodes();\n }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n};\n\n// src/commands/toggleMark.ts\nvar toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands }) => {\n const { extendEmptyMarkRange = false } = options;\n const type = getMarkType(typeOrName, state.schema);\n const isActive2 = isMarkActive(state, type, attributes);\n if (isActive2) {\n return commands.unsetMark(type, { extendEmptyMarkRange });\n }\n return commands.setMark(type, attributes);\n};\n\n// src/commands/toggleNode.ts\nvar toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands }) => {\n const type = getNodeType(typeOrName, state.schema);\n const toggleType = getNodeType(toggleTypeOrName, state.schema);\n const isActive2 = isNodeActive(state, type, attributes);\n let attributesToCopy;\n if (state.selection.$anchor.sameParent(state.selection.$head)) {\n attributesToCopy = state.selection.$anchor.parent.attrs;\n }\n if (isActive2) {\n return commands.setNode(toggleType, attributesToCopy);\n }\n return commands.setNode(type, { ...attributesToCopy, ...attributes });\n};\n\n// src/commands/toggleWrap.ts\nvar toggleWrap = (typeOrName, attributes = {}) => ({ state, commands }) => {\n const type = getNodeType(typeOrName, state.schema);\n const isActive2 = isNodeActive(state, type, attributes);\n if (isActive2) {\n return commands.lift(type);\n }\n return commands.wrapIn(type, attributes);\n};\n\n// src/commands/undoInputRule.ts\nvar undoInputRule = () => ({ state, dispatch }) => {\n const plugins = state.plugins;\n for (let i = 0; i < plugins.length; i += 1) {\n const plugin = plugins[i];\n let undoable;\n if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n if (dispatch) {\n const tr = state.tr;\n const toUndo = undoable.transform;\n for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) {\n tr.step(toUndo.steps[j].invert(toUndo.docs[j]));\n }\n if (undoable.text) {\n const marks = tr.doc.resolve(undoable.from).marks();\n tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));\n } else {\n tr.delete(undoable.from, undoable.to);\n }\n }\n return true;\n }\n }\n return false;\n};\n\n// src/commands/unsetAllMarks.ts\nvar unsetAllMarks = (options = {}) => ({ tr, dispatch, editor }) => {\n const { ignoreClearable = false } = options;\n const { selection } = tr;\n const { empty, ranges } = selection;\n if (empty) {\n return true;\n }\n const { nonClearableMarks } = editor.extensionManager;\n if (dispatch) {\n const clearableMarkTypes = Object.values(editor.schema.marks).filter(\n (markType) => ignoreClearable || !nonClearableMarks.includes(markType.name)\n );\n ranges.forEach((range) => {\n for (const markType of clearableMarkTypes) {\n tr.removeMark(range.$from.pos, range.$to.pos, markType);\n }\n });\n }\n return true;\n};\n\n// src/commands/unsetMark.ts\nvar unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {\n var _a;\n const { extendEmptyMarkRange = false } = options;\n const { selection } = tr;\n const type = getMarkType(typeOrName, state.schema);\n const { $from, empty, ranges } = selection;\n if (!dispatch) {\n return true;\n }\n if (empty && extendEmptyMarkRange) {\n let { from, to } = selection;\n const attrs = (_a = $from.marks().find((mark) => mark.type === type)) == null ? void 0 : _a.attrs;\n const range = getMarkRange($from, type, attrs);\n if (range) {\n from = range.from;\n to = range.to;\n }\n tr.removeMark(from, to, type);\n } else {\n ranges.forEach((range) => {\n tr.removeMark(range.$from.pos, range.$to.pos, type);\n });\n }\n tr.removeStoredMark(type);\n return true;\n};\n\n// src/commands/unsetTextDirection.ts\nvar unsetTextDirection = (position) => ({ tr, state, dispatch }) => {\n const { selection } = state;\n let from;\n let to;\n if (typeof position === \"number\") {\n from = position;\n to = position;\n } else if (position && \"from\" in position && \"to\" in position) {\n from = position.from;\n to = position.to;\n } else {\n from = selection.from;\n to = selection.to;\n }\n if (dispatch) {\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isText) {\n return;\n }\n const newAttrs = { ...node.attrs };\n delete newAttrs.dir;\n tr.setNodeMarkup(pos, void 0, newAttrs);\n });\n }\n return true;\n};\n\n// src/commands/updateAttributes.ts\nvar updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {\n let nodeType = null;\n let markType = null;\n const schemaType = getSchemaTypeNameByName(\n typeof typeOrName === \"string\" ? typeOrName : typeOrName.name,\n state.schema\n );\n if (!schemaType) {\n return false;\n }\n if (schemaType === \"node\") {\n nodeType = getNodeType(typeOrName, state.schema);\n }\n if (schemaType === \"mark\") {\n markType = getMarkType(typeOrName, state.schema);\n }\n let canUpdate = false;\n tr.selection.ranges.forEach((range) => {\n const from = range.$from.pos;\n const to = range.$to.pos;\n let lastPos;\n let lastNode;\n let trimmedFrom;\n let trimmedTo;\n if (tr.selection.empty) {\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (nodeType && nodeType === node.type) {\n canUpdate = true;\n trimmedFrom = Math.max(pos, from);\n trimmedTo = Math.min(pos + node.nodeSize, to);\n lastPos = pos;\n lastNode = node;\n }\n });\n } else {\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (pos < from && nodeType && nodeType === node.type) {\n canUpdate = true;\n trimmedFrom = Math.max(pos, from);\n trimmedTo = Math.min(pos + node.nodeSize, to);\n lastPos = pos;\n lastNode = node;\n }\n if (pos >= from && pos <= to) {\n if (nodeType && nodeType === node.type) {\n canUpdate = true;\n if (dispatch) {\n tr.setNodeMarkup(pos, void 0, {\n ...node.attrs,\n ...attributes\n });\n }\n }\n if (markType && node.marks.length) {\n node.marks.forEach((mark) => {\n if (markType === mark.type) {\n canUpdate = true;\n if (dispatch) {\n const trimmedFrom2 = Math.max(pos, from);\n const trimmedTo2 = Math.min(pos + node.nodeSize, to);\n tr.addMark(\n trimmedFrom2,\n trimmedTo2,\n markType.create({\n ...mark.attrs,\n ...attributes\n })\n );\n }\n }\n });\n }\n }\n });\n }\n if (lastNode) {\n if (lastPos !== void 0 && dispatch) {\n tr.setNodeMarkup(lastPos, void 0, {\n ...lastNode.attrs,\n ...attributes\n });\n }\n if (markType && lastNode.marks.length) {\n lastNode.marks.forEach((mark) => {\n if (markType === mark.type && dispatch) {\n tr.addMark(\n trimmedFrom,\n trimmedTo,\n markType.create({\n ...mark.attrs,\n ...attributes\n })\n );\n }\n });\n }\n }\n });\n return canUpdate;\n};\n\n// src/decorations/constants.ts\nimport { PluginKey } from \"@tiptap/pm/state\";\nvar DECORATION_MANAGER_PLUGIN_KEY_NAME = \"__tiptap_decorations__\";\nvar DECORATION_MANAGER_PLUGIN_KEY = new PluginKey(\n DECORATION_MANAGER_PLUGIN_KEY_NAME\n);\n\n// src/commands/updateDecorations.ts\nvar updateDecorations = (extensionName) => ({ tr, dispatch }) => {\n if (dispatch) {\n tr.setMeta(DECORATION_MANAGER_PLUGIN_KEY, { type: \"force\", name: extensionName });\n }\n return true;\n};\n\n// src/commands/wrapIn.ts\nimport { wrapIn as originalWrapIn } from \"@tiptap/pm/commands\";\nvar wrapIn = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n const type = getNodeType(typeOrName, state.schema);\n return originalWrapIn(type, attributes)(state, dispatch);\n};\n\n// src/commands/wrapInList.ts\nimport { wrapInList as originalWrapInList } from \"@tiptap/pm/schema-list\";\nvar wrapInList = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n const type = getNodeType(typeOrName, state.schema);\n return originalWrapInList(type, attributes)(state, dispatch);\n};\n\n// src/Editor.ts\nimport { EditorState } from \"@tiptap/pm/state\";\nimport { EditorView } from \"@tiptap/pm/view\";\n\n// src/decorations/decorationApplyScope.ts\nvar depthByEditor = /* @__PURE__ */ new WeakMap();\nfunction runInDecorationApplyScope(editor, callback) {\n var _a, _b;\n depthByEditor.set(editor, ((_a = depthByEditor.get(editor)) != null ? _a : 0) + 1);\n try {\n return callback();\n } finally {\n const remaining = ((_b = depthByEditor.get(editor)) != null ? _b : 1) - 1;\n if (remaining > 0) {\n depthByEditor.set(editor, remaining);\n } else {\n depthByEditor.delete(editor);\n }\n }\n}\nfunction isInDecorationApplyScope(editor) {\n return depthByEditor.has(editor);\n}\n\n// src/EventEmitter.ts\nvar EventEmitter = class {\n constructor() {\n this.callbacks = {};\n }\n on(event, fn) {\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n this.callbacks[event].push(fn);\n return this;\n }\n emit(event, ...args) {\n const callbacks = this.callbacks[event];\n if (callbacks) {\n callbacks.forEach((callback) => callback.apply(this, args));\n }\n return this;\n }\n off(event, fn) {\n const callbacks = this.callbacks[event];\n if (callbacks) {\n if (fn) {\n this.callbacks[event] = callbacks.filter((callback) => callback !== fn);\n } else {\n delete this.callbacks[event];\n }\n }\n return this;\n }\n once(event, fn) {\n const onceFn = (...args) => {\n this.off(event, onceFn);\n fn.apply(this, args);\n };\n return this.on(event, onceFn);\n }\n removeAllListeners() {\n this.callbacks = {};\n }\n};\n\n// src/ExtensionManager.ts\nimport { keymap } from \"@tiptap/pm/keymap\";\n\n// src/decorations/DecorationManager.ts\nimport { Plugin } from \"@tiptap/pm/state\";\nimport { DecorationSet as DecorationSet4 } from \"@tiptap/pm/view\";\n\n// src/utilities/isDev.ts\nvar isDev = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\";\n\n// src/decorations/helpers/buildDecorationSet.ts\nimport { DecorationSet } from \"@tiptap/pm/view\";\n\n// src/decorations/helpers/decorationsToPMDecorations.ts\nfunction isWidgetDecoration(decoration) {\n return decoration.kind === \"widget\";\n}\nfunction decorationsToPMDecorations(decorations, extensionName) {\n const pmDecorations = [];\n const widgetKeys = /* @__PURE__ */ new Set();\n for (const decoration of decorations) {\n if (decoration.kind === \"widget\") {\n if (isWidgetDecoration(decoration)) {\n widgetKeys.add(decoration.key);\n }\n }\n pmDecorations.push(decoration.toPMDecoration(extensionName));\n }\n return { decorations: pmDecorations, widgetKeys };\n}\n\n// src/decorations/helpers/buildDecorationSet.ts\nfunction buildDecorationSet(doc, decorations, extensionName) {\n const { decorations: pmDecorations, widgetKeys } = decorationsToPMDecorations(\n decorations,\n extensionName\n );\n return { set: DecorationSet.create(doc, pmDecorations), widgetKeys };\n}\n\n// src/decorations/helpers/rangeOwnsPosition.ts\nfunction rangeOwnsPosition({\n position,\n from,\n to,\n docSize\n}) {\n if (position < from) {\n return false;\n }\n if (position < to) {\n return true;\n }\n return position === to && to === docSize;\n}\n\n// src/decorations/helpers/filterOutOfRangeDecorations.ts\nfunction filterOutOfRangeDecorations({\n decorations,\n from,\n to,\n docSize,\n extensionName,\n warnedExtensions\n}) {\n return decorations.filter((decoration) => {\n if (rangeOwnsPosition({ position: decoration.anchor, from, to, docSize })) {\n return true;\n }\n if (decoration.anchor === to) {\n return false;\n }\n if (!warnedExtensions.has(extensionName)) {\n warnedExtensions.add(extensionName);\n console.warn(\n `[tiptap warn]: Extension \"${extensionName}\" returned a decoration outside the requested range [${from}, ${to}). It was ignored.`\n );\n }\n return false;\n });\n}\n\n// src/decorations/helpers/widgetKeyOf.ts\nfunction widgetKeyOf(decoration) {\n var _a;\n const key = (_a = decoration.spec) == null ? void 0 : _a.key;\n return typeof key === \"string\" ? key : void 0;\n}\n\n// src/decorations/helpers/findDuplicateWidgetKeys.ts\nfunction findDuplicateWidgetKeys(decorationSet) {\n var _a, _b, _c;\n const extensionsByKey = /* @__PURE__ */ new Map();\n const counts = /* @__PURE__ */ new Map();\n for (const decoration of decorationSet.find()) {\n const key = widgetKeyOf(decoration);\n if (!key) {\n continue;\n }\n const extension = (_a = decoration.spec.extensionName) != null ? _a : \"unknown\";\n const extensions = (_b = extensionsByKey.get(key)) != null ? _b : /* @__PURE__ */ new Set();\n extensions.add(extension);\n extensionsByKey.set(key, extensions);\n counts.set(key, ((_c = counts.get(key)) != null ? _c : 0) + 1);\n }\n return Array.from(extensionsByKey, ([key, extensions]) => ({ key, extensions })).filter(\n ({ key }) => {\n var _a2;\n return ((_a2 = counts.get(key)) != null ? _a2 : 0) > 1;\n }\n );\n}\n\n// src/decorations/helpers/isAttrStep.ts\nfunction isAttrStep(step) {\n return step.jsonID === \"attr\";\n}\n\n// src/decorations/helpers/hasResolvableChangedRange.ts\nfunction hasResolvableChangedRange(step) {\n let hasMappedRange = false;\n step.getMap().forEach(() => {\n hasMappedRange = true;\n });\n if (hasMappedRange || isAttrStep(step)) {\n return true;\n }\n const positionalStep = step;\n return typeof positionalStep.from === \"number\" && typeof positionalStep.to === \"number\";\n}\n\n// src/decorations/helpers/getRebuildRanges.ts\nfunction blockRangeFor(doc, changed) {\n let from = null;\n let to = 0;\n let nodeStart = 0;\n for (let index = 0; index < doc.childCount; index += 1) {\n if (nodeStart > changed.to) {\n break;\n }\n const nodeEnd = nodeStart + doc.child(index).nodeSize;\n if (nodeEnd >= changed.from) {\n if (from === null) {\n from = nodeStart;\n }\n to = nodeEnd;\n }\n nodeStart = nodeEnd;\n }\n return from === null ? null : { from, to };\n}\nfunction getRebuildRanges(tr, doc) {\n if (tr.steps.some((step) => !hasResolvableChangedRange(step))) {\n return { type: \"full\" };\n }\n const newRanges = getChangedRanges(tr).map(({ newRange }) => newRange);\n tr.steps.forEach((step, index) => {\n if (!isAttrStep(step)) {\n return;\n }\n const mapping = tr.mapping.slice(index);\n newRanges.push({ from: mapping.map(step.pos, -1), to: mapping.map(step.pos + 1) });\n });\n const ranges = [];\n for (const newRange of newRanges) {\n const blockRange = blockRangeFor(doc, newRange);\n if (blockRange) {\n ranges.push(blockRange);\n }\n }\n ranges.sort((a, b) => a.from - b.from);\n const merged = [];\n for (const range of ranges) {\n const last = merged[merged.length - 1];\n if (last && range.from <= last.to) {\n last.to = Math.max(last.to, range.to);\n } else {\n merged.push({ ...range });\n }\n }\n return { type: \"ranges\", ranges: merged };\n}\n\n// src/decorations/helpers/mapDecorations.ts\nimport { DecorationSet as DecorationSet2 } from \"@tiptap/pm/view\";\n\n// src/decorations/helpers/mapDecorationSet.ts\nfunction mapDecorationSet(set, mapping, doc, widgetKeys) {\n return set.map(mapping, doc, {\n onRemove: (removedSpec) => {\n const key = removedSpec == null ? void 0 : removedSpec.key;\n if (typeof key === \"string\") {\n widgetKeys.delete(key);\n }\n }\n });\n}\n\n// src/decorations/helpers/mapDecorations.ts\nfunction mapDecorations(name, previous, tr) {\n var _a, _b;\n const previousSet = (_a = previous.decorationSetsByExtension[name]) != null ? _a : DecorationSet2.empty;\n const widgetKeys = new Set((_b = previous.widgetKeysByExtension[name]) != null ? _b : []);\n const set = mapDecorationSet(previousSet, tr.mapping, tr.doc, widgetKeys);\n return { set, widgetKeys };\n}\n\n// src/decorations/helpers/mergeDecorationSets.ts\nimport { DecorationSet as DecorationSet3 } from \"@tiptap/pm/view\";\nfunction mergeDecorationSets(doc, decorationSetsByExtension) {\n const allDecorations = Object.values(decorationSetsByExtension).flatMap((set) => set.find());\n return DecorationSet3.create(doc, allDecorations);\n}\n\n// src/decorations/helpers/unionWidgetKeys.ts\nfunction unionWidgetKeys(widgetKeysByExtension) {\n const merged = /* @__PURE__ */ new Set();\n for (const keys of Object.values(widgetKeysByExtension)) {\n for (const key of keys) {\n merged.add(key);\n }\n }\n return merged;\n}\n\n// src/decorations/helpers/validateDecorationSpec.ts\nfunction validateDecorationSpec(name, spec) {\n var _a;\n const strategy = (_a = spec.update) != null ? _a : \"document\";\n switch (strategy) {\n case \"document\":\n if (spec.createInRange) {\n throw new Error(\n `[tiptap error]: Extension \"${name}\" provides createInRange() but does not use the \"changedRanges\" decoration update strategy.`\n );\n }\n return;\n case \"changedRanges\":\n if (!spec.createInRange) {\n throw new Error(\n `[tiptap error]: Extension \"${name}\" uses the \"changedRanges\" decoration update strategy but does not provide createInRange().`\n );\n }\n return;\n case \"manual\":\n if (spec.createInRange) {\n throw new Error(\n `[tiptap error]: Extension \"${name}\" uses the \"manual\" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the \"changedRanges\" strategy.`\n );\n }\n if (spec.shouldUpdate) {\n throw new Error(\n `[tiptap error]: Extension \"${name}\" cannot combine the \"manual\" decoration update strategy with shouldUpdate().`\n );\n }\n return;\n default:\n throw new Error(\n `[tiptap error]: Extension \"${name}\" uses an unknown decoration update strategy. Expected \"document\", \"changedRanges\", or \"manual\".`\n );\n }\n}\n\n// src/decorations/helpers/shouldRecomputeDecoration.ts\nfunction shouldRecomputeDecoration(spec, props, forced) {\n if (forced) {\n return true;\n }\n if (spec.update === \"manual\") {\n return false;\n }\n return spec.shouldUpdate ? spec.shouldUpdate(props) : props.tr.docChanged;\n}\n\n// src/decorations/DecorationManager.ts\nvar EMPTY_KEYS = /* @__PURE__ */ new Set();\nfunction liveWidgetKeys(editor) {\n var _a, _b, _c;\n return (_c = (_b = (_a = editor.extensionManager) == null ? void 0 : _a.decorationManager) == null ? void 0 : _b.liveWidgetKeys()) != null ? _c : EMPTY_KEYS;\n}\nvar DecorationManager = class {\n constructor(options) {\n this.warnedWidgetKeys = /* @__PURE__ */ new Set();\n this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set();\n this.handleBeforeTransaction = ({ nextState }) => {\n const state = DECORATION_MANAGER_PLUGIN_KEY.getState(nextState);\n if (state) {\n this.warnDuplicateWidgetKeys(state);\n }\n };\n this.editor = options.editor;\n this.entries = this.resolveEntries(options.entries);\n this.entries.forEach(({ name, spec }) => validateDecorationSpec(name, spec));\n this.plugin = this.entries.length > 0 ? this.createPlugin() : null;\n this.editor.on(\"beforeTransaction\", this.handleBeforeTransaction);\n }\n destroy() {\n this.editor.off(\"beforeTransaction\", this.handleBeforeTransaction);\n }\n /**\n * Returns the set of live widget keys from all decoration extensions.\n * @returns A readonly set of widget keys\n */\n liveWidgetKeys() {\n var _a, _b;\n return (_b = (_a = DECORATION_MANAGER_PLUGIN_KEY.getState(this.editor.state)) == null ? void 0 : _a.widgetKeys) != null ? _b : EMPTY_KEYS;\n }\n /**\n * The mounted editor view, or `null` when destroyed. Decoration callbacks\n * must never receive the placeholder view `editor.view` falls back to.\n * @returns The mounted editor view, or `null`\n */\n get mountedView() {\n return this.editor.isDestroyed ? null : this.editor.view;\n }\n /**\n * Resolves decoration entries by calling the addDecorations function for each extension entry.\n * @param entries The decoration manager entries to resolve\n * @returns An array of resolved decoration entries\n */\n resolveEntries(entries) {\n const resolved = [];\n for (const { name, addDecorations } of entries) {\n const spec = addDecorations();\n if (spec) {\n resolved.push({ name, spec });\n }\n }\n return resolved;\n }\n /**\n * Creates the ProseMirror plugin for managing decorations.\n * @returns A ProseMirror plugin with state management\n */\n createPlugin() {\n const { editor, entries } = this;\n return new Plugin({\n key: DECORATION_MANAGER_PLUGIN_KEY,\n state: {\n init: (_config, state) => {\n const decorationSetsByExtension = {};\n const widgetKeysByExtension = {};\n for (const { name, spec } of entries) {\n const { set, widgetKeys } = this.buildFullSet(name, spec, state);\n decorationSetsByExtension[name] = set;\n widgetKeysByExtension[name] = widgetKeys;\n }\n const managerState = {\n decorationSetsByExtension,\n widgetKeysByExtension,\n mergedDecorationSet: this.buildMergedSet(state.doc, decorationSetsByExtension),\n widgetKeys: unionWidgetKeys(widgetKeysByExtension)\n };\n this.warnDuplicateWidgetKeys(managerState);\n return managerState;\n },\n apply: (tr, previous, oldState, newState) => {\n const meta = tr.getMeta(DECORATION_MANAGER_PLUGIN_KEY);\n const forceAll = (meta == null ? void 0 : meta.type) === \"force\" && !meta.name;\n const forceName = (meta == null ? void 0 : meta.type) === \"force\" ? meta.name : void 0;\n const decorationSetsByExtension = {};\n const widgetKeysByExtension = {};\n const recomputedNames = /* @__PURE__ */ new Set();\n runInDecorationApplyScope(editor, () => {\n for (const { name, spec } of entries) {\n const forced = forceAll || forceName === name;\n const shouldRecompute = shouldRecomputeDecoration(\n spec,\n { editor, tr, oldState, newState },\n forced\n );\n if (!shouldRecompute) {\n const result = mapDecorations(name, previous, tr);\n decorationSetsByExtension[name] = result.set;\n widgetKeysByExtension[name] = result.widgetKeys;\n } else if (spec.update === \"changedRanges\" && tr.docChanged && !forced) {\n const result = this.applyChangedRangesRecompute(name, spec, previous, tr, newState);\n decorationSetsByExtension[name] = result.set;\n widgetKeysByExtension[name] = result.widgetKeys;\n recomputedNames.add(name);\n } else {\n const { set, widgetKeys } = this.buildFullSet(name, spec, newState);\n decorationSetsByExtension[name] = set;\n widgetKeysByExtension[name] = widgetKeys;\n recomputedNames.add(name);\n }\n }\n });\n if (recomputedNames.size === 0 && !tr.docChanged) {\n return previous;\n }\n const mergedDecorationSet = this.mergeAfterApply({\n entries,\n previous,\n tr,\n decorationSetsByExtension,\n recomputedNames\n });\n return {\n decorationSetsByExtension,\n widgetKeysByExtension,\n mergedDecorationSet,\n widgetKeys: unionWidgetKeys(widgetKeysByExtension)\n };\n }\n },\n props: {\n decorations(state) {\n var _a, _b;\n return (_b = (_a = DECORATION_MANAGER_PLUGIN_KEY.getState(state)) == null ? void 0 : _a.mergedDecorationSet) != null ? _b : DecorationSet4.empty;\n }\n }\n });\n }\n /**\n * Applies changed ranges recomputation to a decoration set, dropping stale decorations and rebuilding only the touched blocks.\n * @param name The name of the decoration extension\n * @param spec The decoration spec\n * @param previous The previous decoration manager state\n * @param tr The transaction to apply\n * @param newState The new editor state\n * @returns The updated decoration set and widget keys\n */\n applyChangedRangesRecompute(name, spec, previous, tr, newState) {\n const resolution = getRebuildRanges(tr, newState.doc);\n if (resolution.type === \"full\") {\n return this.buildFullSet(name, spec, newState);\n }\n return this.rebuildRanges(name, spec, previous, tr, newState, resolution.ranges);\n }\n /**\n * Rebuilds decorations for the changed block ranges: maps the previous set\n * forward, then for each range removes stale decorations, calls\n * `createInRange`, and adds the new ones while syncing widget keys.\n * @param name The extension name.\n * @param spec The decoration spec.\n * @param previous The previous decoration manager state.\n * @param tr The transaction to apply.\n * @param newState The new editor state.\n * @param ranges The block ranges to rebuild.\n * @returns The updated decoration set and widget keys.\n */\n rebuildRanges(name, spec, previous, tr, newState, ranges) {\n var _a, _b;\n const previousSet = (_a = previous.decorationSetsByExtension[name]) != null ? _a : DecorationSet4.empty;\n const widgetKeys = new Set((_b = previous.widgetKeysByExtension[name]) != null ? _b : []);\n let set = mapDecorationSet(previousSet, tr.mapping, tr.doc, widgetKeys);\n const docSize = newState.doc.content.size;\n for (const { from, to } of ranges) {\n const stale = set.find(from, to).filter((decoration) => rangeOwnsPosition({ position: decoration.from, from, to, docSize }));\n for (const decoration of stale) {\n const key = widgetKeyOf(decoration);\n if (key) {\n widgetKeys.delete(key);\n }\n }\n set = set.remove(stale);\n const rangeDecorations = filterOutOfRangeDecorations({\n decorations: this.runCreate(\n name,\n \"createInRange\",\n () => spec.createInRange({\n editor: this.editor,\n state: newState,\n view: this.mountedView,\n from,\n to\n })\n ),\n from,\n to,\n docSize,\n extensionName: name,\n warnedExtensions: this.warnedOutOfRangeExtensions\n });\n const { decorations: pmDecorations, widgetKeys: addedKeys } = decorationsToPMDecorations(\n rangeDecorations,\n name\n );\n set = set.add(newState.doc, pmDecorations);\n for (const key of addedKeys) {\n widgetKeys.add(key);\n }\n }\n return { set, widgetKeys };\n }\n /**\n * Builds a full decoration set for the entire document.\n * @param name The name of the decoration extension\n * @param spec The decoration spec\n * @param state The editor state\n * @returns The decoration set and widget keys\n */\n buildFullSet(name, spec, state) {\n const decorations = this.runCreate(\n name,\n \"create\",\n () => spec.create({\n editor: this.editor,\n state,\n view: this.mountedView\n })\n );\n return buildDecorationSet(state.doc, decorations, name);\n }\n /**\n * Runs a decoration callback and swallows anything it throws. These run inside\n * `state.apply`, where an uncaught error would abort the whole transaction.\n * @param name The extension name.\n * @param method The callback name, used in the error message.\n * @param create The callback to run.\n * @returns The decorations, or an empty array if the callback threw.\n */\n runCreate(name, method, create) {\n try {\n return create();\n } catch (error) {\n console.error(\n `[tiptap error]: Extension \"${name}\" threw in \\`addDecorations().${method}()\\`. Its decorations were dropped for this update.`,\n error\n );\n return [];\n }\n }\n warnDuplicateWidgetKeys(state) {\n if (!isDev) {\n return;\n }\n if (state.widgetKeys.size === 0) {\n this.warnedWidgetKeys.clear();\n return;\n }\n const duplicateKeys = findDuplicateWidgetKeys(state.mergedDecorationSet);\n const nextWarningKeys = new Set(duplicateKeys.map(({ key }) => key));\n for (const { key, extensions } of duplicateKeys) {\n if (this.warnedWidgetKeys.has(key)) {\n continue;\n }\n const names = Array.from(extensions).map((name) => `\"${name}\"`).join(\", \");\n console.warn(\n `[tiptap warn]: Duplicate widget decoration key \"${key}\" in extension${extensions.size === 1 ? \"\" : \"s\"} ${names}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \\`comment-\\${id}\\`).`\n );\n }\n this.warnedWidgetKeys = nextWarningKeys;\n }\n /**\n * Builds the merged DecorationSet during init. Skips the merge for a\n * single extension since its per-extension set is already correct.\n * @param doc The document to build the merged set for.\n * @param decorationSetsByExtension The per-extension decoration sets.\n * @returns The merged decoration set.\n */\n buildMergedSet(doc, decorationSetsByExtension) {\n const names = Object.keys(decorationSetsByExtension);\n if (names.length === 1) {\n return decorationSetsByExtension[names[0]];\n }\n return mergeDecorationSets(doc, decorationSetsByExtension);\n }\n /**\n * Computes the merged DecorationSet after apply. Single extension skips the\n * merge; nothing recomputed maps the previous merged set forward; otherwise\n * the merge is rebuilt from the per-extension sets.\n */\n mergeAfterApply({\n entries,\n previous,\n tr,\n decorationSetsByExtension,\n recomputedNames\n }) {\n if (entries.length === 1) {\n return decorationSetsByExtension[entries[0].name];\n }\n if (recomputedNames.size === 0) {\n return previous.mergedDecorationSet.map(tr.mapping, tr.doc);\n }\n return mergeDecorationSets(tr.doc, decorationSetsByExtension);\n }\n};\n\n// src/utilities/attrsEqual.ts\nfunction attrsEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) {\n return false;\n }\n return keysA.every(\n (key) => Object.prototype.hasOwnProperty.call(b, key) && Object.is(a[key], b[key])\n );\n}\n\n// src/utilities/canInsertNode.ts\nimport { NodeSelection as NodeSelection4 } from \"@tiptap/pm/state\";\nfunction canInsertNode(state, nodeType) {\n const { selection } = state;\n const { $from } = selection;\n if (selection instanceof NodeSelection4) {\n const index = $from.index();\n const parent = $from.parent;\n return parent.canReplaceWith(index, index + 1, nodeType);\n }\n let depth = $from.depth;\n while (depth >= 0) {\n const index = $from.index(depth);\n const parent = $from.node(depth);\n const match = parent.contentMatchAt(index);\n if (match.matchType(nodeType)) {\n return true;\n }\n depth -= 1;\n }\n return false;\n}\n\n// src/utilities/createStyleTag.ts\nfunction createStyleTag(style2, nonce, suffix) {\n const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : \"\"}]`);\n if (tiptapStyleTag !== null) {\n return tiptapStyleTag;\n }\n const styleNode = document.createElement(\"style\");\n if (nonce) {\n styleNode.setAttribute(\"nonce\", nonce);\n }\n styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : \"\"}`, \"\");\n styleNode.innerHTML = style2;\n document.getElementsByTagName(\"head\")[0].appendChild(styleNode);\n return styleNode;\n}\n\n// src/utilities/escapeForRegEx.ts\nfunction escapeForRegEx(string) {\n return string.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n}\n\n// src/utilities/getStyleProperty.ts\nfunction getStyleProperty(element, propertyName) {\n const styleAttr = element.getAttribute(\"style\");\n if (!styleAttr) {\n return null;\n }\n const decls = styleAttr.split(\";\").map((decl) => decl.trim()).filter(Boolean);\n const target = propertyName.toLowerCase();\n for (let i = decls.length - 1; i >= 0; i -= 1) {\n const decl = decls[i];\n const colonIndex = decl.indexOf(\":\");\n if (colonIndex === -1) {\n continue;\n }\n const prop = decl.slice(0, colonIndex).trim().toLowerCase();\n if (prop === target) {\n return decl.slice(colonIndex + 1).trim();\n }\n }\n return null;\n}\n\n// src/utilities/htmlEntities.ts\nfunction decodeHtmlEntities(text) {\n return text.replace(/&lt;/g, \"<\").replace(/&gt;/g, \">\").replace(/&quot;/g, '\"').replace(/&amp;/g, \"&\");\n}\nfunction encodeHtmlEntities(text) {\n return text.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n}\n\n// src/utilities/isFirefox.ts\nfunction isFirefox() {\n return typeof navigator !== \"undefined\" ? /Firefox/.test(navigator.userAgent) : false;\n}\n\n// src/utilities/isNumber.ts\nfunction isNumber(value) {\n return typeof value === \"number\";\n}\n\n// src/utilities/isPlainObject.ts\nfunction getType(value) {\n return Object.prototype.toString.call(value).slice(8, -1);\n}\nfunction isPlainObject(value) {\n if (getType(value) !== \"Object\") {\n return false;\n }\n return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;\n}\n\n// src/utilities/isString.ts\nfunction isString(value) {\n return typeof value === \"string\";\n}\n\n// src/utilities/markdown/index.ts\nvar markdown_exports = {};\n__export(markdown_exports, {\n createAtomBlockMarkdownSpec: () => createAtomBlockMarkdownSpec,\n createBlockMarkdownSpec: () => createBlockMarkdownSpec,\n createInlineMarkdownSpec: () => createInlineMarkdownSpec,\n parseAttributes: () => parseAttributes,\n parseIndentedBlocks: () => parseIndentedBlocks,\n renderNestedMarkdownContent: () => renderNestedMarkdownContent,\n serializeAttributes: () => serializeAttributes\n});\n\n// src/utilities/markdown/attributeUtils.ts\nfunction parseAttributes(attrString) {\n if (!(attrString == null ? void 0 : attrString.trim())) {\n return {};\n }\n const attributes = {};\n const quotedStrings = [];\n const tempString = attrString.replace(/[\"']([^\"']*)[\"']/g, (match) => {\n quotedStrings.push(match);\n return `__QUOTED_${quotedStrings.length - 1}__`;\n });\n const classMatches = tempString.match(/(?:^|\\s)\\.([\\w-]+)/g);\n if (classMatches) {\n const classes = classMatches.map((match) => match.trim().slice(1));\n attributes.class = classes.join(\" \");\n }\n const idMatch = tempString.match(/(?:^|\\s)#([\\w-]+)/);\n if (idMatch) {\n attributes.id = idMatch[1];\n }\n const kvRegex = /([a-zA-Z][\\w-]*)\\s*=\\s*(__QUOTED_\\d+__)/g;\n const kvMatches = Array.from(tempString.matchAll(kvRegex));\n kvMatches.forEach(([, key, quotedRef]) => {\n var _a;\n const quotedIndex = parseInt(((_a = quotedRef.match(/__QUOTED_(\\d+)__/)) == null ? void 0 : _a[1]) || \"0\", 10);\n const quotedValue = quotedStrings[quotedIndex];\n if (quotedValue) {\n attributes[key] = quotedValue.slice(1, -1);\n }\n });\n const cleanString = tempString.replace(/(?:^|\\s)\\.([\\w-]+)/g, \"\").replace(/(?:^|\\s)#([\\w-]+)/g, \"\").replace(/([a-zA-Z][\\w-]*)\\s*=\\s*__QUOTED_\\d+__/g, \"\").trim();\n if (cleanString) {\n const booleanAttrs = cleanString.split(/\\s+/).filter(Boolean);\n booleanAttrs.forEach((attr) => {\n if (attr.match(/^[a-zA-Z][\\w-]*$/)) {\n attributes[attr] = true;\n }\n });\n }\n return attributes;\n}\nfunction serializeAttributes(attributes) {\n if (!attributes || Object.keys(attributes).length === 0) {\n return \"\";\n }\n const parts = [];\n if (attributes.class) {\n const classes = String(attributes.class).split(/\\s+/).filter(Boolean);\n classes.forEach((cls) => parts.push(`.${cls}`));\n }\n if (attributes.id) {\n parts.push(`#${attributes.id}`);\n }\n Object.entries(attributes).forEach(([key, value]) => {\n if (key === \"class\" || key === \"id\") {\n return;\n }\n if (value === true) {\n parts.push(key);\n } else if (value !== false && value != null) {\n parts.push(`${key}=\"${String(value)}\"`);\n }\n });\n return parts.join(\" \");\n}\n\n// src/utilities/markdown/createAtomBlockMarkdownSpec.ts\nfunction createAtomBlockMarkdownSpec(options) {\n const {\n nodeName,\n name: markdownName,\n parseAttributes: parseAttributes2 = parseAttributes,\n serializeAttributes: serializeAttributes2 = serializeAttributes,\n defaultAttributes = {},\n requiredAttributes = [],\n allowedAttributes\n } = options;\n const blockName = markdownName || nodeName;\n const filterAttributes = (attrs) => {\n if (!allowedAttributes) {\n return attrs;\n }\n const filtered = {};\n allowedAttributes.forEach((key) => {\n if (key in attrs) {\n filtered[key] = attrs[key];\n }\n });\n return filtered;\n };\n return {\n parseMarkdown: (token, h2) => {\n const attrs = { ...defaultAttributes, ...token.attributes };\n return h2.createNode(nodeName, attrs, []);\n },\n markdownTokenizer: {\n name: nodeName,\n level: \"block\",\n start(src) {\n var _a;\n const regex = new RegExp(`^:::${blockName}(?:\\\\s|$)`, \"m\");\n const index = (_a = src.match(regex)) == null ? void 0 : _a.index;\n return index !== void 0 ? index : -1;\n },\n tokenize(src, _tokens, _lexer) {\n const regex = new RegExp(`^:::${blockName}(?:\\\\s+\\\\{([^}]*)\\\\})?\\\\s*:::(?:\\\\n|$)`);\n const match = src.match(regex);\n if (!match) {\n return void 0;\n }\n const attrString = match[1] || \"\";\n const attributes = parseAttributes2(attrString);\n const missingRequired = requiredAttributes.find((required) => !(required in attributes));\n if (missingRequired) {\n return void 0;\n }\n return {\n type: nodeName,\n raw: match[0],\n attributes\n };\n }\n },\n renderMarkdown: (node) => {\n const filteredAttrs = filterAttributes(node.attrs || {});\n const attrs = serializeAttributes2(filteredAttrs);\n const attrString = attrs ? ` {${attrs}}` : \"\";\n return `:::${blockName}${attrString} :::`;\n }\n };\n}\n\n// src/utilities/markdown/createBlockMarkdownSpec.ts\nfunction createBlockMarkdownSpec(options) {\n const {\n nodeName,\n name: markdownName,\n getContent,\n parseAttributes: parseAttributes2 = parseAttributes,\n serializeAttributes: serializeAttributes2 = serializeAttributes,\n defaultAttributes = {},\n content = \"block\",\n allowedAttributes\n } = options;\n const blockName = markdownName || nodeName;\n const filterAttributes = (attrs) => {\n if (!allowedAttributes) {\n return attrs;\n }\n const filtered = {};\n allowedAttributes.forEach((key) => {\n if (key in attrs) {\n filtered[key] = attrs[key];\n }\n });\n return filtered;\n };\n return {\n parseMarkdown: (token, h2) => {\n let nodeContent;\n if (getContent) {\n const contentResult = getContent(token);\n nodeContent = typeof contentResult === \"string\" ? [{ type: \"text\", text: contentResult }] : contentResult;\n } else if (content === \"block\") {\n nodeContent = h2.parseChildren(token.tokens || []);\n } else {\n nodeContent = h2.parseInline(token.tokens || []);\n }\n const attrs = { ...defaultAttributes, ...token.attributes };\n return h2.createNode(nodeName, attrs, nodeContent);\n },\n markdownTokenizer: {\n name: nodeName,\n level: \"block\",\n start(src) {\n var _a;\n const regex = new RegExp(`^:::${blockName}`, \"m\");\n const index = (_a = src.match(regex)) == null ? void 0 : _a.index;\n return index !== void 0 ? index : -1;\n },\n tokenize(src, _tokens, lexer) {\n var _a;\n const openingRegex = new RegExp(`^:::${blockName}(?:\\\\s+\\\\{([^}]*)\\\\})?\\\\s*\\\\n`);\n const openingMatch = src.match(openingRegex);\n if (!openingMatch) {\n return void 0;\n }\n const [openingTag, attrString = \"\"] = openingMatch;\n const attributes = parseAttributes2(attrString);\n let level = 1;\n const position = openingTag.length;\n let matchedContent = \"\";\n const blockPattern = /^:::([\\w-]*)(\\s.*)?/gm;\n const remaining = src.slice(position);\n blockPattern.lastIndex = 0;\n for (; ; ) {\n const match = blockPattern.exec(remaining);\n if (match === null) {\n break;\n }\n const matchPos = match.index;\n const blockType = match[1];\n if ((_a = match[2]) == null ? void 0 : _a.endsWith(\":::\")) {\n continue;\n }\n if (blockType) {\n level += 1;\n } else {\n level -= 1;\n if (level === 0) {\n const rawContent = remaining.slice(0, matchPos);\n matchedContent = rawContent.trim();\n const fullMatch = src.slice(0, position + matchPos + match[0].length);\n let contentTokens = [];\n if (matchedContent) {\n if (content === \"block\") {\n contentTokens = lexer.blockTokens(rawContent);\n contentTokens.forEach((token) => {\n if (token.text && (!token.tokens || token.tokens.length === 0)) {\n token.tokens = lexer.inlineTokens(token.text);\n }\n });\n while (contentTokens.length > 0) {\n const lastToken = contentTokens[contentTokens.length - 1];\n if (lastToken.type === \"paragraph\" && (!lastToken.text || lastToken.text.trim() === \"\")) {\n contentTokens.pop();\n } else {\n break;\n }\n }\n } else {\n contentTokens = lexer.inlineTokens(matchedContent);\n }\n }\n return {\n type: nodeName,\n raw: fullMatch,\n attributes,\n content: matchedContent,\n tokens: contentTokens\n };\n }\n }\n }\n return void 0;\n }\n },\n renderMarkdown: (node, h2) => {\n const filteredAttrs = filterAttributes(node.attrs || {});\n const attrs = serializeAttributes2(filteredAttrs);\n const attrString = attrs ? ` {${attrs}}` : \"\";\n const renderedContent = h2.renderChildren(node.content || [], \"\\n\\n\");\n return `:::${blockName}${attrString}\n\n${renderedContent}\n\n:::`;\n }\n };\n}\n\n// src/utilities/markdown/createInlineMarkdownSpec.ts\nfunction parseShortcodeAttributes(attrString) {\n if (!attrString.trim()) {\n return {};\n }\n const attributes = {};\n const regex = /(\\w+)=(?:\"([^\"]*)\"|'([^']*)')/g;\n let match = regex.exec(attrString);\n while (match !== null) {\n const [, key, doubleQuoted, singleQuoted] = match;\n attributes[key] = doubleQuoted || singleQuoted;\n match = regex.exec(attrString);\n }\n return attributes;\n}\nfunction serializeShortcodeAttributes(attrs) {\n return Object.entries(attrs).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${key}=\"${value}\"`).join(\" \");\n}\nfunction createInlineMarkdownSpec(options) {\n const {\n nodeName,\n name: shortcodeName,\n getContent,\n parseAttributes: parseAttributes2 = parseShortcodeAttributes,\n serializeAttributes: serializeAttributes2 = serializeShortcodeAttributes,\n defaultAttributes = {},\n selfClosing = false,\n allowedAttributes\n } = options;\n const shortcode = shortcodeName || nodeName;\n const filterAttributes = (attrs) => {\n if (!allowedAttributes) {\n return attrs;\n }\n const filtered = {};\n allowedAttributes.forEach((attr) => {\n const attrName = typeof attr === \"string\" ? attr : attr.name;\n const skipIfDefault = typeof attr === \"string\" ? void 0 : attr.skipIfDefault;\n if (attrName in attrs) {\n const value = attrs[attrName];\n if (skipIfDefault !== void 0 && value === skipIfDefault) {\n return;\n }\n filtered[attrName] = value;\n }\n });\n return filtered;\n };\n const escapedShortcode = shortcode.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n return {\n parseMarkdown: (token, h2) => {\n const attrs = { ...defaultAttributes, ...token.attributes };\n if (selfClosing) {\n return h2.createNode(nodeName, attrs);\n }\n const content = getContent ? getContent(token) : token.content || \"\";\n if (content) {\n return h2.createNode(nodeName, attrs, [h2.createTextNode(content)]);\n }\n return h2.createNode(nodeName, attrs, []);\n },\n markdownTokenizer: {\n name: nodeName,\n level: \"inline\",\n start(src) {\n const startPattern = selfClosing ? new RegExp(`\\\\[${escapedShortcode}\\\\s*[^\\\\]]*\\\\]`) : new RegExp(`\\\\[${escapedShortcode}\\\\s*[^\\\\]]*\\\\][\\\\s\\\\S]*?\\\\[\\\\/${escapedShortcode}\\\\]`);\n const match = src.match(startPattern);\n const index = match == null ? void 0 : match.index;\n return index !== void 0 ? index : -1;\n },\n tokenize(src, _tokens, _lexer) {\n const tokenPattern = selfClosing ? new RegExp(`^\\\\[${escapedShortcode}\\\\s*([^\\\\]]*)\\\\]`) : new RegExp(\n `^\\\\[${escapedShortcode}\\\\s*([^\\\\]]*)\\\\]([\\\\s\\\\S]*?)\\\\[\\\\/${escapedShortcode}\\\\]`\n );\n const match = src.match(tokenPattern);\n if (!match) {\n return void 0;\n }\n let content = \"\";\n let attrString = \"\";\n if (selfClosing) {\n const [, attrs] = match;\n attrString = attrs;\n } else {\n const [, attrs, contentMatch] = match;\n attrString = attrs;\n content = contentMatch || \"\";\n }\n const attributes = parseAttributes2(attrString.trim());\n return {\n type: nodeName,\n raw: match[0],\n content: content.trim(),\n attributes\n };\n }\n },\n renderMarkdown: (node) => {\n let content = \"\";\n if (getContent) {\n content = getContent(node);\n } else if (node.content && node.content.length > 0) {\n content = node.content.filter((child) => child.type === \"text\").map((child) => child.text).join(\"\");\n }\n const filteredAttrs = filterAttributes(node.attrs || {});\n const attrs = serializeAttributes2(filteredAttrs);\n const attrString = attrs ? ` ${attrs}` : \"\";\n if (selfClosing) {\n return `[${shortcode}${attrString}]`;\n }\n return `[${shortcode}${attrString}]${content}[/${shortcode}]`;\n }\n };\n}\n\n// src/utilities/markdown/parseIndentedBlocks.ts\nfunction parseIndentedBlocks(src, config, lexer) {\n var _a, _b, _c, _d;\n const lines = src.split(\"\\n\");\n const items = [];\n let totalRaw = \"\";\n let i = 0;\n const baseIndentSize = config.baseIndentSize || 2;\n while (i < lines.length) {\n const currentLine = lines[i];\n const itemMatch = currentLine.match(config.itemPattern);\n if (!itemMatch) {\n if (items.length > 0) {\n break;\n } else if (currentLine.trim() === \"\") {\n i += 1;\n totalRaw = `${totalRaw}${currentLine}\n`;\n continue;\n } else {\n return void 0;\n }\n }\n const itemData = config.extractItemData(itemMatch);\n const { indentLevel, mainContent } = itemData;\n totalRaw = `${totalRaw}${currentLine}\n`;\n const itemContent = [mainContent];\n i += 1;\n while (i < lines.length) {\n const nextLine = lines[i];\n if (nextLine.trim() === \"\") {\n const nextNonEmptyIndex = lines.slice(i + 1).findIndex((l) => l.trim() !== \"\");\n if (nextNonEmptyIndex === -1) {\n break;\n }\n const nextNonEmpty = lines[i + 1 + nextNonEmptyIndex];\n const nextIndent2 = ((_b = (_a = nextNonEmpty.match(/^(\\s*)/)) == null ? void 0 : _a[1]) == null ? void 0 : _b.length) || 0;\n if (nextIndent2 > indentLevel) {\n itemContent.push(nextLine);\n totalRaw = `${totalRaw}${nextLine}\n`;\n i += 1;\n continue;\n } else {\n break;\n }\n }\n const nextIndent = ((_d = (_c = nextLine.match(/^(\\s*)/)) == null ? void 0 : _c[1]) == null ? void 0 : _d.length) || 0;\n if (nextIndent > indentLevel) {\n itemContent.push(nextLine);\n totalRaw = `${totalRaw}${nextLine}\n`;\n i += 1;\n } else {\n break;\n }\n }\n let nestedTokens;\n const nestedContent = itemContent.slice(1);\n if (nestedContent.length > 0) {\n const dedentedNested = nestedContent.map((nestedLine) => nestedLine.slice(indentLevel + baseIndentSize)).join(\"\\n\");\n if (dedentedNested.trim()) {\n if (config.customNestedParser) {\n nestedTokens = config.customNestedParser(dedentedNested);\n } else {\n nestedTokens = lexer.blockTokens(dedentedNested);\n }\n }\n }\n const token = config.createToken(itemData, nestedTokens);\n items.push(token);\n }\n if (items.length === 0) {\n return void 0;\n }\n return {\n items,\n raw: totalRaw\n };\n}\n\n// src/utilities/markdown/renderNestedMarkdownContent.ts\nfunction renderNestedMarkdownContent(node, h2, prefixOrGenerator, ctx) {\n if (!node || !Array.isArray(node.content)) {\n return \"\";\n }\n const prefix = typeof prefixOrGenerator === \"function\" ? prefixOrGenerator(ctx) : prefixOrGenerator;\n const [content, ...children] = node.content;\n const mainContent = h2.renderChildren([content]);\n let output = `${prefix}${mainContent}`;\n if (children && children.length > 0) {\n children.forEach((child, index) => {\n var _a, _b;\n const childContent = (_b = (_a = h2.renderChild) == null ? void 0 : _a.call(h2, child, index + 1)) != null ? _b : h2.renderChildren([child]);\n if (childContent !== void 0 && childContent !== null) {\n const indentedChild = childContent.split(\"\\n\").map((line) => line ? h2.indent(line) : h2.indent(\"\")).join(\"\\n\");\n output += child.type === \"paragraph\" ? `\n\n${indentedChild}` : `\n${indentedChild}`;\n }\n });\n }\n return output;\n}\n\n// src/utilities/marksEqual.ts\nfunction markTypeName(mark) {\n return typeof mark.type === \"string\" ? mark.type : mark.type.name;\n}\nfunction marksEqual(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n const consumed = Array.from({ length: b.length }, () => false);\n return a.every((markA) => {\n const nameA = markTypeName(markA);\n const idx = b.findIndex(\n (markB, i) => !consumed[i] && nameA === markTypeName(markB) && attrsEqual(markA.attrs, markB.attrs)\n );\n if (idx === -1) {\n return false;\n }\n consumed[idx] = true;\n return true;\n });\n}\n\n// src/utilities/mergeDeep.ts\nfunction mergeDeep(target, source) {\n const output = { ...target };\n if (isPlainObject(target) && isPlainObject(source)) {\n Object.keys(source).forEach((key) => {\n if (isPlainObject(source[key]) && isPlainObject(target[key])) {\n output[key] = mergeDeep(target[key], source[key]);\n } else {\n output[key] = source[key];\n }\n });\n }\n return output;\n}\n\n// src/MarkView.ts\nfunction updateMarkViewAttributes(checkMark, editor, attrs = {}) {\n const { state } = editor;\n const { doc, tr } = state;\n const thisMark = checkMark;\n doc.descendants((node, pos) => {\n const from = tr.mapping.map(pos);\n const to = tr.mapping.map(pos) + node.nodeSize;\n let foundMark = null;\n node.marks.forEach((mark) => {\n if (mark !== thisMark) {\n return false;\n }\n foundMark = mark;\n });\n if (!foundMark) {\n return;\n }\n let needsUpdate = false;\n Object.keys(attrs).forEach((k) => {\n if (attrs[k] !== foundMark.attrs[k]) {\n needsUpdate = true;\n }\n });\n if (needsUpdate) {\n const updatedMark = checkMark.type.create({\n ...checkMark.attrs,\n ...attrs\n });\n tr.removeMark(from, to, checkMark.type);\n tr.addMark(from, to, updatedMark);\n }\n });\n if (tr.docChanged) {\n editor.view.dispatch(tr);\n }\n}\nvar MarkView = class {\n constructor(component, props, options) {\n this.component = component;\n this.editor = props.editor;\n this.options = { ...options };\n this.mark = props.mark;\n this.HTMLAttributes = props.HTMLAttributes;\n }\n get dom() {\n return this.editor.view.dom;\n }\n get contentDOM() {\n return null;\n }\n /**\n * Update the attributes of the mark in the document.\n * @param attrs The attributes to update.\n */\n updateAttributes(attrs, checkMark) {\n updateMarkViewAttributes(checkMark || this.mark, this.editor, attrs);\n }\n ignoreMutation(mutation) {\n if (!this.dom || !this.contentDOM) {\n return true;\n }\n if (typeof this.options.ignoreMutation === \"function\") {\n return this.options.ignoreMutation({ mutation });\n }\n if (mutation.type === \"selection\") {\n return false;\n }\n if (this.dom.contains(mutation.target) && mutation.type === \"childList\" && (isiOS() || isAndroid()) && this.editor.isFocused) {\n const changedNodes = [\n ...Array.from(mutation.addedNodes),\n ...Array.from(mutation.removedNodes)\n ];\n if (changedNodes.every((node) => node.isContentEditable)) {\n return false;\n }\n }\n if (this.contentDOM === mutation.target && mutation.type === \"attributes\") {\n return true;\n }\n if (this.contentDOM.contains(mutation.target)) {\n return false;\n }\n return true;\n }\n};\n\n// src/InputRule.ts\nimport { Fragment as Fragment4 } from \"@tiptap/pm/model\";\nimport { Plugin as Plugin2 } from \"@tiptap/pm/state\";\nvar InputRule = class {\n constructor(config) {\n var _a;\n this.find = config.find;\n this.handler = config.handler;\n this.undoable = (_a = config.undoable) != null ? _a : true;\n }\n};\nvar inputRuleMatcherHandler = (text, find) => {\n if (isRegExp(find)) {\n return find.exec(text);\n }\n const inputRuleMatch = find(text);\n if (!inputRuleMatch) {\n return null;\n }\n const result = [inputRuleMatch.text];\n result.index = inputRuleMatch.index;\n result.input = text;\n result.data = inputRuleMatch.data;\n if (inputRuleMatch.replaceWith) {\n if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) {\n console.warn(\n '[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\".'\n );\n }\n result.push(inputRuleMatch.replaceWith);\n }\n return result;\n};\nfunction run(config) {\n var _a;\n const { editor, from, to, text, rules, plugin } = config;\n const { view } = editor;\n if (view.composing) {\n return false;\n }\n const $from = view.state.doc.resolve(from);\n if (\n // check for code node\n $from.parent.type.spec.code || // check for code mark\n !!((_a = $from.nodeBefore || $from.nodeAfter) == null ? void 0 : _a.marks.find((mark) => mark.type.spec.code))\n ) {\n return false;\n }\n let matched = false;\n const textBefore = getTextContentFromNodes($from) + text;\n rules.forEach((rule) => {\n if (matched) {\n return;\n }\n const match = inputRuleMatcherHandler(textBefore, rule.find);\n if (!match) {\n return;\n }\n const matchedDocLength = match[0].length - text.length;\n if (matchedDocLength > 0) {\n const matchStartOffset = $from.parentOffset - matchedDocLength;\n if (matchStartOffset < 0 || $from.parent.textBetween(matchStartOffset, $from.parentOffset) !== match[0].slice(0, matchedDocLength)) {\n return;\n }\n }\n const tr = view.state.tr;\n const state = createChainableState({\n state: view.state,\n transaction: tr\n });\n const range = {\n from: from - (match[0].length - text.length),\n to\n };\n const { commands, chain, can } = new CommandManager({\n editor,\n state\n });\n const handler = rule.handler({\n state,\n range,\n match,\n commands,\n chain,\n can\n });\n if (handler === null || !tr.steps.length) {\n return;\n }\n if (rule.undoable) {\n tr.setMeta(plugin, {\n transform: tr,\n from,\n to,\n text\n });\n }\n view.dispatch(tr);\n matched = true;\n });\n return matched;\n}\nfunction inputRulesPlugin(props) {\n const { editor, rules } = props;\n const plugin = new Plugin2({\n state: {\n init() {\n return null;\n },\n apply(tr, prev, state) {\n const stored = tr.getMeta(plugin);\n if (stored) {\n return stored;\n }\n const simulatedInputMeta = tr.getMeta(\"applyInputRules\");\n const isSimulatedInput = !!simulatedInputMeta;\n if (isSimulatedInput) {\n setTimeout(() => {\n let { text } = simulatedInputMeta;\n if (typeof text === \"string\") {\n text = text;\n } else {\n text = getHTMLFromFragment(Fragment4.from(text), state.schema);\n }\n const { from } = simulatedInputMeta;\n const to = from + text.length;\n run({\n editor,\n from,\n to,\n text,\n rules,\n plugin\n });\n });\n }\n return tr.selectionSet || tr.docChanged ? null : prev;\n }\n },\n props: {\n handleTextInput(view, from, to, text) {\n return run({\n editor,\n from,\n to,\n text,\n rules,\n plugin\n });\n },\n handleDOMEvents: {\n compositionend: (view) => {\n setTimeout(() => {\n const { $cursor } = view.state.selection;\n if ($cursor) {\n run({\n editor,\n from: $cursor.pos,\n to: $cursor.pos,\n text: \"\",\n rules,\n plugin\n });\n }\n });\n return false;\n }\n },\n // add support for input rules to trigger on enter\n // this is useful for example for code blocks\n handleKeyDown(view, event) {\n if (event.key !== \"Enter\") {\n return false;\n }\n const { $cursor } = view.state.selection;\n if ($cursor) {\n return run({\n editor,\n from: $cursor.pos,\n to: $cursor.pos,\n text: \"\\n\",\n rules,\n plugin\n });\n }\n return false;\n }\n },\n // @ts-ignore\n isInputRules: true\n });\n return plugin;\n}\n\n// src/Extendable.ts\nvar Extendable = class {\n constructor(config = {}) {\n this.type = \"extendable\";\n this.parent = null;\n this.child = null;\n this.name = \"\";\n this.config = {\n name: this.name\n };\n this.config = {\n ...this.config,\n ...config\n };\n this.name = this.config.name;\n }\n get options() {\n return {\n ...callOrReturn(\n getExtensionField(this, \"addOptions\", {\n name: this.name\n })\n )\n };\n }\n get storage() {\n return {\n ...callOrReturn(\n getExtensionField(this, \"addStorage\", {\n name: this.name,\n options: this.options\n })\n )\n };\n }\n configure(options = {}) {\n const extension = this.extend({\n ...this.config,\n addOptions: () => {\n return mergeDeep(this.options, options);\n }\n });\n extension.name = this.name;\n extension.parent = this.parent;\n this.child = null;\n return extension;\n }\n extend(extendedConfig = {}) {\n const extension = new this.constructor({ ...this.config, ...extendedConfig });\n extension.parent = this;\n this.child = extension;\n extension.name = \"name\" in extendedConfig ? extendedConfig.name : extension.parent.name;\n return extension;\n }\n};\n\n// src/Mark.ts\nvar Mark = class _Mark extends Extendable {\n constructor() {\n super(...arguments);\n this.type = \"mark\";\n }\n /**\n * Create a new Mark instance\n * @param config - Mark configuration object or a function that returns a configuration object\n */\n static create(config = {}) {\n const resolvedConfig = typeof config === \"function\" ? config() : config;\n return new _Mark(resolvedConfig);\n }\n static handleExit({ editor, mark }) {\n const { tr } = editor.state;\n const currentPos = editor.state.selection.$from;\n const isAtEnd = currentPos.pos === currentPos.end();\n if (isAtEnd) {\n const currentMarks = currentPos.marks();\n const isInMark = !!currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);\n if (!isInMark) {\n return false;\n }\n const removeMark = currentMarks.find((m) => (m == null ? void 0 : m.type.name) === mark.name);\n if (removeMark) {\n tr.removeStoredMark(removeMark);\n }\n tr.insertText(\" \", currentPos.pos);\n editor.view.dispatch(tr);\n return true;\n }\n return false;\n }\n configure(options) {\n return super.configure(options);\n }\n extend(extendedConfig) {\n const resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n return super.extend(resolvedConfig);\n }\n};\n\n// src/PasteRule.ts\nimport { Fragment as Fragment5 } from \"@tiptap/pm/model\";\nimport { Plugin as Plugin3 } from \"@tiptap/pm/state\";\nvar PasteRule = class {\n constructor(config) {\n this.find = config.find;\n this.handler = config.handler;\n }\n};\nvar pasteRuleMatcherHandler = (text, find, event) => {\n if (isRegExp(find)) {\n return [...text.matchAll(find)];\n }\n const matches = find(text, event);\n if (!matches) {\n return [];\n }\n return matches.map((pasteRuleMatch) => {\n const result = [pasteRuleMatch.text];\n result.index = pasteRuleMatch.index;\n result.input = text;\n result.data = pasteRuleMatch.data;\n if (pasteRuleMatch.replaceWith) {\n if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) {\n console.warn(\n '[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\".'\n );\n }\n result.push(pasteRuleMatch.replaceWith);\n }\n return result;\n });\n};\nfunction run2(config) {\n const { editor, state, from, to, rule, pasteEvent, dropEvent } = config;\n const { commands, chain, can } = new CommandManager({\n editor,\n state\n });\n const handlers = [];\n state.doc.nodesBetween(from, to, (node, pos) => {\n var _a, _b, _c, _d, _e;\n if (((_b = (_a = node.type) == null ? void 0 : _a.spec) == null ? void 0 : _b.code) || !(node.isText || node.isTextblock || node.isInline)) {\n return;\n }\n const contentSize = (_e = (_d = (_c = node.content) == null ? void 0 : _c.size) != null ? _d : node.nodeSize) != null ? _e : 0;\n const resolvedFrom = Math.max(from, pos);\n const resolvedTo = Math.min(to, pos + contentSize);\n if (resolvedFrom >= resolvedTo) {\n return;\n }\n const textToMatch = node.isText ? node.text || \"\" : node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, \"\\uFFFC\");\n const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);\n matches.forEach((match) => {\n if (match.index === void 0) {\n return;\n }\n const start = resolvedFrom + match.index + 1;\n const end = start + match[0].length;\n const range = {\n from: state.tr.mapping.map(start),\n to: state.tr.mapping.map(end)\n };\n const handler = rule.handler({\n state,\n range,\n match,\n commands,\n chain,\n can,\n pasteEvent,\n dropEvent\n });\n handlers.push(handler);\n });\n });\n const success = handlers.every((handler) => handler !== null);\n return success;\n}\nvar tiptapDragFromOtherEditor = null;\nvar createClipboardPasteEvent = (text) => {\n var _a;\n const event = new ClipboardEvent(\"paste\", {\n clipboardData: new DataTransfer()\n });\n (_a = event.clipboardData) == null ? void 0 : _a.setData(\"text/html\", text);\n return event;\n};\nfunction pasteRulesPlugin(props) {\n const { editor, rules } = props;\n let dragSourceElement = null;\n let isPastedFromProseMirror = false;\n let isDroppedFromProseMirror = false;\n let pasteEvent = typeof ClipboardEvent !== \"undefined\" ? new ClipboardEvent(\"paste\") : null;\n let dropEvent;\n try {\n dropEvent = typeof DragEvent !== \"undefined\" ? new DragEvent(\"drop\") : null;\n } catch {\n dropEvent = null;\n }\n const processEvent = ({\n state,\n from,\n to,\n rule,\n pasteEvt\n }) => {\n const tr = state.tr;\n const chainableState = createChainableState({\n state,\n transaction: tr\n });\n const handler = run2({\n editor,\n state: chainableState,\n from: Math.max(from - 1, 0),\n to: to.b - 1,\n rule,\n pasteEvent: pasteEvt,\n dropEvent\n });\n if (!handler || !tr.steps.length) {\n return;\n }\n try {\n dropEvent = typeof DragEvent !== \"undefined\" ? new DragEvent(\"drop\") : null;\n } catch {\n dropEvent = null;\n }\n pasteEvent = typeof ClipboardEvent !== \"undefined\" ? new ClipboardEvent(\"paste\") : null;\n return tr;\n };\n const plugins = rules.map((rule) => {\n return new Plugin3({\n // we register a global drag handler to track the current drag source element\n view(view) {\n const handleDragstart = (event) => {\n var _a;\n dragSourceElement = ((_a = view.dom.parentElement) == null ? void 0 : _a.contains(event.target)) ? view.dom.parentElement : null;\n if (dragSourceElement) {\n tiptapDragFromOtherEditor = editor;\n }\n };\n const handleDragend = () => {\n if (tiptapDragFromOtherEditor) {\n tiptapDragFromOtherEditor = null;\n }\n };\n window.addEventListener(\"dragstart\", handleDragstart);\n window.addEventListener(\"dragend\", handleDragend);\n return {\n destroy() {\n window.removeEventListener(\"dragstart\", handleDragstart);\n window.removeEventListener(\"dragend\", handleDragend);\n }\n };\n },\n props: {\n handleDOMEvents: {\n drop: (view, event) => {\n isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;\n dropEvent = event;\n if (!isDroppedFromProseMirror) {\n const dragFromOtherEditor = tiptapDragFromOtherEditor;\n if (dragFromOtherEditor == null ? void 0 : dragFromOtherEditor.isEditable) {\n setTimeout(() => {\n const selection = dragFromOtherEditor.state.selection;\n if (selection) {\n dragFromOtherEditor.commands.deleteRange({\n from: selection.from,\n to: selection.to\n });\n }\n }, 10);\n }\n }\n return false;\n },\n paste: (_view, event) => {\n var _a;\n const html = (_a = event.clipboardData) == null ? void 0 : _a.getData(\"text/html\");\n pasteEvent = event;\n isPastedFromProseMirror = !!(html == null ? void 0 : html.includes(\"data-pm-slice\"));\n return false;\n }\n }\n },\n appendTransaction: (transactions, oldState, state) => {\n const transaction = transactions[0];\n const isPaste = transaction.getMeta(\"uiEvent\") === \"paste\" && !isPastedFromProseMirror;\n const isDrop = transaction.getMeta(\"uiEvent\") === \"drop\" && !isDroppedFromProseMirror;\n const simulatedPasteMeta = transaction.getMeta(\"applyPasteRules\");\n const isSimulatedPaste = !!simulatedPasteMeta;\n if (!isPaste && !isDrop && !isSimulatedPaste) {\n return;\n }\n if (isSimulatedPaste) {\n let { text } = simulatedPasteMeta;\n if (typeof text === \"string\") {\n text = text;\n } else {\n text = getHTMLFromFragment(Fragment5.from(text), state.schema);\n }\n const { from: from2 } = simulatedPasteMeta;\n const to2 = from2 + text.length;\n const pasteEvt = createClipboardPasteEvent(text);\n return processEvent({\n rule,\n state,\n from: from2,\n to: { b: to2 },\n pasteEvt\n });\n }\n const from = oldState.doc.content.findDiffStart(state.doc.content);\n const to = oldState.doc.content.findDiffEnd(state.doc.content);\n if (!isNumber(from) || !to || from === to.b) {\n return;\n }\n return processEvent({\n rule,\n state,\n from,\n to,\n pasteEvt: pasteEvent\n });\n }\n });\n });\n return plugins;\n}\n\n// src/ExtensionManager.ts\nvar ExtensionManager = class {\n constructor(extensions, editor) {\n this.splittableMarks = [];\n this.nonClearableMarks = [];\n this.decorationManager = null;\n this.editor = editor;\n this.baseExtensions = extensions;\n this.extensions = resolveExtensions(extensions);\n this.schema = getSchemaByResolvedExtensions(this.extensions, editor);\n this.setupExtensions();\n }\n /**\n * Get all commands from the extensions.\n * @returns An object with all commands where the key is the command name and the value is the command function\n */\n get commands() {\n return this.extensions.reduce((commands, extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: this.editor.extensionStorage[extension.name],\n editor: this.editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const addCommands = getExtensionField(\n extension,\n \"addCommands\",\n context\n );\n if (!addCommands) {\n return commands;\n }\n return {\n ...commands,\n ...addCommands()\n };\n }, {});\n }\n /**\n * Get all registered Prosemirror plugins from the extensions.\n * @returns An array of Prosemirror plugins\n */\n get plugins() {\n const { editor } = this;\n const extensions = sortExtensions([...this.extensions].reverse());\n const allPlugins = extensions.flatMap((extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: this.editor.extensionStorage[extension.name],\n editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const plugins = [];\n const addKeyboardShortcuts = getExtensionField(\n extension,\n \"addKeyboardShortcuts\",\n context\n );\n let defaultBindings = {};\n if (extension.type === \"mark\" && getExtensionField(extension, \"exitable\", context)) {\n defaultBindings.ArrowRight = () => Mark.handleExit({ editor, mark: extension });\n }\n if (addKeyboardShortcuts) {\n const bindings = Object.fromEntries(\n Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {\n return [shortcut, () => method({ editor })];\n })\n );\n defaultBindings = { ...defaultBindings, ...bindings };\n }\n const keyMapPlugin = keymap(defaultBindings);\n plugins.push(keyMapPlugin);\n const addInputRules = getExtensionField(\n extension,\n \"addInputRules\",\n context\n );\n if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {\n const rules = addInputRules();\n if (rules && rules.length) {\n const inputResult = inputRulesPlugin({\n editor,\n rules\n });\n const inputPlugins = Array.isArray(inputResult) ? inputResult : [inputResult];\n plugins.push(...inputPlugins);\n }\n }\n const addPasteRules = getExtensionField(\n extension,\n \"addPasteRules\",\n context\n );\n if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {\n const rules = addPasteRules();\n if (rules && rules.length) {\n const pasteRules = pasteRulesPlugin({ editor, rules });\n plugins.push(...pasteRules);\n }\n }\n const addProseMirrorPlugins = getExtensionField(\n extension,\n \"addProseMirrorPlugins\",\n context\n );\n if (addProseMirrorPlugins) {\n const proseMirrorPlugins = addProseMirrorPlugins();\n plugins.push(...proseMirrorPlugins);\n }\n return plugins;\n });\n const decorationPlugin = this.createDecorationPlugin();\n if (decorationPlugin) {\n allPlugins.push(decorationPlugin);\n }\n return allPlugins;\n }\n /**\n * Aggregates decorations from extensions into a single plugin, or returns null\n * if none exist. Destroys the previous manager to avoid orphaned listeners.\n * @returns A ProseMirror plugin or `null`\n * @example\n * const plugin = editor.extensionManager.createDecorationPlugin()\n */\n createDecorationPlugin() {\n var _a;\n const { editor } = this;\n (_a = this.decorationManager) == null ? void 0 : _a.destroy();\n const entries = [];\n this.extensions.forEach((extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: this.editor.extensionStorage[extension.name],\n editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const addDecorations = getExtensionField(\n extension,\n \"addDecorations\",\n context\n );\n if (!addDecorations) {\n return;\n }\n entries.push({ name: extension.name, addDecorations });\n });\n this.decorationManager = new DecorationManager({ editor, entries });\n return this.decorationManager.plugin;\n }\n /**\n * Get all attributes from the extensions.\n * @returns An array of attributes\n */\n get attributes() {\n return getAttributesFromExtensions(this.extensions);\n }\n /**\n * Get all node views from the extensions.\n * @returns An object with all node views where the key is the node name and the value is the node view function\n */\n get nodeViews() {\n const { editor } = this;\n const { nodeExtensions } = splitExtensions(this.extensions);\n return Object.fromEntries(\n nodeExtensions.filter((extension) => !!getExtensionField(extension, \"addNodeView\")).map((extension) => {\n const extensionAttributes = this.attributes.filter(\n (attribute) => attribute.type === extension.name\n );\n const context = {\n name: extension.name,\n options: extension.options,\n storage: this.editor.extensionStorage[extension.name],\n editor,\n type: getNodeType(extension.name, this.schema)\n };\n const addNodeView = getExtensionField(\n extension,\n \"addNodeView\",\n context\n );\n if (!addNodeView) {\n return [];\n }\n const nodeViewResult = addNodeView();\n if (!nodeViewResult) {\n return [];\n }\n const nodeview = (node, view, getPos, decorations, innerDecorations) => {\n const HTMLAttributes = getRenderedAttributes(node, extensionAttributes);\n return nodeViewResult({\n // pass-through\n node,\n view,\n getPos,\n decorations,\n innerDecorations,\n // tiptap-specific\n editor,\n extension,\n HTMLAttributes\n });\n };\n return [extension.name, nodeview];\n })\n );\n }\n /**\n * Get the composed dispatchTransaction function from all extensions.\n * @param baseDispatch The base dispatch function (e.g. from the editor or user props)\n * @returns A composed dispatch function\n */\n dispatchTransaction(baseDispatch) {\n const { editor } = this;\n const extensions = sortExtensions([...this.extensions].reverse());\n return extensions.reduceRight((next, extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: this.editor.extensionStorage[extension.name],\n editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const dispatchTransaction = getExtensionField(\n extension,\n \"dispatchTransaction\",\n context\n );\n if (!dispatchTransaction) {\n return next;\n }\n return (transaction) => {\n dispatchTransaction.call(context, { transaction, next });\n };\n }, baseDispatch);\n }\n /**\n * Get the composed transformPastedHTML function from all extensions.\n * @param baseTransform The base transform function (e.g. from the editor props)\n * @returns A composed transform function that chains all extension transforms\n */\n transformPastedHTML(baseTransform) {\n const { editor } = this;\n const extensions = sortExtensions([...this.extensions]);\n return extensions.reduce(\n (transform, extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: this.editor.extensionStorage[extension.name],\n editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const extensionTransform = getExtensionField(\n extension,\n \"transformPastedHTML\",\n context\n );\n if (!extensionTransform) {\n return transform;\n }\n return (html, view) => {\n const transformedHtml = transform(html, view);\n return extensionTransform.call(context, transformedHtml);\n };\n },\n baseTransform || ((html) => html)\n );\n }\n get markViews() {\n const { editor } = this;\n const { markExtensions } = splitExtensions(this.extensions);\n return Object.fromEntries(\n markExtensions.filter((extension) => !!getExtensionField(extension, \"addMarkView\")).map((extension) => {\n const extensionAttributes = this.attributes.filter(\n (attribute) => attribute.type === extension.name\n );\n const context = {\n name: extension.name,\n options: extension.options,\n storage: this.editor.extensionStorage[extension.name],\n editor,\n type: getMarkType(extension.name, this.schema)\n };\n const addMarkView = getExtensionField(\n extension,\n \"addMarkView\",\n context\n );\n if (!addMarkView) {\n return [];\n }\n const markView = (mark, view, inline) => {\n const HTMLAttributes = getRenderedAttributes(mark, extensionAttributes);\n return addMarkView()({\n // pass-through\n mark,\n view,\n inline,\n // tiptap-specific\n editor,\n extension,\n HTMLAttributes,\n updateAttributes: (attrs) => {\n updateMarkViewAttributes(mark, editor, attrs);\n }\n });\n };\n return [extension.name, markView];\n })\n );\n }\n /**\n * Destroy the extension manager and clean up all extension references\n * to prevent memory leaks through parent/child extension chains.\n *\n * Walks each extension's full parent chain and nulls every forward\n * `parent.child → current` link where the parent still points to the\n * current node. This breaks the retention path from module-scope\n * singleton roots through deep extend() chains.\n *\n * Only ancestor `.child` links matching the current chain are cleared.\n * The `.parent` pointer on ancestors is never touched — extensions\n * may be shared across live editors, so their own backward references\n * and non-matching forward links must remain intact.\n */\n destroy() {\n var _a;\n (_a = this.decorationManager) == null ? void 0 : _a.destroy();\n this.extensions.forEach((extension) => {\n let current = extension;\n while (current.parent) {\n const parent = current.parent;\n if (parent.child === current) {\n parent.child = null;\n }\n current = parent;\n }\n });\n this.extensions = [];\n this.baseExtensions = [];\n this.decorationManager = null;\n this.schema = null;\n this.editor = null;\n }\n /**\n * Go through all extensions, create extension storages & setup marks\n * & bind editor event listener.\n */\n setupExtensions() {\n const extensions = this.extensions;\n this.editor.extensionStorage = Object.fromEntries(\n extensions.map((extension) => [extension.name, extension.storage])\n );\n extensions.forEach((extension) => {\n var _a, _b;\n const context = {\n name: extension.name,\n options: extension.options,\n storage: this.editor.extensionStorage[extension.name],\n editor: this.editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n if (extension.type === \"mark\") {\n const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, \"keepOnSplit\", context))) != null ? _a : true;\n if (keepOnSplit) {\n this.splittableMarks.push(extension.name);\n }\n const clearable = (_b = callOrReturn(\n getExtensionField(extension, \"clearable\", context)\n )) != null ? _b : true;\n if (!clearable) {\n this.nonClearableMarks.push(extension.name);\n }\n }\n const onBeforeCreate = getExtensionField(\n extension,\n \"onBeforeCreate\",\n context\n );\n const onCreate = getExtensionField(extension, \"onCreate\", context);\n const onUpdate = getExtensionField(extension, \"onUpdate\", context);\n const onSelectionUpdate = getExtensionField(\n extension,\n \"onSelectionUpdate\",\n context\n );\n const onTransaction = getExtensionField(\n extension,\n \"onTransaction\",\n context\n );\n const onFocus = getExtensionField(extension, \"onFocus\", context);\n const onBlur = getExtensionField(extension, \"onBlur\", context);\n const onDestroy = getExtensionField(extension, \"onDestroy\", context);\n if (onBeforeCreate) {\n this.editor.on(\"beforeCreate\", onBeforeCreate);\n }\n if (onCreate) {\n this.editor.on(\"create\", onCreate);\n }\n if (onUpdate) {\n this.editor.on(\"update\", onUpdate);\n }\n if (onSelectionUpdate) {\n this.editor.on(\"selectionUpdate\", onSelectionUpdate);\n }\n if (onTransaction) {\n this.editor.on(\"transaction\", onTransaction);\n }\n if (onFocus) {\n this.editor.on(\"focus\", onFocus);\n }\n if (onBlur) {\n this.editor.on(\"blur\", onBlur);\n }\n if (onDestroy) {\n this.editor.on(\"destroy\", onDestroy);\n }\n });\n }\n};\nExtensionManager.resolve = resolveExtensions;\nExtensionManager.sort = sortExtensions;\nExtensionManager.flatten = flattenExtensions;\n\n// src/extensions/index.ts\nvar extensions_exports = {};\n__export(extensions_exports, {\n ClipboardTextSerializer: () => ClipboardTextSerializer,\n Commands: () => Commands,\n Delete: () => Delete,\n Drop: () => Drop,\n Editable: () => Editable,\n FocusEvents: () => FocusEvents,\n Keymap: () => Keymap,\n Paste: () => Paste,\n Tabindex: () => Tabindex,\n TextDirection: () => TextDirection,\n focusEventsPluginKey: () => focusEventsPluginKey\n});\n\n// src/extensions/clipboardTextSerializer.ts\nimport { Plugin as Plugin4, PluginKey as PluginKey2 } from \"@tiptap/pm/state\";\n\n// src/Extension.ts\nvar Extension = class _Extension extends Extendable {\n constructor() {\n super(...arguments);\n this.type = \"extension\";\n }\n /**\n * Create a new Extension instance\n * @param config - Extension configuration object or a function that returns a configuration object\n */\n static create(config = {}) {\n const resolvedConfig = typeof config === \"function\" ? config() : config;\n return new _Extension(resolvedConfig);\n }\n configure(options) {\n return super.configure(options);\n }\n extend(extendedConfig) {\n const resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n return super.extend(resolvedConfig);\n }\n};\n\n// src/extensions/clipboardTextSerializer.ts\nvar ClipboardTextSerializer = Extension.create({\n name: \"clipboardTextSerializer\",\n addOptions() {\n return {\n blockSeparator: void 0\n };\n },\n addProseMirrorPlugins() {\n return [\n new Plugin4({\n key: new PluginKey2(\"clipboardTextSerializer\"),\n props: {\n clipboardTextSerializer: () => {\n const { editor } = this;\n const { state, schema } = editor;\n const { doc, selection } = state;\n const textSerializers = getTextSerializersFromSchema(schema);\n const { blockSeparator } = this.options;\n const options = {\n ...blockSeparator !== void 0 ? { blockSeparator } : {},\n textSerializers\n };\n const sortedRanges = [...selection.ranges].sort((a, b) => a.$from.pos - b.$from.pos);\n return sortedRanges.map(\n ({ $from, $to }) => getTextBetween(doc, { from: $from.pos, to: $to.pos }, options)\n ).join(blockSeparator != null ? blockSeparator : \"\\n\\n\");\n }\n }\n })\n ];\n }\n});\n\n// src/extensions/commands.ts\nvar Commands = Extension.create({\n name: \"commands\",\n addCommands() {\n return {\n ...commands_exports\n };\n }\n});\n\n// src/extensions/delete.ts\nimport { RemoveMarkStep } from \"@tiptap/pm/transform\";\nvar Delete = Extension.create({\n name: \"delete\",\n onUpdate({ transaction, appendedTransactions }) {\n var _a, _b, _c;\n const callback = () => {\n var _a2, _b2, _c2, _d;\n if ((_d = (_c2 = (_b2 = (_a2 = this.editor.options.coreExtensionOptions) == null ? void 0 : _a2.delete) == null ? void 0 : _b2.filterTransaction) == null ? void 0 : _c2.call(_b2, transaction)) != null ? _d : transaction.getMeta(\"y-sync$\")) {\n return;\n }\n const nextTransaction = combineTransactionSteps(transaction.before, [\n transaction,\n ...appendedTransactions\n ]);\n const changes = getChangedRanges(nextTransaction);\n changes.forEach((change) => {\n if (nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter && nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore) {\n nextTransaction.before.nodesBetween(\n change.oldRange.from,\n change.oldRange.to,\n (node, from) => {\n const to = from + node.nodeSize - 2;\n const isFullyWithinRange = change.oldRange.from <= from && to <= change.oldRange.to;\n this.editor.emit(\"delete\", {\n type: \"node\",\n node,\n from,\n to,\n newFrom: nextTransaction.mapping.map(from),\n newTo: nextTransaction.mapping.map(to),\n deletedRange: change.oldRange,\n newRange: change.newRange,\n partial: !isFullyWithinRange,\n editor: this.editor,\n transaction,\n combinedTransform: nextTransaction\n });\n }\n );\n }\n });\n const mapping = nextTransaction.mapping;\n nextTransaction.steps.forEach((step, index) => {\n var _a3, _b3;\n if (step instanceof RemoveMarkStep) {\n const newStart = mapping.slice(index).map(step.from, -1);\n const newEnd = mapping.slice(index).map(step.to);\n const oldStart = mapping.invert().map(newStart, -1);\n const oldEnd = mapping.invert().map(newEnd);\n const foundBeforeMark = newStart > 0 ? (_a3 = nextTransaction.doc.nodeAt(newStart - 1)) == null ? void 0 : _a3.marks.some((mark) => mark.eq(step.mark)) : false;\n const foundAfterMark = (_b3 = nextTransaction.doc.nodeAt(newEnd)) == null ? void 0 : _b3.marks.some((mark) => mark.eq(step.mark));\n this.editor.emit(\"delete\", {\n type: \"mark\",\n mark: step.mark,\n from: step.from,\n to: step.to,\n deletedRange: {\n from: oldStart,\n to: oldEnd\n },\n newRange: {\n from: newStart,\n to: newEnd\n },\n partial: Boolean(foundAfterMark || foundBeforeMark),\n editor: this.editor,\n transaction,\n combinedTransform: nextTransaction\n });\n }\n });\n };\n if ((_c = (_b = (_a = this.editor.options.coreExtensionOptions) == null ? void 0 : _a.delete) == null ? void 0 : _b.async) != null ? _c : true) {\n setTimeout(callback, 0);\n } else {\n callback();\n }\n }\n});\n\n// src/extensions/drop.ts\nimport { Plugin as Plugin5, PluginKey as PluginKey3 } from \"@tiptap/pm/state\";\nvar Drop = Extension.create({\n name: \"drop\",\n addProseMirrorPlugins() {\n return [\n new Plugin5({\n key: new PluginKey3(\"tiptapDrop\"),\n props: {\n handleDrop: (_, e, slice, moved) => {\n this.editor.emit(\"drop\", {\n editor: this.editor,\n event: e,\n slice,\n moved\n });\n }\n }\n })\n ];\n }\n});\n\n// src/extensions/editable.ts\nimport { Plugin as Plugin6, PluginKey as PluginKey4 } from \"@tiptap/pm/state\";\nvar Editable = Extension.create({\n name: \"editable\",\n addProseMirrorPlugins() {\n return [\n new Plugin6({\n key: new PluginKey4(\"editable\"),\n props: {\n editable: () => this.editor.options.editable\n }\n })\n ];\n }\n});\n\n// src/extensions/focusEvents.ts\nimport { Plugin as Plugin7, PluginKey as PluginKey5 } from \"@tiptap/pm/state\";\nvar focusEventsPluginKey = new PluginKey5(\"focusEvents\");\nvar FocusEvents = Extension.create({\n name: \"focusEvents\",\n addProseMirrorPlugins() {\n const { editor } = this;\n return [\n new Plugin7({\n key: focusEventsPluginKey,\n props: {\n handleDOMEvents: {\n focus: (view, event) => {\n editor.isFocused = true;\n const transaction = editor.state.tr.setMeta(\"focus\", { event }).setMeta(\"addToHistory\", false);\n view.dispatch(transaction);\n return false;\n },\n blur: (view, event) => {\n editor.isFocused = false;\n const transaction = editor.state.tr.setMeta(\"blur\", { event }).setMeta(\"addToHistory\", false);\n view.dispatch(transaction);\n return false;\n }\n }\n }\n })\n ];\n }\n});\n\n// src/extensions/keymap.ts\nimport { Plugin as Plugin8, PluginKey as PluginKey6, Selection as Selection3 } from \"@tiptap/pm/state\";\nvar Keymap = Extension.create({\n name: \"keymap\",\n addKeyboardShortcuts() {\n const handleBackspace = () => this.editor.commands.first(({ commands }) => [\n () => commands.undoInputRule(),\n // maybe convert first text block node to default node\n () => commands.command(({ tr }) => {\n const { selection, doc } = tr;\n const { empty, $anchor } = selection;\n const { pos, parent } = $anchor;\n const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;\n const parentIsIsolating = $parentPos.parent.type.spec.isolating;\n const parentPos = $anchor.pos - $anchor.parentOffset;\n const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection3.atStart(doc).from === pos;\n if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === \"paragraph\") {\n return false;\n }\n return commands.clearNodes();\n }),\n () => commands.deleteSelection(),\n () => commands.joinBackward(),\n () => commands.selectNodeBackward()\n ]);\n const handleDelete = () => this.editor.commands.first(({ commands }) => [\n () => commands.deleteSelection(),\n () => commands.deleteCurrentNode(),\n () => commands.joinForward(),\n () => commands.selectNodeForward()\n ]);\n const handleEnter = () => this.editor.commands.first(({ commands }) => [\n () => commands.newlineInCode(),\n () => commands.createParagraphNear(),\n () => commands.liftEmptyBlock(),\n () => commands.splitBlock()\n ]);\n const baseKeymap = {\n Enter: handleEnter,\n \"Mod-Enter\": () => this.editor.commands.exitCode(),\n Backspace: handleBackspace,\n \"Mod-Backspace\": handleBackspace,\n \"Shift-Backspace\": handleBackspace,\n Delete: handleDelete,\n \"Mod-Delete\": handleDelete,\n \"Mod-a\": () => this.editor.commands.selectAll()\n };\n const pcKeymap = {\n ...baseKeymap\n };\n const macKeymap = {\n ...baseKeymap,\n \"Ctrl-h\": handleBackspace,\n \"Alt-Backspace\": handleBackspace,\n \"Ctrl-d\": handleDelete,\n \"Ctrl-Alt-Backspace\": handleDelete,\n \"Alt-Delete\": handleDelete,\n \"Alt-d\": handleDelete,\n \"Ctrl-a\": () => this.editor.commands.selectTextblockStart(),\n \"Ctrl-e\": () => this.editor.commands.selectTextblockEnd()\n };\n if (isiOS() || isMacOS()) {\n return macKeymap;\n }\n return pcKeymap;\n },\n addProseMirrorPlugins() {\n return [\n // With this plugin we check if the whole document was selected and deleted.\n // In this case we will additionally call `clearNodes()` to convert e.g. a heading\n // to a paragraph if necessary.\n // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well\n // with many other commands.\n new Plugin8({\n key: new PluginKey6(\"clearDocument\"),\n appendTransaction: (transactions, oldState, newState) => {\n if (transactions.some((tr2) => tr2.getMeta(\"composition\"))) {\n return;\n }\n const docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);\n const ignoreTr = transactions.some(\n (transaction) => transaction.getMeta(\"preventClearDocument\")\n );\n if (!docChanges || ignoreTr) {\n return;\n }\n const { empty, from, to } = oldState.selection;\n const allFrom = Selection3.atStart(oldState.doc).from;\n const allEnd = Selection3.atEnd(oldState.doc).to;\n const allWasSelected = from === allFrom && to === allEnd;\n if (empty || !allWasSelected) {\n return;\n }\n const isEmpty = isNodeEmpty(newState.doc);\n if (!isEmpty) {\n return;\n }\n const tr = newState.tr;\n const state = createChainableState({\n state: newState,\n transaction: tr\n });\n const { commands } = new CommandManager({\n editor: this.editor,\n state\n });\n commands.clearNodes();\n if (!tr.steps.length) {\n return;\n }\n return tr;\n }\n })\n ];\n }\n});\n\n// src/extensions/paste.ts\nimport { Plugin as Plugin9, PluginKey as PluginKey7 } from \"@tiptap/pm/state\";\nvar Paste = Extension.create({\n name: \"paste\",\n addProseMirrorPlugins() {\n return [\n new Plugin9({\n key: new PluginKey7(\"tiptapPaste\"),\n props: {\n handlePaste: (_view, e, slice) => {\n this.editor.emit(\"paste\", {\n editor: this.editor,\n event: e,\n slice\n });\n }\n }\n })\n ];\n }\n});\n\n// src/extensions/tabindex.ts\nimport { Plugin as Plugin10, PluginKey as PluginKey8 } from \"@tiptap/pm/state\";\nvar Tabindex = Extension.create({\n name: \"tabindex\",\n addOptions() {\n return {\n value: void 0\n };\n },\n addProseMirrorPlugins() {\n return [\n new Plugin10({\n key: new PluginKey8(\"tabindex\"),\n props: {\n attributes: () => {\n var _a;\n if (!this.editor.isEditable && this.options.value === void 0) {\n return {};\n }\n return { tabindex: (_a = this.options.value) != null ? _a : \"0\" };\n }\n }\n })\n ];\n }\n});\n\n// src/extensions/textDirection.ts\nimport { Plugin as Plugin11, PluginKey as PluginKey9 } from \"@tiptap/pm/state\";\nvar TextDirection = Extension.create({\n name: \"textDirection\",\n addOptions() {\n return {\n direction: void 0\n };\n },\n addGlobalAttributes() {\n if (!this.options.direction) {\n return [];\n }\n const { nodeExtensions } = splitExtensions(this.extensions);\n return [\n {\n types: nodeExtensions.filter((extension) => extension.name !== \"text\").map((extension) => extension.name),\n attributes: {\n dir: {\n default: this.options.direction,\n parseHTML: (element) => {\n const dir = element.getAttribute(\"dir\");\n if (dir && (dir === \"ltr\" || dir === \"rtl\" || dir === \"auto\")) {\n return dir;\n }\n return this.options.direction;\n },\n renderHTML: (attributes) => {\n if (!attributes.dir) {\n return {};\n }\n return {\n dir: attributes.dir\n };\n }\n }\n }\n }\n ];\n },\n addProseMirrorPlugins() {\n return [\n new Plugin11({\n key: new PluginKey9(\"textDirection\"),\n props: {\n attributes: () => {\n const direction = this.options.direction;\n if (!direction) {\n return {};\n }\n return {\n dir: direction\n };\n }\n }\n })\n ];\n }\n});\n\n// src/helpers/warnOnDuplicatedProseMirrorModel.ts\nimport { Fragment as Fragment6 } from \"@tiptap/pm/model\";\nimport { ReplaceStep as ReplaceStep2 } from \"@tiptap/pm/transform\";\nvar hasChecked = false;\nfunction warnOnDuplicatedProseMirrorModel(schema) {\n if (hasChecked) {\n return;\n }\n hasChecked = true;\n let content;\n try {\n content = ReplaceStep2.fromJSON(schema, { from: 0, to: 0 }).slice.content;\n } catch {\n return;\n }\n if (content instanceof Fragment6) {\n return;\n }\n console.warn(\n \"[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.\"\n );\n}\n\n// src/NodePos.ts\nvar NodePos = class _NodePos {\n constructor(pos, editor, isBlock = false, node = null) {\n this.currentNode = null;\n this.actualDepth = null;\n this.isBlock = isBlock;\n this.resolvedPos = pos;\n this.editor = editor;\n this.currentNode = node;\n }\n get name() {\n return this.node.type.name;\n }\n get node() {\n return this.currentNode || this.resolvedPos.node();\n }\n get element() {\n return this.editor.view.domAtPos(this.pos).node;\n }\n get depth() {\n var _a;\n return (_a = this.actualDepth) != null ? _a : this.resolvedPos.depth;\n }\n get pos() {\n return this.resolvedPos.pos;\n }\n get content() {\n return this.node.content;\n }\n set content(content) {\n let from = this.from;\n let to = this.to;\n if (this.isBlock) {\n if (this.content.size === 0) {\n console.error(\n `You can\\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`\n );\n return;\n }\n from = this.from + 1;\n to = this.to - 1;\n }\n this.editor.commands.insertContentAt({ from, to }, content);\n }\n get attributes() {\n return this.node.attrs;\n }\n get textContent() {\n return this.node.textContent;\n }\n get size() {\n return this.node.nodeSize;\n }\n get from() {\n if (this.isBlock) {\n return this.pos;\n }\n return this.resolvedPos.start(this.resolvedPos.depth);\n }\n get range() {\n return {\n from: this.from,\n to: this.to\n };\n }\n get to() {\n if (this.isBlock) {\n return this.pos + this.size;\n }\n return this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);\n }\n get parent() {\n if (this.depth === 0) {\n return null;\n }\n const parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);\n const $pos = this.resolvedPos.doc.resolve(parentPos);\n return new _NodePos($pos, this.editor);\n }\n get before() {\n let $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));\n if ($pos.depth !== this.depth) {\n $pos = this.resolvedPos.doc.resolve(this.from - 3);\n }\n return new _NodePos($pos, this.editor);\n }\n get after() {\n let $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));\n if ($pos.depth !== this.depth) {\n $pos = this.resolvedPos.doc.resolve(this.to + 3);\n }\n return new _NodePos($pos, this.editor);\n }\n get children() {\n const children = [];\n this.node.content.forEach((node, offset) => {\n const isBlock = node.isBlock && !node.isTextblock;\n const isNonTextAtom = node.isAtom && !node.isText;\n const isInline = node.isInline;\n const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);\n if (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) {\n return;\n }\n const $pos = this.resolvedPos.doc.resolve(targetPos);\n if (!isBlock && !isInline && $pos.depth <= this.depth) {\n return;\n }\n const childNodePos = new _NodePos(\n $pos,\n this.editor,\n isBlock,\n isBlock || isInline ? node : null\n );\n if (isBlock) {\n childNodePos.actualDepth = this.depth + 1;\n }\n children.push(childNodePos);\n });\n return children;\n }\n get firstChild() {\n return this.children[0] || null;\n }\n get lastChild() {\n const children = this.children;\n return children[children.length - 1] || null;\n }\n closest(selector, attributes = {}) {\n let node = null;\n let currentNode = this.parent;\n while (currentNode && !node) {\n if (currentNode.node.type.name === selector) {\n if (Object.keys(attributes).length > 0) {\n const nodeAttributes = currentNode.node.attrs;\n const attrKeys = Object.keys(attributes);\n for (let index = 0; index < attrKeys.length; index += 1) {\n const key = attrKeys[index];\n if (nodeAttributes[key] !== attributes[key]) {\n break;\n }\n }\n } else {\n node = currentNode;\n }\n }\n currentNode = currentNode.parent;\n }\n return node;\n }\n querySelector(selector, attributes = {}) {\n return this.querySelectorAll(selector, attributes, true)[0] || null;\n }\n querySelectorAll(selector, attributes = {}, firstItemOnly = false) {\n let nodes = [];\n if (!this.children || this.children.length === 0) {\n return nodes;\n }\n const attrKeys = Object.keys(attributes);\n this.children.forEach((childPos) => {\n if (firstItemOnly && nodes.length > 0) {\n return;\n }\n if (childPos.node.type.name === selector) {\n const doesAllAttributesMatch = attrKeys.every(\n (key) => attributes[key] === childPos.node.attrs[key]\n );\n if (doesAllAttributesMatch) {\n nodes.push(childPos);\n }\n }\n if (firstItemOnly && nodes.length > 0) {\n return;\n }\n nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));\n });\n return nodes;\n }\n setAttribute(attributes) {\n const { tr } = this.editor.state;\n tr.setNodeMarkup(this.from, void 0, {\n ...this.node.attrs,\n ...attributes\n });\n this.editor.view.dispatch(tr);\n }\n};\n\n// src/style.ts\nvar style = `.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// src/Editor.ts\nvar Editor = class extends EventEmitter {\n constructor(options = {}) {\n super();\n this.css = null;\n this.className = \"tiptap\";\n this.editorView = null;\n this.isFocused = false;\n this.destroyed = false;\n /**\n * The editor is considered initialized after the `create` event has been emitted.\n */\n this.isInitialized = false;\n this.extensionStorage = {};\n /**\n * A unique ID for this editor instance.\n */\n this.instanceId = Math.random().toString(36).slice(2, 9);\n this.hasWarnedStaleDecorationRead = false;\n this.options = {\n element: typeof document !== \"undefined\" ? document.createElement(\"div\") : null,\n content: \"\",\n injectCSS: true,\n injectNonce: void 0,\n extensions: [],\n autofocus: false,\n editable: true,\n textDirection: void 0,\n editorProps: {},\n parseOptions: {},\n coreExtensionOptions: {},\n enableInputRules: true,\n enablePasteRules: true,\n enableCoreExtensions: true,\n enableContentCheck: false,\n emitContentError: false,\n onBeforeCreate: () => null,\n onCreate: () => null,\n onMount: () => null,\n onUnmount: () => null,\n onUpdate: () => null,\n onSelectionUpdate: () => null,\n onTransaction: () => null,\n onFocus: () => null,\n onBlur: () => null,\n onDestroy: () => null,\n onContentError: ({ error }) => {\n throw error;\n },\n onPaste: () => null,\n onDrop: () => null,\n onDelete: () => null,\n enableExtensionDispatchTransaction: true\n };\n this.isCapturingTransaction = false;\n this.capturedTransaction = null;\n /**\n * Returns a set of utilities for working with positions and ranges.\n */\n this.utils = {\n getUpdatedPosition,\n createMappablePosition\n };\n this.setOptions(options);\n this.createExtensionManager();\n this.createCommandManager();\n this.createSchema();\n this.on(\"beforeCreate\", this.options.onBeforeCreate);\n this.emit(\"beforeCreate\", { editor: this });\n this.on(\"mount\", this.options.onMount);\n this.on(\"unmount\", this.options.onUnmount);\n this.on(\"contentError\", this.options.onContentError);\n this.on(\"create\", this.options.onCreate);\n this.on(\"update\", this.options.onUpdate);\n this.on(\"selectionUpdate\", this.options.onSelectionUpdate);\n this.on(\"transaction\", this.options.onTransaction);\n this.on(\"focus\", this.options.onFocus);\n this.on(\"blur\", this.options.onBlur);\n this.on(\"destroy\", this.options.onDestroy);\n this.on(\"drop\", ({ event, slice, moved }) => this.options.onDrop(event, slice, moved));\n this.on(\"paste\", ({ event, slice }) => this.options.onPaste(event, slice));\n this.on(\"delete\", this.options.onDelete);\n const initialDoc = this.createDoc();\n if (!this.editorState) {\n const selection = resolveFocusPosition(initialDoc, this.options.autofocus);\n this.editorState = EditorState.create({\n doc: initialDoc,\n schema: this.schema,\n selection: selection || void 0\n });\n }\n warnOnDuplicatedProseMirrorModel(this.schema);\n if (this.options.element) {\n this.mount(this.options.element);\n }\n }\n /**\n * Attach the editor to the DOM, creating a new editor view.\n */\n mount(el) {\n if (typeof document === \"undefined\") {\n throw new Error(\n `[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`\n );\n }\n this.createView(el);\n this.emit(\"mount\", { editor: this });\n if (this.css && !document.head.contains(this.css)) {\n document.head.appendChild(this.css);\n }\n window.setTimeout(() => {\n if (this.isDestroyed) {\n return;\n }\n if (this.options.autofocus !== false && this.options.autofocus !== null) {\n this.commands.focus(this.options.autofocus);\n }\n this.emit(\"create\", { editor: this });\n this.isInitialized = true;\n }, 0);\n }\n /**\n * Remove the editor from the DOM, but still allow remounting at a different point in time\n */\n unmount() {\n if (this.editorView) {\n this.editorState = this.editorView.state;\n const dom = this.editorView.dom;\n if (dom == null ? void 0 : dom.editor) {\n delete dom.editor;\n }\n this.editorView.destroy();\n }\n this.editorView = null;\n this.isInitialized = false;\n if (this.css && !document.querySelectorAll(`.${this.className}`).length) {\n try {\n if (typeof this.css.remove === \"function\") {\n this.css.remove();\n } else if (this.css.parentNode) {\n this.css.parentNode.removeChild(this.css);\n }\n } catch (error) {\n console.warn(\"Failed to remove CSS element:\", error);\n }\n }\n this.css = null;\n this.emit(\"unmount\", { editor: this });\n }\n /**\n * Returns the editor storage.\n */\n get storage() {\n return this.extensionStorage;\n }\n /**\n * An object of all registered commands.\n */\n get commands() {\n return this.commandManager.commands;\n }\n /**\n * Create a command chain to call multiple commands at once.\n */\n chain() {\n if (!this.commandManager) {\n return CommandManager.createFakeChain();\n }\n return this.commandManager.chain();\n }\n /**\n * Check if a command or a command chain can be executed. Without executing it.\n */\n can() {\n if (!this.commandManager) {\n return CommandManager.createFallbackCan();\n }\n return this.commandManager.can();\n }\n /**\n * Inject CSS styles.\n */\n injectCSS() {\n if (this.options.injectCSS && typeof document !== \"undefined\") {\n this.css = createStyleTag(style, this.options.injectNonce);\n }\n }\n /**\n * Update editor options.\n *\n * @param options A list of options\n */\n setOptions(options = {}) {\n this.options = {\n ...this.options,\n ...options\n };\n if (!this.editorView || !this.state || this.isDestroyed) {\n return;\n }\n if (this.options.editorProps) {\n this.view.setProps(this.options.editorProps);\n }\n this.view.updateState(this.state);\n }\n /**\n * Update editable state of the editor.\n */\n setEditable(editable, emitUpdate = true) {\n this.setOptions({ editable });\n if (emitUpdate) {\n this.emit(\"update\", { editor: this, transaction: this.state.tr, appendedTransactions: [] });\n }\n }\n /**\n * Returns whether the editor is editable.\n */\n get isEditable() {\n return this.options.editable && this.view && this.view.editable;\n }\n /**\n * Returns the editor view.\n */\n get view() {\n if (this.editorView) {\n return this.editorView;\n }\n return new Proxy(\n {\n state: this.editorState,\n updateState: (state) => {\n this.editorState = state;\n },\n dispatch: (tr) => {\n this.dispatchTransaction(tr);\n },\n // Stub some commonly accessed properties to prevent errors\n composing: false,\n dragging: null,\n editable: true,\n isDestroyed: false\n },\n {\n get: (obj, key) => {\n if (this.editorView) {\n return this.editorView[key];\n }\n if (key === \"state\") {\n return this.editorState;\n }\n if (key in obj) {\n return Reflect.get(obj, key);\n }\n throw new Error(\n `[tiptap error]: The editor view is not available. Cannot access view['${key}']. The editor may not be mounted yet.`\n );\n }\n }\n );\n }\n /**\n * Returns the editor state.\n */\n get state() {\n if (isDev && !this.hasWarnedStaleDecorationRead && isInDecorationApplyScope(this)) {\n this.hasWarnedStaleDecorationRead = true;\n console.warn(\n \"[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.\"\n );\n }\n if (this.editorView) {\n this.editorState = this.view.state;\n }\n return this.editorState;\n }\n /**\n * Register a ProseMirror plugin.\n *\n * @param plugin A ProseMirror plugin\n * @param handlePlugins Control how to merge the plugin into the existing plugins.\n * @returns The new editor state\n */\n registerPlugin(plugin, handlePlugins) {\n const plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];\n const state = this.state.reconfigure({ plugins });\n this.view.updateState(state);\n return state;\n }\n /**\n * Unregister a ProseMirror plugin.\n *\n * @param nameOrPluginKeyToRemove The plugins name\n * @returns The new editor state or undefined if the editor is destroyed\n */\n unregisterPlugin(nameOrPluginKeyToRemove) {\n if (this.isDestroyed) {\n return void 0;\n }\n const prevPlugins = this.state.plugins;\n let plugins = prevPlugins;\n [].concat(nameOrPluginKeyToRemove).forEach((nameOrPluginKey) => {\n const name = typeof nameOrPluginKey === \"string\" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;\n plugins = plugins.filter((plugin) => !plugin.key.startsWith(name));\n });\n if (prevPlugins.length === plugins.length) {\n return void 0;\n }\n const state = this.state.reconfigure({\n plugins\n });\n this.view.updateState(state);\n return state;\n }\n /**\n * Creates an extension manager.\n */\n createExtensionManager() {\n var _a, _b, _c, _d;\n const coreExtensions = this.options.enableCoreExtensions ? [\n Editable,\n ClipboardTextSerializer.configure({\n blockSeparator: (_b = (_a = this.options.coreExtensionOptions) == null ? void 0 : _a.clipboardTextSerializer) == null ? void 0 : _b.blockSeparator\n }),\n Commands,\n FocusEvents,\n Keymap,\n Tabindex.configure({\n value: (_d = (_c = this.options.coreExtensionOptions) == null ? void 0 : _c.tabindex) == null ? void 0 : _d.value\n }),\n Drop,\n Paste,\n Delete,\n TextDirection.configure({\n direction: this.options.textDirection\n })\n ].filter((ext) => {\n if (typeof this.options.enableCoreExtensions === \"object\") {\n return this.options.enableCoreExtensions[ext.name] !== false;\n }\n return true;\n }) : [];\n const allExtensions = [...coreExtensions, ...this.options.extensions].filter((extension) => {\n return [\"extension\", \"node\", \"mark\"].includes(extension == null ? void 0 : extension.type);\n });\n this.extensionManager = new ExtensionManager(allExtensions, this);\n }\n /**\n * Creates an command manager.\n */\n createCommandManager() {\n this.commandManager = new CommandManager({\n editor: this\n });\n }\n /**\n * Creates a ProseMirror schema.\n */\n createSchema() {\n this.schema = this.extensionManager.schema;\n }\n /**\n * Creates the initial document.\n */\n createDoc() {\n let doc;\n try {\n doc = createDocument(this.options.content, this.schema, this.options.parseOptions, {\n errorOnInvalidContent: this.options.enableContentCheck\n });\n } catch (e) {\n if (!(e instanceof Error) || ![\"[tiptap error]: Invalid JSON content\", \"[tiptap error]: Invalid HTML content\"].includes(\n e.message\n )) {\n throw e;\n }\n const fallbackDoc = createDocument(\n this.options.content,\n this.schema,\n this.options.parseOptions,\n {\n errorOnInvalidContent: false\n }\n );\n this.editorState = EditorState.create({\n doc: fallbackDoc,\n schema: this.schema,\n selection: resolveFocusPosition(fallbackDoc, this.options.autofocus) || void 0\n });\n this.emit(\"contentError\", {\n editor: this,\n error: e,\n disableCollaboration: () => {\n if (\"collaboration\" in this.storage && typeof this.storage.collaboration === \"object\" && this.storage.collaboration) {\n ;\n this.storage.collaboration.isDisabled = true;\n }\n this.options.extensions = this.options.extensions.filter(\n (extension) => extension.name !== \"collaboration\"\n );\n this.createExtensionManager();\n }\n });\n return this.editorState.doc;\n }\n return doc;\n }\n /**\n * Creates a ProseMirror view.\n */\n createView(element) {\n const { editorProps, enableExtensionDispatchTransaction } = this.options;\n const baseDispatch = editorProps.dispatchTransaction || this.dispatchTransaction.bind(this);\n const dispatch = enableExtensionDispatchTransaction ? this.extensionManager.dispatchTransaction(baseDispatch) : baseDispatch;\n const baseTransformPastedHTML = editorProps.transformPastedHTML;\n const transformPastedHTML = this.extensionManager.transformPastedHTML(baseTransformPastedHTML);\n this.editorView = new EditorView(element, {\n ...editorProps,\n attributes: {\n // add `role=\"textbox\"` to the editor element\n role: \"textbox\",\n ...editorProps == null ? void 0 : editorProps.attributes\n },\n dispatchTransaction: dispatch,\n transformPastedHTML,\n state: this.editorState,\n markViews: this.extensionManager.markViews,\n nodeViews: this.extensionManager.nodeViews\n });\n const newState = this.state.reconfigure({\n plugins: this.extensionManager.plugins\n });\n this.view.updateState(newState);\n this.prependClass();\n this.injectCSS();\n const dom = this.view.dom;\n dom.editor = this;\n }\n /**\n * Creates all node and mark views.\n */\n createNodeViews() {\n if (this.view.isDestroyed) {\n return;\n }\n this.view.setProps({\n markViews: this.extensionManager.markViews,\n nodeViews: this.extensionManager.nodeViews\n });\n }\n /**\n * Prepend class name to element.\n */\n prependClass() {\n this.view.dom.className = `${this.className} ${this.view.dom.className}`;\n }\n captureTransaction(fn) {\n this.isCapturingTransaction = true;\n fn();\n this.isCapturingTransaction = false;\n const tr = this.capturedTransaction;\n this.capturedTransaction = null;\n return tr;\n }\n /**\n * The callback over which to send transactions (state updates) produced by the view.\n *\n * @param transaction An editor state transaction\n */\n dispatchTransaction(transaction) {\n if (this.view.isDestroyed) {\n return;\n }\n if (this.isCapturingTransaction) {\n if (!this.capturedTransaction) {\n this.capturedTransaction = transaction;\n return;\n }\n transaction.steps.forEach((step) => {\n var _a;\n return (_a = this.capturedTransaction) == null ? void 0 : _a.step(step);\n });\n return;\n }\n const { state, transactions } = this.state.applyTransaction(transaction);\n const selectionHasChanged = !this.state.selection.eq(state.selection);\n const rootTrWasApplied = transactions.includes(transaction);\n const prevState = this.state;\n this.emit(\"beforeTransaction\", {\n editor: this,\n transaction,\n nextState: state\n });\n if (!rootTrWasApplied) {\n return;\n }\n this.view.updateState(state);\n this.emit(\"transaction\", {\n editor: this,\n transaction,\n appendedTransactions: transactions.slice(1)\n });\n if (selectionHasChanged) {\n this.emit(\"selectionUpdate\", {\n editor: this,\n transaction\n });\n }\n const mostRecentFocusTr = transactions.findLast((tr) => tr.getMeta(\"focus\") || tr.getMeta(\"blur\"));\n const focus2 = mostRecentFocusTr == null ? void 0 : mostRecentFocusTr.getMeta(\"focus\");\n const blur2 = mostRecentFocusTr == null ? void 0 : mostRecentFocusTr.getMeta(\"blur\");\n if (focus2) {\n this.emit(\"focus\", {\n editor: this,\n event: focus2.event,\n // oxlint-disable-next-lineno-non-null-assertion\n transaction: mostRecentFocusTr\n });\n }\n if (blur2) {\n this.emit(\"blur\", {\n editor: this,\n event: blur2.event,\n // oxlint-disable-next-lineno-non-null-assertion\n transaction: mostRecentFocusTr\n });\n }\n if (transaction.getMeta(\"preventUpdate\") || !transactions.some((tr) => tr.docChanged) || prevState.doc.eq(state.doc)) {\n return;\n }\n this.emit(\"update\", {\n editor: this,\n transaction,\n appendedTransactions: transactions.slice(1)\n });\n }\n /**\n * Get attributes of the currently selected node or mark.\n */\n getAttributes(nameOrType) {\n return getAttributes(this.state, nameOrType);\n }\n isActive(nameOrAttributes, attributesOrUndefined) {\n const name = typeof nameOrAttributes === \"string\" ? nameOrAttributes : null;\n const attributes = typeof nameOrAttributes === \"string\" ? attributesOrUndefined : nameOrAttributes;\n return isActive(this.state, name, attributes);\n }\n /**\n * Get the document as JSON.\n */\n getJSON() {\n return this.state.doc.toJSON();\n }\n /**\n * Get the document as HTML.\n */\n getHTML() {\n return getHTMLFromFragment(this.state.doc.content, this.schema);\n }\n /**\n * Get the document as text.\n */\n getText(options) {\n const { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n return getText(this.state.doc, {\n blockSeparator,\n textSerializers: {\n ...getTextSerializersFromSchema(this.schema),\n ...textSerializers\n }\n });\n }\n /**\n * Check if there is no content.\n */\n get isEmpty() {\n return isNodeEmpty(this.state.doc);\n }\n /**\n * Destroy the editor.\n */\n destroy() {\n if (this.destroyed) {\n return;\n }\n this.destroyed = true;\n this.emit(\"destroy\");\n this.unmount();\n this.removeAllListeners();\n this.extensionManager.destroy();\n this.extensionManager = null;\n this.schema = null;\n this.commandManager = null;\n this.extensionStorage = {};\n }\n /**\n * Check if the editor is already destroyed.\n */\n get isDestroyed() {\n var _a, _b;\n return (_b = (_a = this.editorView) == null ? void 0 : _a.isDestroyed) != null ? _b : true;\n }\n $node(selector, attributes) {\n var _a;\n return ((_a = this.$doc) == null ? void 0 : _a.querySelector(selector, attributes)) || null;\n }\n $nodes(selector, attributes) {\n var _a;\n return ((_a = this.$doc) == null ? void 0 : _a.querySelectorAll(selector, attributes)) || null;\n }\n $pos(pos) {\n const $pos = this.state.doc.resolve(pos);\n const node = pos > 0 && $pos.nodeAfter && !$pos.nodeAfter.isText && $pos.nodeAfter.isAtom ? $pos.nodeAfter : null;\n return new NodePos($pos, this, false, node);\n }\n get $doc() {\n return this.$pos(0);\n }\n};\n\n// src/decorations/Decoration.ts\nimport { Decoration as PMDecoration } from \"@tiptap/pm/view\";\nvar Decoration = class {\n static Inline(from, to, attrs = {}, spec) {\n return new InlineDecoration(from, to, attrs, spec);\n }\n static Node(pos, to, attrs = {}, spec) {\n return new NodeDecoration(pos, to, attrs, spec);\n }\n /**\n * Creates a widget decoration: a DOM node drawn at a document position.\n *\n * The `key` is the widget's identity. While it stays the same, ProseMirror\n * keeps the widget mounted and only its position tracks the document.\n * `render`, `side`, `destroy` and other options are fixed on first mount.\n * Change the key to remount with new options.\n *\n * @param pos The document position where the widget is drawn.\n * @param render Called once on first mount. Returns the DOM node.\n * @param options Must include a unique `key`. See `WidgetDecorationOptions`.\n * @returns The widget decoration.\n */\n static Widget(pos, render2, options) {\n const { key, ...spec } = options;\n return new WidgetDecoration(pos, render2, key, spec);\n }\n};\nvar InlineDecoration = class extends Decoration {\n constructor(from, to, attrs = {}, spec) {\n super();\n this.kind = \"inline\";\n this.from = from;\n this.to = to;\n this.attrs = attrs;\n this.spec = spec;\n }\n get anchor() {\n return this.from;\n }\n toPMDecoration(extensionName) {\n const spec = extensionName ? { ...this.spec, extensionName } : this.spec;\n return PMDecoration.inline(this.from, this.to, this.attrs, spec);\n }\n};\nvar NodeDecoration = class extends Decoration {\n constructor(pos, to, attrs = {}, spec) {\n super();\n this.kind = \"node\";\n this.from = pos;\n this.to = to;\n this.attrs = attrs;\n this.spec = spec;\n }\n get anchor() {\n return this.from;\n }\n toPMDecoration(extensionName) {\n const spec = extensionName ? { ...this.spec, extensionName } : this.spec;\n return PMDecoration.node(this.from, this.to, this.attrs, spec);\n }\n};\nvar WidgetDecoration = class extends Decoration {\n constructor(pos, render2, key, spec) {\n super();\n this.kind = \"widget\";\n this.pos = pos;\n this.render = render2;\n this.key = key;\n this.spec = spec;\n }\n get anchor() {\n return this.pos;\n }\n toPMDecoration(extensionName) {\n const spec = extensionName ? { ...this.spec, key: this.key, extensionName } : { ...this.spec, key: this.key };\n return PMDecoration.widget(this.pos, this.render, spec);\n }\n};\n\n// src/decorations/createWidgetDecoration.ts\nfunction getCache(editor, cacheKey) {\n const host = editor;\n let cache = host[cacheKey];\n if (!cache) {\n cache = {\n renderers: /* @__PURE__ */ new Map(),\n props: /* @__PURE__ */ new Map(),\n pendingProps: /* @__PURE__ */ new Map(),\n flushScheduled: false\n };\n host[cacheKey] = cache;\n const sweep = cache;\n editor.on(\"destroy\", () => {\n sweep.pendingProps.clear();\n sweep.renderers.forEach((renderer) => renderer.destroy());\n sweep.renderers.clear();\n sweep.props.clear();\n });\n }\n return cache;\n}\nfunction flushPendingProps(cache) {\n cache.flushScheduled = false;\n for (const [key, props] of cache.pendingProps) {\n const renderer = cache.renderers.get(key);\n if (renderer) {\n renderer.updateProps(props);\n cache.props.set(key, { ...props });\n }\n }\n cache.pendingProps.clear();\n}\nfunction createWidgetDecoration(options) {\n var _a;\n const {\n editor,\n pos,\n key,\n props,\n cacheKey,\n context,\n create,\n materialize,\n side,\n relaxedSide,\n marks,\n stopEvent,\n ignoreSelection,\n destroy\n } = options;\n const cache = getCache(editor, cacheKey);\n if (cache.renderers.has(key)) {\n const previous = (_a = cache.pendingProps.get(key)) != null ? _a : cache.props.get(key);\n if (!previous || !attrsEqual(previous, props)) {\n cache.pendingProps.set(key, props);\n if (!cache.flushScheduled) {\n cache.flushScheduled = true;\n queueMicrotask(() => flushPendingProps(cache));\n }\n }\n }\n const render2 = (_view, getPos) => {\n const renderProps = { ...props, ...context(getPos) };\n let renderer = cache.renderers.get(key);\n if (renderer) {\n renderer.updateProps(renderProps);\n } else {\n renderer = create(renderProps);\n cache.renderers.set(key, renderer);\n cache.props.set(key, { ...props });\n }\n return materialize(renderer);\n };\n return Decoration.Widget(pos, render2, {\n key,\n side,\n relaxedSide,\n marks,\n stopEvent,\n ignoreSelection,\n destroy: (rendererElement) => {\n var _a2;\n if (liveWidgetKeys(editor).has(key)) {\n return;\n }\n try {\n (_a2 = cache.renderers.get(key)) == null ? void 0 : _a2.destroy();\n cache.renderers.delete(key);\n cache.props.delete(key);\n cache.pendingProps.delete(key);\n } finally {\n destroy == null ? void 0 : destroy(rendererElement);\n }\n }\n });\n}\n\n// src/inputRules/markInputRule.ts\nfunction markInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({ state, range, match }) => {\n const attributes = callOrReturn(config.getAttributes, void 0, match);\n if (attributes === false || attributes === null) {\n return null;\n }\n const { tr } = state;\n const captureGroup = match[match.length - 1];\n const fullMatch = match[0];\n if (captureGroup) {\n const startSpaces = fullMatch.search(/\\S/);\n const textStart = range.from + fullMatch.indexOf(captureGroup);\n const textEnd = textStart + captureGroup.length;\n const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter((item) => {\n const excluded = item.mark.type.excluded;\n return excluded.find((type) => type === config.type && type !== item.mark.type);\n }).filter((item) => item.to > textStart);\n if (excludedMarks.length) {\n return null;\n }\n if (textEnd < range.to) {\n tr.delete(textEnd, range.to);\n }\n if (textStart > range.from) {\n tr.delete(range.from + startSpaces, textStart);\n }\n const markEnd = range.from + startSpaces + captureGroup.length;\n tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n tr.removeStoredMark(config.type);\n }\n },\n undoable: config.undoable\n });\n}\n\n// src/inputRules/nodeInputRule.ts\nfunction nodeInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({ state, range, match }) => {\n const attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n const { tr } = state;\n const start = range.from;\n let end = range.to;\n const newNode = config.type.create(attributes);\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n let matchStart = start + offset;\n if (matchStart > end) {\n matchStart = end;\n } else {\n end = matchStart + match[1].length;\n }\n const lastChar = match[0][match[0].length - 1];\n tr.insertText(lastChar, start + match[0].length - 1);\n tr.replaceWith(matchStart, end, newNode);\n } else if (match[0]) {\n const insertionStart = config.type.isInline ? start : start - 1;\n tr.insert(insertionStart, config.type.create(attributes)).delete(\n tr.mapping.map(start),\n tr.mapping.map(end)\n );\n }\n tr.scrollIntoView();\n },\n undoable: config.undoable\n });\n}\n\n// src/inputRules/textblockTypeInputRule.ts\nfunction textblockTypeInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({ state, range, match }) => {\n const $start = state.doc.resolve(range.from);\n const attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) {\n return null;\n }\n state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);\n },\n undoable: config.undoable\n });\n}\n\n// src/inputRules/textInputRule.ts\nfunction textInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({ state, range, match }) => {\n let insert = config.replace;\n let start = range.from;\n const end = range.to;\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n const cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n state.tr.insertText(insert, start, end);\n },\n undoable: config.undoable\n });\n}\n\n// src/inputRules/wrappingInputRule.ts\nimport { canJoin as canJoin2, findWrapping } from \"@tiptap/pm/transform\";\nfunction wrappingInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({ state, range, match, chain }) => {\n const attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n const tr = state.tr.delete(range.from, range.to);\n const $start = tr.doc.resolve(range.from);\n const blockRange = $start.blockRange();\n const wrapping = blockRange && findWrapping(blockRange, config.type, attributes);\n if (!wrapping) {\n return null;\n }\n tr.wrap(blockRange, wrapping);\n if (config.keepMarks && config.editor) {\n const { selection, storedMarks } = state;\n const { splittableMarks } = config.editor.extensionManager;\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n if (marks) {\n const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n }\n }\n if (config.keepAttributes) {\n const nodeType = config.type.name === \"bulletList\" || config.type.name === \"orderedList\" ? \"listItem\" : \"taskList\";\n chain().updateAttributes(nodeType, attributes).run();\n }\n const before = tr.doc.resolve(range.from - 1).nodeBefore;\n if (before && before.type === config.type && canJoin2(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) {\n tr.join(range.from - 1);\n }\n },\n undoable: config.undoable\n });\n}\n\n// src/jsx-runtime.ts\nfunction Fragment7(props) {\n return props.children;\n}\nfunction render(tag, attributes, hasMultipleChildren) {\n if (tag === \"slot\") {\n return 0;\n }\n if (tag instanceof Function) {\n return tag(attributes);\n }\n const { children, ...rest } = attributes != null ? attributes : {};\n if (tag === \"svg\") {\n throw new Error(\n \"SVG elements are not supported in the JSX syntax, use the array syntax instead\"\n );\n }\n if (hasMultipleChildren && Array.isArray(children)) {\n return [tag, rest, ...children];\n }\n return [tag, rest, children];\n}\nvar h = (tag, attributes) => render(tag, attributes, false);\n\n// src/lib/ResizableNodeView.ts\nvar isTouchEvent = (e) => {\n return \"touches\" in e;\n};\nvar ResizableNodeView = class {\n /**\n * Creates a new ResizableNodeView instance.\n *\n * The constructor sets up the resize handles, applies initial sizing from\n * node attributes, and configures all resize behavior options.\n *\n * @param options - Configuration options for the resizable node view\n */\n constructor(options) {\n /** Active resize handle directions */\n this.directions = [\n \"bottom-left\",\n \"bottom-right\",\n \"top-left\",\n \"top-right\"\n ];\n /** Minimum allowed dimensions */\n this.minSize = {\n height: 8,\n width: 8\n };\n /** Whether to always preserve aspect ratio */\n this.preserveAspectRatio = false;\n /** CSS class names for elements */\n this.classNames = {\n container: \"\",\n wrapper: \"\",\n handle: \"\",\n resizing: \"\"\n };\n /** Initial width of the element (for aspect ratio calculation) */\n this.initialWidth = 0;\n /** Initial height of the element (for aspect ratio calculation) */\n this.initialHeight = 0;\n /** Calculated aspect ratio (width / height) */\n this.aspectRatio = 1;\n /** Whether a resize operation is currently active */\n this.isResizing = false;\n /** The handle currently being dragged */\n this.activeHandle = null;\n /** Starting mouse X position when resize began */\n this.startX = 0;\n /** Starting mouse Y position when resize began */\n this.startY = 0;\n /** Element width when resize began */\n this.startWidth = 0;\n /** Element height when resize began */\n this.startHeight = 0;\n /** Whether Shift key is currently pressed (for temporary aspect ratio lock) */\n this.isShiftKeyPressed = false;\n /** Last known editable state of the editor */\n this.lastEditableState = void 0;\n /** Map of handle elements by direction */\n this.handleMap = /* @__PURE__ */ new Map();\n /**\n * Handles mouse movement during an active resize.\n *\n * Calculates the delta from the starting position, computes new dimensions\n * based on the active handle direction, applies constraints and aspect ratio,\n * then updates the element's style and calls the onResize callback.\n *\n * @param event - The mouse move event\n */\n this.handleMouseMove = (event) => {\n if (!this.isResizing || !this.activeHandle) {\n return;\n }\n const deltaX = event.clientX - this.startX;\n const deltaY = event.clientY - this.startY;\n this.handleResize(deltaX, deltaY);\n };\n this.handleTouchMove = (event) => {\n if (!this.isResizing || !this.activeHandle) {\n return;\n }\n const touch = event.touches[0];\n if (!touch) {\n return;\n }\n const deltaX = touch.clientX - this.startX;\n const deltaY = touch.clientY - this.startY;\n this.handleResize(deltaX, deltaY);\n };\n /**\n * Completes the resize operation when the mouse button is released.\n *\n * Captures final dimensions, calls the onCommit callback to persist changes,\n * removes the resizing state and class, and cleans up document-level listeners.\n */\n this.handleMouseUp = () => {\n if (!this.isResizing) {\n return;\n }\n const finalWidth = this.element.offsetWidth;\n const finalHeight = this.element.offsetHeight;\n this.onCommit(finalWidth, finalHeight);\n this.isResizing = false;\n this.activeHandle = null;\n this.container.dataset.resizeState = \"false\";\n if (this.classNames.resizing) {\n this.container.classList.remove(this.classNames.resizing);\n }\n document.removeEventListener(\"mousemove\", this.handleMouseMove);\n document.removeEventListener(\"mouseup\", this.handleMouseUp);\n document.removeEventListener(\"keydown\", this.handleKeyDown);\n document.removeEventListener(\"keyup\", this.handleKeyUp);\n };\n /**\n * Tracks Shift key state to enable temporary aspect ratio locking.\n *\n * When Shift is pressed during resize, aspect ratio is preserved even if\n * preserveAspectRatio is false.\n *\n * @param event - The keyboard event\n */\n this.handleKeyDown = (event) => {\n if (event.key === \"Shift\") {\n this.isShiftKeyPressed = true;\n }\n };\n /**\n * Tracks Shift key release to disable temporary aspect ratio locking.\n *\n * @param event - The keyboard event\n */\n this.handleKeyUp = (event) => {\n if (event.key === \"Shift\") {\n this.isShiftKeyPressed = false;\n }\n };\n var _a, _b, _c, _d, _e, _f;\n this.node = options.node;\n this.editor = options.editor;\n this.element = options.element;\n this.element.draggable = false;\n this.contentElement = options.contentElement;\n this.getPos = options.getPos;\n this.onResize = options.onResize;\n this.onCommit = options.onCommit;\n this.onUpdate = options.onUpdate;\n if ((_a = options.options) == null ? void 0 : _a.min) {\n this.minSize = {\n ...this.minSize,\n ...options.options.min\n };\n }\n if ((_b = options.options) == null ? void 0 : _b.max) {\n this.maxSize = options.options.max;\n }\n if ((_c = options == null ? void 0 : options.options) == null ? void 0 : _c.directions) {\n this.directions = options.options.directions;\n }\n if ((_d = options.options) == null ? void 0 : _d.preserveAspectRatio) {\n this.preserveAspectRatio = options.options.preserveAspectRatio;\n }\n if ((_e = options.options) == null ? void 0 : _e.className) {\n this.classNames = {\n container: options.options.className.container || \"\",\n wrapper: options.options.className.wrapper || \"\",\n handle: options.options.className.handle || \"\",\n resizing: options.options.className.resizing || \"\"\n };\n }\n if ((_f = options.options) == null ? void 0 : _f.createCustomHandle) {\n this.createCustomHandle = options.options.createCustomHandle;\n }\n this.wrapper = this.createWrapper();\n this.container = this.createContainer();\n this.applyInitialSize();\n this.attachHandles();\n this.editor.on(\"update\", this.handleEditorUpdate.bind(this));\n }\n /**\n * Returns the top-level DOM node that should be placed in the editor.\n *\n * This is required by the ProseMirror NodeView interface. The container\n * includes the wrapper, handles, and the actual content element.\n *\n * @returns The container element to be inserted into the editor\n */\n get dom() {\n return this.container;\n }\n get contentDOM() {\n var _a;\n return (_a = this.contentElement) != null ? _a : null;\n }\n handleEditorUpdate() {\n const isEditable = this.editor.isEditable;\n if (isEditable === this.lastEditableState) {\n return;\n }\n this.lastEditableState = isEditable;\n if (!isEditable) {\n this.removeHandles();\n } else if (isEditable && this.handleMap.size === 0) {\n this.attachHandles();\n }\n }\n /**\n * Called when the node's content or attributes change.\n *\n * Updates the internal node reference. If a custom `onUpdate` callback\n * was provided, it will be called to handle additional update logic.\n *\n * @param node - The new/updated node\n * @param decorations - Node decorations\n * @param innerDecorations - Inner decorations\n * @returns `false` if the node type has changed (requires full rebuild), otherwise the result of `onUpdate` or `true`\n */\n update(node, decorations, innerDecorations) {\n if (node.type !== this.node.type) {\n return false;\n }\n this.node = node;\n if (this.onUpdate) {\n return this.onUpdate(node, decorations, innerDecorations);\n }\n return true;\n }\n /**\n * Cleanup method called when the node view is being removed.\n *\n * Removes all event listeners to prevent memory leaks. This is required\n * by the ProseMirror NodeView interface. If a resize is active when\n * destroy is called, it will be properly cancelled.\n */\n destroy() {\n if (this.isResizing) {\n this.container.dataset.resizeState = \"false\";\n if (this.classNames.resizing) {\n this.container.classList.remove(this.classNames.resizing);\n }\n document.removeEventListener(\"mousemove\", this.handleMouseMove);\n document.removeEventListener(\"mouseup\", this.handleMouseUp);\n document.removeEventListener(\"keydown\", this.handleKeyDown);\n document.removeEventListener(\"keyup\", this.handleKeyUp);\n this.isResizing = false;\n this.activeHandle = null;\n }\n this.editor.off(\"update\", this.handleEditorUpdate.bind(this));\n this.container.remove();\n }\n /**\n * Creates the outer container element.\n *\n * The container is the top-level element returned by the NodeView and\n * wraps the entire resizable node. It's set up with flexbox to handle\n * alignment and includes data attributes for styling and identification.\n *\n * @returns The container element\n */\n createContainer() {\n const element = document.createElement(\"div\");\n element.dataset.resizeContainer = \"\";\n element.dataset.node = this.node.type.name;\n element.style.display = this.node.type.isInline ? \"inline-flex\" : \"flex\";\n if (this.classNames.container) {\n element.className = this.classNames.container;\n }\n element.appendChild(this.wrapper);\n return element;\n }\n /**\n * Creates the wrapper element that contains the content and handles.\n *\n * The wrapper uses relative positioning so that resize handles can be\n * positioned absolutely within it. This is the direct parent of the\n * content element being made resizable.\n *\n * @returns The wrapper element\n */\n createWrapper() {\n const element = document.createElement(\"div\");\n element.style.position = \"relative\";\n element.style.display = \"block\";\n element.dataset.resizeWrapper = \"\";\n if (this.classNames.wrapper) {\n element.className = this.classNames.wrapper;\n }\n element.appendChild(this.element);\n return element;\n }\n /**\n * Creates a resize handle element for a specific direction.\n *\n * Each handle is absolutely positioned and includes a data attribute\n * identifying its direction for styling purposes.\n *\n * @param direction - The resize direction for this handle\n * @returns The handle element\n */\n createHandle(direction) {\n const handle = document.createElement(\"div\");\n handle.dataset.resizeHandle = direction;\n handle.style.position = \"absolute\";\n if (this.classNames.handle) {\n handle.className = this.classNames.handle;\n }\n return handle;\n }\n /**\n * Positions a handle element according to its direction.\n *\n * Corner handles (e.g., 'top-left') are positioned at the intersection\n * of two edges. Edge handles (e.g., 'top') span the full width or height.\n *\n * @param handle - The handle element to position\n * @param direction - The direction determining the position\n */\n positionHandle(handle, direction) {\n const isTop = direction.includes(\"top\");\n const isBottom = direction.includes(\"bottom\");\n const isLeft = direction.includes(\"left\");\n const isRight = direction.includes(\"right\");\n if (isTop) {\n handle.style.top = \"0\";\n }\n if (isBottom) {\n handle.style.bottom = \"0\";\n }\n if (isLeft) {\n handle.style.left = \"0\";\n }\n if (isRight) {\n handle.style.right = \"0\";\n }\n if (direction === \"top\" || direction === \"bottom\") {\n handle.style.left = \"0\";\n handle.style.right = \"0\";\n }\n if (direction === \"left\" || direction === \"right\") {\n handle.style.top = \"0\";\n handle.style.bottom = \"0\";\n }\n }\n /**\n * Creates and attaches all resize handles to the wrapper.\n *\n * Iterates through the configured directions, creates a handle for each,\n * positions it, attaches the mousedown listener, and appends it to the DOM.\n */\n attachHandles() {\n this.directions.forEach((direction) => {\n let handle;\n if (this.createCustomHandle) {\n handle = this.createCustomHandle(direction);\n } else {\n handle = this.createHandle(direction);\n }\n if (!(handle instanceof HTMLElement)) {\n console.warn(\n `[ResizableNodeView] createCustomHandle(\"${direction}\") did not return an HTMLElement. Falling back to default handle.`\n );\n handle = this.createHandle(direction);\n }\n if (!this.createCustomHandle) {\n this.positionHandle(handle, direction);\n }\n handle.addEventListener(\"mousedown\", (event) => this.handleResizeStart(event, direction));\n handle.addEventListener(\n \"touchstart\",\n (event) => this.handleResizeStart(event, direction)\n );\n this.handleMap.set(direction, handle);\n this.wrapper.appendChild(handle);\n });\n }\n /**\n * Removes all resize handles from the wrapper.\n *\n * Cleans up the handle map and removes each handle element from the DOM.\n */\n removeHandles() {\n this.handleMap.forEach((el) => el.remove());\n this.handleMap.clear();\n }\n /**\n * Applies initial sizing from node attributes to the element.\n *\n * If width/height attributes exist on the node, they're applied to the element.\n * Otherwise, the element's natural/current dimensions are measured. The aspect\n * ratio is calculated for later use in aspect-ratio-preserving resizes.\n */\n applyInitialSize() {\n const width = this.node.attrs.width;\n const height = this.node.attrs.height;\n if (width) {\n this.element.style.width = `${width}px`;\n this.initialWidth = width;\n } else {\n this.initialWidth = this.element.offsetWidth;\n }\n if (height) {\n this.element.style.height = `${height}px`;\n this.initialHeight = height;\n } else {\n this.initialHeight = this.element.offsetHeight;\n }\n if (this.initialWidth > 0 && this.initialHeight > 0) {\n this.aspectRatio = this.initialWidth / this.initialHeight;\n }\n }\n /**\n * Initiates a resize operation when a handle is clicked.\n *\n * Captures the starting mouse position and element dimensions, sets up\n * the resize state, adds the resizing class and state attribute, and\n * attaches document-level listeners for mouse movement and keyboard input.\n *\n * @param event - The mouse down event\n * @param direction - The direction of the handle being dragged\n */\n handleResizeStart(event, direction) {\n event.preventDefault();\n event.stopPropagation();\n this.isResizing = true;\n this.activeHandle = direction;\n if (isTouchEvent(event)) {\n this.startX = event.touches[0].clientX;\n this.startY = event.touches[0].clientY;\n } else {\n this.startX = event.clientX;\n this.startY = event.clientY;\n }\n this.startWidth = this.element.offsetWidth;\n this.startHeight = this.element.offsetHeight;\n if (this.startWidth > 0 && this.startHeight > 0) {\n this.aspectRatio = this.startWidth / this.startHeight;\n }\n const pos = this.getPos();\n if (pos !== void 0) {\n }\n this.container.dataset.resizeState = \"true\";\n if (this.classNames.resizing) {\n this.container.classList.add(this.classNames.resizing);\n }\n document.addEventListener(\"mousemove\", this.handleMouseMove);\n document.addEventListener(\"touchmove\", this.handleTouchMove);\n document.addEventListener(\"mouseup\", this.handleMouseUp);\n document.addEventListener(\"keydown\", this.handleKeyDown);\n document.addEventListener(\"keyup\", this.handleKeyUp);\n }\n handleResize(deltaX, deltaY) {\n if (!this.activeHandle) {\n return;\n }\n const shouldPreserveAspectRatio = this.preserveAspectRatio || this.isShiftKeyPressed;\n const { width, height } = this.calculateNewDimensions(this.activeHandle, deltaX, deltaY);\n const constrained = this.applyConstraints(width, height, shouldPreserveAspectRatio);\n this.element.style.width = `${constrained.width}px`;\n this.element.style.height = `${constrained.height}px`;\n if (this.onResize) {\n this.onResize(constrained.width, constrained.height);\n }\n }\n /**\n * Calculates new dimensions based on mouse delta and resize direction.\n *\n * Takes the starting dimensions and applies the mouse movement delta\n * according to the handle direction. For corner handles, both dimensions\n * are affected. For edge handles, only one dimension changes. If aspect\n * ratio should be preserved, delegates to applyAspectRatio.\n *\n * @param direction - The active resize handle direction\n * @param deltaX - Horizontal mouse movement since resize start\n * @param deltaY - Vertical mouse movement since resize start\n * @returns The calculated width and height\n */\n calculateNewDimensions(direction, deltaX, deltaY) {\n let newWidth = this.startWidth;\n let newHeight = this.startHeight;\n const isRight = direction.includes(\"right\");\n const isLeft = direction.includes(\"left\");\n const isBottom = direction.includes(\"bottom\");\n const isTop = direction.includes(\"top\");\n if (isRight) {\n newWidth = this.startWidth + deltaX;\n } else if (isLeft) {\n newWidth = this.startWidth - deltaX;\n }\n if (isBottom) {\n newHeight = this.startHeight + deltaY;\n } else if (isTop) {\n newHeight = this.startHeight - deltaY;\n }\n if (direction === \"right\" || direction === \"left\") {\n newWidth = this.startWidth + (isRight ? deltaX : -deltaX);\n }\n if (direction === \"top\" || direction === \"bottom\") {\n newHeight = this.startHeight + (isBottom ? deltaY : -deltaY);\n }\n const shouldPreserveAspectRatio = this.preserveAspectRatio || this.isShiftKeyPressed;\n if (shouldPreserveAspectRatio) {\n return this.applyAspectRatio(newWidth, newHeight, direction);\n }\n return { width: newWidth, height: newHeight };\n }\n /**\n * Applies min/max constraints to dimensions.\n *\n * When aspect ratio is NOT preserved, constraints are applied independently\n * to width and height. When aspect ratio IS preserved, constraints are\n * applied while maintaining the aspect ratio—if one dimension hits a limit,\n * the other is recalculated proportionally.\n *\n * This ensures that aspect ratio is never broken when constrained.\n *\n * @param width - The unconstrained width\n * @param height - The unconstrained height\n * @param preserveAspectRatio - Whether to maintain aspect ratio while constraining\n * @returns The constrained dimensions\n */\n applyConstraints(width, height, preserveAspectRatio) {\n var _a, _b, _c, _d;\n if (!preserveAspectRatio) {\n let constrainedWidth2 = Math.max(this.minSize.width, width);\n let constrainedHeight2 = Math.max(this.minSize.height, height);\n if ((_a = this.maxSize) == null ? void 0 : _a.width) {\n constrainedWidth2 = Math.min(this.maxSize.width, constrainedWidth2);\n }\n if ((_b = this.maxSize) == null ? void 0 : _b.height) {\n constrainedHeight2 = Math.min(this.maxSize.height, constrainedHeight2);\n }\n return { width: constrainedWidth2, height: constrainedHeight2 };\n }\n let constrainedWidth = width;\n let constrainedHeight = height;\n if (constrainedWidth < this.minSize.width) {\n constrainedWidth = this.minSize.width;\n constrainedHeight = constrainedWidth / this.aspectRatio;\n }\n if (constrainedHeight < this.minSize.height) {\n constrainedHeight = this.minSize.height;\n constrainedWidth = constrainedHeight * this.aspectRatio;\n }\n if (((_c = this.maxSize) == null ? void 0 : _c.width) && constrainedWidth > this.maxSize.width) {\n constrainedWidth = this.maxSize.width;\n constrainedHeight = constrainedWidth / this.aspectRatio;\n }\n if (((_d = this.maxSize) == null ? void 0 : _d.height) && constrainedHeight > this.maxSize.height) {\n constrainedHeight = this.maxSize.height;\n constrainedWidth = constrainedHeight * this.aspectRatio;\n }\n return { width: constrainedWidth, height: constrainedHeight };\n }\n /**\n * Adjusts dimensions to maintain the original aspect ratio.\n *\n * For horizontal handles (left/right), uses width as the primary dimension\n * and calculates height from it. For vertical handles (top/bottom), uses\n * height as primary and calculates width. For corner handles, uses width\n * as the primary dimension.\n *\n * @param width - The new width\n * @param height - The new height\n * @param direction - The active resize direction\n * @returns Dimensions adjusted to preserve aspect ratio\n */\n applyAspectRatio(width, height, direction) {\n const isHorizontal = direction === \"left\" || direction === \"right\";\n const isVertical = direction === \"top\" || direction === \"bottom\";\n if (isHorizontal) {\n return {\n width,\n height: width / this.aspectRatio\n };\n }\n if (isVertical) {\n return {\n width: height * this.aspectRatio,\n height\n };\n }\n return {\n width,\n height: width / this.aspectRatio\n };\n }\n};\nvar ResizableNodeview = ResizableNodeView;\n\n// src/Node.ts\nvar Node3 = class _Node extends Extendable {\n constructor() {\n super(...arguments);\n this.type = \"node\";\n }\n /**\n * Create a new Node instance\n * @param config - Node configuration object or a function that returns a configuration object\n */\n static create(config = {}) {\n const resolvedConfig = typeof config === \"function\" ? config() : config;\n return new _Node(resolvedConfig);\n }\n configure(options) {\n return super.configure(options);\n }\n extend(extendedConfig) {\n const resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n return super.extend(resolvedConfig);\n }\n};\n\n// src/NodeView.ts\nimport { NodeSelection as NodeSelection5 } from \"@tiptap/pm/state\";\nvar NodeView = class {\n constructor(component, props, options) {\n this.isDragging = false;\n this.component = component;\n this.editor = props.editor;\n this.options = {\n stopEvent: null,\n ignoreMutation: null,\n ...options\n };\n this.extension = props.extension;\n this.node = props.node;\n this.decorations = props.decorations;\n this.innerDecorations = props.innerDecorations;\n this.view = props.view;\n this.HTMLAttributes = props.HTMLAttributes;\n this.getPos = () => {\n try {\n return props.getPos();\n } catch {\n return void 0;\n }\n };\n this.mount();\n }\n mount() {\n return;\n }\n get dom() {\n return this.editor.view.dom;\n }\n get contentDOM() {\n return null;\n }\n onDragStart(event) {\n var _a, _b, _c, _d, _e, _f, _g;\n const { view } = this.editor;\n const target = event.target;\n const dragHandle = target.nodeType === 3 ? (_a = target.parentElement) == null ? void 0 : _a.closest(\"[data-drag-handle]\") : target.closest(\"[data-drag-handle]\");\n if (!this.dom || ((_b = this.contentDOM) == null ? void 0 : _b.contains(target)) || !dragHandle) {\n return;\n }\n let x = 0;\n let y = 0;\n if (this.dom !== dragHandle) {\n const domBox = this.dom.getBoundingClientRect();\n const handleBox = dragHandle.getBoundingClientRect();\n const offsetX = (_d = event.offsetX) != null ? _d : (_c = event.nativeEvent) == null ? void 0 : _c.offsetX;\n const offsetY = (_f = event.offsetY) != null ? _f : (_e = event.nativeEvent) == null ? void 0 : _e.offsetY;\n x = handleBox.x - domBox.x + offsetX;\n y = handleBox.y - domBox.y + offsetY;\n }\n const clonedNode = this.dom.cloneNode(true);\n try {\n const domBox = this.dom.getBoundingClientRect();\n clonedNode.style.width = `${Math.round(domBox.width)}px`;\n clonedNode.style.height = `${Math.round(domBox.height)}px`;\n clonedNode.style.boxSizing = \"border-box\";\n clonedNode.style.pointerEvents = \"none\";\n } catch {\n }\n let dragImageWrapper = null;\n try {\n dragImageWrapper = document.createElement(\"div\");\n dragImageWrapper.style.position = \"absolute\";\n dragImageWrapper.style.top = \"-9999px\";\n dragImageWrapper.style.left = \"-9999px\";\n dragImageWrapper.style.pointerEvents = \"none\";\n dragImageWrapper.appendChild(clonedNode);\n document.body.appendChild(dragImageWrapper);\n (_g = event.dataTransfer) == null ? void 0 : _g.setDragImage(clonedNode, x, y);\n } finally {\n if (dragImageWrapper) {\n setTimeout(() => {\n try {\n dragImageWrapper == null ? void 0 : dragImageWrapper.remove();\n } catch {\n }\n }, 0);\n }\n }\n const pos = this.getPos();\n if (typeof pos !== \"number\") {\n return;\n }\n const selection = NodeSelection5.create(view.state.doc, pos);\n const transaction = view.state.tr.setSelection(selection);\n view.dispatch(transaction);\n }\n stopEvent(event) {\n var _a;\n if (!this.dom) {\n return false;\n }\n if (typeof this.options.stopEvent === \"function\") {\n return this.options.stopEvent({ event });\n }\n const target = event.target;\n const isInElement = this.dom.contains(target) && !((_a = this.contentDOM) == null ? void 0 : _a.contains(target));\n if (!isInElement) {\n return false;\n }\n const isDragEvent = event.type.startsWith(\"drag\");\n const isDragOverEnterEvent = event.type === \"dragover\" || event.type === \"dragenter\";\n const isDropEvent = event.type === \"drop\";\n const isInput = [\"INPUT\", \"BUTTON\", \"SELECT\", \"TEXTAREA\"].includes(target.tagName) || target.isContentEditable;\n if (isInput && !isDropEvent && !isDragEvent) {\n return true;\n }\n const { isEditable } = this.editor;\n const { isDragging } = this;\n const isDraggable = !!this.node.type.spec.draggable;\n const isSelectable = NodeSelection5.isSelectable(this.node);\n const isCopyEvent = event.type === \"copy\";\n const isPasteEvent = event.type === \"paste\";\n const isCutEvent = event.type === \"cut\";\n const isClickEvent = event.type === \"mousedown\";\n if (!isDraggable && isSelectable && isDragEvent && event.target === this.dom) {\n event.preventDefault();\n }\n if (isDraggable && isDragEvent && !isDragging && event.target === this.dom) {\n event.preventDefault();\n return false;\n }\n if (isDraggable && isEditable && !isDragging && isClickEvent) {\n const dragHandle = target.closest(\"[data-drag-handle]\");\n const isValidDragHandle = dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle));\n if (isValidDragHandle) {\n this.isDragging = true;\n document.addEventListener(\n \"dragend\",\n () => {\n this.isDragging = false;\n },\n { once: true }\n );\n document.addEventListener(\n \"drop\",\n () => {\n this.isDragging = false;\n },\n { once: true }\n );\n document.addEventListener(\n \"mouseup\",\n () => {\n this.isDragging = false;\n },\n { once: true }\n );\n }\n }\n if (isDragging || isDragOverEnterEvent || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {\n return false;\n }\n return true;\n }\n /**\n * Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.\n * @return `false` if the editor should re-read the selection or re-parse the range around the mutation\n * @return `true` if it can safely be ignored.\n */\n ignoreMutation(mutation) {\n if (!this.dom || !this.contentDOM) {\n return true;\n }\n if (typeof this.options.ignoreMutation === \"function\") {\n return this.options.ignoreMutation({ mutation });\n }\n if (this.node.isLeaf || this.node.isAtom) {\n return true;\n }\n if (mutation.type === \"selection\") {\n return false;\n }\n if (this.dom.contains(mutation.target) && mutation.type === \"childList\" && (isiOS() || isAndroid()) && this.editor.isFocused) {\n const changedNodes = [\n ...Array.from(mutation.addedNodes),\n ...Array.from(mutation.removedNodes)\n ];\n if (changedNodes.every((node) => node.isContentEditable)) {\n return false;\n }\n }\n if (this.contentDOM === mutation.target && mutation.type === \"attributes\") {\n return true;\n }\n if (this.contentDOM.contains(mutation.target)) {\n return false;\n }\n return true;\n }\n /**\n * Update the attributes of the prosemirror node.\n */\n updateAttributes(attributes) {\n this.editor.commands.command(({ tr }) => {\n const pos = this.getPos();\n if (typeof pos !== \"number\") {\n return false;\n }\n tr.setNodeMarkup(pos, void 0, {\n ...this.node.attrs,\n ...attributes\n });\n return true;\n });\n }\n /**\n * Delete the node.\n */\n deleteNode() {\n const from = this.getPos();\n if (typeof from !== \"number\") {\n return;\n }\n const to = from + this.node.nodeSize;\n this.editor.commands.deleteRange({ from, to });\n }\n};\n\n// src/pasteRules/markPasteRule.ts\nfunction markPasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler: ({ state, range, match, pasteEvent }) => {\n const attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);\n if (attributes === false || attributes === null) {\n return null;\n }\n const { tr } = state;\n const captureGroup = match[match.length - 1];\n const fullMatch = match[0];\n let markEnd = range.to;\n if (captureGroup) {\n const startSpaces = fullMatch.search(/\\S/);\n const textStart = range.from + fullMatch.indexOf(captureGroup);\n const textEnd = textStart + captureGroup.length;\n const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter((item) => {\n const excluded = item.mark.type.excluded;\n return excluded.find((type) => type === config.type && type !== item.mark.type);\n }).filter((item) => item.to > textStart);\n if (excludedMarks.length) {\n return null;\n }\n if (textEnd < range.to) {\n tr.delete(textEnd, range.to);\n }\n if (textStart > range.from) {\n tr.delete(range.from + startSpaces, textStart);\n }\n markEnd = range.from + startSpaces + captureGroup.length;\n tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n const isMatchAtEndOfText = match.index !== void 0 && match.input !== void 0 && match.index + match[0].length >= match.input.length;\n if (!isMatchAtEndOfText) {\n tr.removeStoredMark(config.type);\n }\n }\n }\n });\n}\n\n// src/pasteRules/nodePasteRule.ts\nfunction nodePasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler({ match, chain, range, pasteEvent }) {\n const attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);\n const content = callOrReturn(config.getContent, void 0, attributes);\n if (attributes === false || attributes === null) {\n return null;\n }\n const node = { type: config.type.name, attrs: attributes };\n if (content) {\n node.content = content;\n }\n if (match.input) {\n chain().deleteRange(range).insertContentAt(range.from, node);\n }\n }\n });\n}\n\n// src/pasteRules/textPasteRule.ts\nfunction textPasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler: ({ state, range, match }) => {\n let insert = config.replace;\n let start = range.from;\n const end = range.to;\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n const cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n state.tr.insertText(insert, start, end);\n }\n });\n}\n\n// src/Tracker.ts\nvar Tracker = class {\n constructor(transaction) {\n this.transaction = transaction;\n this.currentStep = this.transaction.steps.length;\n }\n map(position) {\n let deleted = false;\n const mappedPosition = this.transaction.steps.slice(this.currentStep).reduce((newPosition, step) => {\n const mapResult = step.getMap().mapResult(newPosition);\n if (mapResult.deleted) {\n deleted = true;\n }\n return mapResult.pos;\n }, position);\n return {\n position: mappedPosition,\n deleted\n };\n }\n};\nexport {\n CommandManager,\n DECORATION_MANAGER_PLUGIN_KEY,\n Decoration,\n DecorationManager,\n Editor,\n Extendable,\n Extension,\n Fragment7 as Fragment,\n InlineDecoration,\n InputRule,\n MappablePosition,\n Mark,\n MarkView,\n Node3 as Node,\n NodeDecoration,\n NodePos,\n NodeView,\n PasteRule,\n ResizableNodeView,\n ResizableNodeview,\n Tracker,\n WidgetDecoration,\n attrsEqual,\n callOrReturn,\n canInsertNode,\n combineTransactionSteps,\n commands_exports as commands,\n createAtomBlockMarkdownSpec,\n createBlockMarkdownSpec,\n createChainableState,\n createDocument,\n h as createElement,\n createInlineMarkdownSpec,\n createMappablePosition,\n createNodeFromContent,\n createStyleTag,\n createWidgetDecoration,\n decodeHtmlEntities,\n defaultBlockAt,\n deleteProps,\n elementFromString,\n encodeHtmlEntities,\n escapeForRegEx,\n extensions_exports as extensions,\n findChildren,\n findChildrenInRange,\n findDuplicates,\n findParentNode,\n findParentNodeClosestToPos,\n flattenExtensions,\n fromString,\n generateHTML,\n generateJSON,\n generateText,\n getAttributes,\n getAttributesFromExtensions,\n getChangedRanges,\n getDebugJSON,\n getExtensionField,\n getHTMLFromFragment,\n getMarkAttributes,\n getMarkRange,\n getMarkType,\n getMarksBetween,\n getNodeAtPosition,\n getNodeAttributes,\n getNodeType,\n getPreviousBlockSibling,\n getRenderedAttributes,\n getSchema,\n getSchemaByResolvedExtensions,\n getSchemaTypeByName,\n getSchemaTypeNameByName,\n getSplittedAttributes,\n getStyleProperty,\n getText,\n getTextBetween,\n getTextContentFromNodes,\n getTextSerializersFromSchema,\n getUpdatedPosition,\n h,\n injectExtensionAttributesToParseRule,\n inputRulesPlugin,\n isActive,\n isAndroid,\n isAtEndOfNode,\n isAtStartOfNode,\n isEmptyObject,\n isExtensionRulesEnabled,\n isFirefox,\n isFunction,\n isList,\n isMacOS,\n isMarkActive,\n isNodeActive,\n isNodeEmpty,\n isNodeSelection,\n isNodeViewSelected,\n isNumber,\n isPlainObject,\n isProseMirrorAddMarkStep,\n isProseMirrorAddNodeMarkStep,\n isProseMirrorAttrStep,\n isProseMirrorCellSelection,\n isProseMirrorDocAttrStep,\n isProseMirrorFragment,\n isProseMirrorNodeSelection,\n isProseMirrorRemoveMarkStep,\n isProseMirrorRemoveNodeMarkStep,\n isProseMirrorReplaceAroundStep,\n isProseMirrorReplaceStep,\n isProseMirrorSlice,\n isProseMirrorStep,\n isProseMirrorStepResult,\n isRegExp,\n isSafari,\n isString,\n isTextSelection,\n isiOS,\n liveWidgetKeys,\n markInputRule,\n markPasteRule,\n markdown_exports as markdown,\n marksEqual,\n mergeAttributes,\n mergeDeep,\n minMax,\n nodeInputRule,\n nodePasteRule,\n objectIncludes,\n parseAttributes,\n parseIndentedBlocks,\n pasteRulesPlugin,\n posToDOMRect,\n removeDuplicates,\n renderNestedMarkdownContent,\n resolveExtensions,\n resolveFocusPosition,\n rewriteUnknownContent,\n selectionToInsertionEnd,\n serializeAttributes,\n sortExtensions,\n splitExtensions,\n textInputRule,\n textPasteRule,\n textblockTypeInputRule,\n updateMarkViewAttributes,\n wrappingInputRule\n};\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAAA,IAAI,KAAY,OAAO,gBACnB,MAAY,GAAQ,MAAQ;CAC9B,KAAK,IAAI,KAAQ,GACf,GAAU,GAAQ,GAAM;EAAE,KAAK,EAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AAGA,SAAS,EAAqB,GAAQ;CACpC,IAAM,EAAE,UAAO,mBAAgB,GAC3B,EAAE,iBAAc,GAChB,EAAE,WAAQ,GACV,EAAE,mBAAgB;CACtB,OAAO;EACL,GAAG;EACH,OAAO,EAAM,MAAM,KAAK,CAAK;EAC7B,kBAAkB,EAAM,iBAAiB,KAAK,CAAK;EACnD,SAAS,EAAM;EACf,QAAQ,EAAM;EACd,aAAa,EAAM,YAAY,KAAK,CAAK;EACzC,QAAQ,EAAM,OAAO,KAAK,CAAK;EAC/B,IAAI,cAAc;GAChB,OAAO;EACT;EACA,IAAI,YAAY;GACd,OAAO;EACT;EACA,IAAI,MAAM;GACR,OAAO;EACT;EACA,IAAI,KAAK;GAIP,OAHA,IAAY,EAAY,WACxB,IAAM,EAAY,KAClB,IAAc,EAAY,aACnB;EACT;CACF;AACF;AAGA,IAAI,IAAiB,MAAM,EAAgB;CACzC,YAAY,GAAO;EAGjB,AAFA,KAAK,SAAS,EAAM,QACpB,KAAK,cAAc,KAAK,OAAO,iBAAiB,UAChD,KAAK,cAAc,EAAM;CAC3B;CACA,IAAI,iBAAiB;EACnB,OAAO,CAAC,CAAC,KAAK;CAChB;CACA,IAAI,QAAQ;EACV,OAAO,KAAK,eAAe,KAAK,OAAO;CACzC;CACA,IAAI,WAAW;EACb,IAAM,EAAE,gBAAa,WAAQ,aAAU,MACjC,EAAE,YAAS,GACX,EAAE,UAAO,GACT,IAAQ,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AAM,IACpB,IAAU,EAAM;GACpB,IAAI,GAAc;IAChB,IAAM,IAAc,EAAU,OAAO,IAAI,GACnC,IAAY,EAAM,OAAO,EAAU,QAAQ,CAAY,GACvD,IAAU,IAAY,EAAa;IAKzC,IAJsB,GAAgB,EAAM,MAAM,EAAM,IAAI,EAAM,GAAG,CAAC,CAAC,QAAQ,MAC5D,EAAK,KAAK,KAAK,SAChB,MAAM,MAAS,MAAS,EAAO,QAAQ,MAAS,EAAK,KAAK,IAAI,CAC/E,CAAC,CAAC,QAAQ,MAAS,EAAK,KAAK,CACd,CAAC,CAAC,QAChB,OAAO;IAWT,AATI,IAAU,EAAM,MAClB,EAAG,OAAO,GAAS,EAAM,EAAE,GAEzB,IAAY,EAAM,QACpB,EAAG,OAAO,EAAM,OAAO,GAAa,CAAS,GAE/C,IAAU,EAAM,OAAO,IAAc,EAAa,QAClD,EAAG,QAAQ,EAAM,OAAO,GAAa,GAAS,EAAO,KAAK,OAAO,KAAc,CAAC,CAAC,CAAC,GACvD,EAAM,UAAU,KAAK,KAAK,EAAM,UAAU,KAAK,KAAK,EAAM,QAAQ,EAAM,EAAE,CAAC,UAAU,EAAM,MAAM,UAE1H,EAAG,iBAAiB,EAAO,IAAI;GAEnC;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":["Fragment$1"],"sources":["../../../../../node_modules/@tiptap/core/dist/index.js"],"sourcesContent":["import { t as __exportAll } from \"./rolldown-runtime-D7D4PA-g.js\";\nimport { RemoveMarkStep, ReplaceAroundStep, ReplaceStep, Transform, canJoin, canSplit, findWrapping, joinPoint, liftTarget } from \"@tiptap/pm/transform\";\nimport { createParagraphNear, exitCode, joinBackward, joinDown, joinForward, joinTextblockBackward, joinTextblockForward, joinUp, lift, liftEmptyBlock, newlineInCode, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, setBlockType, wrapIn } from \"@tiptap/pm/commands\";\nimport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, TextSelection } from \"@tiptap/pm/state\";\nimport { DOMParser, DOMSerializer, Fragment as Fragment$1, Node as Node$1, Schema, Slice } from \"@tiptap/pm/model\";\nimport { liftListItem, sinkListItem, wrapInList } from \"@tiptap/pm/schema-list\";\nimport { Decoration as Decoration$1, DecorationSet, EditorView } from \"@tiptap/pm/view\";\nimport { keymap } from \"@tiptap/pm/keymap\";\n//#region src/helpers/createChainableState.ts\n/**\n* Takes a Transaction & Editor State and turns it into a chainable state object\n* @param config The transaction and state to create the chainable state from\n* @returns A chainable Editor state object\n*/\nfunction createChainableState(config) {\n\tconst { state, transaction } = config;\n\tlet { selection } = transaction;\n\tlet { doc } = transaction;\n\tlet { storedMarks } = transaction;\n\treturn {\n\t\t...state,\n\t\tapply: state.apply.bind(state),\n\t\tapplyTransaction: state.applyTransaction.bind(state),\n\t\tplugins: state.plugins,\n\t\tschema: state.schema,\n\t\treconfigure: state.reconfigure.bind(state),\n\t\ttoJSON: state.toJSON.bind(state),\n\t\tget storedMarks() {\n\t\t\treturn storedMarks;\n\t\t},\n\t\tget selection() {\n\t\t\treturn selection;\n\t\t},\n\t\tget doc() {\n\t\t\treturn doc;\n\t\t},\n\t\tget tr() {\n\t\t\tselection = transaction.selection;\n\t\t\tdoc = transaction.doc;\n\t\t\tstoredMarks = transaction.storedMarks;\n\t\t\treturn transaction;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/CommandManager.ts\nvar CommandManager = class CommandManager {\n\tconstructor(props) {\n\t\tthis.editor = props.editor;\n\t\tthis.rawCommands = this.editor.extensionManager.commands;\n\t\tthis.customState = props.state;\n\t}\n\tget hasCustomState() {\n\t\treturn !!this.customState;\n\t}\n\tget state() {\n\t\treturn this.customState || this.editor.state;\n\t}\n\tget commands() {\n\t\tconst { rawCommands, editor, state } = this;\n\t\tconst { view } = editor;\n\t\tconst { tr } = state;\n\t\tconst props = this.buildProps(tr);\n\t\treturn Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n\t\t\tconst method = (...args) => {\n\t\t\t\tconst callback = command(...args)(props);\n\t\t\t\tif (!tr.getMeta(\"preventDispatch\") && !this.hasCustomState) view.dispatch(tr);\n\t\t\t\treturn callback;\n\t\t\t};\n\t\t\treturn [name, method];\n\t\t}));\n\t}\n\tget chain() {\n\t\treturn () => this.createChain();\n\t}\n\tget can() {\n\t\treturn () => this.createCan();\n\t}\n\tcreateChain(startTr, shouldDispatch = true) {\n\t\tconst { rawCommands, editor, state } = this;\n\t\tconst { view } = editor;\n\t\tconst callbacks = [];\n\t\tconst hasStartTransaction = !!startTr;\n\t\tconst tr = startTr || state.tr;\n\t\tconst run = () => {\n\t\t\tif (!hasStartTransaction && shouldDispatch && !tr.getMeta(\"preventDispatch\") && !this.hasCustomState) view.dispatch(tr);\n\t\t\treturn callbacks.every((callback) => callback === true);\n\t\t};\n\t\tconst chain = {\n\t\t\t...Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n\t\t\t\tconst chainedCommand = (...args) => {\n\t\t\t\t\tconst props = this.buildProps(tr, shouldDispatch);\n\t\t\t\t\tconst callback = command(...args)(props);\n\t\t\t\t\tcallbacks.push(callback);\n\t\t\t\t\treturn chain;\n\t\t\t\t};\n\t\t\t\treturn [name, chainedCommand];\n\t\t\t})),\n\t\t\trun\n\t\t};\n\t\treturn chain;\n\t}\n\t/**\n\t* Creates a chain that safely returns `false` when run.\n\t* @returns A non-dispatching command chain.\n\t* @example\n\t* const chain = CommandManager.createFakeChain()\n\t* chain.focus().run() // false\n\t*/\n\tstatic createFakeChain() {\n\t\tconst chain = new Proxy({}, { get: (_target, property) => {\n\t\t\tif (property === \"then\") return;\n\t\t\tif (property === \"run\") return () => false;\n\t\t\treturn () => chain;\n\t\t} });\n\t\treturn chain;\n\t}\n\tcreateCan(startTr) {\n\t\tconst { rawCommands, state } = this;\n\t\tconst dispatch = false;\n\t\tconst tr = startTr || state.tr;\n\t\tconst props = this.buildProps(tr, dispatch);\n\t\treturn {\n\t\t\t...Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n\t\t\t\treturn [name, (...args) => command(...args)({\n\t\t\t\t\t...props,\n\t\t\t\t\tdispatch: void 0\n\t\t\t\t})];\n\t\t\t})),\n\t\t\tchain: () => this.createChain(tr, dispatch)\n\t\t};\n\t}\n\t/**\n\t* Creates capability checks that safely return `false`.\n\t* @returns A non-dispatching capability checker.\n\t* @example\n\t* const can = CommandManager.createFallbackCan()\n\t* can.focus() // false\n\t*/\n\tstatic createFallbackCan() {\n\t\tconst chain = CommandManager.createFakeChain();\n\t\treturn new Proxy({ chain: () => chain }, { get: (target, property) => {\n\t\t\tif (property === \"then\") return;\n\t\t\tif (property === \"chain\") return target.chain;\n\t\t\treturn () => false;\n\t\t} });\n\t}\n\tbuildProps(tr, shouldDispatch = true) {\n\t\tconst { rawCommands, editor, state } = this;\n\t\tconst { view } = editor;\n\t\tconst props = {\n\t\t\ttr,\n\t\t\teditor,\n\t\t\tview,\n\t\t\tstate: createChainableState({\n\t\t\t\tstate,\n\t\t\t\ttransaction: tr\n\t\t\t}),\n\t\t\tdispatch: shouldDispatch ? () => void 0 : void 0,\n\t\t\tchain: () => this.createChain(tr, shouldDispatch),\n\t\t\tcan: () => this.createCan(tr),\n\t\t\tget commands() {\n\t\t\t\treturn Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n\t\t\t\t\treturn [name, (...args) => command(...args)(props)];\n\t\t\t\t}));\n\t\t\t}\n\t\t};\n\t\treturn props;\n\t}\n};\n//#endregion\n//#region src/commands/blur.ts\nconst blur = () => ({ editor, view }) => {\n\trequestAnimationFrame(() => {\n\t\tif (!editor.isDestroyed) {\n\t\t\tvar _window;\n\t\t\tview.dom.blur();\n\t\t\t(_window = window) === null || _window === void 0 || (_window = _window.getSelection()) === null || _window === void 0 || _window.removeAllRanges();\n\t\t}\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/clearContent.ts\nconst clearContent = (emitUpdate = true) => ({ commands }) => {\n\treturn commands.setContent(\"\", { emitUpdate });\n};\n//#endregion\n//#region src/commands/clearNodes.ts\nconst clearNodes = () => ({ state, tr, dispatch }) => {\n\tconst { selection } = tr;\n\tconst { ranges } = selection;\n\tif (!dispatch) return true;\n\tranges.forEach(({ $from, $to }) => {\n\t\tstate.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n\t\t\tif (node.type.isText) return;\n\t\t\tconst { doc, mapping } = tr;\n\t\t\tconst $mappedFrom = doc.resolve(mapping.map(pos));\n\t\t\tconst $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));\n\t\t\tconst nodeRange = $mappedFrom.blockRange($mappedTo);\n\t\t\tif (!nodeRange) return;\n\t\t\tconst targetLiftDepth = liftTarget(nodeRange);\n\t\t\tif (node.type.isTextblock) {\n\t\t\t\tconst { defaultType } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());\n\t\t\t\ttr.setNodeMarkup(nodeRange.start, defaultType);\n\t\t\t}\n\t\t\tif (targetLiftDepth || targetLiftDepth === 0) tr.lift(nodeRange, targetLiftDepth);\n\t\t});\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/command.ts\nconst command = (fn) => (props) => {\n\treturn fn(props);\n};\n//#endregion\n//#region src/commands/createParagraphNear.ts\nconst createParagraphNear$1 = () => ({ state, dispatch }) => {\n\treturn createParagraphNear(state, dispatch);\n};\n//#endregion\n//#region src/commands/cut.ts\nconst cut = (originRange, targetPos) => ({ editor, tr }) => {\n\tconst { state } = editor;\n\tconst contentSlice = state.doc.slice(originRange.from, originRange.to);\n\ttr.deleteRange(originRange.from, originRange.to);\n\tconst newPos = tr.mapping.map(targetPos);\n\ttr.insert(newPos, contentSlice.content);\n\ttr.setSelection(new TextSelection(tr.doc.resolve(Math.max(newPos - 1, 0))));\n\treturn true;\n};\n//#endregion\n//#region src/commands/deleteCurrentNode.ts\nconst deleteCurrentNode = () => ({ tr, dispatch }) => {\n\tconst { selection } = tr;\n\tconst currentNode = selection.$anchor.node();\n\tif (currentNode.content.size > 0) return false;\n\tconst $pos = tr.selection.$anchor;\n\tfor (let depth = $pos.depth; depth > 0; depth -= 1) if ($pos.node(depth).type === currentNode.type) {\n\t\tif (dispatch) {\n\t\t\tconst from = $pos.before(depth);\n\t\t\tconst to = $pos.after(depth);\n\t\t\ttr.delete(from, to).scrollIntoView();\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n};\n//#endregion\n//#region src/helpers/getNodeType.ts\nfunction getNodeType(nameOrType, schema) {\n\tif (typeof nameOrType === \"string\") {\n\t\tif (!schema.nodes[nameOrType]) throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);\n\t\treturn schema.nodes[nameOrType];\n\t}\n\treturn nameOrType;\n}\n//#endregion\n//#region src/commands/deleteNode.ts\nconst deleteNode = (typeOrName) => ({ tr, state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tconst $pos = tr.selection.$anchor;\n\tfor (let depth = $pos.depth; depth > 0; depth -= 1) if ($pos.node(depth).type === type) {\n\t\tif (dispatch) {\n\t\t\tconst from = $pos.before(depth);\n\t\t\tconst to = $pos.after(depth);\n\t\t\ttr.delete(from, to).scrollIntoView();\n\t\t}\n\t\treturn true;\n\t}\n\treturn false;\n};\n//#endregion\n//#region src/commands/deleteRange.ts\nconst deleteRange = (range) => ({ tr, dispatch }) => {\n\tconst { from, to } = range;\n\tif (dispatch) tr.delete(from, to);\n\treturn true;\n};\n//#endregion\n//#region src/commands/deleteSelection.ts\n/**\n* Check if a node has text content based on its content specification.\n* Returns true if the node's content spec matches text* or text+ patterns.\n*/\nconst hasTextContent = (nodeSpec) => {\n\tif (!nodeSpec.content) return false;\n\treturn /^text(\\*|\\+)/.test(nodeSpec.content);\n};\n/**\n* Expand selection position for a specific side (left or right) to handle inline text nodes.\n* This function checks if the position is within an inline node with text content and\n* expands it to include the entire node boundaries for proper deletion.\n* @param $pos - The resolved position to expand\n* @param schema - The ProseMirror schema\n* @param side - Which side to expand ('left' or 'right')\n* @returns The expanded position for deletion\n*/\nconst expandSelectionForSide = ($pos, schema, side) => {\n\tif (!$pos.parent.isInline) return $pos.pos;\n\tif (side === \"left\" && $pos.pos > $pos.start() || side === \"right\" && $pos.pos < $pos.end()) return $pos.pos;\n\tconst parentContent = schema.nodes[$pos.parent.type.name].spec;\n\tif (!hasTextContent(parentContent)) return $pos.pos;\n\treturn side === \"left\" ? $pos.start() - 1 : $pos.end() + 1;\n};\n/**\n* Expand selection range to properly handle deletion of inline text nodes.\n* Inline text nodes don't collapse correctly when text inside is deleted,\n* so we need to expand the selection to include the entire node.\n* See: https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1365\n*/\nconst expandSelectionForInlineText = ($from, $to, schema) => {\n\treturn {\n\t\tfrom: expandSelectionForSide($from, schema, \"left\"),\n\t\tto: expandSelectionForSide($to, schema, \"right\")\n\t};\n};\nconst deleteSelection = () => ({ state, dispatch }) => {\n\tif (state.selection.empty) return false;\n\tif (dispatch) {\n\t\tconst tr = state.tr;\n\t\tconst { ranges } = state.selection;\n\t\tconst mapFrom = tr.steps.length;\n\t\tranges.forEach((range) => {\n\t\t\tconst mapping = tr.mapping.slice(mapFrom);\n\t\t\tconst $from = tr.doc.resolve(mapping.map(range.$from.pos));\n\t\t\tconst $to = tr.doc.resolve(mapping.map(range.$to.pos));\n\t\t\tconst { from, to } = expandSelectionForInlineText($from, $to, state.schema);\n\t\t\ttr.deleteRange(from, to);\n\t\t});\n\t\tif (!tr.selection.empty) tr.setSelection(TextSelection.near(tr.doc.resolve(tr.selection.from)));\n\t\ttr.scrollIntoView();\n\t\tdispatch(tr);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/enter.ts\nconst enter = () => ({ commands }) => {\n\treturn commands.keyboardShortcut(\"Enter\");\n};\n//#endregion\n//#region src/commands/exitCode.ts\nconst exitCode$1 = () => ({ state, dispatch }) => {\n\treturn exitCode(state, dispatch);\n};\n//#endregion\n//#region src/utilities/isRegExp.ts\nfunction isRegExp(value) {\n\treturn Object.prototype.toString.call(value) === \"[object RegExp]\";\n}\n//#endregion\n//#region src/utilities/objectIncludes.ts\n/**\n* Check if object1 includes object2\n* @param object1 Object\n* @param object2 Object\n*/\nfunction objectIncludes(object1, object2, options = { strict: true }) {\n\tconst keys = Object.keys(object2);\n\tif (!keys.length) return true;\n\treturn keys.every((key) => {\n\t\tif (options.strict) return object2[key] === object1[key];\n\t\tif (isRegExp(object2[key])) return object2[key].test(object1[key]);\n\t\treturn object2[key] === object1[key];\n\t});\n}\n//#endregion\n//#region src/helpers/getMarkRange.ts\nfunction findMarkInSet(marks, type, attributes = {}) {\n\treturn marks.find((item) => {\n\t\treturn item.type === type && objectIncludes(Object.fromEntries(Object.keys(attributes).map((k) => [k, item.attrs[k]])), attributes);\n\t});\n}\nfunction isMarkInSet(marks, type, attributes = {}) {\n\treturn !!findMarkInSet(marks, type, attributes);\n}\n/**\n* Get the range of a mark at a resolved position.\n*/\nfunction getMarkRange($pos, type, attributes) {\n\tif (!$pos || !type) return;\n\tlet start = $pos.parent.childAfter($pos.parentOffset);\n\tif (!start.node || !start.node.marks.some((mark) => mark.type === type)) start = $pos.parent.childBefore($pos.parentOffset);\n\tif (!start.node || !start.node.marks.some((mark) => mark.type === type)) return;\n\tif (!attributes) {\n\t\tconst firstMark = start.node.marks.find((mark) => mark.type === type);\n\t\tif (firstMark) attributes = firstMark.attrs;\n\t}\n\tif (!findMarkInSet([...start.node.marks], type, attributes)) return;\n\tlet startIndex = start.index;\n\tlet startPos = $pos.start() + start.offset;\n\tlet endIndex = startIndex + 1;\n\tlet endPos = startPos + start.node.nodeSize;\n\twhile (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {\n\t\tstartIndex -= 1;\n\t\tstartPos -= $pos.parent.child(startIndex).nodeSize;\n\t}\n\twhile (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {\n\t\tendPos += $pos.parent.child(endIndex).nodeSize;\n\t\tendIndex += 1;\n\t}\n\treturn {\n\t\tfrom: startPos,\n\t\tto: endPos\n\t};\n}\n//#endregion\n//#region src/helpers/getMarkType.ts\nfunction getMarkType(nameOrType, schema) {\n\tif (typeof nameOrType === \"string\") {\n\t\tif (!schema.marks[nameOrType]) throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);\n\t\treturn schema.marks[nameOrType];\n\t}\n\treturn nameOrType;\n}\n//#endregion\n//#region src/commands/extendMarkRange.ts\nconst extendMarkRange = (typeOrName, attributes) => ({ tr, state, dispatch }) => {\n\tconst type = getMarkType(typeOrName, state.schema);\n\tconst { doc, selection } = tr;\n\tconst { $from, from, to } = selection;\n\tif (dispatch) {\n\t\tconst range = getMarkRange($from, type, attributes);\n\t\tif (range && range.from <= from && range.to >= to) {\n\t\t\tconst newSelection = TextSelection.create(doc, range.from, range.to);\n\t\t\ttr.setSelection(newSelection);\n\t\t}\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/first.ts\nconst first = (commands) => (props) => {\n\tconst items = typeof commands === \"function\" ? commands(props) : commands;\n\tfor (let i = 0; i < items.length; i += 1) if (items[i](props)) return true;\n\treturn false;\n};\n//#endregion\n//#region src/helpers/isTextSelection.ts\nfunction isTextSelection(value) {\n\treturn value instanceof TextSelection;\n}\n//#endregion\n//#region src/utilities/minMax.ts\nfunction minMax(value = 0, min = 0, max = 0) {\n\treturn Math.min(Math.max(value, min), max);\n}\n//#endregion\n//#region src/helpers/resolveFocusPosition.ts\nfunction resolveFocusPosition(doc, position = null) {\n\tif (!position) return null;\n\tconst selectionAtStart = Selection.atStart(doc);\n\tconst selectionAtEnd = Selection.atEnd(doc);\n\tif (position === \"start\" || position === true) return selectionAtStart;\n\tif (position === \"end\") return selectionAtEnd;\n\tconst minPos = selectionAtStart.from;\n\tconst maxPos = selectionAtEnd.to;\n\tif (position === \"all\") return TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));\n\treturn TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));\n}\n//#endregion\n//#region src/utilities/isAndroid.ts\nfunction isAndroid() {\n\treturn [\"Android\"].includes(navigator.platform) || /android/i.test(navigator.userAgent);\n}\n//#endregion\n//#region src/utilities/isiOS.ts\nfunction isiOS() {\n\treturn [\n\t\t\"iPad Simulator\",\n\t\t\"iPhone Simulator\",\n\t\t\"iPod Simulator\",\n\t\t\"iPad\",\n\t\t\"iPhone\",\n\t\t\"iPod\"\n\t].includes(navigator.platform) || navigator.userAgent.includes(\"Mac\") && \"ontouchend\" in document;\n}\n//#endregion\n//#region src/utilities/isSafari.ts\n/**\n* Detects if the current browser is Safari (but not iOS Safari or Chrome).\n* @returns `true` if the browser is Safari, `false` otherwise.\n* @example\n* if (isSafari()) {\n* // Safari-specific handling\n* }\n*/\nfunction isSafari() {\n\treturn typeof navigator !== \"undefined\" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : false;\n}\n//#endregion\n//#region src/commands/focus.ts\nconst focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {\n\toptions = {\n\t\tscrollIntoView: true,\n\t\t...options\n\t};\n\tconst delayedFocus = () => {\n\t\tif (isiOS() || isAndroid()) view.dom.focus();\n\t\tif (isSafari() && !isiOS() && !isAndroid()) view.dom.focus({ preventScroll: true });\n\t\trequestAnimationFrame(() => {\n\t\t\tif (!editor.isDestroyed) {\n\t\t\t\tview.focus();\n\t\t\t\tif (options === null || options === void 0 ? void 0 : options.scrollIntoView) editor.commands.scrollIntoView();\n\t\t\t}\n\t\t});\n\t};\n\ttry {\n\t\tif (view.hasFocus() && position === null || position === false) return true;\n\t} catch {\n\t\treturn false;\n\t}\n\tif (dispatch && position === null && !isTextSelection(editor.state.selection)) {\n\t\tdelayedFocus();\n\t\treturn true;\n\t}\n\tconst selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;\n\tconst isSameSelection = editor.state.selection.eq(selection);\n\tif (dispatch) {\n\t\tif (!isSameSelection) tr.setSelection(selection);\n\t\tif (isSameSelection && tr.storedMarks) tr.setStoredMarks(tr.storedMarks);\n\t\tdelayedFocus();\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/forEach.ts\nconst forEach = (items, fn) => (props) => {\n\treturn items.every((item, index) => fn(item, {\n\t\t...props,\n\t\tindex\n\t}));\n};\n//#endregion\n//#region src/commands/insertContent.ts\nconst insertContent = (value, options) => ({ tr, commands }) => {\n\treturn commands.insertContentAt({\n\t\tfrom: tr.selection.from,\n\t\tto: tr.selection.to\n\t}, value, options);\n};\n//#endregion\n//#region src/utilities/elementFromString.ts\nconst removeWhitespaces = (node) => {\n\tconst children = node.childNodes;\n\tfor (let i = children.length - 1; i >= 0; i -= 1) {\n\t\tconst child = children[i];\n\t\tif (child.nodeType === 3 && child.nodeValue && /^(\\n\\s\\s|\\n)$/.test(child.nodeValue)) node.removeChild(child);\n\t\telse if (child.nodeType === 1) removeWhitespaces(child);\n\t}\n\treturn node;\n};\nfunction elementFromString(value) {\n\tif (typeof window === \"undefined\") throw new Error(\"[tiptap error]: there is no window object available, so this function cannot be used\");\n\tconst wrappedValue = `<body>${value}</body>`;\n\tconst html = new window.DOMParser().parseFromString(wrappedValue, \"text/html\").body;\n\treturn removeWhitespaces(html);\n}\n//#endregion\n//#region src/helpers/isProseMirrorContent.ts\n/**\n* Checks whether a value is already a ProseMirror node or fragment. Looks for the\n* `nodesBetween` method, because `instanceof` fails when prosemirror-model is loaded twice.\n* @param value Any value that could be passed as content\n* @returns True for a node or a fragment, false for JSON, HTML and everything else\n* @example ```js\n* isProseMirrorContent(editor.state.doc)\n* ```\n*/\nfunction isProseMirrorContent(value) {\n\treturn typeof (value === null || value === void 0 ? void 0 : value.nodesBetween) === \"function\";\n}\n//#endregion\n//#region src/helpers/createNodeFromContent.ts\n/**\n* Takes a JSON or HTML content and creates a Prosemirror node or fragment from it.\n* @param content The JSON or HTML content to create the node from\n* @param schema The Prosemirror schema to use for the node\n* @param options Options for the parser\n* @returns The created Prosemirror node or fragment\n*/\nfunction createNodeFromContent(content, schema, options) {\n\tif (isProseMirrorContent(content)) return content;\n\tconst isJSONContent = typeof content === \"object\" && content !== null;\n\toptions = {\n\t\tslice: true,\n\t\tparseOptions: {},\n\t\t...options\n\t};\n\tconst isTextContent = typeof content === \"string\";\n\tif (isJSONContent) try {\n\t\tif (Array.isArray(content) && content.length > 0) return Fragment$1.fromArray(content.map((item) => schema.nodeFromJSON(item)));\n\t\tconst node = schema.nodeFromJSON(content);\n\t\tif (options.errorOnInvalidContent) node.check();\n\t\treturn node;\n\t} catch (error) {\n\t\tif (options.errorOnInvalidContent) throw new Error(\"[tiptap error]: Invalid JSON content\", { cause: error });\n\t\tconsole.warn(\"[tiptap warn]: Invalid content.\", \"Passed value:\", content, \"Error:\", error);\n\t\treturn createNodeFromContent(\"\", schema, options);\n\t}\n\tif (isTextContent) {\n\t\tif (options.errorOnInvalidContent) {\n\t\t\tlet hasInvalidContent = false;\n\t\t\tlet invalidContent = \"\";\n\t\t\tconst contentCheckSchema = new Schema({\n\t\t\t\ttopNode: schema.spec.topNode,\n\t\t\t\tmarks: schema.spec.marks,\n\t\t\t\tnodes: schema.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {\n\t\t\t\t\tcontent: \"inline*\",\n\t\t\t\t\tgroup: \"block\",\n\t\t\t\t\tparseDOM: [{\n\t\t\t\t\t\ttag: \"*\",\n\t\t\t\t\t\tgetAttrs: (e) => {\n\t\t\t\t\t\t\thasInvalidContent = true;\n\t\t\t\t\t\t\tinvalidContent = typeof e === \"string\" ? e : e.outerHTML;\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}]\n\t\t\t\t} })\n\t\t\t});\n\t\t\tif (options.slice) DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);\n\t\t\telse DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);\n\t\t\tif (options.errorOnInvalidContent && hasInvalidContent) throw new Error(\"[tiptap error]: Invalid HTML content\", { cause: /* @__PURE__ */ new Error(`Invalid element found: ${invalidContent}`) });\n\t\t}\n\t\tconst parser = DOMParser.fromSchema(schema);\n\t\tif (options.slice) return parser.parseSlice(elementFromString(content), options.parseOptions).content;\n\t\treturn parser.parse(elementFromString(content), options.parseOptions);\n\t}\n\treturn createNodeFromContent(\"\", schema, options);\n}\n//#endregion\n//#region src/helpers/isFragment.ts\n/**\n* Checks whether a node or fragment is a fragment. Looks for a missing `type` field,\n* because `instanceof` fails when prosemirror-model is loaded twice.\n* @param nodeOrFragment A ProseMirror node or fragment\n* @returns True for a fragment, false for a node\n* @example ```js\n* isFragment(editor.state.doc.content)\n* ```\n*/\nfunction isFragment(nodeOrFragment) {\n\treturn !(\"type\" in nodeOrFragment);\n}\n//#endregion\n//#region src/helpers/selectionToInsertionEnd.ts\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n\tconst last = tr.steps.length - 1;\n\tif (last < startLen) return;\n\tconst step = tr.steps[last];\n\tif (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return;\n\tconst map = tr.mapping.maps[last];\n\tlet end = 0;\n\tmap.forEach((_from, _to, _newFrom, newTo) => {\n\t\tif (end === 0) end = newTo;\n\t});\n\ttr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\n//#endregion\n//#region src/commands/insertContentAt.ts\nconst insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {\n\tif (dispatch) {\n\t\toptions = {\n\t\t\tparseOptions: editor.options.parseOptions,\n\t\t\tupdateSelection: true,\n\t\t\tapplyInputRules: false,\n\t\t\tapplyPasteRules: false,\n\t\t\t...options\n\t\t};\n\t\tlet content;\n\t\tconst emitContentError = (error) => {\n\t\t\teditor.emit(\"contentError\", {\n\t\t\t\teditor,\n\t\t\t\terror,\n\t\t\t\tdisableCollaboration: () => {\n\t\t\t\t\tif (\"collaboration\" in editor.storage && typeof editor.storage.collaboration === \"object\" && editor.storage.collaboration) editor.storage.collaboration.isDisabled = true;\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tconst parseOptions = {\n\t\t\tpreserveWhitespace: \"full\",\n\t\t\t...options.parseOptions\n\t\t};\n\t\tif (!options.errorOnInvalidContent && !editor.options.enableContentCheck && editor.options.emitContentError) try {\n\t\t\tcreateNodeFromContent(value, editor.schema, {\n\t\t\t\tparseOptions,\n\t\t\t\terrorOnInvalidContent: true\n\t\t\t});\n\t\t} catch (e) {\n\t\t\temitContentError(e);\n\t\t}\n\t\ttry {\n\t\t\tvar _options$errorOnInval;\n\t\t\tcontent = createNodeFromContent(value, editor.schema, {\n\t\t\t\tparseOptions,\n\t\t\t\terrorOnInvalidContent: (_options$errorOnInval = options.errorOnInvalidContent) !== null && _options$errorOnInval !== void 0 ? _options$errorOnInval : editor.options.enableContentCheck\n\t\t\t});\n\t\t} catch (e) {\n\t\t\temitContentError(e);\n\t\t\treturn false;\n\t\t}\n\t\tlet { from, to } = typeof position === \"number\" ? {\n\t\t\tfrom: position,\n\t\t\tto: position\n\t\t} : {\n\t\t\tfrom: position.from,\n\t\t\tto: position.to\n\t\t};\n\t\tlet isOnlyTextContent = true;\n\t\tlet isOnlyBlockContent = true;\n\t\tconst nodes = isFragment(content) ? content.content : [content];\n\t\tnodes.forEach((node) => {\n\t\t\tnode.check();\n\t\t\tisOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;\n\t\t\tisOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;\n\t\t});\n\t\tif (from === to && isOnlyBlockContent) {\n\t\t\tconst { parent } = tr.doc.resolve(from);\n\t\t\tif (parent.isTextblock && !parent.type.spec.code && !parent.childCount) {\n\t\t\t\tfrom -= 1;\n\t\t\t\tto += 1;\n\t\t\t}\n\t\t}\n\t\tlet newContent;\n\t\tif (isOnlyTextContent) {\n\t\t\tif (Array.isArray(value)) newContent = value.map((item) => item.text || \"\").join(\"\");\n\t\t\telse if (isProseMirrorContent(value)) newContent = nodes.map((node) => {\n\t\t\t\tvar _node$text;\n\t\t\t\treturn (_node$text = node.text) !== null && _node$text !== void 0 ? _node$text : \"\";\n\t\t\t}).join(\"\");\n\t\t\telse if (typeof value === \"object\" && !!value && !!value.text) newContent = value.text;\n\t\t\telse newContent = value;\n\t\t\ttr.insertText(newContent, from, to);\n\t\t} else {\n\t\t\tnewContent = Fragment$1.from(nodes);\n\t\t\tconst $from = tr.doc.resolve(from);\n\t\t\tconst $fromNode = $from.node();\n\t\t\tconst fromSelectionAtStart = $from.parentOffset === 0;\n\t\t\tconst isTextSelection = $fromNode.isText || $fromNode.isTextblock;\n\t\t\tconst hasContent = $fromNode.content.size > 0;\n\t\t\tif (fromSelectionAtStart && isTextSelection && hasContent && isOnlyBlockContent) from = Math.max(0, from - 1);\n\t\t\ttr.replaceWith(from, to, nodes);\n\t\t}\n\t\tif (options.updateSelection) selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n\t\tif (options.applyInputRules) tr.setMeta(\"applyInputRules\", {\n\t\t\tfrom,\n\t\t\ttext: newContent\n\t\t});\n\t\tif (options.applyPasteRules) tr.setMeta(\"applyPasteRules\", {\n\t\t\tfrom,\n\t\t\ttext: newContent\n\t\t});\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/helpers/defaultBlockAt.ts\n/**\n* Gets the default block type at a given match\n* @param match The content match to get the default block type from\n* @returns The default block type or null\n*/\nfunction defaultBlockAt(match) {\n\tfor (let i = 0; i < match.edgeCount; i += 1) {\n\t\tconst { type } = match.edge(i);\n\t\tif (type.isTextblock && !type.hasRequiredAttrs()) return type;\n\t}\n\treturn null;\n}\n//#endregion\n//#region src/commands/insertDefaultBlock.ts\nconst insertDefaultBlock = (options = {}) => ({ tr, dispatch, editor }) => {\n\tconst { pos, attrs, content, updateSelection = true } = options;\n\tlet $pos;\n\tif (typeof pos === \"number\") $pos = tr.doc.resolve(pos);\n\telse if (pos) $pos = pos;\n\telse $pos = tr.selection.$from;\n\tconst defaultType = defaultBlockAt($pos.parent.contentMatchAt($pos.index()));\n\tif (!defaultType) return false;\n\tconst validAttrKeys = Object.keys(defaultType.spec.attrs || {});\n\tconst filteredAttrs = attrs ? Object.fromEntries(Object.entries(attrs).filter(([key]) => validAttrKeys.includes(key))) : {};\n\tlet node;\n\tif (content) {\n\t\tconst parsed = createNodeFromContent(content, editor.schema);\n\t\tnode = defaultType.createAndFill(filteredAttrs, parsed);\n\t} else node = defaultType.createAndFill(filteredAttrs);\n\tif (!node) return false;\n\tif (dispatch) {\n\t\ttr.insert($pos.pos, node);\n\t\tif (updateSelection) selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/join.ts\nconst joinUp$1 = () => ({ state, dispatch }) => {\n\treturn joinUp(state, dispatch);\n};\nconst joinDown$1 = () => ({ state, dispatch }) => {\n\treturn joinDown(state, dispatch);\n};\nconst joinBackward$1 = () => ({ state, dispatch }) => {\n\treturn joinBackward(state, dispatch);\n};\nconst joinForward$1 = () => ({ state, dispatch }) => {\n\treturn joinForward(state, dispatch);\n};\n//#endregion\n//#region src/commands/joinItemBackward.ts\nconst joinItemBackward = () => ({ state, dispatch, tr }) => {\n\ttry {\n\t\tconst point = joinPoint(state.doc, state.selection.$from.pos, -1);\n\t\tif (point === null || point === void 0) return false;\n\t\ttr.join(point, 2);\n\t\tif (dispatch) dispatch(tr);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n//#endregion\n//#region src/commands/joinItemForward.ts\nconst joinItemForward = () => ({ state, dispatch, tr }) => {\n\ttry {\n\t\tconst point = joinPoint(state.doc, state.selection.$from.pos, 1);\n\t\tif (point === null || point === void 0) return false;\n\t\ttr.join(point, 2);\n\t\tif (dispatch) dispatch(tr);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n//#endregion\n//#region src/commands/joinTextblockBackward.ts\nconst joinTextblockBackward$1 = () => ({ state, dispatch }) => {\n\treturn joinTextblockBackward(state, dispatch);\n};\n//#endregion\n//#region src/commands/joinTextblockForward.ts\nconst joinTextblockForward$1 = () => ({ state, dispatch }) => {\n\treturn joinTextblockForward(state, dispatch);\n};\n//#endregion\n//#region src/utilities/isMacOS.ts\nfunction isMacOS() {\n\treturn typeof navigator !== \"undefined\" ? /Mac/.test(navigator.platform) : false;\n}\n//#endregion\n//#region src/commands/keyboardShortcut.ts\nfunction normalizeKeyName(name) {\n\tconst parts = name.split(/-(?!$)/);\n\tlet result = parts[parts.length - 1];\n\tif (result === \"Space\") result = \" \";\n\tlet alt;\n\tlet ctrl;\n\tlet shift;\n\tlet meta;\n\tfor (let i = 0; i < parts.length - 1; i += 1) {\n\t\tconst mod = parts[i];\n\t\tif (/^(cmd|meta|m)$/i.test(mod)) meta = true;\n\t\telse if (/^a(lt)?$/i.test(mod)) alt = true;\n\t\telse if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;\n\t\telse if (/^s(hift)?$/i.test(mod)) shift = true;\n\t\telse if (/^mod$/i.test(mod)) {\n\t\t\tif (isiOS() || isMacOS()) meta = true;\n\t\t\telse ctrl = true;\n\t\t} else throw new Error(`Unrecognized modifier name: ${mod}`);\n\t}\n\tif (alt) result = `Alt-${result}`;\n\tif (ctrl) result = `Ctrl-${result}`;\n\tif (meta) result = `Meta-${result}`;\n\tif (shift) result = `Shift-${result}`;\n\treturn result;\n}\nconst keyboardShortcut = (name) => ({ editor, view, tr, dispatch }) => {\n\tconst keys = normalizeKeyName(name).split(/-(?!$)/);\n\tconst key = keys.find((item) => ![\n\t\t\"Alt\",\n\t\t\"Ctrl\",\n\t\t\"Meta\",\n\t\t\"Shift\"\n\t].includes(item));\n\tconst event = new KeyboardEvent(\"keydown\", {\n\t\tkey: key === \"Space\" ? \" \" : key,\n\t\taltKey: keys.includes(\"Alt\"),\n\t\tctrlKey: keys.includes(\"Ctrl\"),\n\t\tmetaKey: keys.includes(\"Meta\"),\n\t\tshiftKey: keys.includes(\"Shift\"),\n\t\tbubbles: true,\n\t\tcancelable: true\n\t});\n\tconst capturedTransaction = editor.captureTransaction(() => {\n\t\tview.someProp(\"handleKeyDown\", (f) => f(view, event));\n\t});\n\tcapturedTransaction === null || capturedTransaction === void 0 || capturedTransaction.steps.forEach((step) => {\n\t\tconst newStep = step.map(tr.mapping);\n\t\tif (newStep && dispatch) tr.maybeStep(newStep);\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/helpers/isNodeActive.ts\nfunction isNodeActive(state, typeOrName, attributes = {}) {\n\tconst { from, to, empty } = state.selection;\n\tconst type = typeOrName ? getNodeType(typeOrName, state.schema) : null;\n\tconst nodeRanges = [];\n\tstate.doc.nodesBetween(from, to, (node, pos) => {\n\t\tif (node.isText) return;\n\t\tconst relativeFrom = Math.max(from, pos);\n\t\tconst relativeTo = Math.min(to, pos + node.nodeSize);\n\t\tnodeRanges.push({\n\t\t\tnode,\n\t\t\tfrom: relativeFrom,\n\t\t\tto: relativeTo\n\t\t});\n\t});\n\tconst selectionRange = to - from;\n\tconst matchedNodeRanges = nodeRanges.filter((nodeRange) => {\n\t\tif (!type) return true;\n\t\treturn type.name === nodeRange.node.type.name;\n\t}).filter((nodeRange) => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }));\n\tif (empty) return !!matchedNodeRanges.length;\n\treturn matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0) >= selectionRange;\n}\n//#endregion\n//#region src/commands/lift.ts\nconst lift$1 = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n\tif (!isNodeActive(state, getNodeType(typeOrName, state.schema), attributes)) return false;\n\treturn lift(state, dispatch);\n};\n//#endregion\n//#region src/commands/liftEmptyBlock.ts\nconst liftEmptyBlock$1 = () => ({ state, dispatch }) => {\n\treturn liftEmptyBlock(state, dispatch);\n};\n//#endregion\n//#region src/commands/liftListItem.ts\nconst liftListItem$1 = (typeOrName) => ({ state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\treturn liftListItem(type)(state, dispatch);\n};\n//#endregion\n//#region src/commands/newlineInCode.ts\nconst newlineInCode$1 = () => ({ state, dispatch }) => {\n\treturn newlineInCode(state, dispatch);\n};\n//#endregion\n//#region src/helpers/getSchemaTypeNameByName.ts\n/**\n* Get the type of a schema item by its name.\n* @param name The name of the schema item\n* @param schema The Prosemiror schema to search in\n* @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist\n*/\nfunction getSchemaTypeNameByName(name, schema) {\n\tif (schema.nodes[name]) return \"node\";\n\tif (schema.marks[name]) return \"mark\";\n\treturn null;\n}\n//#endregion\n//#region src/utilities/deleteProps.ts\n/**\n* Remove a property or an array of properties from an object\n* @param obj Object\n* @param key Key to remove\n*/\nfunction deleteProps(obj, propOrProps) {\n\tconst props = typeof propOrProps === \"string\" ? [propOrProps] : propOrProps;\n\treturn Object.keys(obj).reduce((newObj, prop) => {\n\t\tif (!props.includes(prop)) newObj[prop] = obj[prop];\n\t\treturn newObj;\n\t}, {});\n}\n//#endregion\n//#region src/commands/resetAttributes.ts\nconst resetAttributes = (typeOrName, attributes) => ({ tr, state, dispatch }) => {\n\tlet nodeType = null;\n\tlet markType = null;\n\tconst schemaType = getSchemaTypeNameByName(typeof typeOrName === \"string\" ? typeOrName : typeOrName.name, state.schema);\n\tif (!schemaType) return false;\n\tif (schemaType === \"node\") nodeType = getNodeType(typeOrName, state.schema);\n\tif (schemaType === \"mark\") markType = getMarkType(typeOrName, state.schema);\n\tlet canReset = false;\n\ttr.selection.ranges.forEach((range) => {\n\t\tstate.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {\n\t\t\tif (nodeType && nodeType === node.type) {\n\t\t\t\tcanReset = true;\n\t\t\t\tif (dispatch) tr.setNodeMarkup(pos, void 0, deleteProps(node.attrs, attributes));\n\t\t\t}\n\t\t\tif (markType && node.marks.length) node.marks.forEach((mark) => {\n\t\t\t\tif (markType === mark.type) {\n\t\t\t\t\tcanReset = true;\n\t\t\t\t\tif (dispatch) tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t});\n\treturn canReset;\n};\n//#endregion\n//#region src/commands/scrollIntoView.ts\nconst scrollIntoView = () => ({ tr, dispatch }) => {\n\tif (dispatch) tr.scrollIntoView();\n\treturn true;\n};\n//#endregion\n//#region src/commands/selectAll.ts\nconst selectAll = () => ({ tr, dispatch }) => {\n\tif (dispatch) {\n\t\tconst selection = new AllSelection(tr.doc);\n\t\ttr.setSelection(selection);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/selectNodeBackward.ts\nconst selectNodeBackward$1 = () => ({ state, dispatch }) => {\n\treturn selectNodeBackward(state, dispatch);\n};\n//#endregion\n//#region src/commands/selectNodeForward.ts\nconst selectNodeForward$1 = () => ({ state, dispatch }) => {\n\treturn selectNodeForward(state, dispatch);\n};\n//#endregion\n//#region src/commands/selectParentNode.ts\nconst selectParentNode$1 = () => ({ state, dispatch }) => {\n\treturn selectParentNode(state, dispatch);\n};\n//#endregion\n//#region src/commands/selectTextblockEnd.ts\nconst selectTextblockEnd$1 = () => ({ state, dispatch }) => {\n\treturn selectTextblockEnd(state, dispatch);\n};\n//#endregion\n//#region src/commands/selectTextblockStart.ts\nconst selectTextblockStart$1 = () => ({ state, dispatch }) => {\n\treturn selectTextblockStart(state, dispatch);\n};\n//#endregion\n//#region src/helpers/createDocument.ts\n/**\n* Create a new Prosemirror document node from content.\n* @param content The JSON or HTML content to create the document from\n* @param schema The Prosemirror schema to use for the document\n* @param parseOptions Options for the parser\n* @returns The created Prosemirror document node\n*/\nfunction createDocument(content, schema, parseOptions = {}, options = {}) {\n\treturn createNodeFromContent(content, schema, {\n\t\tslice: false,\n\t\tparseOptions,\n\t\terrorOnInvalidContent: options.errorOnInvalidContent\n\t});\n}\n//#endregion\n//#region src/commands/setContent.ts\nconst setContent = (content, { errorOnInvalidContent, emitUpdate = true, parseOptions = {} } = {}) => ({ editor, tr, dispatch, commands }) => {\n\tconst { doc } = tr;\n\tif (parseOptions.preserveWhitespace !== \"full\") {\n\t\tconst document = createDocument(content, editor.schema, parseOptions, { errorOnInvalidContent: errorOnInvalidContent !== null && errorOnInvalidContent !== void 0 ? errorOnInvalidContent : editor.options.enableContentCheck });\n\t\tif (dispatch) {\n\t\t\tconst nodes = isFragment(document) ? document.content : [document];\n\t\t\ttr.replaceWith(0, doc.content.size, nodes).setMeta(\"preventUpdate\", !emitUpdate);\n\t\t}\n\t\treturn true;\n\t}\n\tif (dispatch) tr.setMeta(\"preventUpdate\", !emitUpdate);\n\treturn commands.insertContentAt({\n\t\tfrom: 0,\n\t\tto: doc.content.size\n\t}, content, {\n\t\tparseOptions,\n\t\terrorOnInvalidContent: errorOnInvalidContent !== null && errorOnInvalidContent !== void 0 ? errorOnInvalidContent : editor.options.enableContentCheck\n\t});\n};\n//#endregion\n//#region src/helpers/getMarkAttributes.ts\nfunction getMarkAttributes(state, typeOrName) {\n\tconst type = getMarkType(typeOrName, state.schema);\n\tconst { from, to, empty } = state.selection;\n\tconst marks = [];\n\tif (empty) {\n\t\tif (state.storedMarks) marks.push(...state.storedMarks);\n\t\tmarks.push(...state.selection.$head.marks());\n\t} else state.doc.nodesBetween(from, to, (node) => {\n\t\tmarks.push(...node.marks);\n\t});\n\tconst mark = marks.find((markItem) => markItem.type.name === type.name);\n\tif (!mark) return {};\n\treturn { ...mark.attrs };\n}\n//#endregion\n//#region src/helpers/combineTransactionSteps.ts\n/**\n* Returns a new `Transform` based on all steps of the passed transactions.\n* @param oldDoc The Prosemirror node to start from\n* @param transactions The transactions to combine\n* @returns A new `Transform` with all steps of the passed transactions\n*/\nfunction combineTransactionSteps(oldDoc, transactions) {\n\tconst transform = new Transform(oldDoc);\n\ttransactions.forEach((transaction) => {\n\t\ttransaction.steps.forEach((step) => {\n\t\t\ttransform.step(step);\n\t\t});\n\t});\n\treturn transform;\n}\n//#endregion\n//#region src/helpers/findChildren.ts\n/**\n* Find children inside a Prosemirror node that match a predicate.\n* @param node The Prosemirror node to search in\n* @param predicate The predicate to match\n* @returns An array of nodes with their positions\n*/\nfunction findChildren(node, predicate) {\n\tconst nodesWithPos = [];\n\tnode.descendants((child, pos) => {\n\t\tif (predicate(child)) nodesWithPos.push({\n\t\t\tnode: child,\n\t\t\tpos\n\t\t});\n\t});\n\treturn nodesWithPos;\n}\n//#endregion\n//#region src/helpers/findChildrenInRange.ts\n/**\n* Same as `findChildren` but searches only within a `range`.\n* @param node The Prosemirror node to search in\n* @param range The range to search in\n* @param predicate The predicate to match\n* @returns An array of nodes with their positions\n*/\nfunction findChildrenInRange(node, range, predicate) {\n\tconst nodesWithPos = [];\n\tnode.nodesBetween(range.from, range.to, (child, pos) => {\n\t\tif (predicate(child)) nodesWithPos.push({\n\t\t\tnode: child,\n\t\t\tpos\n\t\t});\n\t});\n\treturn nodesWithPos;\n}\n//#endregion\n//#region src/helpers/findParentNodeClosestToPos.ts\n/**\n* Finds the closest parent node to a resolved position that matches a predicate.\n* @param $pos The resolved position to search from\n* @param predicate The predicate to match\n* @returns The closest parent node to the resolved position that matches the predicate\n* @example ```js\n* findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')\n* ```\n*/\nfunction findParentNodeClosestToPos($pos, predicate) {\n\tfor (let i = $pos.depth; i > 0; i -= 1) {\n\t\tconst node = $pos.node(i);\n\t\tif (predicate(node)) return {\n\t\t\tpos: i > 0 ? $pos.before(i) : 0,\n\t\t\tstart: $pos.start(i),\n\t\t\tdepth: i,\n\t\t\tnode\n\t\t};\n\t}\n}\n//#endregion\n//#region src/helpers/findParentNode.ts\n/**\n* Finds the closest parent node to the current selection that matches a predicate.\n* @param predicate The predicate to match\n* @returns A command that finds the closest parent node to the current selection that matches the predicate\n* @example ```js\n* findParentNode(node => node.type.name === 'paragraph')\n* ```\n*/\nfunction findParentNode(predicate) {\n\treturn (selection) => findParentNodeClosestToPos(selection.$from, predicate);\n}\n//#endregion\n//#region src/helpers/getExtensionField.ts\n/**\n* Returns a field from an extension\n* @param extension The Tiptap extension\n* @param field The field, for example `renderHTML` or `priority`\n* @param context The context object that should be passed as `this` into the function\n* @returns The field value\n*/\nfunction getExtensionField(extension, field, context) {\n\tif (extension.config[field] === void 0 && extension.parent) return getExtensionField(extension.parent, field, context);\n\tif (typeof extension.config[field] === \"function\") return extension.config[field].bind({\n\t\t...context,\n\t\tparent: extension.parent ? getExtensionField(extension.parent, field, context) : null\n\t});\n\treturn extension.config[field];\n}\n//#endregion\n//#region src/helpers/flattenExtensions.ts\n/**\n* Create a flattened array of extensions by traversing the `addExtensions` field.\n* @param extensions An array of Tiptap extensions\n* @returns A flattened array of Tiptap extensions\n*/\nfunction flattenExtensions(extensions) {\n\treturn extensions.map((extension) => {\n\t\tconst addExtensions = getExtensionField(extension, \"addExtensions\", {\n\t\t\tname: extension.name,\n\t\t\toptions: extension.options,\n\t\t\tstorage: extension.storage\n\t\t});\n\t\tif (addExtensions) return [extension, ...flattenExtensions(addExtensions())];\n\t\treturn extension;\n\t}).flat(10);\n}\n//#endregion\n//#region src/helpers/getHTMLFromFragment.ts\nfunction getHTMLFromFragment(fragment, schema) {\n\tconst documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);\n\tconst container = document.implementation.createHTMLDocument().createElement(\"div\");\n\tcontainer.appendChild(documentFragment);\n\treturn container.innerHTML;\n}\n//#endregion\n//#region src/utilities/isFunction.ts\nfunction isFunction(value) {\n\treturn typeof value === \"function\";\n}\n//#endregion\n//#region src/utilities/callOrReturn.ts\n/**\n* Optionally calls `value` as a function.\n* Otherwise it is returned directly.\n* @param value Function or any value.\n* @param context Optional context to bind to function.\n* @param props Optional props to pass to function.\n*/\nfunction callOrReturn(value, context = void 0, ...props) {\n\tif (isFunction(value)) {\n\t\tif (context) return value.bind(context)(...props);\n\t\treturn value(...props);\n\t}\n\treturn value;\n}\n//#endregion\n//#region src/utilities/isEmptyObject.ts\nfunction isEmptyObject(value = {}) {\n\treturn Object.keys(value).length === 0 && value.constructor === Object;\n}\n//#endregion\n//#region src/helpers/splitExtensions.ts\nfunction splitExtensions(extensions) {\n\treturn {\n\t\tbaseExtensions: extensions.filter((extension) => extension.type === \"extension\"),\n\t\tnodeExtensions: extensions.filter((extension) => extension.type === \"node\"),\n\t\tmarkExtensions: extensions.filter((extension) => extension.type === \"mark\")\n\t};\n}\n//#endregion\n//#region src/helpers/getAttributesFromExtensions.ts\n/**\n* Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.\n* @param extensions List of extensions\n*/\nfunction getAttributesFromExtensions(extensions) {\n\tconst extensionAttributes = [];\n\tconst { nodeExtensions, markExtensions } = splitExtensions(extensions);\n\tconst nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];\n\tconst defaultAttribute = {\n\t\tdefault: null,\n\t\tvalidate: void 0,\n\t\trendered: true,\n\t\trenderHTML: null,\n\t\tparseHTML: null,\n\t\tkeepOnSplit: true,\n\t\tisRequired: false\n\t};\n\tconst nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== \"text\").map((ext) => ext.name);\n\tconst markExtensionTypes = markExtensions.map((ext) => ext.name);\n\tconst allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];\n\textensions.forEach((extension) => {\n\t\tconst addGlobalAttributes = getExtensionField(extension, \"addGlobalAttributes\", {\n\t\t\tname: extension.name,\n\t\t\toptions: extension.options,\n\t\t\tstorage: extension.storage,\n\t\t\textensions: nodeAndMarkExtensions\n\t\t});\n\t\tif (!addGlobalAttributes) return;\n\t\taddGlobalAttributes().forEach((globalAttribute) => {\n\t\t\tlet resolvedTypes;\n\t\t\tif (Array.isArray(globalAttribute.types)) resolvedTypes = globalAttribute.types;\n\t\t\telse if (globalAttribute.types === \"*\") resolvedTypes = allExtensionTypes;\n\t\t\telse if (globalAttribute.types === \"nodes\") resolvedTypes = nodeExtensionTypes;\n\t\t\telse if (globalAttribute.types === \"marks\") resolvedTypes = markExtensionTypes;\n\t\t\telse resolvedTypes = [];\n\t\t\tresolvedTypes.forEach((type) => {\n\t\t\t\tObject.entries(globalAttribute.attributes).forEach(([name, attribute]) => {\n\t\t\t\t\textensionAttributes.push({\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tattribute: {\n\t\t\t\t\t\t\t...defaultAttribute,\n\t\t\t\t\t\t\t...attribute\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\tnodeAndMarkExtensions.forEach((extension) => {\n\t\tconst addAttributes = getExtensionField(extension, \"addAttributes\", {\n\t\t\tname: extension.name,\n\t\t\toptions: extension.options,\n\t\t\tstorage: extension.storage\n\t\t});\n\t\tif (!addAttributes) return;\n\t\tconst attributes = addAttributes();\n\t\tObject.entries(attributes).forEach(([name, attribute]) => {\n\t\t\tconst mergedAttr = {\n\t\t\t\t...defaultAttribute,\n\t\t\t\t...attribute\n\t\t\t};\n\t\t\tif (typeof (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === \"function\") mergedAttr.default = mergedAttr.default();\n\t\t\tif ((mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.isRequired) && (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === void 0) delete mergedAttr.default;\n\t\t\textensionAttributes.push({\n\t\t\t\ttype: extension.name,\n\t\t\t\tname,\n\t\t\t\tattribute: mergedAttr\n\t\t\t});\n\t\t});\n\t});\n\treturn extensionAttributes;\n}\n//#endregion\n//#region src/utilities/mergeAttributes.ts\n/** Splits a CSS style string into declarations, ignoring semicolons inside quotes/parentheses. */\nfunction splitStyleDeclarations(styles) {\n\tconst result = [];\n\tlet current = \"\";\n\tlet inSingleQuote = false;\n\tlet inDoubleQuote = false;\n\tlet parenDepth = 0;\n\tconst length = styles.length;\n\tfor (let i = 0; i < length; i += 1) {\n\t\tconst char = styles[i];\n\t\tif (char === \"'\" && !inDoubleQuote) {\n\t\t\tinSingleQuote = !inSingleQuote;\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\" && !inSingleQuote) {\n\t\t\tinDoubleQuote = !inDoubleQuote;\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (!inSingleQuote && !inDoubleQuote) {\n\t\t\tif (char === \"(\") {\n\t\t\t\tparenDepth += 1;\n\t\t\t\tcurrent += char;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \")\" && parenDepth > 0) {\n\t\t\t\tparenDepth -= 1;\n\t\t\t\tcurrent += char;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === \";\" && parenDepth === 0) {\n\t\t\t\tresult.push(current);\n\t\t\t\tcurrent = \"\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tcurrent += char;\n\t}\n\tif (current) result.push(current);\n\treturn result;\n}\n/** Yields property/value pairs from a style string. */\nfunction parseStyleEntries(styles) {\n\tconst pairs = [];\n\tconst declarations = splitStyleDeclarations(styles || \"\");\n\tconst numDeclarations = declarations.length;\n\tfor (let i = 0; i < numDeclarations; i += 1) {\n\t\tconst declaration = declarations[i];\n\t\tconst firstColonIndex = declaration.indexOf(\":\");\n\t\tif (firstColonIndex === -1) continue;\n\t\tconst property = declaration.slice(0, firstColonIndex).trim();\n\t\tconst value = declaration.slice(firstColonIndex + 1).trim();\n\t\tif (property && value) pairs.push([property, value]);\n\t}\n\treturn pairs;\n}\nfunction mergeAttributes(...objects) {\n\treturn objects.filter((item) => !!item).reduce((items, item) => {\n\t\tconst mergedAttributes = { ...items };\n\t\tObject.entries(item).forEach(([key, value]) => {\n\t\t\tif (key === \"__proto__\") {\n\t\t\t\tObject.defineProperty(mergedAttributes, key, {\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tvalue,\n\t\t\t\t\twritable: true\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!mergedAttributes[key]) {\n\t\t\t\tmergedAttributes[key] = value;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (key === \"class\") {\n\t\t\t\tconst valueClasses = value ? String(value).split(\" \") : [];\n\t\t\t\tconst existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(\" \") : [];\n\t\t\t\tconst insertClasses = valueClasses.filter((valueClass) => !existingClasses.includes(valueClass));\n\t\t\t\tmergedAttributes[key] = [...existingClasses, ...insertClasses].join(\" \");\n\t\t\t} else if (key === \"style\") {\n\t\t\t\tconst styleMap = new Map([...parseStyleEntries(mergedAttributes[key]), ...parseStyleEntries(value)]);\n\t\t\t\tmergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join(\"; \");\n\t\t\t} else mergedAttributes[key] = value;\n\t\t});\n\t\treturn mergedAttributes;\n\t}, {});\n}\n//#endregion\n//#region src/helpers/getRenderedAttributes.ts\nfunction getRenderedAttributes(nodeOrMark, extensionAttributes) {\n\treturn extensionAttributes.filter((attribute) => attribute.type === nodeOrMark.type.name).filter((item) => item.attribute.rendered).map((item) => {\n\t\tif (!item.attribute.renderHTML) return { [item.name]: nodeOrMark.attrs[item.name] };\n\t\treturn item.attribute.renderHTML(nodeOrMark.attrs) || {};\n\t}).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\n//#endregion\n//#region src/utilities/fromString.ts\nfunction fromString(value) {\n\tif (typeof value !== \"string\") return value;\n\tif (value.match(/^[+-]?(?:\\d*\\.)?\\d+$/)) return Number(value);\n\tif (value === \"true\") return true;\n\tif (value === \"false\") return false;\n\treturn value;\n}\n//#endregion\n//#region src/helpers/injectExtensionAttributesToParseRule.ts\n/**\n* This function merges extension attributes into parserule attributes (`attrs` or `getAttrs`).\n* Cancels when `getAttrs` returned `false`.\n* @param parseRule ProseMirror ParseRule\n* @param extensionAttributes List of attributes to inject\n*/\nfunction injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {\n\tif (\"style\" in parseRule) return parseRule;\n\treturn {\n\t\t...parseRule,\n\t\tgetAttrs: (node) => {\n\t\t\tconst oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;\n\t\t\tif (oldAttributes === false) return false;\n\t\t\tconst newAttributes = extensionAttributes.reduce((items, item) => {\n\t\t\t\tconst value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));\n\t\t\t\tif (value === null || value === void 0) return items;\n\t\t\t\treturn {\n\t\t\t\t\t...items,\n\t\t\t\t\t[item.name]: value\n\t\t\t\t};\n\t\t\t}, {});\n\t\t\treturn {\n\t\t\t\t...oldAttributes,\n\t\t\t\t...newAttributes\n\t\t\t};\n\t\t}\n\t};\n}\n//#endregion\n//#region src/helpers/getSchemaByResolvedExtensions.ts\nfunction cleanUpSchemaItem(data) {\n\treturn Object.fromEntries(Object.entries(data).filter(([key, value]) => {\n\t\tif (key === \"attrs\" && isEmptyObject(value)) return false;\n\t\treturn value !== null && value !== void 0;\n\t}));\n}\n/**\n* Builds an attribute spec tuple for ProseMirror schema from an extension attribute.\n* @param extensionAttribute The extension attribute to build the spec for\n* @returns A tuple of [attributeName, spec]\n*/\nfunction buildAttributeSpec(extensionAttribute) {\n\tvar _extensionAttribute$a, _extensionAttribute$a2;\n\tconst spec = {};\n\tif (!(extensionAttribute === null || extensionAttribute === void 0 || (_extensionAttribute$a = extensionAttribute.attribute) === null || _extensionAttribute$a === void 0 ? void 0 : _extensionAttribute$a.isRequired) && \"default\" in ((extensionAttribute === null || extensionAttribute === void 0 ? void 0 : extensionAttribute.attribute) || {})) spec.default = extensionAttribute.attribute.default;\n\tif ((extensionAttribute === null || extensionAttribute === void 0 || (_extensionAttribute$a2 = extensionAttribute.attribute) === null || _extensionAttribute$a2 === void 0 ? void 0 : _extensionAttribute$a2.validate) !== void 0) spec.validate = extensionAttribute.attribute.validate;\n\treturn [extensionAttribute.name, spec];\n}\n/**\n* Creates a new Prosemirror schema based on the given extensions.\n* @param extensions An array of Tiptap extensions\n* @param editor The editor instance\n* @returns A Prosemirror schema\n*/\nfunction getSchemaByResolvedExtensions(extensions, editor) {\n\tvar _nodeExtensions$find;\n\tconst allAttributes = getAttributesFromExtensions(extensions);\n\tconst { nodeExtensions, markExtensions } = splitExtensions(extensions);\n\tconst topNode = (_nodeExtensions$find = nodeExtensions.find((extension) => getExtensionField(extension, \"topNode\"))) === null || _nodeExtensions$find === void 0 ? void 0 : _nodeExtensions$find.name;\n\tconst nodes = Object.fromEntries(nodeExtensions.map((extension) => {\n\t\tconst extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);\n\t\tconst context = {\n\t\t\tname: extension.name,\n\t\t\toptions: extension.options,\n\t\t\tstorage: extension.storage,\n\t\t\teditor\n\t\t};\n\t\tconst schema = cleanUpSchemaItem({\n\t\t\t...extensions.reduce((fields, e) => {\n\t\t\t\tconst extendNodeSchema = getExtensionField(e, \"extendNodeSchema\", context);\n\t\t\t\treturn {\n\t\t\t\t\t...fields,\n\t\t\t\t\t...extendNodeSchema ? extendNodeSchema(extension) : {}\n\t\t\t\t};\n\t\t\t}, {}),\n\t\t\tcontent: callOrReturn(getExtensionField(extension, \"content\", context)),\n\t\t\tmarks: callOrReturn(getExtensionField(extension, \"marks\", context)),\n\t\t\tgroup: callOrReturn(getExtensionField(extension, \"group\", context)),\n\t\t\tinline: callOrReturn(getExtensionField(extension, \"inline\", context)),\n\t\t\tatom: callOrReturn(getExtensionField(extension, \"atom\", context)),\n\t\t\tselectable: callOrReturn(getExtensionField(extension, \"selectable\", context)),\n\t\t\tdraggable: callOrReturn(getExtensionField(extension, \"draggable\", context)),\n\t\t\tcode: callOrReturn(getExtensionField(extension, \"code\", context)),\n\t\t\twhitespace: callOrReturn(getExtensionField(extension, \"whitespace\", context)),\n\t\t\tlinebreakReplacement: callOrReturn(getExtensionField(extension, \"linebreakReplacement\", context)),\n\t\t\tdefining: callOrReturn(getExtensionField(extension, \"defining\", context)),\n\t\t\tisolating: callOrReturn(getExtensionField(extension, \"isolating\", context)),\n\t\t\tattrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))\n\t\t});\n\t\tconst parseHTML = callOrReturn(getExtensionField(extension, \"parseHTML\", context));\n\t\tif (parseHTML) schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));\n\t\tconst renderHTML = getExtensionField(extension, \"renderHTML\", context);\n\t\tif (renderHTML) schema.toDOM = (node) => renderHTML({\n\t\t\tnode,\n\t\t\tHTMLAttributes: getRenderedAttributes(node, extensionAttributes)\n\t\t});\n\t\tconst renderText = getExtensionField(extension, \"renderText\", context);\n\t\tif (renderText) schema.toText = renderText;\n\t\treturn [extension.name, schema];\n\t}));\n\tconst marks = Object.fromEntries(markExtensions.map((extension) => {\n\t\tconst extensionAttributes = allAttributes.filter((attribute) => attribute.type === extension.name);\n\t\tconst context = {\n\t\t\tname: extension.name,\n\t\t\toptions: extension.options,\n\t\t\tstorage: extension.storage,\n\t\t\teditor\n\t\t};\n\t\tconst schema = cleanUpSchemaItem({\n\t\t\t...extensions.reduce((fields, e) => {\n\t\t\t\tconst extendMarkSchema = getExtensionField(e, \"extendMarkSchema\", context);\n\t\t\t\treturn {\n\t\t\t\t\t...fields,\n\t\t\t\t\t...extendMarkSchema ? extendMarkSchema(extension) : {}\n\t\t\t\t};\n\t\t\t}, {}),\n\t\t\tinclusive: callOrReturn(getExtensionField(extension, \"inclusive\", context)),\n\t\t\texcludes: callOrReturn(getExtensionField(extension, \"excludes\", context)),\n\t\t\tgroup: callOrReturn(getExtensionField(extension, \"group\", context)),\n\t\t\tspanning: callOrReturn(getExtensionField(extension, \"spanning\", context)),\n\t\t\tcode: callOrReturn(getExtensionField(extension, \"code\", context)),\n\t\t\tattrs: Object.fromEntries(extensionAttributes.map(buildAttributeSpec))\n\t\t});\n\t\tconst parseHTML = callOrReturn(getExtensionField(extension, \"parseHTML\", context));\n\t\tif (parseHTML) schema.parseDOM = parseHTML.map((parseRule) => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));\n\t\tconst renderHTML = getExtensionField(extension, \"renderHTML\", context);\n\t\tif (renderHTML) schema.toDOM = (mark) => renderHTML({\n\t\t\tmark,\n\t\t\tHTMLAttributes: getRenderedAttributes(mark, extensionAttributes)\n\t\t});\n\t\treturn [extension.name, schema];\n\t}));\n\treturn new Schema({\n\t\ttopNode,\n\t\tnodes,\n\t\tmarks\n\t});\n}\n//#endregion\n//#region src/utilities/findDuplicates.ts\n/**\n* Find duplicates in an array.\n*/\nfunction findDuplicates(items) {\n\tconst filtered = items.filter((el, index) => items.indexOf(el) !== index);\n\treturn Array.from(new Set(filtered));\n}\n//#endregion\n//#region src/helpers/sortExtensions.ts\n/**\n* Sort extensions by priority.\n* @param extensions An array of Tiptap extensions\n* @returns A sorted array of Tiptap extensions by priority\n*/\nfunction sortExtensions(extensions) {\n\tconst defaultPriority = 100;\n\treturn extensions.sort((a, b) => {\n\t\tconst priorityA = getExtensionField(a, \"priority\") || defaultPriority;\n\t\tconst priorityB = getExtensionField(b, \"priority\") || defaultPriority;\n\t\tif (priorityA > priorityB) return -1;\n\t\tif (priorityA < priorityB) return 1;\n\t\treturn 0;\n\t});\n}\n//#endregion\n//#region src/helpers/resolveExtensions.ts\n/**\n* Returns a flattened and sorted extension list while\n* also checking for duplicated extensions and warns the user.\n* @param extensions An array of Tiptap extensions\n* @returns An flattened and sorted array of Tiptap extensions\n*/\nfunction resolveExtensions(extensions) {\n\tconst resolvedExtensions = sortExtensions(flattenExtensions(extensions));\n\tconst duplicatedNames = findDuplicates(resolvedExtensions.map((extension) => extension.name));\n\tif (duplicatedNames.length) console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map((item) => `'${item}'`).join(\", \")}]. This can lead to issues.`);\n\treturn resolvedExtensions;\n}\n//#endregion\n//#region src/helpers/getSchema.ts\nfunction getSchema(extensions, editor) {\n\treturn getSchemaByResolvedExtensions(resolveExtensions(extensions), editor);\n}\n//#endregion\n//#region src/helpers/generateHTML.ts\n/**\n* Generate HTML from a JSONContent\n* @param doc The JSONContent to generate HTML from\n* @param extensions The extensions to use for the schema\n* @returns The generated HTML\n*/\nfunction generateHTML(doc, extensions) {\n\tconst schema = getSchema(extensions);\n\treturn getHTMLFromFragment(Node$1.fromJSON(schema, doc).content, schema);\n}\n//#endregion\n//#region src/helpers/generateJSON.ts\n/**\n* Generate JSONContent from HTML\n* @param html The HTML to generate JSONContent from\n* @param extensions The extensions to use for the schema\n* @returns The generated JSONContent\n*/\nfunction generateJSON(html, extensions) {\n\tconst schema = getSchema(extensions);\n\tconst dom = elementFromString(html);\n\treturn DOMParser.fromSchema(schema).parse(dom).toJSON();\n}\n//#endregion\n//#region src/helpers/getTextBetween.ts\n/**\n* Gets the text between two positions in a Prosemirror node\n* and serializes it using the given text serializers and block separator (see getText)\n* @param startNode The Prosemirror node to start from\n* @param range The range of the text to get\n* @param options Options for the text serializer & block separator\n* @returns The text between the two positions\n*/\nfunction getTextBetween(startNode, range, options) {\n\tconst { from, to } = range;\n\tconst { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n\tlet text = \"\";\n\tstartNode.nodesBetween(from, to, (node, pos, parent, index) => {\n\t\tif (node.isBlock && pos > from) text += blockSeparator;\n\t\tconst textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];\n\t\tif (textSerializer) {\n\t\t\tif (parent) text += textSerializer({\n\t\t\t\tnode,\n\t\t\t\tpos,\n\t\t\t\tparent,\n\t\t\t\tindex,\n\t\t\t\trange\n\t\t\t});\n\t\t\treturn false;\n\t\t}\n\t\tif (node.isText) {\n\t\t\tvar _node$text;\n\t\t\ttext += node === null || node === void 0 || (_node$text = node.text) === null || _node$text === void 0 ? void 0 : _node$text.slice(Math.max(from, pos) - pos, to - pos);\n\t\t}\n\t});\n\treturn text;\n}\n//#endregion\n//#region src/helpers/getText.ts\n/**\n* Gets the text of a Prosemirror node\n* @param node The Prosemirror node\n* @param options Options for the text serializer & block separator\n* @returns The text of the node\n* @example ```js\n* const text = getText(node, { blockSeparator: '\\n' })\n* ```\n*/\nfunction getText(node, options) {\n\treturn getTextBetween(node, {\n\t\tfrom: 0,\n\t\tto: node.content.size\n\t}, options);\n}\n//#endregion\n//#region src/helpers/getTextSerializersFromSchema.ts\n/**\n* Find text serializers `toText` in a Prosemirror schema\n* @param schema The Prosemirror schema to search in\n* @returns A record of text serializers by node name\n*/\nfunction getTextSerializersFromSchema(schema) {\n\treturn Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));\n}\n//#endregion\n//#region src/helpers/generateText.ts\n/**\n* Generate raw text from a JSONContent\n* @param doc The JSONContent to generate text from\n* @param extensions The extensions to use for the schema\n* @param options Options for the text generation f.e. blockSeparator or textSerializers\n* @returns The generated text\n*/\nfunction generateText(doc, extensions, options) {\n\tconst { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n\tconst schema = getSchema(extensions);\n\treturn getText(Node$1.fromJSON(schema, doc), {\n\t\tblockSeparator,\n\t\ttextSerializers: {\n\t\t\t...getTextSerializersFromSchema(schema),\n\t\t\t...textSerializers\n\t\t}\n\t});\n}\n//#endregion\n//#region src/helpers/getNodeAttributes.ts\nfunction getNodeAttributes(state, typeOrName) {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tconst { from, to } = state.selection;\n\tconst nodes = [];\n\tstate.doc.nodesBetween(from, to, (node) => {\n\t\tnodes.push(node);\n\t});\n\tconst node = nodes.reverse().find((nodeItem) => nodeItem.type.name === type.name);\n\tif (!node) return {};\n\treturn { ...node.attrs };\n}\n//#endregion\n//#region src/helpers/getAttributes.ts\n/**\n* Get node or mark attributes by type or name on the current editor state\n* @param state The current editor state\n* @param typeOrName The node or mark type or name\n* @returns The attributes of the node or mark or an empty object\n*/\nfunction getAttributes(state, typeOrName) {\n\tconst schemaType = getSchemaTypeNameByName(typeof typeOrName === \"string\" ? typeOrName : typeOrName.name, state.schema);\n\tif (schemaType === \"node\") return getNodeAttributes(state, typeOrName);\n\tif (schemaType === \"mark\") return getMarkAttributes(state, typeOrName);\n\treturn {};\n}\n//#endregion\n//#region src/utilities/removeDuplicates.ts\n/**\n* Removes duplicated values within an array.\n* Supports numbers, strings and objects.\n*/\nfunction removeDuplicates(array, by = JSON.stringify) {\n\tconst seen = {};\n\treturn array.filter((item) => {\n\t\tconst key = by(item);\n\t\treturn Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;\n\t});\n}\n//#endregion\n//#region src/helpers/getChangedRanges.ts\n/**\n* Removes duplicated ranges and ranges that are\n* fully captured by other ranges.\n*/\nfunction simplifyChangedRanges(changes) {\n\tconst uniqueChanges = removeDuplicates(changes);\n\treturn uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {\n\t\treturn !uniqueChanges.filter((_, i) => i !== index).some((otherChange) => {\n\t\t\treturn change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;\n\t\t});\n\t});\n}\n/**\n* Returns a list of changed ranges\n* based on the first and last state of all steps.\n*/\nfunction getChangedRanges(transform) {\n\tconst { mapping, steps } = transform;\n\tconst changes = [];\n\tmapping.maps.forEach((stepMap, index) => {\n\t\tconst ranges = [];\n\t\tif (!stepMap.ranges.length) {\n\t\t\tconst { from, to } = steps[index];\n\t\t\tif (from === void 0 || to === void 0) return;\n\t\t\tranges.push({\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t});\n\t\t} else stepMap.forEach((from, to) => {\n\t\t\tranges.push({\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t});\n\t\t});\n\t\tranges.forEach(({ from, to }) => {\n\t\t\tconst newStart = mapping.slice(index).map(from, -1);\n\t\t\tconst newEnd = mapping.slice(index).map(to);\n\t\t\tconst oldStart = mapping.invert().map(newStart, -1);\n\t\t\tconst oldEnd = mapping.invert().map(newEnd);\n\t\t\tchanges.push({\n\t\t\t\toldRange: {\n\t\t\t\t\tfrom: oldStart,\n\t\t\t\t\tto: oldEnd\n\t\t\t\t},\n\t\t\t\tnewRange: {\n\t\t\t\t\tfrom: newStart,\n\t\t\t\t\tto: newEnd\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t});\n\treturn simplifyChangedRanges(changes);\n}\n//#endregion\n//#region src/helpers/getDebugJSON.ts\nfunction getDebugJSON(node, startOffset = 0) {\n\tconst increment = node.type === node.type.schema.topNodeType ? 0 : 1;\n\tconst from = startOffset;\n\tconst to = from + node.nodeSize;\n\tconst marks = node.marks.map((mark) => {\n\t\tconst output = { type: mark.type.name };\n\t\tif (Object.keys(mark.attrs).length) output.attrs = { ...mark.attrs };\n\t\treturn output;\n\t});\n\tconst attrs = { ...node.attrs };\n\tconst output = {\n\t\ttype: node.type.name,\n\t\tfrom,\n\t\tto\n\t};\n\tif (Object.keys(attrs).length) output.attrs = attrs;\n\tif (marks.length) output.marks = marks;\n\tif (node.content.childCount) {\n\t\toutput.content = [];\n\t\tnode.forEach((child, offset) => {\n\t\t\tvar _output$content;\n\t\t\t(_output$content = output.content) === null || _output$content === void 0 || _output$content.push(getDebugJSON(child, startOffset + offset + increment));\n\t\t});\n\t}\n\tif (node.text) output.text = node.text;\n\treturn output;\n}\n//#endregion\n//#region src/helpers/getMarksBetween.ts\nfunction getMarksBetween(from, to, doc) {\n\tconst marks = [];\n\tif (from === to) doc.resolve(from).marks().forEach((mark) => {\n\t\tconst range = getMarkRange(doc.resolve(from), mark.type);\n\t\tif (!range) return;\n\t\tmarks.push({\n\t\t\tmark,\n\t\t\t...range\n\t\t});\n\t});\n\telse doc.nodesBetween(from, to, (node, pos) => {\n\t\tif (!node || (node === null || node === void 0 ? void 0 : node.nodeSize) === void 0) return;\n\t\tmarks.push(...node.marks.map((mark) => ({\n\t\t\tfrom: pos,\n\t\t\tto: pos + node.nodeSize,\n\t\t\tmark\n\t\t})));\n\t});\n\treturn marks;\n}\n//#endregion\n//#region src/helpers/getNodeAtPosition.ts\n/**\n* Finds the first node of a given type or name in the current selection.\n* @param state The editor state.\n* @param typeOrName The node type or name.\n* @param pos The position to start searching from.\n* @param maxDepth The maximum depth to search.\n* @returns The node and the depth as an array.\n*/\nconst getNodeAtPosition = (state, typeOrName, pos, maxDepth = 20) => {\n\tconst $pos = state.doc.resolve(pos);\n\tlet currentDepth = maxDepth;\n\tlet node = null;\n\twhile (currentDepth > 0 && node === null) {\n\t\tconst currentNode = $pos.node(currentDepth);\n\t\tif ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type.name) === typeOrName) node = currentNode;\n\t\telse currentDepth -= 1;\n\t}\n\treturn [node, currentDepth];\n};\n//#endregion\n//#region src/helpers/getPreviousBlockSibling.ts\n/**\n* Returns the block-level sibling immediately before the cursor's textblock\n* (or null when the cursor is at the first child of its block parent).\n*\n* The position does not have to sit inside a textblock: for any resolved\n* position, the result is the sibling immediately before `$pos.parent`. At a\n* GapCursor position this is the sibling before the whole container, not the\n* node before the gap.\n*\n* @param $pos The resolved position to look around\n* @returns The previous block-level sibling, or null\n* @example ```js\n* // Cursor in a top-level paragraph after a list:\n* // <ul><li>A</li></ul><p>|B</p>\n* getPreviousBlockSibling($from) // <ul>\n*\n* // Cursor in the second paragraph of a list item:\n* // <ul><li><p>A</p><p>|B</p></li></ul>\n* getPreviousBlockSibling($from) // <p>A</p>\n*\n* // Cursor in the first child of its block parent:\n* // <doc><p>|A</p></doc>\n* getPreviousBlockSibling($from) // null\n* ```\n*/\nconst getPreviousBlockSibling = ($pos) => {\n\tconst parentDepth = $pos.depth - 1;\n\tif (parentDepth < 0) return null;\n\tconst index = $pos.index(parentDepth);\n\tif (index === 0) return null;\n\treturn $pos.node(parentDepth).child(index - 1);\n};\n//#endregion\n//#region src/helpers/getSchemaTypeByName.ts\n/**\n* Tries to get a node or mark type by its name.\n* @param name The name of the node or mark type\n* @param schema The Prosemiror schema to search in\n* @returns The node or mark type, or null if it doesn't exist\n*/\nfunction getSchemaTypeByName(name, schema) {\n\treturn schema.nodes[name] || schema.marks[name] || null;\n}\n//#endregion\n//#region src/helpers/getSplittedAttributes.ts\n/**\n* Return attributes of an extension that should be splitted by keepOnSplit flag\n* @param extensionAttributes Array of extension attributes\n* @param typeName The type of the extension\n* @param attributes The attributes of the extension\n* @returns The splitted attributes\n*/\nfunction getSplittedAttributes(extensionAttributes, typeName, attributes) {\n\treturn Object.fromEntries(Object.entries(attributes).filter(([name]) => {\n\t\tconst extensionAttribute = extensionAttributes.find((item) => {\n\t\t\treturn item.type === typeName && item.name === name;\n\t\t});\n\t\tif (!extensionAttribute) return false;\n\t\treturn extensionAttribute.attribute.keepOnSplit;\n\t}));\n}\n//#endregion\n//#region src/helpers/getTextContentFromNodes.ts\n/**\n* Returns the text content of a resolved prosemirror position\n* @param $from The resolved position to get the text content from\n* @param maxMatch The maximum number of characters to match\n* @returns The text content\n*/\nconst getTextContentFromNodes = ($from, maxMatch = 500) => {\n\tlet textBefore = \"\";\n\tconst sliceEndPos = $from.parentOffset;\n\t$from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {\n\t\tvar _node$type$spec$toTex, _node$type$spec;\n\t\tconst chunk = ((_node$type$spec$toTex = (_node$type$spec = node.type.spec).toText) === null || _node$type$spec$toTex === void 0 ? void 0 : _node$type$spec$toTex.call(_node$type$spec, {\n\t\t\tnode,\n\t\t\tpos,\n\t\t\tparent,\n\t\t\tindex\n\t\t})) || node.textContent || \"%leaf%\";\n\t\ttextBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));\n\t});\n\treturn textBefore;\n};\n//#endregion\n//#region src/helpers/isMarkActive.ts\nfunction isMarkActive(state, typeOrName, attributes = {}) {\n\tconst { empty, ranges } = state.selection;\n\tconst type = typeOrName ? getMarkType(typeOrName, state.schema) : null;\n\tif (empty) return !!(state.storedMarks || state.selection.$from.marks()).filter((mark) => {\n\t\tif (!type) return true;\n\t\treturn type.name === mark.type.name;\n\t}).find((mark) => objectIncludes(mark.attrs, attributes, { strict: false }));\n\tlet selectionRange = 0;\n\tconst markRanges = [];\n\tranges.forEach(({ $from, $to }) => {\n\t\tconst from = $from.pos;\n\t\tconst to = $to.pos;\n\t\tstate.doc.nodesBetween(from, to, (node, pos) => {\n\t\t\tif (type && node.inlineContent && !node.type.allowsMarkType(type)) return false;\n\t\t\tif (!node.isText && !node.marks.length) return;\n\t\t\tconst relativeFrom = Math.max(from, pos);\n\t\t\tconst relativeTo = Math.min(to, pos + node.nodeSize);\n\t\t\tconst range = relativeTo - relativeFrom;\n\t\t\tselectionRange += range;\n\t\t\tmarkRanges.push(...node.marks.map((mark) => ({\n\t\t\t\tmark,\n\t\t\t\tfrom: relativeFrom,\n\t\t\t\tto: relativeTo\n\t\t\t})));\n\t\t});\n\t});\n\tif (selectionRange === 0) return false;\n\tconst matchedRange = markRanges.filter((markRange) => {\n\t\tif (!type) return true;\n\t\treturn type.name === markRange.mark.type.name;\n\t}).filter((markRange) => objectIncludes(markRange.mark.attrs, attributes, { strict: false })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n\tconst excludedRange = markRanges.filter((markRange) => {\n\t\tif (!type) return true;\n\t\treturn markRange.mark.type !== type && markRange.mark.type.excludes(type);\n\t}).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n\treturn (matchedRange > 0 ? matchedRange + excludedRange : matchedRange) >= selectionRange;\n}\n//#endregion\n//#region src/helpers/isActive.ts\nfunction isActive(state, name, attributes = {}) {\n\tif (!name) return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);\n\tconst schemaType = getSchemaTypeNameByName(name, state.schema);\n\tif (schemaType === \"node\") return isNodeActive(state, name, attributes);\n\tif (schemaType === \"mark\") return isMarkActive(state, name, attributes);\n\treturn false;\n}\n//#endregion\n//#region src/helpers/isAtEndOfNode.ts\nconst isAtEndOfNode = (state, nodeType) => {\n\tconst { $from, $to, $anchor } = state.selection;\n\tif (nodeType) {\n\t\tconst parentNode = findParentNode((node) => node.type.name === nodeType)(state.selection);\n\t\tif (!parentNode) return false;\n\t\tconst $parentPos = state.doc.resolve(parentNode.pos + 1);\n\t\tif ($anchor.pos + 1 === $parentPos.end()) return true;\n\t\treturn false;\n\t}\n\tif ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) return false;\n\treturn true;\n};\n//#endregion\n//#region src/helpers/isAtStartOfNode.ts\nconst isAtStartOfNode = (state) => {\n\tconst { $from, $to } = state.selection;\n\tif ($from.parentOffset > 0 || $from.pos !== $to.pos) return false;\n\treturn true;\n};\n//#endregion\n//#region src/helpers/isExtensionRulesEnabled.ts\nfunction isExtensionRulesEnabled(extension, enabled) {\n\tif (Array.isArray(enabled)) return enabled.some((enabledExtension) => {\n\t\treturn (typeof enabledExtension === \"string\" ? enabledExtension : enabledExtension.name) === extension.name;\n\t});\n\treturn enabled;\n}\n//#endregion\n//#region src/helpers/isList.ts\nfunction isList(name, extensions) {\n\tconst { nodeExtensions } = splitExtensions(extensions);\n\tconst extension = nodeExtensions.find((item) => item.name === name);\n\tif (!extension) return false;\n\tconst group = callOrReturn(getExtensionField(extension, \"group\", {\n\t\tname: extension.name,\n\t\toptions: extension.options,\n\t\tstorage: extension.storage\n\t}));\n\tif (typeof group !== \"string\") return false;\n\treturn group.split(\" \").includes(\"list\");\n}\n//#endregion\n//#region src/helpers/isNodeEmpty.ts\n/**\n* Returns true if the given prosemirror node is empty.\n*/\nfunction isNodeEmpty(node, { checkChildren = true, ignoreWhitespace = false } = {}) {\n\tif (ignoreWhitespace) {\n\t\tif (node.type.name === \"hardBreak\") return true;\n\t\tif (node.isText) {\n\t\t\tvar _node$text;\n\t\t\treturn !/\\S/.test((_node$text = node.text) !== null && _node$text !== void 0 ? _node$text : \"\");\n\t\t}\n\t}\n\tif (node.isText) return !node.text;\n\tif (node.isAtom || node.isLeaf) return false;\n\tif (node.content.childCount === 0) return true;\n\tif (checkChildren) {\n\t\tlet isContentEmpty = true;\n\t\tnode.content.forEach((childNode) => {\n\t\t\tif (isContentEmpty === false) return;\n\t\t\tif (!isNodeEmpty(childNode, {\n\t\t\t\tignoreWhitespace,\n\t\t\t\tcheckChildren\n\t\t\t})) isContentEmpty = false;\n\t\t});\n\t\treturn isContentEmpty;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/helpers/isNodeSelection.ts\nfunction isNodeSelection(value) {\n\treturn value instanceof NodeSelection;\n}\n//#endregion\n//#region src/helpers/isNodeViewSelected.ts\n/**\n* Determines whether a node view should be considered selected for the given\n* editor selection.\n*\n* A node is considered selected when the current selection fully covers it\n* (e.g. a `NodeSelection`). When `selectedOnTextSelection` is enabled, the\n* node is additionally considered selected if a `TextSelection` is fully\n* contained within the node's range.\n*\n* @param selection The current editor selection.\n* @param pos The start position of the node in the document.\n* @param nodeSize The size of the node.\n* @param selectedOnTextSelection When `true`, also treat selections inside the node as selected.\n* @returns `true` if the node view should render as selected.\n*/\nfunction isNodeViewSelected({ selection, pos, nodeSize, selectedOnTextSelection = false }) {\n\tconst { from, to } = selection;\n\tif (from <= pos && to >= pos + nodeSize) return true;\n\tif (selectedOnTextSelection && isTextSelection(selection) && from > pos && to < pos + nodeSize) return true;\n\treturn false;\n}\n//#endregion\n//#region src/helpers/isProseMirrorStep.ts\n/**\n* Checks if a value is a ProseMirror step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror Step\n* @example ```js\n* isProseMirrorStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (typeof step.apply !== \"function\" || typeof step.getMap !== \"function\" || typeof step.invert !== \"function\" || typeof step.map !== \"function\" || typeof step.merge !== \"function\" || typeof step.toJSON !== \"function\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorAddMarkStep.ts\n/**\n* Checks if a value is a ProseMirror add mark step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror AddMarkStep\n* @example ```js\n* isProseMirrorAddMarkStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorAddMarkStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"addMark\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorAddNodeMarkStep.ts\n/**\n* Checks if a value is a ProseMirror add node mark step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror AddNodeMarkStep\n* @example ```js\n* isProseMirrorAddNodeMarkStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorAddNodeMarkStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"addNodeMark\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorAttrStep.ts\n/**\n* Checks if a value is a ProseMirror attribute step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror AttrStep\n* @example ```js\n* isProseMirrorAttrStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorAttrStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"attr\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorCellSelection.ts\n/**\n* Check whether a selection provides the cell-iteration API.\n*\n* @param selection - Selection to inspect.\n* @returns Whether the selection is a table cell selection.\n* @example ```js\n* isProseMirrorCellSelection(editor.state.selection)\n* ```\n*/\nfunction isProseMirrorCellSelection(selection) {\n\tif (selection === null || typeof selection !== \"object\") return false;\n\treturn \"forEachCell\" in selection && typeof selection.forEachCell === \"function\";\n}\n//#endregion\n//#region src/helpers/isProseMirrorDocAttrStep.ts\n/**\n* Checks if a value is a ProseMirror document attribute step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror DocAttrStep\n* @example ```js\n* isProseMirrorDocAttrStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorDocAttrStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"docAttr\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorFragment.ts\n/**\n* Checks if a value is a ProseMirror fragment by inspecting it\n* @param value The value to check\n* @returns - A boolean, if true the value is a ProseMirror fragment\n* @example ```js\n* isProseMirrorFragment(editor.state.doc.content)\n* ```\n*/\nfunction isProseMirrorFragment(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst fragment = value;\n\tif (!Array.isArray(fragment.content) || typeof fragment.size !== \"number\" || typeof fragment.nodesBetween !== \"function\" || typeof fragment.descendants !== \"function\" || typeof fragment.textBetween !== \"function\" || typeof fragment.append !== \"function\" || typeof fragment.cut !== \"function\" || typeof fragment.eq !== \"function\" || typeof fragment.child !== \"function\" || typeof fragment.forEach !== \"function\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorNodeSelection.ts\n/**\n* Check whether a selection exposes a selected node.\n*\n* @param selection - Selection to inspect.\n* @returns Whether the selection is a node selection.\n* @example ```js\n* isProseMirrorNodeSelection(editor.state.selection)\n* ```\n*/\nfunction isProseMirrorNodeSelection(selection) {\n\tif (selection === null || typeof selection !== \"object\") return false;\n\treturn \"node\" in selection && selection.node != null;\n}\n//#endregion\n//#region src/helpers/isProseMirrorRemoveMarkStep.ts\n/**\n* Checks if a value is a ProseMirror remove mark step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror RemoveMarkStep\n* @example ```js\n* isProseMirrorRemoveMarkStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorRemoveMarkStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"removeMark\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorRemoveNodeMarkStep.ts\n/**\n* Checks if a value is a ProseMirror remove node mark step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror RemoveNodeMarkStep\n* @example ```js\n* isProseMirrorRemoveNodeMarkStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorRemoveNodeMarkStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"removeNodeMark\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorReplaceAroundStep.ts\n/**\n* Checks if a value is a ProseMirror replace around step\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror ReplaceAroundStep\n* @example ```js\n* isProseMirrorReplaceAroundStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorReplaceAroundStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"replaceAround\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorReplaceStep.ts\n/**\n* Checks if a value is a ProseMirror replace step result\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror ReplaceStep\n* @example ```js\n* isProseMirrorReplaceStep(transaction.steps[0])\n* ```\n*/\nfunction isProseMirrorReplaceStep(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst step = value;\n\tif (!isProseMirrorStep(step)) return false;\n\tconst json = step.toJSON();\n\tif (json === null || typeof json !== \"object\" || json.stepType !== \"replace\") return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorSlice.ts\n/**\n* Checks if a value is a ProseMirror slice by inspecting it\n* @param value The value to check\n* @returns - A boolean, if true the value is a ProseMirror slice\n* @example ```js\n* isProseMirrorSlice(editor.state.doc.content.slice(0, 10))\n* ```\n*/\nfunction isProseMirrorSlice(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst slice = value;\n\tconst openStartIsNumber = Number.isInteger(slice.openStart) && slice.openStart >= 0;\n\tconst openEndIsNumber = Number.isInteger(slice.openEnd) && slice.openEnd >= 0;\n\tconst sliceHasRequiredProperties = typeof slice.size === \"number\" && typeof slice.eq === \"function\" && typeof slice.toJSON === \"function\";\n\tif (!openStartIsNumber || !openEndIsNumber || !sliceHasRequiredProperties) return false;\n\tconst content = slice.content;\n\tif (content === null || typeof content !== \"object\") return false;\n\tif (!isProseMirrorFragment(content)) return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/isProseMirrorStepResult.ts\n/**\n* Checks if a value is a ProseMirror step result\n* @param value The value to check\n* @returns - A boolean, if the boolean is true the value is a ProseMirror StepResult\n* @example ```js\n* isProseMirrorStepResult(step.apply(editor.state.doc))\n* ```\n*/\nfunction isProseMirrorStepResult(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst result = value;\n\tconst isValidDoc = result.doc !== null && typeof result.doc === \"object\" && result.failed === null;\n\tconst isValidFailed = typeof result.failed === \"string\" && result.doc === null;\n\tif (!isValidDoc && !isValidFailed) return false;\n\treturn true;\n}\n//#endregion\n//#region src/helpers/MappablePosition.ts\n/**\n* A class that represents a mappable position in the editor. It can be extended\n* by other extensions to add additional position mapping capabilities.\n*/\nvar MappablePosition = class MappablePosition {\n\tconstructor(position) {\n\t\tthis.position = position;\n\t}\n\t/**\n\t* Creates a MappablePosition from a JSON object.\n\t*/\n\tstatic fromJSON(json) {\n\t\treturn new MappablePosition(json.position);\n\t}\n\t/**\n\t* Converts the MappablePosition to a JSON object.\n\t*/\n\ttoJSON() {\n\t\treturn { position: this.position };\n\t}\n};\n/**\n* Calculates the new position after applying a transaction.\n*\n* @returns The new mappable position and the map result.\n*/\nfunction getUpdatedPosition(position, transaction) {\n\tconst mapResult = transaction.mapping.mapResult(position.position);\n\treturn {\n\t\tposition: new MappablePosition(mapResult.pos),\n\t\tmapResult\n\t};\n}\n/**\n* Creates a MappablePosition from a position number. This is the default\n* implementation for Tiptap core. It can be overridden by other Tiptap\n* extensions.\n*\n* @param position The position (as a number) where the MappablePosition will be created.\n* @returns A new MappablePosition instance at the given position.\n*/\nfunction createMappablePosition(position) {\n\treturn new MappablePosition(position);\n}\n//#endregion\n//#region src/helpers/posToDOMRect.ts\nfunction posToDOMRect(view, from, to) {\n\tconst minPos = 0;\n\tconst maxPos = view.state.doc.content.size;\n\tconst resolvedFrom = minMax(from, minPos, maxPos);\n\tconst resolvedEnd = minMax(to, minPos, maxPos);\n\tconst start = view.coordsAtPos(resolvedFrom);\n\tconst end = view.coordsAtPos(resolvedEnd, -1);\n\tconst top = Math.min(start.top, end.top);\n\tconst bottom = Math.max(start.bottom, end.bottom);\n\tconst left = Math.min(start.left, end.left);\n\tconst right = Math.max(start.right, end.right);\n\tconst data = {\n\t\ttop,\n\t\tbottom,\n\t\tleft,\n\t\tright,\n\t\twidth: right - left,\n\t\theight: bottom - top,\n\t\tx: left,\n\t\ty: top\n\t};\n\treturn {\n\t\t...data,\n\t\ttoJSON: () => data\n\t};\n}\n//#endregion\n//#region src/helpers/rewriteUnknownContent.ts\n/**\n* The actual implementation of the rewriteUnknownContent function\n*/\nfunction rewriteUnknownContentInner({ json, validMarks, validNodes, options, rewrittenContent = [] }) {\n\tif (json.marks && Array.isArray(json.marks)) json.marks = json.marks.filter((mark) => {\n\t\tif (mark === null || mark === void 0) return false;\n\t\tconst name = typeof mark === \"string\" ? mark : mark.type;\n\t\tif (validMarks.has(name)) return true;\n\t\trewrittenContent.push({\n\t\t\toriginal: JSON.parse(JSON.stringify(mark)),\n\t\t\tunsupported: name\n\t\t});\n\t\treturn false;\n\t});\n\tif (json.content && Array.isArray(json.content)) json.content = json.content.map((value) => {\n\t\tif (value === null || value === void 0) return null;\n\t\treturn rewriteUnknownContentInner({\n\t\t\tjson: value,\n\t\t\tvalidMarks,\n\t\t\tvalidNodes,\n\t\t\toptions,\n\t\t\trewrittenContent\n\t\t}).json;\n\t}).filter((a) => a !== null && a !== void 0);\n\tif (json.type && !validNodes.has(json.type)) {\n\t\trewrittenContent.push({\n\t\t\toriginal: JSON.parse(JSON.stringify(json)),\n\t\t\tunsupported: json.type\n\t\t});\n\t\tif (json.content && Array.isArray(json.content) && (options === null || options === void 0 ? void 0 : options.fallbackToParagraph) !== false) {\n\t\t\tjson.type = \"paragraph\";\n\t\t\treturn {\n\t\t\t\tjson,\n\t\t\t\trewrittenContent\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tjson: null,\n\t\t\trewrittenContent\n\t\t};\n\t}\n\treturn {\n\t\tjson,\n\t\trewrittenContent\n\t};\n}\n/**\n* Rewrite unknown nodes and marks within JSON content\n* Allowing for user within the editor\n*/\nfunction rewriteUnknownContent(json, schema, options) {\n\treturn rewriteUnknownContentInner({\n\t\tjson,\n\t\tvalidNodes: new Set(Object.keys(schema.nodes)),\n\t\tvalidMarks: new Set(Object.keys(schema.marks)),\n\t\toptions\n\t});\n}\n//#endregion\n//#region src/commands/setMark.ts\nfunction canSetMark(state, tr, newMarkType) {\n\tconst { selection } = tr;\n\tlet cursor = null;\n\tif (isTextSelection(selection)) cursor = selection.$cursor;\n\tif (cursor) {\n\t\tvar _state$storedMarks;\n\t\tconst currentMarks = (_state$storedMarks = state.storedMarks) !== null && _state$storedMarks !== void 0 ? _state$storedMarks : cursor.marks();\n\t\treturn cursor.parent.type.allowsMarkType(newMarkType) && (!!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType)));\n\t}\n\tconst { ranges } = selection;\n\treturn ranges.some(({ $from, $to }) => {\n\t\tlet someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;\n\t\tstate.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {\n\t\t\tif (someNodeSupportsMark) return false;\n\t\t\tif (node.isInline) {\n\t\t\t\tconst parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);\n\t\t\t\tconst currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some((otherMark) => otherMark.type.excludes(newMarkType));\n\t\t\t\tsomeNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;\n\t\t\t}\n\t\t\treturn !someNodeSupportsMark;\n\t\t});\n\t\treturn someNodeSupportsMark;\n\t});\n}\nconst setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {\n\tconst { selection } = tr;\n\tconst { empty, ranges } = selection;\n\tconst type = getMarkType(typeOrName, state.schema);\n\tif (dispatch) {\n\t\tif (empty) {\n\t\t\tconst oldAttributes = getMarkAttributes(state, type);\n\t\t\ttr.addStoredMark(type.create({\n\t\t\t\t...oldAttributes,\n\t\t\t\t...attributes\n\t\t\t}));\n\t\t} else ranges.forEach((range) => {\n\t\t\tconst from = range.$from.pos;\n\t\t\tconst to = range.$to.pos;\n\t\t\tstate.doc.nodesBetween(from, to, (node, pos) => {\n\t\t\t\tconst trimmedFrom = Math.max(pos, from);\n\t\t\t\tconst trimmedTo = Math.min(pos + node.nodeSize, to);\n\t\t\t\tif (node.marks.find((mark) => mark.type === type)) node.marks.forEach((mark) => {\n\t\t\t\t\tif (type === mark.type) tr.addMark(trimmedFrom, trimmedTo, type.create({\n\t\t\t\t\t\t...mark.attrs,\n\t\t\t\t\t\t...attributes\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t\telse tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));\n\t\t\t});\n\t\t});\n\t}\n\treturn canSetMark(state, tr, type);\n};\n//#endregion\n//#region src/commands/setMeta.ts\nconst setMeta = (key, value) => ({ tr }) => {\n\ttr.setMeta(key, value);\n\treturn true;\n};\n//#endregion\n//#region src/commands/setNode.ts\nconst setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tlet attributesToCopy;\n\tif (state.selection.$anchor.sameParent(state.selection.$head)) attributesToCopy = state.selection.$anchor.parent.attrs;\n\tif (!type.isTextblock) {\n\t\tconsole.warn(\"[tiptap warn]: Currently \\\"setNode()\\\" only supports text block nodes.\");\n\t\treturn false;\n\t}\n\treturn chain().command(({ commands }) => {\n\t\tif (setBlockType(type, {\n\t\t\t...attributesToCopy,\n\t\t\t...attributes\n\t\t})(state)) return true;\n\t\treturn commands.clearNodes();\n\t}).command(({ state: updatedState }) => {\n\t\treturn setBlockType(type, {\n\t\t\t...attributesToCopy,\n\t\t\t...attributes\n\t\t})(updatedState, dispatch);\n\t}).run();\n};\n//#endregion\n//#region src/commands/setNodeSelection.ts\nconst setNodeSelection = (position) => ({ tr, dispatch }) => {\n\tif (dispatch) {\n\t\tconst { doc } = tr;\n\t\tconst from = minMax(position, 0, doc.content.size);\n\t\tconst selection = NodeSelection.create(doc, from);\n\t\ttr.setSelection(selection);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/setTextDirection.ts\nconst setTextDirection = (direction, position) => ({ tr, state, dispatch }) => {\n\tconst { selection } = state;\n\tlet from;\n\tlet to;\n\tif (typeof position === \"number\") {\n\t\tfrom = position;\n\t\tto = position;\n\t} else if (position && \"from\" in position && \"to\" in position) {\n\t\tfrom = position.from;\n\t\tto = position.to;\n\t} else {\n\t\tfrom = selection.from;\n\t\tto = selection.to;\n\t}\n\tif (dispatch) tr.doc.nodesBetween(from, to, (node, pos) => {\n\t\tif (node.isText) return;\n\t\ttr.setNodeMarkup(pos, void 0, {\n\t\t\t...node.attrs,\n\t\t\tdir: direction\n\t\t});\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/setTextSelection.ts\nconst setTextSelection = (position) => ({ tr, dispatch }) => {\n\tif (dispatch) {\n\t\tconst { doc } = tr;\n\t\tconst { from, to } = typeof position === \"number\" ? {\n\t\t\tfrom: position,\n\t\t\tto: position\n\t\t} : position;\n\t\tconst minPos = TextSelection.atStart(doc).from;\n\t\tconst maxPos = TextSelection.atEnd(doc).to;\n\t\tconst resolvedFrom = minMax(from, minPos, maxPos);\n\t\tconst resolvedEnd = minMax(to, minPos, maxPos);\n\t\tconst selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);\n\t\ttr.setSelection(selection);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/sinkListItem.ts\nconst sinkListItem$1 = (typeOrName) => ({ state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\treturn sinkListItem(type)(state, dispatch);\n};\n//#endregion\n//#region src/commands/splitBlock.ts\nfunction ensureMarks(state, splittableMarks) {\n\tconst marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n\tif (marks) {\n\t\tconst filteredMarks = marks.filter((mark) => splittableMarks === null || splittableMarks === void 0 ? void 0 : splittableMarks.includes(mark.type.name));\n\t\tstate.tr.ensureMarks(filteredMarks);\n\t}\n}\nconst splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor }) => {\n\tconst { selection, doc } = tr;\n\tconst { $from, $to } = selection;\n\tconst extensionAttributes = editor.extensionManager.attributes;\n\tconst newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);\n\tif (selection instanceof NodeSelection && selection.node.isBlock) {\n\t\tif (!$from.parentOffset || !canSplit(doc, $from.pos)) return false;\n\t\tif (dispatch) {\n\t\t\tif (keepMarks) ensureMarks(state, editor.extensionManager.splittableMarks);\n\t\t\ttr.split($from.pos).scrollIntoView();\n\t\t}\n\t\treturn true;\n\t}\n\tif (!$from.parent.isBlock) return false;\n\tconst atEnd = $to.parentOffset === $to.parent.content.size;\n\tconst deflt = $from.depth === 0 ? void 0 : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));\n\tlet types = atEnd && deflt ? [{\n\t\ttype: deflt,\n\t\tattrs: newAttributes\n\t}] : void 0;\n\tlet can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);\n\tif (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{ type: deflt }] : void 0)) {\n\t\tcan = true;\n\t\ttypes = deflt ? [{\n\t\t\ttype: deflt,\n\t\t\tattrs: newAttributes\n\t\t}] : void 0;\n\t}\n\tif (dispatch) {\n\t\tif (can) {\n\t\t\tif (selection instanceof TextSelection) tr.deleteSelection();\n\t\t\ttr.split(tr.mapping.map($from.pos), 1, types);\n\t\t\tif (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {\n\t\t\t\tconst first = tr.mapping.map($from.before());\n\t\t\t\tconst $first = tr.doc.resolve(first);\n\t\t\t\tif ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);\n\t\t\t}\n\t\t}\n\t\tif (keepMarks) ensureMarks(state, editor.extensionManager.splittableMarks);\n\t\ttr.scrollIntoView();\n\t}\n\treturn can;\n};\n//#endregion\n//#region src/commands/splitListItem.ts\nconst splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch, editor }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tconst { $from, $to } = state.selection;\n\tconst node = state.selection.node;\n\tif (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;\n\tconst grandParent = $from.node(-1);\n\tif (grandParent.type !== type) return false;\n\tconst extensionAttributes = editor.extensionManager.attributes;\n\tif ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {\n\t\tif ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) return false;\n\t\tif (dispatch) {\n\t\t\tvar _type$contentMatch$de;\n\t\t\tlet wrap = Fragment$1.empty;\n\t\t\tconst depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n\t\t\tfor (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) wrap = Fragment$1.from($from.node(d).copy(wrap));\n\t\t\tconst depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n\t\t\tconst newNextTypeAttributes = {\n\t\t\t\t...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n\t\t\t\t...overrideAttrs\n\t\t\t};\n\t\t\tconst nextType = ((_type$contentMatch$de = type.contentMatch.defaultType) === null || _type$contentMatch$de === void 0 ? void 0 : _type$contentMatch$de.createAndFill(newNextTypeAttributes)) || void 0;\n\t\t\twrap = wrap.append(Fragment$1.from(type.createAndFill(null, nextType) || void 0));\n\t\t\tconst start = $from.before($from.depth - (depthBefore - 1));\n\t\t\ttr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n\t\t\tlet sel = -1;\n\t\t\ttr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {\n\t\t\t\tif (sel > -1) return false;\n\t\t\t\tif (n.isTextblock && n.content.size === 0) sel = pos + 1;\n\t\t\t});\n\t\t\tif (sel > -1) tr.setSelection(TextSelection.near(tr.doc.resolve(sel)));\n\t\t\ttr.scrollIntoView();\n\t\t}\n\t\treturn true;\n\t}\n\tconst nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n\tconst newTypeAttributes = {\n\t\t...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),\n\t\t...overrideAttrs\n\t};\n\tconst newNextTypeAttributes = {\n\t\t...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n\t\t...overrideAttrs\n\t};\n\ttr.delete($from.pos, $to.pos);\n\tconst types = nextType ? [{\n\t\ttype,\n\t\tattrs: newTypeAttributes\n\t}, {\n\t\ttype: nextType,\n\t\tattrs: newNextTypeAttributes\n\t}] : [{\n\t\ttype,\n\t\tattrs: newTypeAttributes\n\t}];\n\tif (!canSplit(tr.doc, $from.pos, 2)) return false;\n\tif (dispatch) {\n\t\tconst { selection, storedMarks } = state;\n\t\tconst { splittableMarks } = editor.extensionManager;\n\t\tconst marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n\t\ttr.split($from.pos, 2, types).scrollIntoView();\n\t\tif (!marks || !dispatch) return true;\n\t\tconst filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n\t\ttr.ensureMarks(filteredMarks);\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/toggleList.ts\n/**\n* Normalise a list type attribute for comparison.\n* Treats null, undefined, and \"1\" as equivalent (the default numeric type).\n*/\nfunction normalizeListType(type) {\n\treturn !type || type === \"1\" ? null : type;\n}\n/**\n* Check if two list type attributes are compatible for joining.\n* Lists can only join when they have the same type (both default, or both the same non-default type).\n*/\nfunction areListTypesCompatible(typeA, typeB) {\n\treturn normalizeListType(typeA) === normalizeListType(typeB);\n}\nconst joinListBackwards = (tr, listType) => {\n\tconst list = findParentNode((node) => node.type === listType)(tr.selection);\n\tif (!list) return true;\n\tconst before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);\n\tif (before === void 0) return true;\n\tconst nodeBefore = tr.doc.nodeAt(before);\n\tif (!(list.node.type === (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos))) return true;\n\tif (!areListTypesCompatible(list.node.attrs.type, nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.attrs.type)) return true;\n\ttr.join(list.pos);\n\treturn true;\n};\nconst joinListForwards = (tr, listType) => {\n\tconst list = findParentNode((node) => node.type === listType)(tr.selection);\n\tif (!list) return true;\n\tconst after = tr.doc.resolve(list.start).after(list.depth);\n\tif (after === void 0) return true;\n\tconst nodeAfter = tr.doc.nodeAt(after);\n\tif (!(list.node.type === (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type) && canJoin(tr.doc, after))) return true;\n\tif (!areListTypesCompatible(list.node.attrs.type, nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.attrs.type)) return true;\n\ttr.join(after);\n\treturn true;\n};\nfunction createInnerSelectionForWholeDocList(tr) {\n\tconst doc = tr.doc;\n\tconst list = doc.firstChild;\n\tif (!list) return null;\n\tconst $start = doc.resolve(1);\n\tconst $end = doc.resolve(list.nodeSize - 1);\n\treturn TextSelection.between($start, $end);\n}\nconst toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({ editor, tr, state, dispatch, chain, commands, can }) => {\n\tconst { extensions, splittableMarks } = editor.extensionManager;\n\tconst listType = getNodeType(listTypeOrName, state.schema);\n\tconst itemType = getNodeType(itemTypeOrName, state.schema);\n\tconst { selection, storedMarks } = state;\n\tconst { $from, $to } = selection;\n\tconst range = $from.blockRange($to);\n\tconst marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n\tif (!range) return false;\n\tconst parentList = findParentNode((node) => isList(node.type.name, extensions))(selection);\n\tconst isAllSelection = selection.from === 0 && selection.to === state.doc.content.size;\n\tconst topLevelNodes = state.doc.content.content;\n\tconst soleTopLevelNode = topLevelNodes.length === 1 ? topLevelNodes[0] : null;\n\tconst allSelectionList = isAllSelection && soleTopLevelNode && isList(soleTopLevelNode.type.name, extensions) ? {\n\t\tnode: soleTopLevelNode,\n\t\tpos: 0,\n\t\tdepth: 0\n\t} : null;\n\tconst currentList = parentList !== null && parentList !== void 0 ? parentList : allSelectionList;\n\tconst isInsideExistingList = !!parentList && range.depth >= 1 && range.depth - parentList.depth <= 1;\n\tconst hasWholeDocSelectedList = !!allSelectionList;\n\tif ((isInsideExistingList || hasWholeDocSelectedList) && currentList) {\n\t\tif (currentList.node.type === listType) {\n\t\t\tif (isAllSelection && hasWholeDocSelectedList) return chain().command(({ tr: trx, dispatch: disp }) => {\n\t\t\t\tconst nextSelection = createInnerSelectionForWholeDocList(trx);\n\t\t\t\tif (!nextSelection) return false;\n\t\t\t\ttrx.setSelection(nextSelection);\n\t\t\t\tif (disp) disp(trx);\n\t\t\t\treturn true;\n\t\t\t}).liftListItem(itemType).run();\n\t\t\treturn commands.liftListItem(itemType);\n\t\t}\n\t\tif (isList(currentList.node.type.name, extensions) && listType.validContent(currentList.node.content)) return chain().command(() => {\n\t\t\ttr.setNodeMarkup(currentList.pos, listType);\n\t\t\treturn true;\n\t\t}).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n\t}\n\tif (!keepMarks || !marks || !dispatch) return chain().command(() => {\n\t\tif (can().wrapInList(listType, attributes)) return true;\n\t\treturn commands.clearNodes();\n\t}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n\treturn chain().command(() => {\n\t\tconst canWrapInList = can().wrapInList(listType, attributes);\n\t\tconst filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n\t\ttr.ensureMarks(filteredMarks);\n\t\tif (canWrapInList) return true;\n\t\treturn commands.clearNodes();\n\t}).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n};\n//#endregion\n//#region src/commands/toggleMark.ts\nconst toggleMark = (typeOrName, attributes = {}, options = {}) => ({ state, commands }) => {\n\tconst { extendEmptyMarkRange = false } = options;\n\tconst type = getMarkType(typeOrName, state.schema);\n\tif (isMarkActive(state, type, attributes)) return commands.unsetMark(type, { extendEmptyMarkRange });\n\treturn commands.setMark(type, attributes);\n};\n//#endregion\n//#region src/commands/toggleNode.ts\nconst toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, commands }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tconst toggleType = getNodeType(toggleTypeOrName, state.schema);\n\tconst isActive = isNodeActive(state, type, attributes);\n\tlet attributesToCopy;\n\tif (state.selection.$anchor.sameParent(state.selection.$head)) attributesToCopy = state.selection.$anchor.parent.attrs;\n\tif (isActive) return commands.setNode(toggleType, attributesToCopy);\n\treturn commands.setNode(type, {\n\t\t...attributesToCopy,\n\t\t...attributes\n\t});\n};\n//#endregion\n//#region src/commands/toggleWrap.ts\nconst toggleWrap = (typeOrName, attributes = {}) => ({ state, commands }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\tif (isNodeActive(state, type, attributes)) return commands.lift(type);\n\treturn commands.wrapIn(type, attributes);\n};\n//#endregion\n//#region src/commands/undoInputRule.ts\nconst undoInputRule = () => ({ state, dispatch }) => {\n\tconst plugins = state.plugins;\n\tfor (let i = 0; i < plugins.length; i += 1) {\n\t\tconst plugin = plugins[i];\n\t\tlet undoable;\n\t\tif (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n\t\t\tif (dispatch) {\n\t\t\t\tconst tr = state.tr;\n\t\t\t\tconst toUndo = undoable.transform;\n\t\t\t\tfor (let j = toUndo.steps.length - 1; j >= 0; j -= 1) tr.step(toUndo.steps[j].invert(toUndo.docs[j]));\n\t\t\t\tif (undoable.text) {\n\t\t\t\t\tconst marks = tr.doc.resolve(undoable.from).marks();\n\t\t\t\t\ttr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));\n\t\t\t\t} else tr.delete(undoable.from, undoable.to);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n};\n//#endregion\n//#region src/commands/unsetAllMarks.ts\nconst unsetAllMarks = (options = {}) => ({ tr, dispatch, editor }) => {\n\tconst { ignoreClearable = false } = options;\n\tconst { selection } = tr;\n\tconst { empty, ranges } = selection;\n\tif (empty) return true;\n\tconst { nonClearableMarks } = editor.extensionManager;\n\tif (dispatch) {\n\t\tconst clearableMarkTypes = Object.values(editor.schema.marks).filter((markType) => ignoreClearable || !nonClearableMarks.includes(markType.name));\n\t\tranges.forEach((range) => {\n\t\t\tfor (const markType of clearableMarkTypes) tr.removeMark(range.$from.pos, range.$to.pos, markType);\n\t\t});\n\t}\n\treturn true;\n};\n//#endregion\n//#region src/commands/unsetMark.ts\nconst unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {\n\tconst { extendEmptyMarkRange = false } = options;\n\tconst { selection } = tr;\n\tconst type = getMarkType(typeOrName, state.schema);\n\tconst { $from, empty, ranges } = selection;\n\tif (!dispatch) return true;\n\tif (empty && extendEmptyMarkRange) {\n\t\tvar _$from$marks$find;\n\t\tlet { from, to } = selection;\n\t\tconst range = getMarkRange($from, type, (_$from$marks$find = $from.marks().find((mark) => mark.type === type)) === null || _$from$marks$find === void 0 ? void 0 : _$from$marks$find.attrs);\n\t\tif (range) {\n\t\t\tfrom = range.from;\n\t\t\tto = range.to;\n\t\t}\n\t\ttr.removeMark(from, to, type);\n\t} else ranges.forEach((range) => {\n\t\ttr.removeMark(range.$from.pos, range.$to.pos, type);\n\t});\n\ttr.removeStoredMark(type);\n\treturn true;\n};\n//#endregion\n//#region src/commands/unsetTextDirection.ts\nconst unsetTextDirection = (position) => ({ tr, state, dispatch }) => {\n\tconst { selection } = state;\n\tlet from;\n\tlet to;\n\tif (typeof position === \"number\") {\n\t\tfrom = position;\n\t\tto = position;\n\t} else if (position && \"from\" in position && \"to\" in position) {\n\t\tfrom = position.from;\n\t\tto = position.to;\n\t} else {\n\t\tfrom = selection.from;\n\t\tto = selection.to;\n\t}\n\tif (dispatch) tr.doc.nodesBetween(from, to, (node, pos) => {\n\t\tif (node.isText) return;\n\t\tconst newAttrs = { ...node.attrs };\n\t\tdelete newAttrs.dir;\n\t\ttr.setNodeMarkup(pos, void 0, newAttrs);\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/updateAttributes.ts\nconst updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {\n\tlet nodeType = null;\n\tlet markType = null;\n\tconst schemaType = getSchemaTypeNameByName(typeof typeOrName === \"string\" ? typeOrName : typeOrName.name, state.schema);\n\tif (!schemaType) return false;\n\tif (schemaType === \"node\") nodeType = getNodeType(typeOrName, state.schema);\n\tif (schemaType === \"mark\") markType = getMarkType(typeOrName, state.schema);\n\tlet canUpdate = false;\n\ttr.selection.ranges.forEach((range) => {\n\t\tconst from = range.$from.pos;\n\t\tconst to = range.$to.pos;\n\t\tlet lastPos;\n\t\tlet lastNode;\n\t\tlet trimmedFrom;\n\t\tlet trimmedTo;\n\t\tif (tr.selection.empty) state.doc.nodesBetween(from, to, (node, pos) => {\n\t\t\tif (nodeType && nodeType === node.type) {\n\t\t\t\tcanUpdate = true;\n\t\t\t\ttrimmedFrom = Math.max(pos, from);\n\t\t\t\ttrimmedTo = Math.min(pos + node.nodeSize, to);\n\t\t\t\tlastPos = pos;\n\t\t\t\tlastNode = node;\n\t\t\t}\n\t\t});\n\t\telse state.doc.nodesBetween(from, to, (node, pos) => {\n\t\t\tif (pos < from && nodeType && nodeType === node.type) {\n\t\t\t\tcanUpdate = true;\n\t\t\t\ttrimmedFrom = Math.max(pos, from);\n\t\t\t\ttrimmedTo = Math.min(pos + node.nodeSize, to);\n\t\t\t\tlastPos = pos;\n\t\t\t\tlastNode = node;\n\t\t\t}\n\t\t\tif (pos >= from && pos <= to) {\n\t\t\t\tif (nodeType && nodeType === node.type) {\n\t\t\t\t\tcanUpdate = true;\n\t\t\t\t\tif (dispatch) tr.setNodeMarkup(pos, void 0, {\n\t\t\t\t\t\t...node.attrs,\n\t\t\t\t\t\t...attributes\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif (markType && node.marks.length) node.marks.forEach((mark) => {\n\t\t\t\t\tif (markType === mark.type) {\n\t\t\t\t\t\tcanUpdate = true;\n\t\t\t\t\t\tif (dispatch) {\n\t\t\t\t\t\t\tconst trimmedFrom2 = Math.max(pos, from);\n\t\t\t\t\t\t\tconst trimmedTo2 = Math.min(pos + node.nodeSize, to);\n\t\t\t\t\t\t\ttr.addMark(trimmedFrom2, trimmedTo2, markType.create({\n\t\t\t\t\t\t\t\t...mark.attrs,\n\t\t\t\t\t\t\t\t...attributes\n\t\t\t\t\t\t\t}));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\tif (lastNode) {\n\t\t\tif (lastPos !== void 0 && dispatch) tr.setNodeMarkup(lastPos, void 0, {\n\t\t\t\t...lastNode.attrs,\n\t\t\t\t...attributes\n\t\t\t});\n\t\t\tif (markType && lastNode.marks.length) lastNode.marks.forEach((mark) => {\n\t\t\t\tif (markType === mark.type && dispatch) tr.addMark(trimmedFrom, trimmedTo, markType.create({\n\t\t\t\t\t...mark.attrs,\n\t\t\t\t\t...attributes\n\t\t\t\t}));\n\t\t\t});\n\t\t}\n\t});\n\treturn canUpdate;\n};\nconst DECORATION_MANAGER_PLUGIN_KEY = new PluginKey(\"__tiptap_decorations__\");\n//#endregion\n//#region src/commands/updateDecorations.ts\nconst updateDecorations = (extensionName) => ({ tr, dispatch }) => {\n\tif (dispatch) tr.setMeta(DECORATION_MANAGER_PLUGIN_KEY, {\n\t\ttype: \"force\",\n\t\tname: extensionName\n\t});\n\treturn true;\n};\n//#endregion\n//#region src/commands/wrapIn.ts\nconst wrapIn$1 = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\treturn wrapIn(type, attributes)(state, dispatch);\n};\n//#endregion\n//#region src/commands/wrapInList.ts\nconst wrapInList$1 = (typeOrName, attributes = {}) => ({ state, dispatch }) => {\n\tconst type = getNodeType(typeOrName, state.schema);\n\treturn wrapInList(type, attributes)(state, dispatch);\n};\n//#endregion\n//#region src/commands/index.ts\nvar commands_exports = /* @__PURE__ */ __exportAll({\n\tblur: () => blur,\n\tclearContent: () => clearContent,\n\tclearNodes: () => clearNodes,\n\tcommand: () => command,\n\tcreateParagraphNear: () => createParagraphNear$1,\n\tcut: () => cut,\n\tdeleteCurrentNode: () => deleteCurrentNode,\n\tdeleteNode: () => deleteNode,\n\tdeleteRange: () => deleteRange,\n\tdeleteSelection: () => deleteSelection,\n\tenter: () => enter,\n\texitCode: () => exitCode$1,\n\textendMarkRange: () => extendMarkRange,\n\tfirst: () => first,\n\tfocus: () => focus,\n\tforEach: () => forEach,\n\tinsertContent: () => insertContent,\n\tinsertContentAt: () => insertContentAt,\n\tinsertDefaultBlock: () => insertDefaultBlock,\n\tjoinBackward: () => joinBackward$1,\n\tjoinDown: () => joinDown$1,\n\tjoinForward: () => joinForward$1,\n\tjoinItemBackward: () => joinItemBackward,\n\tjoinItemForward: () => joinItemForward,\n\tjoinTextblockBackward: () => joinTextblockBackward$1,\n\tjoinTextblockForward: () => joinTextblockForward$1,\n\tjoinUp: () => joinUp$1,\n\tkeyboardShortcut: () => keyboardShortcut,\n\tlift: () => lift$1,\n\tliftEmptyBlock: () => liftEmptyBlock$1,\n\tliftListItem: () => liftListItem$1,\n\tnewlineInCode: () => newlineInCode$1,\n\tresetAttributes: () => resetAttributes,\n\tscrollIntoView: () => scrollIntoView,\n\tselectAll: () => selectAll,\n\tselectNodeBackward: () => selectNodeBackward$1,\n\tselectNodeForward: () => selectNodeForward$1,\n\tselectParentNode: () => selectParentNode$1,\n\tselectTextblockEnd: () => selectTextblockEnd$1,\n\tselectTextblockStart: () => selectTextblockStart$1,\n\tsetContent: () => setContent,\n\tsetMark: () => setMark,\n\tsetMeta: () => setMeta,\n\tsetNode: () => setNode,\n\tsetNodeSelection: () => setNodeSelection,\n\tsetTextDirection: () => setTextDirection,\n\tsetTextSelection: () => setTextSelection,\n\tsinkListItem: () => sinkListItem$1,\n\tsplitBlock: () => splitBlock,\n\tsplitListItem: () => splitListItem,\n\ttoggleList: () => toggleList,\n\ttoggleMark: () => toggleMark,\n\ttoggleNode: () => toggleNode,\n\ttoggleWrap: () => toggleWrap,\n\tundoInputRule: () => undoInputRule,\n\tunsetAllMarks: () => unsetAllMarks,\n\tunsetMark: () => unsetMark,\n\tunsetTextDirection: () => unsetTextDirection,\n\tupdateAttributes: () => updateAttributes,\n\tupdateDecorations: () => updateDecorations,\n\twrapIn: () => wrapIn$1,\n\twrapInList: () => wrapInList$1\n});\n//#endregion\n//#region src/decorations/decorationApplyScope.ts\n/**\n* Tracks which editors are running decoration create() callbacks inside state.apply,\n* using a private WeakMap to keep this off the public Editor surface.\n*/\nconst depthByEditor = /* @__PURE__ */ new WeakMap();\n/**\n* Marks callback as decoration-apply work for editor, so editor.state can warn\n* about stale reads. Counts depth to handle nested applies.\n*\n* @param editor The editor the decorations belong to\n* @param callback The work to run inside the scope\n* @returns Whatever `callback` returns\n* @example\n* runInDecorationApplyScope(editor, () => spec.create({ editor, state, view }))\n*/\nfunction runInDecorationApplyScope(editor, callback) {\n\tvar _depthByEditor$get;\n\tdepthByEditor.set(editor, ((_depthByEditor$get = depthByEditor.get(editor)) !== null && _depthByEditor$get !== void 0 ? _depthByEditor$get : 0) + 1);\n\ttry {\n\t\treturn callback();\n\t} finally {\n\t\tvar _depthByEditor$get2;\n\t\tconst remaining = ((_depthByEditor$get2 = depthByEditor.get(editor)) !== null && _depthByEditor$get2 !== void 0 ? _depthByEditor$get2 : 1) - 1;\n\t\tif (remaining > 0) depthByEditor.set(editor, remaining);\n\t\telse depthByEditor.delete(editor);\n\t}\n}\n/**\n* Whether the editor is currently inside a decoration apply scope.\n*\n* @param editor The editor to check\n* @returns `true` while decoration create() callbacks run\n* @example\n* if (isInDecorationApplyScope(editor)) {\n* // reads of editor.state are stale here\n* }\n*/\nfunction isInDecorationApplyScope(editor) {\n\treturn depthByEditor.has(editor);\n}\n//#endregion\n//#region src/EventEmitter.ts\nvar EventEmitter = class {\n\tconstructor() {\n\t\tthis.callbacks = {};\n\t}\n\ton(event, fn) {\n\t\tif (!this.callbacks[event]) this.callbacks[event] = [];\n\t\tthis.callbacks[event].push(fn);\n\t\treturn this;\n\t}\n\temit(event, ...args) {\n\t\tconst callbacks = this.callbacks[event];\n\t\tif (callbacks) callbacks.forEach((callback) => callback.apply(this, args));\n\t\treturn this;\n\t}\n\toff(event, fn) {\n\t\tconst callbacks = this.callbacks[event];\n\t\tif (callbacks) {\n\t\t\tif (fn) this.callbacks[event] = callbacks.filter((callback) => callback !== fn);\n\t\t\telse delete this.callbacks[event];\n\t\t}\n\t\treturn this;\n\t}\n\tonce(event, fn) {\n\t\tconst onceFn = (...args) => {\n\t\t\tthis.off(event, onceFn);\n\t\t\tfn.apply(this, args);\n\t\t};\n\t\treturn this.on(event, onceFn);\n\t}\n\tremoveAllListeners() {\n\t\tthis.callbacks = {};\n\t}\n};\n//#endregion\n//#region src/utilities/isDev.ts\n/**\n* Whether the editor runs in a development build. Use it to guard warnings so\n* bundlers can drop them from production output.\n*/\nconst isDev = typeof process !== \"undefined\" && process.env.NODE_ENV !== \"production\";\n//#endregion\n//#region src/decorations/helpers/decorationsToPMDecorations.ts\nfunction isWidgetDecoration(decoration) {\n\treturn decoration.kind === \"widget\";\n}\n/**\n* Converts a list of decorations to ProseMirror decorations.\n* @param decorations The decorations to convert.\n* @param extensionName The name of the extension that created the decorations.\n* @returns The converted decorations and the widget keys.\n*/\nfunction decorationsToPMDecorations(decorations, extensionName) {\n\tconst pmDecorations = [];\n\tconst widgetKeys = /* @__PURE__ */ new Set();\n\tfor (const decoration of decorations) {\n\t\tif (decoration.kind === \"widget\") {\n\t\t\tif (isWidgetDecoration(decoration)) widgetKeys.add(decoration.key);\n\t\t}\n\t\tpmDecorations.push(decoration.toPMDecoration(extensionName));\n\t}\n\treturn {\n\t\tdecorations: pmDecorations,\n\t\twidgetKeys\n\t};\n}\n//#endregion\n//#region src/decorations/helpers/buildDecorationSet.ts\n/**\n* Builds a DecorationSet from a list of decorations.\n* @param doc The document to build the decoration set for.\n* @param decorations The decorations to build the set from.\n* @param extensionName The name of the extension that created the decorations.\n* @returns The built decoration set and the widget keys.\n*/\nfunction buildDecorationSet(doc, decorations, extensionName) {\n\tconst { decorations: pmDecorations, widgetKeys } = decorationsToPMDecorations(decorations, extensionName);\n\treturn {\n\t\tset: DecorationSet.create(doc, pmDecorations),\n\t\twidgetKeys\n\t};\n}\n//#endregion\n//#region src/decorations/helpers/rangeOwnsPosition.ts\n/**\n* Whether the block range `[from, to)` owns a decoration at `position`.\n*\n* `to` is the next block's start, so that block owns it. The last block is the\n* exception: nothing follows it, so it owns the end of the document.\n*\n* @param options The position, the range, and the document size.\n* @returns True when the range owns the position.\n* @example\n* // <p>foo</p><p>bar</p>, blocks [0, 5] and [5, 10]\n* rangeOwnsPosition({ position: 5, from: 0, to: 5, docSize: 10 }) // false, block 2 owns it\n* rangeOwnsPosition({ position: 5, from: 5, to: 10, docSize: 10 }) // true\n* rangeOwnsPosition({ position: 10, from: 5, to: 10, docSize: 10 }) // true, end of document\n*/\nfunction rangeOwnsPosition({ position, from, to, docSize }) {\n\tif (position < from) return false;\n\tif (position < to) return true;\n\treturn position === to && to === docSize;\n}\n//#endregion\n//#region src/decorations/helpers/filterOutOfRangeDecorations.ts\n/**\n* Filter decorations the block range `[from, to)` does not own.\n* Must match the stale sweep in `DecorationManager.rebuildRanges`.\n*\n* @param options The decorations, the range, and the warning bookkeeping.\n* @returns The filtered decorations.\n*/\nfunction filterOutOfRangeDecorations({ decorations, from, to, docSize, extensionName, warnedExtensions }) {\n\treturn decorations.filter((decoration) => {\n\t\tif (rangeOwnsPosition({\n\t\t\tposition: decoration.anchor,\n\t\t\tfrom,\n\t\t\tto,\n\t\t\tdocSize\n\t\t})) return true;\n\t\tif (decoration.anchor === to) return false;\n\t\tif (!warnedExtensions.has(extensionName)) {\n\t\t\twarnedExtensions.add(extensionName);\n\t\t\tconsole.warn(`[tiptap warn]: Extension \"${extensionName}\" returned a decoration outside the requested range [${from}, ${to}). It was ignored.`);\n\t\t}\n\t\treturn false;\n\t});\n}\n//#endregion\n//#region src/decorations/helpers/widgetKeyOf.ts\n/**\n* Extracts the widget key from a decoration spec.\n* @param decoration The decoration to extract the key from.\n* @returns The widget key, or undefined if the decoration has no key.\n*/\nfunction widgetKeyOf(decoration) {\n\tvar _decoration$spec;\n\tconst key = (_decoration$spec = decoration.spec) === null || _decoration$spec === void 0 ? void 0 : _decoration$spec.key;\n\treturn typeof key === \"string\" ? key : void 0;\n}\n//#endregion\n//#region src/decorations/helpers/findDuplicateWidgetKeys.ts\n/**\n* Finds widget keys which are still duplicated in the final decoration set.\n* @param decorationSet The merged decoration set to inspect.\n* @returns The duplicate keys and their producing extensions.\n*/\nfunction findDuplicateWidgetKeys(decorationSet) {\n\tconst extensionsByKey = /* @__PURE__ */ new Map();\n\tconst counts = /* @__PURE__ */ new Map();\n\tfor (const decoration of decorationSet.find()) {\n\t\tvar _extensionName, _extensionsByKey$get, _counts$get;\n\t\tconst key = widgetKeyOf(decoration);\n\t\tif (!key) continue;\n\t\tconst extension = (_extensionName = decoration.spec.extensionName) !== null && _extensionName !== void 0 ? _extensionName : \"unknown\";\n\t\tconst extensions = (_extensionsByKey$get = extensionsByKey.get(key)) !== null && _extensionsByKey$get !== void 0 ? _extensionsByKey$get : /* @__PURE__ */ new Set();\n\t\textensions.add(extension);\n\t\textensionsByKey.set(key, extensions);\n\t\tcounts.set(key, ((_counts$get = counts.get(key)) !== null && _counts$get !== void 0 ? _counts$get : 0) + 1);\n\t}\n\treturn Array.from(extensionsByKey, ([key, extensions]) => ({\n\t\tkey,\n\t\textensions\n\t})).filter(({ key }) => {\n\t\tvar _counts$get2;\n\t\treturn ((_counts$get2 = counts.get(key)) !== null && _counts$get2 !== void 0 ? _counts$get2 : 0) > 1;\n\t});\n}\n//#endregion\n//#region src/decorations/helpers/isAttrStep.ts\n/**\n* Whether a step only sets a node attribute.\n*\n* Matched by `jsonID` rather than `instanceof`, which fails when two copies of\n* prosemirror-transform are loaded.\n*\n* @param step The step to check.\n* @returns `true` for an `AttrStep`, which carries the target node's position.\n* @example\n* if (isAttrStep(step)) {\n* rebuildBlockAt(step.pos)\n* }\n*/\nfunction isAttrStep(step) {\n\treturn step.jsonID === \"attr\";\n}\n//#endregion\n//#region src/decorations/helpers/hasResolvableChangedRange.ts\n/**\n* Check if a step has a resolvable changed range.\n* @param step The step to check.\n* @returns True if the step has a resolvable changed range, false otherwise.\n*/\nfunction hasResolvableChangedRange(step) {\n\tlet hasMappedRange = false;\n\tstep.getMap().forEach(() => {\n\t\thasMappedRange = true;\n\t});\n\tif (hasMappedRange || isAttrStep(step)) return true;\n\tconst positionalStep = step;\n\treturn typeof positionalStep.from === \"number\" && typeof positionalStep.to === \"number\";\n}\n//#endregion\n//#region src/decorations/helpers/getRebuildRanges.ts\n/**\n* Expands a changed range to the top-level blocks it touches. Blocks are\n* ordered, so the walk stops as soon as it passes the range.\n*/\nfunction blockRangeFor(doc, changed) {\n\tlet from = null;\n\tlet to = 0;\n\tlet nodeStart = 0;\n\tfor (let index = 0; index < doc.childCount; index += 1) {\n\t\tif (nodeStart > changed.to) break;\n\t\tconst nodeEnd = nodeStart + doc.child(index).nodeSize;\n\t\tif (nodeEnd >= changed.from) {\n\t\t\tif (from === null) from = nodeStart;\n\t\t\tto = nodeEnd;\n\t\t}\n\t\tnodeStart = nodeEnd;\n\t}\n\treturn from === null ? null : {\n\t\tfrom,\n\t\tto\n\t};\n}\n/**\n* Returns the top-level block ranges to recompute after a transaction,\n* or `{ type: 'full' }` when the whole document must be rebuilt.\n* @param tr The transaction to inspect.\n* @param doc The new document after the transaction.\n* @returns The block ranges to recompute, or a full-recompute signal.\n*/\nfunction getRebuildRanges(tr, doc) {\n\tif (tr.steps.some((step) => !hasResolvableChangedRange(step))) return { type: \"full\" };\n\tconst newRanges = getChangedRanges(tr).map(({ newRange }) => newRange);\n\ttr.steps.forEach((step, index) => {\n\t\tif (!isAttrStep(step)) return;\n\t\tconst mapping = tr.mapping.slice(index);\n\t\tnewRanges.push({\n\t\t\tfrom: mapping.map(step.pos, -1),\n\t\t\tto: mapping.map(step.pos + 1)\n\t\t});\n\t});\n\tconst ranges = [];\n\tfor (const newRange of newRanges) {\n\t\tconst blockRange = blockRangeFor(doc, newRange);\n\t\tif (blockRange) ranges.push(blockRange);\n\t}\n\tranges.sort((a, b) => a.from - b.from);\n\tconst merged = [];\n\tfor (const range of ranges) {\n\t\tconst last = merged[merged.length - 1];\n\t\tif (last && range.from <= last.to) last.to = Math.max(last.to, range.to);\n\t\telse merged.push({ ...range });\n\t}\n\treturn {\n\t\ttype: \"ranges\",\n\t\tranges: merged\n\t};\n}\n//#endregion\n//#region src/decorations/helpers/mapDecorationSet.ts\n/**\n* Maps a decoration set through a mapping and prunes the keys of any widget\n* dropped because its position was deleted.\n* @param set The decoration set to map.\n* @param mapping The mapping to use.\n* @param doc The document to map the set through.\n* @param widgetKeys The set of widget keys to prune.\n* @returns The mapped decoration set.\n*/\nfunction mapDecorationSet(set, mapping, doc, widgetKeys) {\n\treturn set.map(mapping, doc, { onRemove: (removedSpec) => {\n\t\tconst key = removedSpec === null || removedSpec === void 0 ? void 0 : removedSpec.key;\n\t\tif (typeof key === \"string\") widgetKeys.delete(key);\n\t} });\n}\n//#endregion\n//#region src/decorations/helpers/mapDecorations.ts\n/**\n* Moves an extension's existing decorations to their new positions after a\n* transaction, and prunes widget keys for any widget whose position was deleted.\n* @param name The name of the decoration extension.\n* @param previous The previous decoration manager state.\n* @param tr The transaction to map through.\n* @returns The updated decoration set and widget keys.\n*/\nfunction mapDecorations(name, previous, tr) {\n\tvar _previous$decorationS, _previous$widgetKeysB;\n\tconst previousSet = (_previous$decorationS = previous.decorationSetsByExtension[name]) !== null && _previous$decorationS !== void 0 ? _previous$decorationS : DecorationSet.empty;\n\tconst widgetKeys = new Set((_previous$widgetKeysB = previous.widgetKeysByExtension[name]) !== null && _previous$widgetKeysB !== void 0 ? _previous$widgetKeysB : []);\n\treturn {\n\t\tset: mapDecorationSet(previousSet, tr.mapping, tr.doc, widgetKeys),\n\t\twidgetKeys\n\t};\n}\n//#endregion\n//#region src/decorations/helpers/mergeDecorationSets.ts\n/**\n* Merges multiple decoration sets into a single decoration set.\n* @param doc The document to merge the decoration sets for.\n* @param decorationSetsByExtension The decoration sets to merge.\n* @returns The merged decoration set.\n*/\nfunction mergeDecorationSets(doc, decorationSetsByExtension) {\n\tconst allDecorations = Object.values(decorationSetsByExtension).flatMap((set) => set.find());\n\treturn DecorationSet.create(doc, allDecorations);\n}\n//#endregion\n//#region src/decorations/helpers/unionWidgetKeys.ts\n/**\n* Unions all widget keys from multiple extensions into a single set.\n* @param widgetKeysByExtension The widget keys to union.\n* @returns The unioned widget keys.\n*/\nfunction unionWidgetKeys(widgetKeysByExtension) {\n\tconst merged = /* @__PURE__ */ new Set();\n\tfor (const keys of Object.values(widgetKeysByExtension)) for (const key of keys) merged.add(key);\n\treturn merged;\n}\n//#endregion\n//#region src/decorations/helpers/validateDecorationSpec.ts\n/**\n* Validates a decoration spec to ensure it follows the correct pattern for its update strategy.\n* @param name The name of the extension.\n* @param spec The decoration spec to validate\n*/\nfunction validateDecorationSpec(name, spec) {\n\tvar _update;\n\tswitch ((_update = spec.update) !== null && _update !== void 0 ? _update : \"document\") {\n\t\tcase \"document\":\n\t\t\tif (spec.createInRange) throw new Error(`[tiptap error]: Extension \"${name}\" provides createInRange() but does not use the \"changedRanges\" decoration update strategy.`);\n\t\t\treturn;\n\t\tcase \"changedRanges\":\n\t\t\tif (!spec.createInRange) throw new Error(`[tiptap error]: Extension \"${name}\" uses the \"changedRanges\" decoration update strategy but does not provide createInRange().`);\n\t\t\treturn;\n\t\tcase \"manual\":\n\t\t\tif (spec.createInRange) throw new Error(`[tiptap error]: Extension \"${name}\" uses the \"manual\" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the \"changedRanges\" strategy.`);\n\t\t\tif (spec.shouldUpdate) throw new Error(`[tiptap error]: Extension \"${name}\" cannot combine the \"manual\" decoration update strategy with shouldUpdate().`);\n\t\t\treturn;\n\t\tdefault: throw new Error(`[tiptap error]: Extension \"${name}\" uses an unknown decoration update strategy. Expected \"document\", \"changedRanges\", or \"manual\".`);\n\t}\n}\n//#endregion\n//#region src/decorations/helpers/shouldRecomputeDecoration.ts\n/**\n* Decides whether a decoration spec should be recomputed for a transaction.\n* @param spec The decoration spec to check.\n* @param props Properties containing editor, transaction, and state.\n* @param forced Whether recomputation was forced.\n* @returns `true` if the decoration should be recomputed.\n*/\nfunction shouldRecomputeDecoration(spec, props, forced) {\n\tif (forced) return true;\n\tif (spec.update === \"manual\") return false;\n\treturn spec.shouldUpdate ? spec.shouldUpdate(props) : props.tr.docChanged;\n}\n//#endregion\n//#region src/decorations/DecorationManager.ts\nconst EMPTY_KEYS = /* @__PURE__ */ new Set();\nfunction liveWidgetKeys(editor) {\n\tvar _editor$extensionMana, _editor$extensionMana2;\n\treturn (_editor$extensionMana = (_editor$extensionMana2 = editor.extensionManager) === null || _editor$extensionMana2 === void 0 || (_editor$extensionMana2 = _editor$extensionMana2.decorationManager) === null || _editor$extensionMana2 === void 0 ? void 0 : _editor$extensionMana2.liveWidgetKeys()) !== null && _editor$extensionMana !== void 0 ? _editor$extensionMana : EMPTY_KEYS;\n}\nvar DecorationManager = class {\n\tconstructor(options) {\n\t\tthis.warnedWidgetKeys = /* @__PURE__ */ new Set();\n\t\tthis.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set();\n\t\tthis.handleBeforeTransaction = ({ nextState }) => {\n\t\t\tconst state = DECORATION_MANAGER_PLUGIN_KEY.getState(nextState);\n\t\t\tif (state) this.warnDuplicateWidgetKeys(state);\n\t\t};\n\t\tthis.editor = options.editor;\n\t\tthis.entries = this.resolveEntries(options.entries);\n\t\tthis.entries.forEach(({ name, spec }) => validateDecorationSpec(name, spec));\n\t\tthis.plugin = this.entries.length > 0 ? this.createPlugin() : null;\n\t\tthis.editor.on(\"beforeTransaction\", this.handleBeforeTransaction);\n\t}\n\tdestroy() {\n\t\tthis.editor.off(\"beforeTransaction\", this.handleBeforeTransaction);\n\t}\n\t/**\n\t* Returns the set of live widget keys from all decoration extensions.\n\t* @returns A readonly set of widget keys\n\t*/\n\tliveWidgetKeys() {\n\t\tvar _DECORATION_MANAGER_P, _DECORATION_MANAGER_P2;\n\t\treturn (_DECORATION_MANAGER_P = (_DECORATION_MANAGER_P2 = DECORATION_MANAGER_PLUGIN_KEY.getState(this.editor.state)) === null || _DECORATION_MANAGER_P2 === void 0 ? void 0 : _DECORATION_MANAGER_P2.widgetKeys) !== null && _DECORATION_MANAGER_P !== void 0 ? _DECORATION_MANAGER_P : EMPTY_KEYS;\n\t}\n\t/**\n\t* The mounted editor view, or `null` when destroyed. Decoration callbacks\n\t* must never receive the placeholder view `editor.view` falls back to.\n\t* @returns The mounted editor view, or `null`\n\t*/\n\tget mountedView() {\n\t\treturn this.editor.isDestroyed ? null : this.editor.view;\n\t}\n\t/**\n\t* Resolves decoration entries by calling the addDecorations function for each extension entry.\n\t* @param entries The decoration manager entries to resolve\n\t* @returns An array of resolved decoration entries\n\t*/\n\tresolveEntries(entries) {\n\t\tconst resolved = [];\n\t\tfor (const { name, addDecorations } of entries) {\n\t\t\tconst spec = addDecorations();\n\t\t\tif (spec) resolved.push({\n\t\t\t\tname,\n\t\t\t\tspec\n\t\t\t});\n\t\t}\n\t\treturn resolved;\n\t}\n\t/**\n\t* Creates the ProseMirror plugin for managing decorations.\n\t* @returns A ProseMirror plugin with state management\n\t*/\n\tcreatePlugin() {\n\t\tconst { editor, entries } = this;\n\t\treturn new Plugin({\n\t\t\tkey: DECORATION_MANAGER_PLUGIN_KEY,\n\t\t\tstate: {\n\t\t\t\tinit: (_config, state) => {\n\t\t\t\t\tconst decorationSetsByExtension = {};\n\t\t\t\t\tconst widgetKeysByExtension = {};\n\t\t\t\t\tfor (const { name, spec } of entries) {\n\t\t\t\t\t\tconst { set, widgetKeys } = this.buildFullSet(name, spec, state);\n\t\t\t\t\t\tdecorationSetsByExtension[name] = set;\n\t\t\t\t\t\twidgetKeysByExtension[name] = widgetKeys;\n\t\t\t\t\t}\n\t\t\t\t\tconst managerState = {\n\t\t\t\t\t\tdecorationSetsByExtension,\n\t\t\t\t\t\twidgetKeysByExtension,\n\t\t\t\t\t\tmergedDecorationSet: this.buildMergedSet(state.doc, decorationSetsByExtension),\n\t\t\t\t\t\twidgetKeys: unionWidgetKeys(widgetKeysByExtension)\n\t\t\t\t\t};\n\t\t\t\t\tthis.warnDuplicateWidgetKeys(managerState);\n\t\t\t\t\treturn managerState;\n\t\t\t\t},\n\t\t\t\tapply: (tr, previous, oldState, newState) => {\n\t\t\t\t\tconst meta = tr.getMeta(DECORATION_MANAGER_PLUGIN_KEY);\n\t\t\t\t\tconst forceAll = (meta === null || meta === void 0 ? void 0 : meta.type) === \"force\" && !meta.name;\n\t\t\t\t\tconst forceName = (meta === null || meta === void 0 ? void 0 : meta.type) === \"force\" ? meta.name : void 0;\n\t\t\t\t\tconst decorationSetsByExtension = {};\n\t\t\t\t\tconst widgetKeysByExtension = {};\n\t\t\t\t\tconst recomputedNames = /* @__PURE__ */ new Set();\n\t\t\t\t\trunInDecorationApplyScope(editor, () => {\n\t\t\t\t\t\tfor (const { name, spec } of entries) {\n\t\t\t\t\t\t\tconst forced = forceAll || forceName === name;\n\t\t\t\t\t\t\tif (!shouldRecomputeDecoration(spec, {\n\t\t\t\t\t\t\t\teditor,\n\t\t\t\t\t\t\t\ttr,\n\t\t\t\t\t\t\t\toldState,\n\t\t\t\t\t\t\t\tnewState\n\t\t\t\t\t\t\t}, forced)) {\n\t\t\t\t\t\t\t\tconst result = mapDecorations(name, previous, tr);\n\t\t\t\t\t\t\t\tdecorationSetsByExtension[name] = result.set;\n\t\t\t\t\t\t\t\twidgetKeysByExtension[name] = result.widgetKeys;\n\t\t\t\t\t\t\t} else if (spec.update === \"changedRanges\" && tr.docChanged && !forced) {\n\t\t\t\t\t\t\t\tconst result = this.applyChangedRangesRecompute(name, spec, previous, tr, newState);\n\t\t\t\t\t\t\t\tdecorationSetsByExtension[name] = result.set;\n\t\t\t\t\t\t\t\twidgetKeysByExtension[name] = result.widgetKeys;\n\t\t\t\t\t\t\t\trecomputedNames.add(name);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tconst { set, widgetKeys } = this.buildFullSet(name, spec, newState);\n\t\t\t\t\t\t\t\tdecorationSetsByExtension[name] = set;\n\t\t\t\t\t\t\t\twidgetKeysByExtension[name] = widgetKeys;\n\t\t\t\t\t\t\t\trecomputedNames.add(name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tif (recomputedNames.size === 0 && !tr.docChanged) return previous;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdecorationSetsByExtension,\n\t\t\t\t\t\twidgetKeysByExtension,\n\t\t\t\t\t\tmergedDecorationSet: this.mergeAfterApply({\n\t\t\t\t\t\t\tentries,\n\t\t\t\t\t\t\tprevious,\n\t\t\t\t\t\t\ttr,\n\t\t\t\t\t\t\tdecorationSetsByExtension,\n\t\t\t\t\t\t\trecomputedNames\n\t\t\t\t\t\t}),\n\t\t\t\t\t\twidgetKeys: unionWidgetKeys(widgetKeysByExtension)\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t\tprops: { decorations(state) {\n\t\t\t\tvar _DECORATION_MANAGER_P3, _DECORATION_MANAGER_P4;\n\t\t\t\treturn (_DECORATION_MANAGER_P3 = (_DECORATION_MANAGER_P4 = DECORATION_MANAGER_PLUGIN_KEY.getState(state)) === null || _DECORATION_MANAGER_P4 === void 0 ? void 0 : _DECORATION_MANAGER_P4.mergedDecorationSet) !== null && _DECORATION_MANAGER_P3 !== void 0 ? _DECORATION_MANAGER_P3 : DecorationSet.empty;\n\t\t\t} }\n\t\t});\n\t}\n\t/**\n\t* Applies changed ranges recomputation to a decoration set, dropping stale decorations and rebuilding only the touched blocks.\n\t* @param name The name of the decoration extension\n\t* @param spec The decoration spec\n\t* @param previous The previous decoration manager state\n\t* @param tr The transaction to apply\n\t* @param newState The new editor state\n\t* @returns The updated decoration set and widget keys\n\t*/\n\tapplyChangedRangesRecompute(name, spec, previous, tr, newState) {\n\t\tconst resolution = getRebuildRanges(tr, newState.doc);\n\t\tif (resolution.type === \"full\") return this.buildFullSet(name, spec, newState);\n\t\treturn this.rebuildRanges(name, spec, previous, tr, newState, resolution.ranges);\n\t}\n\t/**\n\t* Rebuilds decorations for the changed block ranges: maps the previous set\n\t* forward, then for each range removes stale decorations, calls\n\t* `createInRange`, and adds the new ones while syncing widget keys.\n\t* @param name The extension name.\n\t* @param spec The decoration spec.\n\t* @param previous The previous decoration manager state.\n\t* @param tr The transaction to apply.\n\t* @param newState The new editor state.\n\t* @param ranges The block ranges to rebuild.\n\t* @returns The updated decoration set and widget keys.\n\t*/\n\trebuildRanges(name, spec, previous, tr, newState, ranges) {\n\t\tvar _previous$decorationS, _previous$widgetKeysB;\n\t\tconst previousSet = (_previous$decorationS = previous.decorationSetsByExtension[name]) !== null && _previous$decorationS !== void 0 ? _previous$decorationS : DecorationSet.empty;\n\t\tconst widgetKeys = new Set((_previous$widgetKeysB = previous.widgetKeysByExtension[name]) !== null && _previous$widgetKeysB !== void 0 ? _previous$widgetKeysB : []);\n\t\tlet set = mapDecorationSet(previousSet, tr.mapping, tr.doc, widgetKeys);\n\t\tconst docSize = newState.doc.content.size;\n\t\tfor (const { from, to } of ranges) {\n\t\t\tconst stale = set.find(from, to).filter((decoration) => rangeOwnsPosition({\n\t\t\t\tposition: decoration.from,\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tdocSize\n\t\t\t}));\n\t\t\tfor (const decoration of stale) {\n\t\t\t\tconst key = widgetKeyOf(decoration);\n\t\t\t\tif (key) widgetKeys.delete(key);\n\t\t\t}\n\t\t\tset = set.remove(stale);\n\t\t\tconst { decorations: pmDecorations, widgetKeys: addedKeys } = decorationsToPMDecorations(filterOutOfRangeDecorations({\n\t\t\t\tdecorations: this.runCreate(name, \"createInRange\", () => spec.createInRange({\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tstate: newState,\n\t\t\t\t\tview: this.mountedView,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto\n\t\t\t\t})),\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tdocSize,\n\t\t\t\textensionName: name,\n\t\t\t\twarnedExtensions: this.warnedOutOfRangeExtensions\n\t\t\t}), name);\n\t\t\tset = set.add(newState.doc, pmDecorations);\n\t\t\tfor (const key of addedKeys) widgetKeys.add(key);\n\t\t}\n\t\treturn {\n\t\t\tset,\n\t\t\twidgetKeys\n\t\t};\n\t}\n\t/**\n\t* Builds a full decoration set for the entire document.\n\t* @param name The name of the decoration extension\n\t* @param spec The decoration spec\n\t* @param state The editor state\n\t* @returns The decoration set and widget keys\n\t*/\n\tbuildFullSet(name, spec, state) {\n\t\tconst decorations = this.runCreate(name, \"create\", () => spec.create({\n\t\t\teditor: this.editor,\n\t\t\tstate,\n\t\t\tview: this.mountedView\n\t\t}));\n\t\treturn buildDecorationSet(state.doc, decorations, name);\n\t}\n\t/**\n\t* Runs a decoration callback and swallows anything it throws. These run inside\n\t* `state.apply`, where an uncaught error would abort the whole transaction.\n\t* @param name The extension name.\n\t* @param method The callback name, used in the error message.\n\t* @param create The callback to run.\n\t* @returns The decorations, or an empty array if the callback threw.\n\t*/\n\trunCreate(name, method, create) {\n\t\ttry {\n\t\t\treturn create();\n\t\t} catch (error) {\n\t\t\tconsole.error(`[tiptap error]: Extension \"${name}\" threw in \\`addDecorations().${method}()\\`. Its decorations were dropped for this update.`, error);\n\t\t\treturn [];\n\t\t}\n\t}\n\twarnDuplicateWidgetKeys(state) {\n\t\tif (!isDev) return;\n\t\tif (state.widgetKeys.size === 0) {\n\t\t\tthis.warnedWidgetKeys.clear();\n\t\t\treturn;\n\t\t}\n\t\tconst duplicateKeys = findDuplicateWidgetKeys(state.mergedDecorationSet);\n\t\tconst nextWarningKeys = new Set(duplicateKeys.map(({ key }) => key));\n\t\tfor (const { key, extensions } of duplicateKeys) {\n\t\t\tif (this.warnedWidgetKeys.has(key)) continue;\n\t\t\tconst names = Array.from(extensions).map((name) => `\"${name}\"`).join(\", \");\n\t\t\tconsole.warn(`[tiptap warn]: Duplicate widget decoration key \"${key}\" in extension${extensions.size === 1 ? \"\" : \"s\"} ${names}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \\`comment-\\${id}\\`).`);\n\t\t}\n\t\tthis.warnedWidgetKeys = nextWarningKeys;\n\t}\n\t/**\n\t* Builds the merged DecorationSet during init. Skips the merge for a\n\t* single extension since its per-extension set is already correct.\n\t* @param doc The document to build the merged set for.\n\t* @param decorationSetsByExtension The per-extension decoration sets.\n\t* @returns The merged decoration set.\n\t*/\n\tbuildMergedSet(doc, decorationSetsByExtension) {\n\t\tconst names = Object.keys(decorationSetsByExtension);\n\t\tif (names.length === 1) return decorationSetsByExtension[names[0]];\n\t\treturn mergeDecorationSets(doc, decorationSetsByExtension);\n\t}\n\t/**\n\t* Computes the merged DecorationSet after apply. Single extension skips the\n\t* merge; nothing recomputed maps the previous merged set forward; otherwise\n\t* the merge is rebuilt from the per-extension sets.\n\t*/\n\tmergeAfterApply({ entries, previous, tr, decorationSetsByExtension, recomputedNames }) {\n\t\tif (entries.length === 1) return decorationSetsByExtension[entries[0].name];\n\t\tif (recomputedNames.size === 0) return previous.mergedDecorationSet.map(tr.mapping, tr.doc);\n\t\treturn mergeDecorationSets(tr.doc, decorationSetsByExtension);\n\t}\n};\n//#endregion\n//#region src/utilities/attrsEqual.ts\n/**\n* Compare two attribute objects for equality.\n* Handles null/undefined and asserts key presence in both objects so that\n* `{ foo: undefined }` and `{ bar: undefined }` are not treated as equal.\n*/\nfunction attrsEqual(a, b) {\n\tif (a === b) return true;\n\tif (!a || !b) return false;\n\tconst keysA = Object.keys(a);\n\tconst keysB = Object.keys(b);\n\tif (keysA.length !== keysB.length) return false;\n\treturn keysA.every((key) => Object.prototype.hasOwnProperty.call(b, key) && Object.is(a[key], b[key]));\n}\n//#endregion\n//#region src/utilities/canInsertNode.ts\nfunction canInsertNode(state, nodeType) {\n\tconst { selection } = state;\n\tconst { $from } = selection;\n\tif (selection instanceof NodeSelection) {\n\t\tconst index = $from.index();\n\t\treturn $from.parent.canReplaceWith(index, index + 1, nodeType);\n\t}\n\tlet depth = $from.depth;\n\twhile (depth >= 0) {\n\t\tconst index = $from.index(depth);\n\t\tif ($from.node(depth).contentMatchAt(index).matchType(nodeType)) return true;\n\t\tdepth -= 1;\n\t}\n\treturn false;\n}\n//#endregion\n//#region src/utilities/createStyleTag.ts\nfunction createStyleTag(style, nonce, suffix) {\n\tconst tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : \"\"}]`);\n\tif (tiptapStyleTag !== null) return tiptapStyleTag;\n\tconst styleNode = document.createElement(\"style\");\n\tif (nonce) styleNode.setAttribute(\"nonce\", nonce);\n\tstyleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : \"\"}`, \"\");\n\tstyleNode.innerHTML = style;\n\tdocument.getElementsByTagName(\"head\")[0].appendChild(styleNode);\n\treturn styleNode;\n}\n//#endregion\n//#region src/utilities/escapeForRegEx.ts\nfunction escapeForRegEx(string) {\n\treturn string.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n}\n//#endregion\n//#region src/utilities/getStyleProperty.ts\n/**\n* Read a CSS property value directly from an element's raw inline `style`\n* attribute, bypassing the CSSOM (e.g. `element.style.fontFamily`) which\n* canonicalizes values and can change formatting. The original format is\n* preserved (quotes, hex vs rgb, etc.).\n*\n* When a property is declared more than once, the last declaration wins —\n* this matches CSS cascade order and is useful when nested spans are merged\n* and the child's value should take priority.\n*\n* Property name comparison is case-insensitive.\n*\n* @param element - The element whose `style` attribute should be read.\n* @param propertyName - The CSS property name (e.g. `font-family`).\n* @returns The raw value string, or `null` if the property is not present.\n*\n* @example\n* ```ts\n* parseHTML: element => getStyleProperty(element, 'font-family')\n* ```\n*/\nfunction getStyleProperty(element, propertyName) {\n\tconst styleAttr = element.getAttribute(\"style\");\n\tif (!styleAttr) return null;\n\tconst decls = styleAttr.split(\";\").map((decl) => decl.trim()).filter(Boolean);\n\tconst target = propertyName.toLowerCase();\n\tfor (let i = decls.length - 1; i >= 0; i -= 1) {\n\t\tconst decl = decls[i];\n\t\tconst colonIndex = decl.indexOf(\":\");\n\t\tif (colonIndex === -1) continue;\n\t\tif (decl.slice(0, colonIndex).trim().toLowerCase() === target) return decl.slice(colonIndex + 1).trim();\n\t}\n\treturn null;\n}\n//#endregion\n//#region src/utilities/htmlEntities.ts\n/**\n* Decode common HTML entities in text content so they display as literal\n* characters inside the editor. The decode order matters: `&amp;` must be\n* decoded **last** so that doubly-encoded sequences like `&amp;lt;` first\n* survive the `&lt;` pass and then correctly become `&lt;` (not `<`).\n*/\nfunction decodeHtmlEntities(text) {\n\treturn text.replace(/&lt;/g, \"<\").replace(/&gt;/g, \">\").replace(/&quot;/g, \"\\\"\").replace(/&amp;/g, \"&\");\n}\n/**\n* Encode HTML special characters so they roundtrip safely through markdown.\n* `&` is encoded **first** to avoid double-encoding the ampersand in other\n* entities (e.g. `<` → `&lt;`, not `&amp;lt;`).\n*\n* Note: `\"` is intentionally NOT encoded here because double quotes are\n* ordinary characters in markdown and do not need escaping. The decode\n* function still handles `&quot;` because the markdown tokenizer may emit it.\n*/\nfunction encodeHtmlEntities(text) {\n\treturn text.replace(/&/g, \"&amp;\").replace(/</g, \"&lt;\").replace(/>/g, \"&gt;\");\n}\n//#endregion\n//#region src/utilities/isFirefox.ts\n/**\n* Detects if the current browser is Firefox.\n* @returns `true` if the browser is Firefox, `false` otherwise.\n* @example\n* if (isFirefox()) {\n* // Firefox-specific handling\n* }\n*/\nfunction isFirefox() {\n\treturn typeof navigator !== \"undefined\" ? /Firefox/.test(navigator.userAgent) : false;\n}\n//#endregion\n//#region src/utilities/isNumber.ts\nfunction isNumber(value) {\n\treturn typeof value === \"number\";\n}\n//#endregion\n//#region src/utilities/isPlainObject.ts\nfunction getType(value) {\n\treturn Object.prototype.toString.call(value).slice(8, -1);\n}\nfunction isPlainObject(value) {\n\tif (getType(value) !== \"Object\") return false;\n\treturn value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;\n}\n//#endregion\n//#region src/utilities/isString.ts\nfunction isString(value) {\n\treturn typeof value === \"string\";\n}\n//#endregion\n//#region src/utilities/markdown/tokenizeAttributes.ts\nfunction isWhitespace(character) {\n\treturn /\\s/.test(character);\n}\nfunction isAsciiLetter(character) {\n\treturn /^[a-zA-Z]$/.test(character);\n}\nfunction isWordCharacter(character) {\n\treturn /^\\w$/.test(character);\n}\nfunction skipWhitespace(input, index) {\n\twhile (index < input.length && isWhitespace(input[index])) index += 1;\n\treturn index;\n}\nfunction skipToWhitespace(input, index) {\n\twhile (index < input.length && !isWhitespace(input[index])) index += 1;\n\treturn index;\n}\nfunction readName(input, index, allowHyphen) {\n\twhile (index < input.length && (isWordCharacter(input[index]) || allowHyphen && input[index] === \"-\")) index += 1;\n\treturn index;\n}\nfunction readShorthand(input, index) {\n\tconst prefix = input[index];\n\tconst nameStart = index + 1;\n\tconst nameEnd = readName(input, nameStart, true);\n\tif (nameEnd === nameStart) return { nextIndex: skipToWhitespace(input, nameEnd) };\n\treturn {\n\t\ttoken: {\n\t\t\ttype: prefix === \".\" ? \"class\" : \"id\",\n\t\t\tname: input.slice(nameStart, nameEnd)\n\t\t},\n\t\tnextIndex: skipToWhitespace(input, nameEnd)\n\t};\n}\nfunction readQuotedSegment(input, index) {\n\tconst closingQuote = input.indexOf(input[index], index + 1);\n\treturn { nextIndex: skipToWhitespace(input, closingQuote === -1 ? index : closingQuote + 1) };\n}\nfunction readKeyValue(input, name, index, allowWhitespace) {\n\tlet valueStart = allowWhitespace ? skipWhitespace(input, index) : index;\n\tif (input[valueStart] !== \"=\") return;\n\tvalueStart = allowWhitespace ? skipWhitespace(input, valueStart + 1) : valueStart + 1;\n\tconst quote = input[valueStart];\n\tif (quote !== \"\\\"\" && quote !== \"'\") return;\n\tconst valueEnd = input.indexOf(quote, valueStart + 1);\n\tif (valueEnd === -1) return;\n\treturn {\n\t\ttoken: {\n\t\t\ttype: \"keyValue\",\n\t\t\tname,\n\t\t\tvalue: input.slice(valueStart + 1, valueEnd)\n\t\t},\n\t\tnextIndex: skipToWhitespace(input, valueEnd + 1)\n\t};\n}\nfunction readNamedAttribute(input, index, syntax) {\n\tconst isPandoc = syntax === \"pandoc\";\n\tconst nameEnd = readName(input, index + 1, isPandoc);\n\tconst name = input.slice(index, nameEnd);\n\tconst keyValue = readKeyValue(input, name, nameEnd, isPandoc);\n\tif (keyValue) return keyValue;\n\tconst isStandalone = nameEnd === input.length || isWhitespace(input[nameEnd]);\n\treturn {\n\t\ttoken: isPandoc && isStandalone ? {\n\t\t\ttype: \"boolean\",\n\t\t\tname\n\t\t} : void 0,\n\t\tnextIndex: syntax === \"shortcode\" ? skipToWhitespace(input, nameEnd) : nameEnd\n\t};\n}\nfunction readAttribute(input, index, syntax) {\n\tconst prefix = input[index];\n\tif (syntax === \"pandoc\" && (prefix === \".\" || prefix === \"#\")) return readShorthand(input, index);\n\tif (prefix === \"\\\"\" || prefix === \"'\") return readQuotedSegment(input, index);\n\tif (syntax === \"pandoc\" ? isAsciiLetter(prefix) : isWordCharacter(prefix)) return readNamedAttribute(input, index, syntax);\n\treturn { nextIndex: skipToWhitespace(input, index) };\n}\nfunction tokenizeAttributes(input, syntax) {\n\tconst tokens = [];\n\tlet index = 0;\n\twhile (index < input.length) {\n\t\tindex = skipWhitespace(input, index);\n\t\tif (index >= input.length) break;\n\t\tconst result = readAttribute(input, index, syntax);\n\t\tif (result.token) tokens.push(result.token);\n\t\tindex = result.nextIndex;\n\t}\n\treturn tokens;\n}\n//#endregion\n//#region src/utilities/markdown/parseAttributes.ts\nfunction applyTokens(tokens) {\n\tconst attributes = {};\n\tconst classes = tokens.filter((token) => token.type === \"class\").map((token) => token.name);\n\tconst id = tokens.find((token) => token.type === \"id\");\n\tif (classes.length > 0) attributes.class = classes.join(\" \");\n\tif (id) attributes.id = id.name;\n\ttokens.forEach((token) => {\n\t\tif (token.type === \"keyValue\") attributes[token.name] = token.value;\n\t});\n\ttokens.forEach((token) => {\n\t\tif (token.type === \"boolean\") attributes[token.name] = true;\n\t});\n\treturn attributes;\n}\n/**\n* Parses a Pandoc-style attribute string into an object.\n*\n* @param attrString - The attribute string to parse\n* @returns Parsed attributes object\n*\n* @example\n* ```ts\n* parseAttributes('.btn #submit disabled type=\"button\"')\n* // { class: 'btn', id: 'submit', disabled: true, type: 'button' }\n* ```\n*/\nfunction parseAttributes(attrString) {\n\tif (!(attrString === null || attrString === void 0 ? void 0 : attrString.trim())) return {};\n\treturn applyTokens(tokenizeAttributes(attrString, \"pandoc\"));\n}\n//#endregion\n//#region src/utilities/markdown/serializeAttributes.ts\n/**\n* Serializes an attributes object to a Pandoc-style attribute string.\n*\n* @param attributes - The attributes object to serialize\n* @returns Serialized attribute string\n*\n* @example\n* ```ts\n* serializeAttributes({ class: 'btn primary', id: 'submit', disabled: true, type: 'button' })\n* // '.btn .primary #submit disabled type=\"button\"'\n* ```\n*/\nfunction serializeAttributes(attributes) {\n\tif (!attributes || Object.keys(attributes).length === 0) return \"\";\n\tconst parts = [];\n\tif (attributes.class) String(attributes.class).split(/\\s+/).filter(Boolean).forEach((className) => parts.push(`.${className}`));\n\tif (attributes.id) parts.push(`#${attributes.id}`);\n\tObject.entries(attributes).forEach(([key, value]) => {\n\t\tif (key === \"class\" || key === \"id\") return;\n\t\tif (value === true) parts.push(key);\n\t\telse if (value !== false && value != null) parts.push(`${key}=\"${String(value)}\"`);\n\t});\n\treturn parts.join(\" \");\n}\n//#endregion\n//#region src/utilities/markdown/createAtomBlockMarkdownSpec.ts\n/**\n* Creates a complete markdown spec for atomic block nodes using Pandoc syntax.\n*\n* The generated spec handles:\n* - Parsing self-closing blocks with `:::blockName {attributes}`\n* - Extracting and parsing attributes\n* - Validating required attributes\n* - Rendering blocks back to markdown\n*\n* @param options - Configuration for the atomic block markdown spec\n* @returns Complete markdown specification object\n*\n* @example\n* ```ts\n* const youtubeSpec = createAtomBlockMarkdownSpec({\n* nodeName: 'youtube',\n* requiredAttributes: ['src'],\n* defaultAttributes: { start: 0 },\n* allowedAttributes: ['src', 'start', 'width', 'height'] // Only these get rendered to markdown\n* })\n*\n* // Usage in extension:\n* export const Youtube = Node.create({\n* // ... other config\n* markdown: youtubeSpec\n* })\n* ```\n*/\nfunction createAtomBlockMarkdownSpec(options) {\n\tconst { nodeName, name: markdownName, parseAttributes: parseAttributes$2 = parseAttributes, serializeAttributes: serializeAttributes$2 = serializeAttributes, defaultAttributes = {}, requiredAttributes = [], allowedAttributes } = options;\n\tconst blockName = markdownName || nodeName;\n\tconst filterAttributes = (attrs) => {\n\t\tif (!allowedAttributes) return attrs;\n\t\tconst filtered = {};\n\t\tallowedAttributes.forEach((key) => {\n\t\t\tif (key in attrs) filtered[key] = attrs[key];\n\t\t});\n\t\treturn filtered;\n\t};\n\treturn {\n\t\tparseMarkdown: (token, h) => {\n\t\t\tconst attrs = {\n\t\t\t\t...defaultAttributes,\n\t\t\t\t...token.attributes\n\t\t\t};\n\t\t\treturn h.createNode(nodeName, attrs, []);\n\t\t},\n\t\tmarkdownTokenizer: {\n\t\t\tname: nodeName,\n\t\t\tlevel: \"block\",\n\t\t\tstart(src) {\n\t\t\t\tvar _src$match;\n\t\t\t\tconst regex = new RegExp(`^:::${blockName}(?:\\\\s|$)`, \"m\");\n\t\t\t\tconst index = (_src$match = src.match(regex)) === null || _src$match === void 0 ? void 0 : _src$match.index;\n\t\t\t\treturn index !== void 0 ? index : -1;\n\t\t\t},\n\t\t\ttokenize(src, _tokens, _lexer) {\n\t\t\t\tconst regex = new RegExp(`^:::${blockName}(?:\\\\s+\\\\{([^}]*)\\\\})?\\\\s*:::(?:\\\\n|$)`);\n\t\t\t\tconst match = src.match(regex);\n\t\t\t\tif (!match) return;\n\t\t\t\tconst attrString = match[1] || \"\";\n\t\t\t\tconst attributes = parseAttributes$2(attrString);\n\t\t\t\tif (requiredAttributes.find((required) => !(required in attributes))) return;\n\t\t\t\treturn {\n\t\t\t\t\ttype: nodeName,\n\t\t\t\t\traw: match[0],\n\t\t\t\t\tattributes\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\trenderMarkdown: (node) => {\n\t\t\tconst filteredAttrs = filterAttributes(node.attrs || {});\n\t\t\tconst attrs = serializeAttributes$2(filteredAttrs);\n\t\t\tconst attrString = attrs ? ` {${attrs}}` : \"\";\n\t\t\treturn `:::${blockName}${attrString} :::`;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/utilities/markdown/createBlockMarkdownSpec.ts\n/**\n* Creates a complete markdown spec for block-level nodes using Pandoc syntax.\n*\n* The generated spec handles:\n* - Parsing blocks with `:::blockName {attributes}` syntax\n* - Extracting and parsing attributes\n* - Rendering blocks back to markdown with proper formatting\n* - Nested content support\n*\n* @param options - Configuration for the block markdown spec\n* @returns Complete markdown specification object\n*\n* @example\n* ```ts\n* const calloutSpec = createBlockMarkdownSpec({\n* nodeName: 'callout',\n* defaultAttributes: { type: 'info' },\n* allowedAttributes: ['type', 'title'] // Only these get rendered to markdown\n* })\n*\n* // Usage in extension:\n* export const Callout = Node.create({\n* // ... other config\n* markdown: calloutSpec\n* })\n* ```\n*/\nfunction createBlockMarkdownSpec(options) {\n\tconst { nodeName, name: markdownName, getContent, parseAttributes: parseAttributes$1 = parseAttributes, serializeAttributes: serializeAttributes$1 = serializeAttributes, defaultAttributes = {}, content = \"block\", allowedAttributes } = options;\n\tconst blockName = markdownName || nodeName;\n\tconst filterAttributes = (attrs) => {\n\t\tif (!allowedAttributes) return attrs;\n\t\tconst filtered = {};\n\t\tallowedAttributes.forEach((key) => {\n\t\t\tif (key in attrs) filtered[key] = attrs[key];\n\t\t});\n\t\treturn filtered;\n\t};\n\treturn {\n\t\tparseMarkdown: (token, h) => {\n\t\t\tlet nodeContent;\n\t\t\tif (getContent) {\n\t\t\t\tconst contentResult = getContent(token);\n\t\t\t\tnodeContent = typeof contentResult === \"string\" ? [{\n\t\t\t\t\ttype: \"text\",\n\t\t\t\t\ttext: contentResult\n\t\t\t\t}] : contentResult;\n\t\t\t} else if (content === \"block\") nodeContent = h.parseChildren(token.tokens || []);\n\t\t\telse nodeContent = h.parseInline(token.tokens || []);\n\t\t\tconst attrs = {\n\t\t\t\t...defaultAttributes,\n\t\t\t\t...token.attributes\n\t\t\t};\n\t\t\treturn h.createNode(nodeName, attrs, nodeContent);\n\t\t},\n\t\tmarkdownTokenizer: {\n\t\t\tname: nodeName,\n\t\t\tlevel: \"block\",\n\t\t\tstart(src) {\n\t\t\t\tvar _src$match;\n\t\t\t\tconst regex = new RegExp(`^:::${blockName}`, \"m\");\n\t\t\t\tconst index = (_src$match = src.match(regex)) === null || _src$match === void 0 ? void 0 : _src$match.index;\n\t\t\t\treturn index !== void 0 ? index : -1;\n\t\t\t},\n\t\t\ttokenize(src, _tokens, lexer) {\n\t\t\t\tconst openingRegex = new RegExp(`^:::${blockName}(?:\\\\s+\\\\{([^}]*)\\\\})?\\\\s*\\\\n`);\n\t\t\t\tconst openingMatch = src.match(openingRegex);\n\t\t\t\tif (!openingMatch) return;\n\t\t\t\tconst [openingTag, attrString = \"\"] = openingMatch;\n\t\t\t\tconst attributes = parseAttributes$1(attrString);\n\t\t\t\tlet level = 1;\n\t\t\t\tconst position = openingTag.length;\n\t\t\t\tlet matchedContent = \"\";\n\t\t\t\tconst blockPattern = /^:::([\\w-]*)(\\s.*)?/gm;\n\t\t\t\tconst remaining = src.slice(position);\n\t\t\t\tblockPattern.lastIndex = 0;\n\t\t\t\tfor (;;) {\n\t\t\t\t\tvar _match$;\n\t\t\t\t\tconst match = blockPattern.exec(remaining);\n\t\t\t\t\tif (match === null) break;\n\t\t\t\t\tconst matchPos = match.index;\n\t\t\t\t\tconst blockType = match[1];\n\t\t\t\t\tif ((_match$ = match[2]) === null || _match$ === void 0 ? void 0 : _match$.endsWith(\":::\")) continue;\n\t\t\t\t\tif (blockType) level += 1;\n\t\t\t\t\telse {\n\t\t\t\t\t\tlevel -= 1;\n\t\t\t\t\t\tif (level === 0) {\n\t\t\t\t\t\t\tconst rawContent = remaining.slice(0, matchPos);\n\t\t\t\t\t\t\tmatchedContent = rawContent.trim();\n\t\t\t\t\t\t\tconst fullMatch = src.slice(0, position + matchPos + match[0].length);\n\t\t\t\t\t\t\tlet contentTokens = [];\n\t\t\t\t\t\t\tif (matchedContent) {\n\t\t\t\t\t\t\t\tif (content === \"block\") {\n\t\t\t\t\t\t\t\t\tcontentTokens = lexer.blockTokens(rawContent);\n\t\t\t\t\t\t\t\t\tcontentTokens.forEach((token) => {\n\t\t\t\t\t\t\t\t\t\tif (token.text && (!token.tokens || token.tokens.length === 0)) token.tokens = lexer.inlineTokens(token.text);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\twhile (contentTokens.length > 0) {\n\t\t\t\t\t\t\t\t\t\tconst lastToken = contentTokens[contentTokens.length - 1];\n\t\t\t\t\t\t\t\t\t\tif (lastToken.type === \"paragraph\" && (!lastToken.text || lastToken.text.trim() === \"\")) contentTokens.pop();\n\t\t\t\t\t\t\t\t\t\telse break;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else contentTokens = lexer.inlineTokens(matchedContent);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\ttype: nodeName,\n\t\t\t\t\t\t\t\traw: fullMatch,\n\t\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\t\tcontent: matchedContent,\n\t\t\t\t\t\t\t\ttokens: contentTokens\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\trenderMarkdown: (node, h) => {\n\t\t\tconst filteredAttrs = filterAttributes(node.attrs || {});\n\t\t\tconst attrs = serializeAttributes$1(filteredAttrs);\n\t\t\tconst attrString = attrs ? ` {${attrs}}` : \"\";\n\t\t\tconst renderedContent = h.renderChildren(node.content || [], \"\\n\\n\");\n\t\t\treturn `:::${blockName}${attrString}\\n\\n${renderedContent}\\n\\n:::`;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/utilities/markdown/parseShortcodeAttributes.ts\nfunction parseShortcodeAttributes(attrString) {\n\tconst attributes = {};\n\ttokenizeAttributes(attrString, \"shortcode\").forEach((token) => {\n\t\tif (token.type === \"keyValue\") attributes[token.name] = token.value;\n\t});\n\treturn attributes;\n}\n//#endregion\n//#region src/utilities/markdown/createInlineMarkdownSpec.ts\n/**\n* Serialize attributes back to shortcode format\n* Always quotes all values with double quotes\n*/\nfunction serializeShortcodeAttributes(attrs) {\n\treturn Object.entries(attrs).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => `${key}=\"${value}\"`).join(\" \");\n}\n/**\n* Creates a complete markdown spec for inline nodes using attribute syntax.\n*\n* The generated spec handles:\n* - Parsing shortcode syntax with `[nodeName attributes]content[/nodeName]` format\n* - Self-closing shortcodes like `[emoji name=party_popper]`\n* - Extracting and parsing attributes from the opening tag\n* - Rendering inline elements back to shortcode markdown\n* - Supporting both content-based and self-closing inline elements\n*\n* @param options - Configuration for the inline markdown spec\n* @returns Complete markdown specification object\n*\n* @example\n* ```ts\n* // Self-closing mention: [mention id=\"madonna\" label=\"Madonna\"]\n* const mentionSpec = createInlineMarkdownSpec({\n* nodeName: 'mention',\n* selfClosing: true,\n* defaultAttributes: { type: 'user' },\n* allowedAttributes: ['id', 'label'] // Only these get rendered to markdown\n* })\n*\n* // Self-closing emoji: [emoji name=\"party_popper\"]\n* const emojiSpec = createInlineMarkdownSpec({\n* nodeName: 'emoji',\n* selfClosing: true,\n* allowedAttributes: ['name']\n* })\n*\n* // With content: [highlight color=\"yellow\"]text[/highlight]\n* const highlightSpec = createInlineMarkdownSpec({\n* nodeName: 'highlight',\n* selfClosing: false,\n* allowedAttributes: ['color', 'style']\n* })\n*\n* // Usage in extension:\n* export const Mention = Node.create({\n* name: 'mention', // Must match nodeName\n* // ... other config\n* markdown: mentionSpec\n* })\n* ```\n*/\nfunction createInlineMarkdownSpec(options) {\n\tconst { nodeName, name: shortcodeName, getContent, parseAttributes = parseShortcodeAttributes, serializeAttributes = serializeShortcodeAttributes, defaultAttributes = {}, selfClosing = false, allowedAttributes } = options;\n\tconst shortcode = shortcodeName || nodeName;\n\tconst filterAttributes = (attrs) => {\n\t\tif (!allowedAttributes) return attrs;\n\t\tconst filtered = {};\n\t\tallowedAttributes.forEach((attr) => {\n\t\t\tconst attrName = typeof attr === \"string\" ? attr : attr.name;\n\t\t\tconst skipIfDefault = typeof attr === \"string\" ? void 0 : attr.skipIfDefault;\n\t\t\tif (attrName in attrs) {\n\t\t\t\tconst value = attrs[attrName];\n\t\t\t\tif (skipIfDefault !== void 0 && value === skipIfDefault) return;\n\t\t\t\tfiltered[attrName] = value;\n\t\t\t}\n\t\t});\n\t\treturn filtered;\n\t};\n\tconst escapedShortcode = shortcode.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\treturn {\n\t\tparseMarkdown: (token, h) => {\n\t\t\tconst attrs = {\n\t\t\t\t...defaultAttributes,\n\t\t\t\t...token.attributes\n\t\t\t};\n\t\t\tif (selfClosing) return h.createNode(nodeName, attrs);\n\t\t\tconst content = getContent ? getContent(token) : token.content || \"\";\n\t\t\tif (content) return h.createNode(nodeName, attrs, [h.createTextNode(content)]);\n\t\t\treturn h.createNode(nodeName, attrs, []);\n\t\t},\n\t\tmarkdownTokenizer: {\n\t\t\tname: nodeName,\n\t\t\tlevel: \"inline\",\n\t\t\tstart(src) {\n\t\t\t\tconst startPattern = selfClosing ? new RegExp(`\\\\[${escapedShortcode}\\\\s*[^\\\\]]*\\\\]`) : new RegExp(`\\\\[${escapedShortcode}\\\\s*[^\\\\]]*\\\\][\\\\s\\\\S]*?\\\\[\\\\/${escapedShortcode}\\\\]`);\n\t\t\t\tconst match = src.match(startPattern);\n\t\t\t\tconst index = match === null || match === void 0 ? void 0 : match.index;\n\t\t\t\treturn index !== void 0 ? index : -1;\n\t\t\t},\n\t\t\ttokenize(src, _tokens, _lexer) {\n\t\t\t\tconst tokenPattern = selfClosing ? new RegExp(`^\\\\[${escapedShortcode}\\\\s*([^\\\\]]*)\\\\]`) : new RegExp(`^\\\\[${escapedShortcode}\\\\s*([^\\\\]]*)\\\\]([\\\\s\\\\S]*?)\\\\[\\\\/${escapedShortcode}\\\\]`);\n\t\t\t\tconst match = src.match(tokenPattern);\n\t\t\t\tif (!match) return;\n\t\t\t\tlet content = \"\";\n\t\t\t\tlet attrString = \"\";\n\t\t\t\tif (selfClosing) {\n\t\t\t\t\tconst [, attrs] = match;\n\t\t\t\t\tattrString = attrs;\n\t\t\t\t} else {\n\t\t\t\t\tconst [, attrs, contentMatch] = match;\n\t\t\t\t\tattrString = attrs;\n\t\t\t\t\tcontent = contentMatch || \"\";\n\t\t\t\t}\n\t\t\t\tconst attributes = parseAttributes(attrString.trim());\n\t\t\t\treturn {\n\t\t\t\t\ttype: nodeName,\n\t\t\t\t\traw: match[0],\n\t\t\t\t\tcontent: content.trim(),\n\t\t\t\t\tattributes\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\trenderMarkdown: (node) => {\n\t\t\tlet content = \"\";\n\t\t\tif (getContent) content = getContent(node);\n\t\t\telse if (node.content && node.content.length > 0) content = node.content.filter((child) => child.type === \"text\").map((child) => child.text).join(\"\");\n\t\t\tconst filteredAttrs = filterAttributes(node.attrs || {});\n\t\t\tconst attrs = serializeAttributes(filteredAttrs);\n\t\t\tconst attrString = attrs ? ` ${attrs}` : \"\";\n\t\t\tif (selfClosing) return `[${shortcode}${attrString}]`;\n\t\t\treturn `[${shortcode}${attrString}]${content}[/${shortcode}]`;\n\t\t}\n\t};\n}\n//#endregion\n//#region src/utilities/markdown/parseIndentedBlocks.ts\n/**\n* Parses markdown text into hierarchical indented blocks with proper nesting.\n*\n* This utility handles:\n* - Line-by-line parsing with pattern matching\n* - Hierarchical nesting based on indentation levels\n* - Nested content collection and parsing\n* - Empty line handling\n* - Content dedenting for nested blocks\n*\n* The key difference from flat parsing is that this maintains the hierarchical\n* structure where nested items become `nestedTokens` of their parent items,\n* rather than being flattened into a single array.\n*\n* @param src - The markdown source text to parse\n* @param config - Configuration object defining how to parse and create tokens\n* @param lexer - Markdown lexer for parsing nested content\n* @returns Parsed result with hierarchical items, or undefined if no matches\n*\n* @example\n* ```ts\n* const result = parseIndentedBlocks(src, {\n* itemPattern: /^(\\s*)([-+*])\\s+\\[([ xX])\\]\\s+(.*)$/,\n* extractItemData: (match) => ({\n* indentLevel: match[1].length,\n* mainContent: match[4],\n* checked: match[3].toLowerCase() === 'x'\n* }),\n* createToken: (data, nestedTokens) => ({\n* type: 'taskItem',\n* checked: data.checked,\n* text: data.mainContent,\n* nestedTokens\n* })\n* }, lexer)\n* ```\n*/\nfunction parseIndentedBlocks(src, config, lexer) {\n\tconst lines = src.split(\"\\n\");\n\tconst items = [];\n\tlet totalRaw = \"\";\n\tlet i = 0;\n\tconst baseIndentSize = config.baseIndentSize || 2;\n\twhile (i < lines.length) {\n\t\tconst currentLine = lines[i];\n\t\tconst itemMatch = currentLine.match(config.itemPattern);\n\t\tif (!itemMatch) {\n\t\t\tif (items.length > 0) break;\n\t\t\telse if (currentLine.trim() === \"\") {\n\t\t\t\ti += 1;\n\t\t\t\ttotalRaw = `${totalRaw}${currentLine}\\n`;\n\t\t\t\tcontinue;\n\t\t\t} else return;\n\t\t}\n\t\tconst itemData = config.extractItemData(itemMatch);\n\t\tconst { indentLevel, mainContent } = itemData;\n\t\ttotalRaw = `${totalRaw}${currentLine}\\n`;\n\t\tconst itemContent = [mainContent];\n\t\ti += 1;\n\t\twhile (i < lines.length) {\n\t\t\tvar _nextLine$match;\n\t\t\tconst nextLine = lines[i];\n\t\t\tif (nextLine.trim() === \"\") {\n\t\t\t\tvar _nextNonEmpty$match;\n\t\t\t\tconst nextNonEmptyIndex = lines.slice(i + 1).findIndex((l) => l.trim() !== \"\");\n\t\t\t\tif (nextNonEmptyIndex === -1) break;\n\t\t\t\tif ((((_nextNonEmpty$match = lines[i + 1 + nextNonEmptyIndex].match(/^(\\s*)/)) === null || _nextNonEmpty$match === void 0 || (_nextNonEmpty$match = _nextNonEmpty$match[1]) === null || _nextNonEmpty$match === void 0 ? void 0 : _nextNonEmpty$match.length) || 0) > indentLevel) {\n\t\t\t\t\titemContent.push(nextLine);\n\t\t\t\t\ttotalRaw = `${totalRaw}${nextLine}\\n`;\n\t\t\t\t\ti += 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t} else break;\n\t\t\t}\n\t\t\tif ((((_nextLine$match = nextLine.match(/^(\\s*)/)) === null || _nextLine$match === void 0 || (_nextLine$match = _nextLine$match[1]) === null || _nextLine$match === void 0 ? void 0 : _nextLine$match.length) || 0) > indentLevel) {\n\t\t\t\titemContent.push(nextLine);\n\t\t\t\ttotalRaw = `${totalRaw}${nextLine}\\n`;\n\t\t\t\ti += 1;\n\t\t\t} else break;\n\t\t}\n\t\tlet nestedTokens;\n\t\tconst nestedContent = itemContent.slice(1);\n\t\tif (nestedContent.length > 0) {\n\t\t\tconst dedentedNested = nestedContent.map((nestedLine) => nestedLine.slice(indentLevel + baseIndentSize)).join(\"\\n\");\n\t\t\tif (dedentedNested.trim()) {\n\t\t\t\tif (config.customNestedParser) nestedTokens = config.customNestedParser(dedentedNested);\n\t\t\t\telse nestedTokens = lexer.blockTokens(dedentedNested);\n\t\t\t}\n\t\t}\n\t\tconst token = config.createToken(itemData, nestedTokens);\n\t\titems.push(token);\n\t}\n\tif (items.length === 0) return;\n\treturn {\n\t\titems,\n\t\traw: totalRaw\n\t};\n}\n//#endregion\n//#region src/utilities/markdown/renderNestedMarkdownContent.ts\n/**\n* @fileoverview Utility functions for rendering nested content in markdown.\n*\n* This module provides reusable utilities for extensions that need to render\n* content with a prefix on the main line and properly indented nested content.\n*/\n/**\n* Utility function for rendering content with a main line prefix and nested indented content.\n*\n* This function handles the common pattern of rendering content with:\n* 1. A main line with a prefix (like \"- \" for lists, \"> \" for blockquotes, etc.)\n* 2. Nested content that gets indented properly\n*\n* @param node - The ProseMirror node representing the content\n* @param h - The markdown renderer helper\n* @param prefixOrGenerator - Either a string prefix or a function that generates the prefix from context\n* @param ctx - Optional context object (used when prefixOrGenerator is a function)\n* @returns The rendered markdown string\n*\n* @example\n* ```ts\n* // For a bullet list item with static prefix\n* return renderNestedMarkdownContent(node, h, '- ')\n*\n* // For a task item with static prefix\n* const prefix = `- [${node.attrs?.checked ? 'x' : ' '}] `\n* return renderNestedMarkdownContent(node, h, prefix)\n*\n* // For a blockquote with static prefix\n* return renderNestedMarkdownContent(node, h, '> ')\n*\n* // For content with dynamic prefix based on context\n* return renderNestedMarkdownContent(node, h, ctx => {\n* if (ctx.parentType === 'orderedList') {\n* return `${ctx.index + 1}. `\n* }\n* return '- '\n* }, ctx)\n*\n* // Custom extension example\n* const CustomContainer = Node.create({\n* name: 'customContainer',\n* // ... other config\n* markdown: {\n* render: (node, h) => {\n* const type = node.attrs?.type || 'info'\n* return renderNestedMarkdownContent(node, h, `[${type}] `)\n* }\n* }\n* })\n* ```\n*/\nfunction renderNestedMarkdownContent(node, h, prefixOrGenerator, ctx) {\n\tif (!node || !Array.isArray(node.content)) return \"\";\n\tconst prefix = typeof prefixOrGenerator === \"function\" ? prefixOrGenerator(ctx) : prefixOrGenerator;\n\tconst [content, ...children] = node.content;\n\tlet output = `${prefix}${h.renderChildren([content])}`;\n\tif (children && children.length > 0) children.forEach((child, index) => {\n\t\tvar _h$renderChild, _h$renderChild2;\n\t\tconst childContent = (_h$renderChild = (_h$renderChild2 = h.renderChild) === null || _h$renderChild2 === void 0 ? void 0 : _h$renderChild2.call(h, child, index + 1)) !== null && _h$renderChild !== void 0 ? _h$renderChild : h.renderChildren([child]);\n\t\tif (childContent !== void 0 && childContent !== null) {\n\t\t\tconst indentedChild = childContent.split(\"\\n\").map((line) => line ? h.indent(line) : h.indent(\"\")).join(\"\\n\");\n\t\t\toutput += child.type === \"paragraph\" ? `\\n\\n${indentedChild}` : `\\n${indentedChild}`;\n\t\t}\n\t});\n\treturn output;\n}\n//#endregion\n//#region src/utilities/markdown/index.ts\nvar markdown_exports = /* @__PURE__ */ __exportAll({\n\tcreateAtomBlockMarkdownSpec: () => createAtomBlockMarkdownSpec,\n\tcreateBlockMarkdownSpec: () => createBlockMarkdownSpec,\n\tcreateInlineMarkdownSpec: () => createInlineMarkdownSpec,\n\tparseAttributes: () => parseAttributes,\n\tparseIndentedBlocks: () => parseIndentedBlocks,\n\trenderNestedMarkdownContent: () => renderNestedMarkdownContent,\n\tserializeAttributes: () => serializeAttributes\n});\n//#endregion\n//#region src/utilities/marksEqual.ts\nfunction markTypeName(mark) {\n\treturn typeof mark.type === \"string\" ? mark.type : mark.type.name;\n}\n/**\n* Compare two arrays of mark objects for equality (order-insensitive).\n* Marks are matched by type name and attributes (via attrsEqual),\n* so key ordering in attrs does not matter, nor does mark array order.\n*/\nfunction marksEqual(a, b) {\n\tif (a.length !== b.length) return false;\n\tconst consumed = Array.from({ length: b.length }, () => false);\n\treturn a.every((markA) => {\n\t\tconst nameA = markTypeName(markA);\n\t\tconst idx = b.findIndex((markB, i) => !consumed[i] && nameA === markTypeName(markB) && attrsEqual(markA.attrs, markB.attrs));\n\t\tif (idx === -1) return false;\n\t\tconsumed[idx] = true;\n\t\treturn true;\n\t});\n}\n//#endregion\n//#region src/utilities/mergeDeep.ts\nfunction mergeDeep(target, source) {\n\tconst output = { ...target };\n\tif (isPlainObject(target) && isPlainObject(source)) Object.keys(source).forEach((key) => {\n\t\tif (isPlainObject(source[key]) && isPlainObject(target[key])) output[key] = mergeDeep(target[key], source[key]);\n\t\telse output[key] = source[key];\n\t});\n\treturn output;\n}\n//#endregion\n//#region src/MarkView.ts\nfunction updateMarkViewAttributes(checkMark, editor, attrs = {}) {\n\tconst { state } = editor;\n\tconst { doc, tr } = state;\n\tconst thisMark = checkMark;\n\tdoc.descendants((node, pos) => {\n\t\tconst from = tr.mapping.map(pos);\n\t\tconst to = tr.mapping.map(pos) + node.nodeSize;\n\t\tlet foundMark = null;\n\t\tnode.marks.forEach((mark) => {\n\t\t\tif (mark !== thisMark) return false;\n\t\t\tfoundMark = mark;\n\t\t});\n\t\tif (!foundMark) return;\n\t\tlet needsUpdate = false;\n\t\tObject.keys(attrs).forEach((k) => {\n\t\t\tif (attrs[k] !== foundMark.attrs[k]) needsUpdate = true;\n\t\t});\n\t\tif (needsUpdate) {\n\t\t\tconst updatedMark = checkMark.type.create({\n\t\t\t\t...checkMark.attrs,\n\t\t\t\t...attrs\n\t\t\t});\n\t\t\ttr.removeMark(from, to, checkMark.type);\n\t\t\ttr.addMark(from, to, updatedMark);\n\t\t}\n\t});\n\tif (tr.docChanged) editor.view.dispatch(tr);\n}\nvar MarkView = class {\n\tconstructor(component, props, options) {\n\t\tthis.component = component;\n\t\tthis.editor = props.editor;\n\t\tthis.options = { ...options };\n\t\tthis.mark = props.mark;\n\t\tthis.HTMLAttributes = props.HTMLAttributes;\n\t}\n\tget dom() {\n\t\treturn this.editor.view.dom;\n\t}\n\tget contentDOM() {\n\t\treturn null;\n\t}\n\t/**\n\t* Update the attributes of the mark in the document.\n\t* @param attrs The attributes to update.\n\t*/\n\tupdateAttributes(attrs, checkMark) {\n\t\tupdateMarkViewAttributes(checkMark || this.mark, this.editor, attrs);\n\t}\n\tignoreMutation(mutation) {\n\t\tif (!this.dom || !this.contentDOM) return true;\n\t\tif (typeof this.options.ignoreMutation === \"function\") return this.options.ignoreMutation({ mutation });\n\t\tif (mutation.type === \"selection\") return false;\n\t\tif (this.dom.contains(mutation.target) && mutation.type === \"childList\" && (isiOS() || isAndroid()) && this.editor.isFocused) {\n\t\t\tif ([...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)].every((node) => node.isContentEditable)) return false;\n\t\t}\n\t\tif (this.contentDOM === mutation.target && mutation.type === \"attributes\") return true;\n\t\tif (this.contentDOM.contains(mutation.target)) return false;\n\t\treturn true;\n\t}\n};\n//#endregion\n//#region src/InputRule.ts\nvar InputRule = class {\n\tconstructor(config) {\n\t\tvar _config$undoable;\n\t\tthis.find = config.find;\n\t\tthis.handler = config.handler;\n\t\tthis.undoable = (_config$undoable = config.undoable) !== null && _config$undoable !== void 0 ? _config$undoable : true;\n\t}\n};\nconst inputRuleMatcherHandler = (text, find) => {\n\tif (isRegExp(find)) return find.exec(text);\n\tconst inputRuleMatch = find(text);\n\tif (!inputRuleMatch) return null;\n\tconst result = [inputRuleMatch.text];\n\tresult.index = inputRuleMatch.index;\n\tresult.input = text;\n\tresult.data = inputRuleMatch.data;\n\tif (inputRuleMatch.replaceWith) {\n\t\tif (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) console.warn(\"[tiptap warn]: \\\"inputRuleMatch.replaceWith\\\" must be part of \\\"inputRuleMatch.text\\\".\");\n\t\tresult.push(inputRuleMatch.replaceWith);\n\t}\n\treturn result;\n};\nfunction run$1(config) {\n\tvar _ref;\n\tconst { editor, from, to, text, rules, plugin } = config;\n\tconst { view } = editor;\n\tif (view.composing) return false;\n\tconst $from = view.state.doc.resolve(from);\n\tif ($from.parent.type.spec.code || !!((_ref = $from.nodeBefore || $from.nodeAfter) === null || _ref === void 0 ? void 0 : _ref.marks.find((mark) => mark.type.spec.code))) return false;\n\tlet matched = false;\n\tconst textBefore = getTextContentFromNodes($from) + text;\n\trules.forEach((rule) => {\n\t\tif (matched) return;\n\t\tconst match = inputRuleMatcherHandler(textBefore, rule.find);\n\t\tif (!match) return;\n\t\tconst matchedDocLength = match[0].length - text.length;\n\t\tif (matchedDocLength > 0) {\n\t\t\tconst matchStartOffset = $from.parentOffset - matchedDocLength;\n\t\t\tif (matchStartOffset < 0 || $from.parent.textBetween(matchStartOffset, $from.parentOffset) !== match[0].slice(0, matchedDocLength)) return;\n\t\t}\n\t\tconst tr = view.state.tr;\n\t\tconst state = createChainableState({\n\t\t\tstate: view.state,\n\t\t\ttransaction: tr\n\t\t});\n\t\tconst range = {\n\t\t\tfrom: from - (match[0].length - text.length),\n\t\t\tto\n\t\t};\n\t\tconst { commands, chain, can } = new CommandManager({\n\t\t\teditor,\n\t\t\tstate\n\t\t});\n\t\tif (rule.handler({\n\t\t\tstate,\n\t\t\trange,\n\t\t\tmatch,\n\t\t\tcommands,\n\t\t\tchain,\n\t\t\tcan\n\t\t}) === null || !tr.steps.length) return;\n\t\tif (rule.undoable) tr.setMeta(plugin, {\n\t\t\ttransform: tr,\n\t\t\tfrom,\n\t\t\tto,\n\t\t\ttext\n\t\t});\n\t\tview.dispatch(tr);\n\t\tmatched = true;\n\t});\n\treturn matched;\n}\n/**\n* Create an input rules plugin. When enabled, it will cause text\n* input that matches any of the given rules to trigger the rule’s\n* action.\n*/\nfunction inputRulesPlugin(props) {\n\tconst { editor, rules } = props;\n\tconst plugin = new Plugin({\n\t\tstate: {\n\t\t\tinit() {\n\t\t\t\treturn null;\n\t\t\t},\n\t\t\tapply(tr, prev, state) {\n\t\t\t\tconst stored = tr.getMeta(plugin);\n\t\t\t\tif (stored) return stored;\n\t\t\t\tconst simulatedInputMeta = tr.getMeta(\"applyInputRules\");\n\t\t\t\tif (!!simulatedInputMeta) setTimeout(() => {\n\t\t\t\t\tlet { text } = simulatedInputMeta;\n\t\t\t\t\tif (typeof text === \"string\") text = text;\n\t\t\t\t\telse text = getHTMLFromFragment(Fragment$1.from(text), state.schema);\n\t\t\t\t\tconst { from } = simulatedInputMeta;\n\t\t\t\t\tconst to = from + text.length;\n\t\t\t\t\trun$1({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto,\n\t\t\t\t\t\ttext,\n\t\t\t\t\t\trules,\n\t\t\t\t\t\tplugin\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\treturn tr.selectionSet || tr.docChanged ? null : prev;\n\t\t\t}\n\t\t},\n\t\tprops: {\n\t\t\thandleTextInput(view, from, to, text) {\n\t\t\t\treturn run$1({\n\t\t\t\t\teditor,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\ttext,\n\t\t\t\t\trules,\n\t\t\t\t\tplugin\n\t\t\t\t});\n\t\t\t},\n\t\t\thandleDOMEvents: { compositionend: (view) => {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tconst { $cursor } = view.state.selection;\n\t\t\t\t\tif ($cursor) run$1({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\tfrom: $cursor.pos,\n\t\t\t\t\t\tto: $cursor.pos,\n\t\t\t\t\t\ttext: \"\",\n\t\t\t\t\t\trules,\n\t\t\t\t\t\tplugin\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t} },\n\t\t\thandleKeyDown(view, event) {\n\t\t\t\tif (event.key !== \"Enter\") return false;\n\t\t\t\tconst { $cursor } = view.state.selection;\n\t\t\t\tif ($cursor) return run$1({\n\t\t\t\t\teditor,\n\t\t\t\t\tfrom: $cursor.pos,\n\t\t\t\t\tto: $cursor.pos,\n\t\t\t\t\ttext: \"\\n\",\n\t\t\t\t\trules,\n\t\t\t\t\tplugin\n\t\t\t\t});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tisInputRules: true\n\t});\n\treturn plugin;\n}\n//#endregion\n//#region src/Extendable.ts\nvar Extendable = class {\n\tconstructor(config = {}) {\n\t\tthis.type = \"extendable\";\n\t\tthis.parent = null;\n\t\tthis.child = null;\n\t\tthis.name = \"\";\n\t\tthis.config = { name: this.name };\n\t\tthis.config = {\n\t\t\t...this.config,\n\t\t\t...config\n\t\t};\n\t\tthis.name = this.config.name;\n\t}\n\tget options() {\n\t\treturn { ...callOrReturn(getExtensionField(this, \"addOptions\", { name: this.name })) };\n\t}\n\tget storage() {\n\t\treturn { ...callOrReturn(getExtensionField(this, \"addStorage\", {\n\t\t\tname: this.name,\n\t\t\toptions: this.options\n\t\t})) };\n\t}\n\tconfigure(options = {}) {\n\t\tconst extension = this.extend({\n\t\t\t...this.config,\n\t\t\taddOptions: () => {\n\t\t\t\treturn mergeDeep(this.options, options);\n\t\t\t}\n\t\t});\n\t\textension.name = this.name;\n\t\textension.parent = this.parent;\n\t\tthis.child = null;\n\t\treturn extension;\n\t}\n\textend(extendedConfig = {}) {\n\t\tconst extension = new this.constructor({\n\t\t\t...this.config,\n\t\t\t...extendedConfig\n\t\t});\n\t\textension.parent = this;\n\t\tthis.child = extension;\n\t\textension.name = \"name\" in extendedConfig ? extendedConfig.name : extension.parent.name;\n\t\treturn extension;\n\t}\n};\n//#endregion\n//#region src/Mark.ts\n/**\n* The Mark class is used to create custom mark extensions.\n* @see https://tiptap.dev/api/extensions#create-a-new-extension\n*/\nvar Mark = class Mark extends Extendable {\n\tconstructor(..._args) {\n\t\tsuper(..._args);\n\t\tthis.type = \"mark\";\n\t}\n\t/**\n\t* Create a new Mark instance\n\t* @param config - Mark configuration object or a function that returns a configuration object\n\t*/\n\tstatic create(config = {}) {\n\t\tconst resolvedConfig = typeof config === \"function\" ? config() : config;\n\t\treturn new Mark(resolvedConfig);\n\t}\n\tstatic handleExit({ editor, mark }) {\n\t\tconst { tr } = editor.state;\n\t\tconst currentPos = editor.state.selection.$from;\n\t\tif (currentPos.pos === currentPos.end()) {\n\t\t\tconst currentMarks = currentPos.marks();\n\t\t\tif (!!!currentMarks.find((m) => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name)) return false;\n\t\t\tconst removeMark = currentMarks.find((m) => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name);\n\t\t\tif (removeMark) tr.removeStoredMark(removeMark);\n\t\t\ttr.insertText(\" \", currentPos.pos);\n\t\t\teditor.view.dispatch(tr);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\tconfigure(options) {\n\t\treturn super.configure(options);\n\t}\n\textend(extendedConfig) {\n\t\tconst resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n\t\treturn super.extend(resolvedConfig);\n\t}\n};\n//#endregion\n//#region src/PasteRule.ts\n/**\n* Paste rules are used to react to pasted content.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n*/\nvar PasteRule = class {\n\tconstructor(config) {\n\t\tthis.find = config.find;\n\t\tthis.handler = config.handler;\n\t}\n};\nconst pasteRuleMatcherHandler = (text, find, event) => {\n\tif (isRegExp(find)) return [...text.matchAll(find)];\n\tconst matches = find(text, event);\n\tif (!matches) return [];\n\treturn matches.map((pasteRuleMatch) => {\n\t\tconst result = [pasteRuleMatch.text];\n\t\tresult.index = pasteRuleMatch.index;\n\t\tresult.input = text;\n\t\tresult.data = pasteRuleMatch.data;\n\t\tif (pasteRuleMatch.replaceWith) {\n\t\t\tif (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) console.warn(\"[tiptap warn]: \\\"pasteRuleMatch.replaceWith\\\" must be part of \\\"pasteRuleMatch.text\\\".\");\n\t\t\tresult.push(pasteRuleMatch.replaceWith);\n\t\t}\n\t\treturn result;\n\t});\n};\nfunction run(config) {\n\tconst { editor, state, from, to, rule, pasteEvent, dropEvent } = config;\n\tconst { commands, chain, can } = new CommandManager({\n\t\teditor,\n\t\tstate\n\t});\n\tconst handlers = [];\n\tstate.doc.nodesBetween(from, to, (node, pos) => {\n\t\tvar _node$type, _ref, _node$content$size, _node$content;\n\t\tif (((_node$type = node.type) === null || _node$type === void 0 || (_node$type = _node$type.spec) === null || _node$type === void 0 ? void 0 : _node$type.code) || !(node.isText || node.isTextblock || node.isInline)) return;\n\t\tconst contentSize = (_ref = (_node$content$size = (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.size) !== null && _node$content$size !== void 0 ? _node$content$size : node.nodeSize) !== null && _ref !== void 0 ? _ref : 0;\n\t\tconst resolvedFrom = Math.max(from, pos);\n\t\tconst resolvedTo = Math.min(to, pos + contentSize);\n\t\tif (resolvedFrom >= resolvedTo) return;\n\t\tconst textToMatch = node.isText ? node.text || \"\" : node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, \"\");\n\t\tpasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent).forEach((match) => {\n\t\t\tif (match.index === void 0) return;\n\t\t\tconst start = resolvedFrom + match.index + 1;\n\t\t\tconst end = start + match[0].length;\n\t\t\tconst range = {\n\t\t\t\tfrom: state.tr.mapping.map(start),\n\t\t\t\tto: state.tr.mapping.map(end)\n\t\t\t};\n\t\t\tconst handler = rule.handler({\n\t\t\t\tstate,\n\t\t\t\trange,\n\t\t\t\tmatch,\n\t\t\t\tcommands,\n\t\t\t\tchain,\n\t\t\t\tcan,\n\t\t\t\tpasteEvent,\n\t\t\t\tdropEvent\n\t\t\t});\n\t\t\thandlers.push(handler);\n\t\t});\n\t});\n\treturn handlers.every((handler) => handler !== null);\n}\nlet tiptapDragFromOtherEditor = null;\nconst createClipboardPasteEvent = (text) => {\n\tvar _event$clipboardData;\n\tconst event = new ClipboardEvent(\"paste\", { clipboardData: new DataTransfer() });\n\t(_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 || _event$clipboardData.setData(\"text/html\", text);\n\treturn event;\n};\n/**\n* Create an paste rules plugin. When enabled, it will cause pasted\n* text that matches any of the given rules to trigger the rule’s\n* action.\n*/\nfunction pasteRulesPlugin(props) {\n\tconst { editor, rules } = props;\n\tlet dragSourceElement = null;\n\tlet isPastedFromProseMirror = false;\n\tlet isDroppedFromProseMirror = false;\n\tlet pasteEvent = typeof ClipboardEvent !== \"undefined\" ? new ClipboardEvent(\"paste\") : null;\n\tlet dropEvent;\n\ttry {\n\t\tdropEvent = typeof DragEvent !== \"undefined\" ? new DragEvent(\"drop\") : null;\n\t} catch {\n\t\tdropEvent = null;\n\t}\n\tconst processEvent = ({ state, from, to, rule, pasteEvt }) => {\n\t\tconst tr = state.tr;\n\t\tconst chainableState = createChainableState({\n\t\t\tstate,\n\t\t\ttransaction: tr\n\t\t});\n\t\tif (!run({\n\t\t\teditor,\n\t\t\tstate: chainableState,\n\t\t\tfrom: Math.max(from - 1, 0),\n\t\t\tto: to.b - 1,\n\t\t\trule,\n\t\t\tpasteEvent: pasteEvt,\n\t\t\tdropEvent\n\t\t}) || !tr.steps.length) return;\n\t\ttry {\n\t\t\tdropEvent = typeof DragEvent !== \"undefined\" ? new DragEvent(\"drop\") : null;\n\t\t} catch {\n\t\t\tdropEvent = null;\n\t\t}\n\t\tpasteEvent = typeof ClipboardEvent !== \"undefined\" ? new ClipboardEvent(\"paste\") : null;\n\t\treturn tr;\n\t};\n\treturn rules.map((rule) => {\n\t\treturn new Plugin({\n\t\t\tview(view) {\n\t\t\t\tconst handleDragstart = (event) => {\n\t\t\t\t\tvar _view$dom$parentEleme;\n\t\t\t\t\tdragSourceElement = ((_view$dom$parentEleme = view.dom.parentElement) === null || _view$dom$parentEleme === void 0 ? void 0 : _view$dom$parentEleme.contains(event.target)) ? view.dom.parentElement : null;\n\t\t\t\t\tif (dragSourceElement) tiptapDragFromOtherEditor = editor;\n\t\t\t\t};\n\t\t\t\tconst handleDragend = () => {\n\t\t\t\t\tif (tiptapDragFromOtherEditor) tiptapDragFromOtherEditor = null;\n\t\t\t\t};\n\t\t\t\twindow.addEventListener(\"dragstart\", handleDragstart);\n\t\t\t\twindow.addEventListener(\"dragend\", handleDragend);\n\t\t\t\treturn { destroy() {\n\t\t\t\t\twindow.removeEventListener(\"dragstart\", handleDragstart);\n\t\t\t\t\twindow.removeEventListener(\"dragend\", handleDragend);\n\t\t\t\t} };\n\t\t\t},\n\t\t\tprops: { handleDOMEvents: {\n\t\t\t\tdrop: (view, event) => {\n\t\t\t\t\tisDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;\n\t\t\t\t\tdropEvent = event;\n\t\t\t\t\tif (!isDroppedFromProseMirror) {\n\t\t\t\t\t\tconst dragFromOtherEditor = tiptapDragFromOtherEditor;\n\t\t\t\t\t\tif (dragFromOtherEditor === null || dragFromOtherEditor === void 0 ? void 0 : dragFromOtherEditor.isEditable) setTimeout(() => {\n\t\t\t\t\t\t\tconst selection = dragFromOtherEditor.state.selection;\n\t\t\t\t\t\t\tif (selection) dragFromOtherEditor.commands.deleteRange({\n\t\t\t\t\t\t\t\tfrom: selection.from,\n\t\t\t\t\t\t\t\tto: selection.to\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\tpaste: (_view, event) => {\n\t\t\t\t\tvar _clipboardData;\n\t\t\t\t\tconst html = (_clipboardData = event.clipboardData) === null || _clipboardData === void 0 ? void 0 : _clipboardData.getData(\"text/html\");\n\t\t\t\t\tpasteEvent = event;\n\t\t\t\t\tisPastedFromProseMirror = !!(html === null || html === void 0 ? void 0 : html.includes(\"data-pm-slice\"));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} },\n\t\t\tappendTransaction: (transactions, oldState, state) => {\n\t\t\t\tconst transaction = transactions[0];\n\t\t\t\tconst isPaste = transaction.getMeta(\"uiEvent\") === \"paste\" && !isPastedFromProseMirror;\n\t\t\t\tconst isDrop = transaction.getMeta(\"uiEvent\") === \"drop\" && !isDroppedFromProseMirror;\n\t\t\t\tconst simulatedPasteMeta = transaction.getMeta(\"applyPasteRules\");\n\t\t\t\tconst isSimulatedPaste = !!simulatedPasteMeta;\n\t\t\t\tif (!isPaste && !isDrop && !isSimulatedPaste) return;\n\t\t\t\tif (isSimulatedPaste) {\n\t\t\t\t\tlet { text } = simulatedPasteMeta;\n\t\t\t\t\tif (typeof text === \"string\") text = text;\n\t\t\t\t\telse text = getHTMLFromFragment(Fragment$1.from(text), state.schema);\n\t\t\t\t\tconst { from } = simulatedPasteMeta;\n\t\t\t\t\tconst to = from + text.length;\n\t\t\t\t\tconst pasteEvt = createClipboardPasteEvent(text);\n\t\t\t\t\treturn processEvent({\n\t\t\t\t\t\trule,\n\t\t\t\t\t\tstate,\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto: { b: to },\n\t\t\t\t\t\tpasteEvt\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst from = oldState.doc.content.findDiffStart(state.doc.content);\n\t\t\t\tconst to = oldState.doc.content.findDiffEnd(state.doc.content);\n\t\t\t\tif (!isNumber(from) || !to || from === to.b) return;\n\t\t\t\treturn processEvent({\n\t\t\t\t\trule,\n\t\t\t\t\tstate,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\tpasteEvt: pasteEvent\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n}\n//#endregion\n//#region src/ExtensionManager.ts\nvar ExtensionManager = class {\n\tconstructor(extensions, editor) {\n\t\tthis.splittableMarks = [];\n\t\tthis.nonClearableMarks = [];\n\t\tthis.decorationManager = null;\n\t\tthis.editor = editor;\n\t\tthis.baseExtensions = extensions;\n\t\tthis.extensions = resolveExtensions(extensions);\n\t\tthis.schema = getSchemaByResolvedExtensions(this.extensions, editor);\n\t\tthis.setupExtensions();\n\t}\n\t/**\n\t* Get all commands from the extensions.\n\t* @returns An object with all commands where the key is the command name and the value is the command function\n\t*/\n\tget commands() {\n\t\treturn this.extensions.reduce((commands, extension) => {\n\t\t\tconst addCommands = getExtensionField(extension, \"addCommands\", {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor: this.editor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t});\n\t\t\tif (!addCommands) return commands;\n\t\t\treturn {\n\t\t\t\t...commands,\n\t\t\t\t...addCommands()\n\t\t\t};\n\t\t}, {});\n\t}\n\t/**\n\t* Get all registered Prosemirror plugins from the extensions.\n\t* @returns An array of Prosemirror plugins\n\t*/\n\tget plugins() {\n\t\tconst { editor } = this;\n\t\tconst allPlugins = sortExtensions([...this.extensions].reverse()).flatMap((extension) => {\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t};\n\t\t\tconst plugins = [];\n\t\t\tconst addKeyboardShortcuts = getExtensionField(extension, \"addKeyboardShortcuts\", context);\n\t\t\tlet defaultBindings = {};\n\t\t\tif (extension.type === \"mark\" && getExtensionField(extension, \"exitable\", context)) defaultBindings.ArrowRight = () => Mark.handleExit({\n\t\t\t\teditor,\n\t\t\t\tmark: extension\n\t\t\t});\n\t\t\tif (addKeyboardShortcuts) {\n\t\t\t\tconst bindings = Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {\n\t\t\t\t\treturn [shortcut, () => method({ editor })];\n\t\t\t\t}));\n\t\t\t\tdefaultBindings = {\n\t\t\t\t\t...defaultBindings,\n\t\t\t\t\t...bindings\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst keyMapPlugin = keymap(defaultBindings);\n\t\t\tplugins.push(keyMapPlugin);\n\t\t\tconst addInputRules = getExtensionField(extension, \"addInputRules\", context);\n\t\t\tif (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {\n\t\t\t\tconst rules = addInputRules();\n\t\t\t\tif (rules && rules.length) {\n\t\t\t\t\tconst inputResult = inputRulesPlugin({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\trules\n\t\t\t\t\t});\n\t\t\t\t\tconst inputPlugins = Array.isArray(inputResult) ? inputResult : [inputResult];\n\t\t\t\t\tplugins.push(...inputPlugins);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst addPasteRules = getExtensionField(extension, \"addPasteRules\", context);\n\t\t\tif (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {\n\t\t\t\tconst rules = addPasteRules();\n\t\t\t\tif (rules && rules.length) {\n\t\t\t\t\tconst pasteRules = pasteRulesPlugin({\n\t\t\t\t\t\teditor,\n\t\t\t\t\t\trules\n\t\t\t\t\t});\n\t\t\t\t\tplugins.push(...pasteRules);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst addProseMirrorPlugins = getExtensionField(extension, \"addProseMirrorPlugins\", context);\n\t\t\tif (addProseMirrorPlugins) {\n\t\t\t\tconst proseMirrorPlugins = addProseMirrorPlugins();\n\t\t\t\tplugins.push(...proseMirrorPlugins);\n\t\t\t}\n\t\t\treturn plugins;\n\t\t});\n\t\tconst decorationPlugin = this.createDecorationPlugin();\n\t\tif (decorationPlugin) allPlugins.push(decorationPlugin);\n\t\treturn allPlugins;\n\t}\n\t/**\n\t* Aggregates decorations from extensions into a single plugin, or returns null\n\t* if none exist. Destroys the previous manager to avoid orphaned listeners.\n\t* @returns A ProseMirror plugin or `null`\n\t* @example\n\t* const plugin = editor.extensionManager.createDecorationPlugin()\n\t*/\n\tcreateDecorationPlugin() {\n\t\tvar _this$decorationManag;\n\t\tconst { editor } = this;\n\t\t(_this$decorationManag = this.decorationManager) === null || _this$decorationManag === void 0 || _this$decorationManag.destroy();\n\t\tconst entries = [];\n\t\tthis.extensions.forEach((extension) => {\n\t\t\tconst addDecorations = getExtensionField(extension, \"addDecorations\", {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t});\n\t\t\tif (!addDecorations) return;\n\t\t\tentries.push({\n\t\t\t\tname: extension.name,\n\t\t\t\taddDecorations\n\t\t\t});\n\t\t});\n\t\tthis.decorationManager = new DecorationManager({\n\t\t\teditor,\n\t\t\tentries\n\t\t});\n\t\treturn this.decorationManager.plugin;\n\t}\n\t/**\n\t* Get all attributes from the extensions.\n\t* @returns An array of attributes\n\t*/\n\tget attributes() {\n\t\treturn getAttributesFromExtensions(this.extensions);\n\t}\n\t/**\n\t* Get all node views from the extensions.\n\t* @returns An object with all node views where the key is the node name and the value is the node view function\n\t*/\n\tget nodeViews() {\n\t\tconst { editor } = this;\n\t\tconst { nodeExtensions } = splitExtensions(this.extensions);\n\t\treturn Object.fromEntries(nodeExtensions.filter((extension) => !!getExtensionField(extension, \"addNodeView\")).map((extension) => {\n\t\t\tconst extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);\n\t\t\tconst addNodeView = getExtensionField(extension, \"addNodeView\", {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getNodeType(extension.name, this.schema)\n\t\t\t});\n\t\t\tif (!addNodeView) return [];\n\t\t\tconst nodeViewResult = addNodeView();\n\t\t\tif (!nodeViewResult) return [];\n\t\t\tconst nodeview = (node, view, getPos, decorations, innerDecorations) => {\n\t\t\t\tconst HTMLAttributes = getRenderedAttributes(node, extensionAttributes);\n\t\t\t\treturn nodeViewResult({\n\t\t\t\t\tnode,\n\t\t\t\t\tview,\n\t\t\t\t\tgetPos,\n\t\t\t\t\tdecorations,\n\t\t\t\t\tinnerDecorations,\n\t\t\t\t\teditor,\n\t\t\t\t\textension,\n\t\t\t\t\tHTMLAttributes\n\t\t\t\t});\n\t\t\t};\n\t\t\treturn [extension.name, nodeview];\n\t\t}));\n\t}\n\t/**\n\t* Get the composed dispatchTransaction function from all extensions.\n\t* @param baseDispatch The base dispatch function (e.g. from the editor or user props)\n\t* @returns A composed dispatch function\n\t*/\n\tdispatchTransaction(baseDispatch) {\n\t\tconst { editor } = this;\n\t\treturn sortExtensions([...this.extensions].reverse()).reduceRight((next, extension) => {\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t};\n\t\t\tconst dispatchTransaction = getExtensionField(extension, \"dispatchTransaction\", context);\n\t\t\tif (!dispatchTransaction) return next;\n\t\t\treturn (transaction) => {\n\t\t\t\tdispatchTransaction.call(context, {\n\t\t\t\t\ttransaction,\n\t\t\t\t\tnext\n\t\t\t\t});\n\t\t\t};\n\t\t}, baseDispatch);\n\t}\n\t/**\n\t* Get the composed transformPastedHTML function from all extensions.\n\t* @param baseTransform The base transform function (e.g. from the editor props)\n\t* @returns A composed transform function that chains all extension transforms\n\t*/\n\ttransformPastedHTML(baseTransform) {\n\t\tconst { editor } = this;\n\t\treturn sortExtensions([...this.extensions]).reduce((transform, extension) => {\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t};\n\t\t\tconst extensionTransform = getExtensionField(extension, \"transformPastedHTML\", context);\n\t\t\tif (!extensionTransform) return transform;\n\t\t\treturn (html, view) => {\n\t\t\t\tconst transformedHtml = transform(html, view);\n\t\t\t\treturn extensionTransform.call(context, transformedHtml);\n\t\t\t};\n\t\t}, baseTransform || ((html) => html));\n\t}\n\tget markViews() {\n\t\tconst { editor } = this;\n\t\tconst { markExtensions } = splitExtensions(this.extensions);\n\t\treturn Object.fromEntries(markExtensions.filter((extension) => !!getExtensionField(extension, \"addMarkView\")).map((extension) => {\n\t\t\tconst extensionAttributes = this.attributes.filter((attribute) => attribute.type === extension.name);\n\t\t\tconst addMarkView = getExtensionField(extension, \"addMarkView\", {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor,\n\t\t\t\ttype: getMarkType(extension.name, this.schema)\n\t\t\t});\n\t\t\tif (!addMarkView) return [];\n\t\t\tconst markView = (mark, view, inline) => {\n\t\t\t\tconst HTMLAttributes = getRenderedAttributes(mark, extensionAttributes);\n\t\t\t\treturn addMarkView()({\n\t\t\t\t\tmark,\n\t\t\t\t\tview,\n\t\t\t\t\tinline,\n\t\t\t\t\teditor,\n\t\t\t\t\textension,\n\t\t\t\t\tHTMLAttributes,\n\t\t\t\t\tupdateAttributes: (attrs) => {\n\t\t\t\t\t\tupdateMarkViewAttributes(mark, editor, attrs);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t\treturn [extension.name, markView];\n\t\t}));\n\t}\n\t/**\n\t* Destroy the extension manager and clean up all extension references\n\t* to prevent memory leaks through parent/child extension chains.\n\t*\n\t* Walks each extension's full parent chain and nulls every forward\n\t* `parent.child → current` link where the parent still points to the\n\t* current node. This breaks the retention path from module-scope\n\t* singleton roots through deep extend() chains.\n\t*\n\t* Only ancestor `.child` links matching the current chain are cleared.\n\t* The `.parent` pointer on ancestors is never touched — extensions\n\t* may be shared across live editors, so their own backward references\n\t* and non-matching forward links must remain intact.\n\t*/\n\tdestroy() {\n\t\tvar _this$decorationManag2;\n\t\t(_this$decorationManag2 = this.decorationManager) === null || _this$decorationManag2 === void 0 || _this$decorationManag2.destroy();\n\t\tthis.extensions.forEach((extension) => {\n\t\t\tlet current = extension;\n\t\t\twhile (current.parent) {\n\t\t\t\tconst parent = current.parent;\n\t\t\t\tif (parent.child === current) parent.child = null;\n\t\t\t\tcurrent = parent;\n\t\t\t}\n\t\t});\n\t\tthis.extensions = [];\n\t\tthis.baseExtensions = [];\n\t\tthis.decorationManager = null;\n\t\tthis.schema = null;\n\t\tthis.editor = null;\n\t}\n\t/**\n\t* Go through all extensions, create extension storages & setup marks\n\t* & bind editor event listener.\n\t*/\n\tsetupExtensions() {\n\t\tconst extensions = this.extensions;\n\t\tthis.editor.extensionStorage = Object.fromEntries(extensions.map((extension) => [extension.name, extension.storage]));\n\t\textensions.forEach((extension) => {\n\t\t\tconst context = {\n\t\t\t\tname: extension.name,\n\t\t\t\toptions: extension.options,\n\t\t\t\tstorage: this.editor.extensionStorage[extension.name],\n\t\t\t\teditor: this.editor,\n\t\t\t\ttype: getSchemaTypeByName(extension.name, this.schema)\n\t\t\t};\n\t\t\tif (extension.type === \"mark\") {\n\t\t\t\tvar _callOrReturn, _callOrReturn2;\n\t\t\t\tif ((_callOrReturn = callOrReturn(getExtensionField(extension, \"keepOnSplit\", context))) !== null && _callOrReturn !== void 0 ? _callOrReturn : true) this.splittableMarks.push(extension.name);\n\t\t\t\tif (!((_callOrReturn2 = callOrReturn(getExtensionField(extension, \"clearable\", context))) !== null && _callOrReturn2 !== void 0 ? _callOrReturn2 : true)) this.nonClearableMarks.push(extension.name);\n\t\t\t}\n\t\t\tconst onBeforeCreate = getExtensionField(extension, \"onBeforeCreate\", context);\n\t\t\tconst onCreate = getExtensionField(extension, \"onCreate\", context);\n\t\t\tconst onUpdate = getExtensionField(extension, \"onUpdate\", context);\n\t\t\tconst onSelectionUpdate = getExtensionField(extension, \"onSelectionUpdate\", context);\n\t\t\tconst onTransaction = getExtensionField(extension, \"onTransaction\", context);\n\t\t\tconst onFocus = getExtensionField(extension, \"onFocus\", context);\n\t\t\tconst onBlur = getExtensionField(extension, \"onBlur\", context);\n\t\t\tconst onDestroy = getExtensionField(extension, \"onDestroy\", context);\n\t\t\tif (onBeforeCreate) this.editor.on(\"beforeCreate\", onBeforeCreate);\n\t\t\tif (onCreate) this.editor.on(\"create\", onCreate);\n\t\t\tif (onUpdate) this.editor.on(\"update\", onUpdate);\n\t\t\tif (onSelectionUpdate) this.editor.on(\"selectionUpdate\", onSelectionUpdate);\n\t\t\tif (onTransaction) this.editor.on(\"transaction\", onTransaction);\n\t\t\tif (onFocus) this.editor.on(\"focus\", onFocus);\n\t\t\tif (onBlur) this.editor.on(\"blur\", onBlur);\n\t\t\tif (onDestroy) this.editor.on(\"destroy\", onDestroy);\n\t\t});\n\t}\n};\nExtensionManager.resolve = resolveExtensions;\nExtensionManager.sort = sortExtensions;\nExtensionManager.flatten = flattenExtensions;\n//#endregion\n//#region src/Extension.ts\n/**\n* The Extension class is the base class for all extensions.\n* @see https://tiptap.dev/api/extensions#create-a-new-extension\n*/\nvar Extension = class Extension extends Extendable {\n\tconstructor(..._args) {\n\t\tsuper(..._args);\n\t\tthis.type = \"extension\";\n\t}\n\t/**\n\t* Create a new Extension instance\n\t* @param config - Extension configuration object or a function that returns a configuration object\n\t*/\n\tstatic create(config = {}) {\n\t\tconst resolvedConfig = typeof config === \"function\" ? config() : config;\n\t\treturn new Extension(resolvedConfig);\n\t}\n\tconfigure(options) {\n\t\treturn super.configure(options);\n\t}\n\textend(extendedConfig) {\n\t\tconst resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n\t\treturn super.extend(resolvedConfig);\n\t}\n};\n//#endregion\n//#region src/extensions/clipboardTextSerializer.ts\nconst ClipboardTextSerializer = Extension.create({\n\tname: \"clipboardTextSerializer\",\n\taddOptions() {\n\t\treturn { blockSeparator: void 0 };\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"clipboardTextSerializer\"),\n\t\t\tprops: { clipboardTextSerializer: () => {\n\t\t\t\tconst { editor } = this;\n\t\t\t\tconst { state, schema } = editor;\n\t\t\t\tconst { doc, selection } = state;\n\t\t\t\tconst textSerializers = getTextSerializersFromSchema(schema);\n\t\t\t\tconst { blockSeparator } = this.options;\n\t\t\t\tconst options = {\n\t\t\t\t\t...blockSeparator !== void 0 ? { blockSeparator } : {},\n\t\t\t\t\ttextSerializers\n\t\t\t\t};\n\t\t\t\treturn [...selection.ranges].sort((a, b) => a.$from.pos - b.$from.pos).map(({ $from, $to }) => getTextBetween(doc, {\n\t\t\t\t\tfrom: $from.pos,\n\t\t\t\t\tto: $to.pos\n\t\t\t\t}, options)).join(blockSeparator !== null && blockSeparator !== void 0 ? blockSeparator : \"\\n\\n\");\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/commands.ts\nconst Commands = Extension.create({\n\tname: \"commands\",\n\taddCommands() {\n\t\treturn { ...commands_exports };\n\t}\n});\n//#endregion\n//#region src/extensions/delete.ts\n/**\n* This extension allows you to be notified when the user deletes content you are interested in.\n*/\nconst Delete = Extension.create({\n\tname: \"delete\",\n\tonUpdate({ transaction, appendedTransactions }) {\n\t\tvar _this$editor$options$4, _this$editor$options$5;\n\t\tconst callback = () => {\n\t\t\tvar _this$editor$options$, _this$editor$options$2, _this$editor$options$3;\n\t\t\tif ((_this$editor$options$ = (_this$editor$options$2 = this.editor.options.coreExtensionOptions) === null || _this$editor$options$2 === void 0 || (_this$editor$options$2 = _this$editor$options$2.delete) === null || _this$editor$options$2 === void 0 || (_this$editor$options$3 = _this$editor$options$2.filterTransaction) === null || _this$editor$options$3 === void 0 ? void 0 : _this$editor$options$3.call(_this$editor$options$2, transaction)) !== null && _this$editor$options$ !== void 0 ? _this$editor$options$ : transaction.getMeta(\"y-sync$\")) return;\n\t\t\tconst nextTransaction = combineTransactionSteps(transaction.before, [transaction, ...appendedTransactions]);\n\t\t\tgetChangedRanges(nextTransaction).forEach((change) => {\n\t\t\t\tif (nextTransaction.mapping.mapResult(change.oldRange.from).deletedAfter && nextTransaction.mapping.mapResult(change.oldRange.to).deletedBefore) nextTransaction.before.nodesBetween(change.oldRange.from, change.oldRange.to, (node, from) => {\n\t\t\t\t\tconst to = from + node.nodeSize - 2;\n\t\t\t\t\tconst isFullyWithinRange = change.oldRange.from <= from && to <= change.oldRange.to;\n\t\t\t\t\tthis.editor.emit(\"delete\", {\n\t\t\t\t\t\ttype: \"node\",\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tfrom,\n\t\t\t\t\t\tto,\n\t\t\t\t\t\tnewFrom: nextTransaction.mapping.map(from),\n\t\t\t\t\t\tnewTo: nextTransaction.mapping.map(to),\n\t\t\t\t\t\tdeletedRange: change.oldRange,\n\t\t\t\t\t\tnewRange: change.newRange,\n\t\t\t\t\t\tpartial: !isFullyWithinRange,\n\t\t\t\t\t\teditor: this.editor,\n\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\tcombinedTransform: nextTransaction\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t\tconst mapping = nextTransaction.mapping;\n\t\t\tnextTransaction.steps.forEach((step, index) => {\n\t\t\t\tif (step instanceof RemoveMarkStep) {\n\t\t\t\t\tvar _nextTransaction$doc$, _nextTransaction$doc$2;\n\t\t\t\t\tconst newStart = mapping.slice(index).map(step.from, -1);\n\t\t\t\t\tconst newEnd = mapping.slice(index).map(step.to);\n\t\t\t\t\tconst oldStart = mapping.invert().map(newStart, -1);\n\t\t\t\t\tconst oldEnd = mapping.invert().map(newEnd);\n\t\t\t\t\tconst foundBeforeMark = newStart > 0 ? (_nextTransaction$doc$ = nextTransaction.doc.nodeAt(newStart - 1)) === null || _nextTransaction$doc$ === void 0 ? void 0 : _nextTransaction$doc$.marks.some((mark) => mark.eq(step.mark)) : false;\n\t\t\t\t\tconst foundAfterMark = (_nextTransaction$doc$2 = nextTransaction.doc.nodeAt(newEnd)) === null || _nextTransaction$doc$2 === void 0 ? void 0 : _nextTransaction$doc$2.marks.some((mark) => mark.eq(step.mark));\n\t\t\t\t\tthis.editor.emit(\"delete\", {\n\t\t\t\t\t\ttype: \"mark\",\n\t\t\t\t\t\tmark: step.mark,\n\t\t\t\t\t\tfrom: step.from,\n\t\t\t\t\t\tto: step.to,\n\t\t\t\t\t\tdeletedRange: {\n\t\t\t\t\t\t\tfrom: oldStart,\n\t\t\t\t\t\t\tto: oldEnd\n\t\t\t\t\t\t},\n\t\t\t\t\t\tnewRange: {\n\t\t\t\t\t\t\tfrom: newStart,\n\t\t\t\t\t\t\tto: newEnd\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpartial: Boolean(foundAfterMark || foundBeforeMark),\n\t\t\t\t\t\teditor: this.editor,\n\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\tcombinedTransform: nextTransaction\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\t\tif ((_this$editor$options$4 = (_this$editor$options$5 = this.editor.options.coreExtensionOptions) === null || _this$editor$options$5 === void 0 || (_this$editor$options$5 = _this$editor$options$5.delete) === null || _this$editor$options$5 === void 0 ? void 0 : _this$editor$options$5.async) !== null && _this$editor$options$4 !== void 0 ? _this$editor$options$4 : true) setTimeout(callback, 0);\n\t\telse callback();\n\t}\n});\n//#endregion\n//#region src/extensions/drop.ts\nconst Drop = Extension.create({\n\tname: \"drop\",\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"tiptapDrop\"),\n\t\t\tprops: { handleDrop: (_, e, slice, moved) => {\n\t\t\t\tthis.editor.emit(\"drop\", {\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tevent: e,\n\t\t\t\t\tslice,\n\t\t\t\t\tmoved\n\t\t\t\t});\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/editable.ts\nconst Editable = Extension.create({\n\tname: \"editable\",\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"editable\"),\n\t\t\tprops: { editable: () => this.editor.options.editable }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/focusEvents.ts\nconst focusEventsPluginKey = new PluginKey(\"focusEvents\");\nconst FocusEvents = Extension.create({\n\tname: \"focusEvents\",\n\taddProseMirrorPlugins() {\n\t\tconst { editor } = this;\n\t\treturn [new Plugin({\n\t\t\tkey: focusEventsPluginKey,\n\t\t\tprops: { handleDOMEvents: {\n\t\t\t\tfocus: (view, event) => {\n\t\t\t\t\teditor.isFocused = true;\n\t\t\t\t\tconst transaction = editor.state.tr.setMeta(\"focus\", { event }).setMeta(\"addToHistory\", false);\n\t\t\t\t\tview.dispatch(transaction);\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\tblur: (view, event) => {\n\t\t\t\t\teditor.isFocused = false;\n\t\t\t\t\tconst transaction = editor.state.tr.setMeta(\"blur\", { event }).setMeta(\"addToHistory\", false);\n\t\t\t\t\tview.dispatch(transaction);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/keymap.ts\nconst Keymap = Extension.create({\n\tname: \"keymap\",\n\taddKeyboardShortcuts() {\n\t\tconst handleBackspace = () => this.editor.commands.first(({ commands }) => [\n\t\t\t() => commands.undoInputRule(),\n\t\t\t() => commands.command(({ tr }) => {\n\t\t\t\tconst { selection, doc } = tr;\n\t\t\t\tconst { empty, $anchor } = selection;\n\t\t\t\tconst { pos, parent } = $anchor;\n\t\t\t\tconst $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;\n\t\t\t\tconst parentIsIsolating = $parentPos.parent.type.spec.isolating;\n\t\t\t\tconst parentPos = $anchor.pos - $anchor.parentOffset;\n\t\t\t\tconst isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;\n\t\t\t\tif (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === \"paragraph\") return false;\n\t\t\t\treturn commands.clearNodes();\n\t\t\t}),\n\t\t\t() => commands.deleteSelection(),\n\t\t\t() => commands.joinBackward(),\n\t\t\t() => commands.selectNodeBackward()\n\t\t]);\n\t\tconst handleDelete = () => this.editor.commands.first(({ commands }) => [\n\t\t\t() => commands.deleteSelection(),\n\t\t\t() => commands.deleteCurrentNode(),\n\t\t\t() => commands.joinForward(),\n\t\t\t() => commands.selectNodeForward()\n\t\t]);\n\t\tconst handleEnter = () => this.editor.commands.first(({ commands }) => [\n\t\t\t() => commands.newlineInCode(),\n\t\t\t() => commands.createParagraphNear(),\n\t\t\t() => commands.liftEmptyBlock(),\n\t\t\t() => commands.splitBlock()\n\t\t]);\n\t\tconst baseKeymap = {\n\t\t\tEnter: handleEnter,\n\t\t\t\"Mod-Enter\": () => this.editor.commands.exitCode(),\n\t\t\tBackspace: handleBackspace,\n\t\t\t\"Mod-Backspace\": handleBackspace,\n\t\t\t\"Shift-Backspace\": handleBackspace,\n\t\t\tDelete: handleDelete,\n\t\t\t\"Mod-Delete\": handleDelete,\n\t\t\t\"Mod-a\": () => this.editor.commands.selectAll()\n\t\t};\n\t\tconst pcKeymap = { ...baseKeymap };\n\t\tconst macKeymap = {\n\t\t\t...baseKeymap,\n\t\t\t\"Ctrl-h\": handleBackspace,\n\t\t\t\"Alt-Backspace\": handleBackspace,\n\t\t\t\"Ctrl-d\": handleDelete,\n\t\t\t\"Ctrl-Alt-Backspace\": handleDelete,\n\t\t\t\"Alt-Delete\": handleDelete,\n\t\t\t\"Alt-d\": handleDelete,\n\t\t\t\"Ctrl-a\": () => this.editor.commands.selectTextblockStart(),\n\t\t\t\"Ctrl-e\": () => this.editor.commands.selectTextblockEnd()\n\t\t};\n\t\tif (isiOS() || isMacOS()) return macKeymap;\n\t\treturn pcKeymap;\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"clearDocument\"),\n\t\t\tappendTransaction: (transactions, oldState, newState) => {\n\t\t\t\tif (transactions.some((tr) => tr.getMeta(\"composition\"))) return;\n\t\t\t\tconst docChanges = transactions.some((transaction) => transaction.docChanged) && !oldState.doc.eq(newState.doc);\n\t\t\t\tconst ignoreTr = transactions.some((transaction) => transaction.getMeta(\"preventClearDocument\"));\n\t\t\t\tif (!docChanges || ignoreTr) return;\n\t\t\t\tconst { empty, from, to } = oldState.selection;\n\t\t\t\tconst allFrom = Selection.atStart(oldState.doc).from;\n\t\t\t\tconst allEnd = Selection.atEnd(oldState.doc).to;\n\t\t\t\tif (empty || !(from === allFrom && to === allEnd)) return;\n\t\t\t\tif (!isNodeEmpty(newState.doc)) return;\n\t\t\t\tconst tr = newState.tr;\n\t\t\t\tconst state = createChainableState({\n\t\t\t\t\tstate: newState,\n\t\t\t\t\ttransaction: tr\n\t\t\t\t});\n\t\t\t\tconst { commands } = new CommandManager({\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tstate\n\t\t\t\t});\n\t\t\t\tcommands.clearNodes();\n\t\t\t\tif (!tr.steps.length) return;\n\t\t\t\treturn tr;\n\t\t\t}\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/paste.ts\nconst Paste = Extension.create({\n\tname: \"paste\",\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"tiptapPaste\"),\n\t\t\tprops: { handlePaste: (_view, e, slice) => {\n\t\t\t\tthis.editor.emit(\"paste\", {\n\t\t\t\t\teditor: this.editor,\n\t\t\t\t\tevent: e,\n\t\t\t\t\tslice\n\t\t\t\t});\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/tabindex.ts\n/**\n* The Tabindex extension adds a configurable tabindex attribute to the editor.\n*\n* By default, the editor gets tabindex=\"0\" when editable. This can be customized\n* via coreExtensionOptions to support specific focus ordering requirements in forms\n* or to enable focusing on non-editable editors.\n*\n* @example\n* ```ts\n* new Editor({\n* coreExtensionOptions: {\n* tabindex: {\n* value: '-1',\n* },\n* },\n* })\n* ```\n*/\nconst Tabindex = Extension.create({\n\tname: \"tabindex\",\n\taddOptions() {\n\t\treturn { value: void 0 };\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"tabindex\"),\n\t\t\tprops: { attributes: () => {\n\t\t\t\tvar _this$options$value;\n\t\t\t\tif (!this.editor.isEditable && this.options.value === void 0) return {};\n\t\t\t\treturn { tabindex: (_this$options$value = this.options.value) !== null && _this$options$value !== void 0 ? _this$options$value : \"0\" };\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/textDirection.ts\n/**\n* The TextDirection extension adds support for setting text direction (LTR/RTL/auto)\n* on all nodes in the editor.\n*\n* This extension adds a global `dir` attribute to all node types, which can be used\n* to control bidirectional text rendering. The direction can be set globally via\n* editor options or per-node using commands.\n*/\nconst TextDirection = Extension.create({\n\tname: \"textDirection\",\n\taddOptions() {\n\t\treturn { direction: void 0 };\n\t},\n\taddGlobalAttributes() {\n\t\tif (!this.options.direction) return [];\n\t\tconst { nodeExtensions } = splitExtensions(this.extensions);\n\t\treturn [{\n\t\t\ttypes: nodeExtensions.filter((extension) => extension.name !== \"text\").map((extension) => extension.name),\n\t\t\tattributes: { dir: {\n\t\t\t\tdefault: this.options.direction,\n\t\t\t\tparseHTML: (element) => {\n\t\t\t\t\tconst dir = element.getAttribute(\"dir\");\n\t\t\t\t\tif (dir && (dir === \"ltr\" || dir === \"rtl\" || dir === \"auto\")) return dir;\n\t\t\t\t\treturn this.options.direction;\n\t\t\t\t},\n\t\t\t\trenderHTML: (attributes) => {\n\t\t\t\t\tif (!attributes.dir) return {};\n\t\t\t\t\treturn { dir: attributes.dir };\n\t\t\t\t}\n\t\t\t} }\n\t\t}];\n\t},\n\taddProseMirrorPlugins() {\n\t\treturn [new Plugin({\n\t\t\tkey: new PluginKey(\"textDirection\"),\n\t\t\tprops: { attributes: () => {\n\t\t\t\tconst direction = this.options.direction;\n\t\t\t\tif (!direction) return {};\n\t\t\t\treturn { dir: direction };\n\t\t\t} }\n\t\t})];\n\t}\n});\n//#endregion\n//#region src/extensions/index.ts\nvar extensions_exports = /* @__PURE__ */ __exportAll({\n\tClipboardTextSerializer: () => ClipboardTextSerializer,\n\tCommands: () => Commands,\n\tDelete: () => Delete,\n\tDrop: () => Drop,\n\tEditable: () => Editable,\n\tFocusEvents: () => FocusEvents,\n\tKeymap: () => Keymap,\n\tPaste: () => Paste,\n\tTabindex: () => Tabindex,\n\tTextDirection: () => TextDirection,\n\tfocusEventsPluginKey: () => focusEventsPluginKey\n});\n//#endregion\n//#region src/helpers/warnOnDuplicatedProseMirrorModel.ts\nlet hasChecked = false;\n/**\n* Warns once when prosemirror-model is loaded twice\n* @param schema The editor schema\n* @returns void\n* @example ```js\n* warnOnDuplicatedProseMirrorModel(editor.schema)\n* ```\n*/\nfunction warnOnDuplicatedProseMirrorModel(schema) {\n\tif (hasChecked) return;\n\thasChecked = true;\n\tlet content;\n\ttry {\n\t\tcontent = ReplaceStep.fromJSON(schema, {\n\t\t\tfrom: 0,\n\t\t\tto: 0\n\t\t}).slice.content;\n\t} catch {\n\t\treturn;\n\t}\n\tif (content instanceof Fragment$1) return;\n\tconsole.warn(\"[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.\");\n}\n//#endregion\n//#region src/NodePos.ts\nvar NodePos = class NodePos {\n\tget name() {\n\t\treturn this.node.type.name;\n\t}\n\tconstructor(pos, editor, isBlock = false, node = null) {\n\t\tthis.currentNode = null;\n\t\tthis.actualDepth = null;\n\t\tthis.isBlock = isBlock;\n\t\tthis.resolvedPos = pos;\n\t\tthis.editor = editor;\n\t\tthis.currentNode = node;\n\t}\n\tget node() {\n\t\treturn this.currentNode || this.resolvedPos.node();\n\t}\n\tget element() {\n\t\treturn this.editor.view.domAtPos(this.pos).node;\n\t}\n\tget depth() {\n\t\tvar _this$actualDepth;\n\t\treturn (_this$actualDepth = this.actualDepth) !== null && _this$actualDepth !== void 0 ? _this$actualDepth : this.resolvedPos.depth;\n\t}\n\tget pos() {\n\t\treturn this.resolvedPos.pos;\n\t}\n\tget content() {\n\t\treturn this.node.content;\n\t}\n\tset content(content) {\n\t\tlet from = this.from;\n\t\tlet to = this.to;\n\t\tif (this.isBlock) {\n\t\t\tif (this.content.size === 0) {\n\t\t\t\tconsole.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfrom = this.from + 1;\n\t\t\tto = this.to - 1;\n\t\t}\n\t\tthis.editor.commands.insertContentAt({\n\t\t\tfrom,\n\t\t\tto\n\t\t}, content);\n\t}\n\tget attributes() {\n\t\treturn this.node.attrs;\n\t}\n\tget textContent() {\n\t\treturn this.node.textContent;\n\t}\n\tget size() {\n\t\treturn this.node.nodeSize;\n\t}\n\tget from() {\n\t\tif (this.isBlock) return this.pos;\n\t\treturn this.resolvedPos.start(this.resolvedPos.depth);\n\t}\n\tget range() {\n\t\treturn {\n\t\t\tfrom: this.from,\n\t\t\tto: this.to\n\t\t};\n\t}\n\tget to() {\n\t\tif (this.isBlock) return this.pos + this.size;\n\t\treturn this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);\n\t}\n\tget parent() {\n\t\tif (this.depth === 0) return null;\n\t\tconst parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);\n\t\tconst $pos = this.resolvedPos.doc.resolve(parentPos);\n\t\treturn new NodePos($pos, this.editor);\n\t}\n\tget before() {\n\t\tlet $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));\n\t\tif ($pos.depth !== this.depth) $pos = this.resolvedPos.doc.resolve(this.from - 3);\n\t\treturn new NodePos($pos, this.editor);\n\t}\n\tget after() {\n\t\tlet $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));\n\t\tif ($pos.depth !== this.depth) $pos = this.resolvedPos.doc.resolve(this.to + 3);\n\t\treturn new NodePos($pos, this.editor);\n\t}\n\tget children() {\n\t\tconst children = [];\n\t\tthis.node.content.forEach((node, offset) => {\n\t\t\tconst isBlock = node.isBlock && !node.isTextblock;\n\t\t\tconst isNonTextAtom = node.isAtom && !node.isText;\n\t\t\tconst isInline = node.isInline;\n\t\t\tconst targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);\n\t\t\tif (targetPos < 0 || targetPos > this.resolvedPos.doc.nodeSize - 2) return;\n\t\t\tconst $pos = this.resolvedPos.doc.resolve(targetPos);\n\t\t\tif (!isBlock && !isInline && $pos.depth <= this.depth) return;\n\t\t\tconst childNodePos = new NodePos($pos, this.editor, isBlock, isBlock || isInline ? node : null);\n\t\t\tif (isBlock) childNodePos.actualDepth = this.depth + 1;\n\t\t\tchildren.push(childNodePos);\n\t\t});\n\t\treturn children;\n\t}\n\tget firstChild() {\n\t\treturn this.children[0] || null;\n\t}\n\tget lastChild() {\n\t\tconst children = this.children;\n\t\treturn children[children.length - 1] || null;\n\t}\n\tclosest(selector, attributes = {}) {\n\t\tlet node = null;\n\t\tlet currentNode = this.parent;\n\t\twhile (currentNode && !node) {\n\t\t\tif (currentNode.node.type.name === selector) {\n\t\t\t\tif (Object.keys(attributes).length > 0) {\n\t\t\t\t\tconst nodeAttributes = currentNode.node.attrs;\n\t\t\t\t\tconst attrKeys = Object.keys(attributes);\n\t\t\t\t\tfor (let index = 0; index < attrKeys.length; index += 1) {\n\t\t\t\t\t\tconst key = attrKeys[index];\n\t\t\t\t\t\tif (nodeAttributes[key] !== attributes[key]) break;\n\t\t\t\t\t}\n\t\t\t\t} else node = currentNode;\n\t\t\t}\n\t\t\tcurrentNode = currentNode.parent;\n\t\t}\n\t\treturn node;\n\t}\n\tquerySelector(selector, attributes = {}) {\n\t\treturn this.querySelectorAll(selector, attributes, true)[0] || null;\n\t}\n\tquerySelectorAll(selector, attributes = {}, firstItemOnly = false) {\n\t\tlet nodes = [];\n\t\tif (!this.children || this.children.length === 0) return nodes;\n\t\tconst attrKeys = Object.keys(attributes);\n\t\t/**\n\t\t* Finds all children recursively that match the selector and attributes\n\t\t* If firstItemOnly is true, it will return the first item found\n\t\t*/\n\t\tthis.children.forEach((childPos) => {\n\t\t\tif (firstItemOnly && nodes.length > 0) return;\n\t\t\tif (childPos.node.type.name === selector) {\n\t\t\t\tif (attrKeys.every((key) => attributes[key] === childPos.node.attrs[key])) nodes.push(childPos);\n\t\t\t}\n\t\t\tif (firstItemOnly && nodes.length > 0) return;\n\t\t\tnodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));\n\t\t});\n\t\treturn nodes;\n\t}\n\tsetAttribute(attributes) {\n\t\tconst { tr } = this.editor.state;\n\t\ttr.setNodeMarkup(this.from, void 0, {\n\t\t\t...this.node.attrs,\n\t\t\t...attributes\n\t\t});\n\t\tthis.editor.view.dispatch(tr);\n\t}\n};\n//#endregion\n//#region src/style.ts\nconst style = `.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//#endregion\n//#region src/Editor.ts\nvar Editor = class extends EventEmitter {\n\tconstructor(options = {}) {\n\t\tsuper();\n\t\tthis.css = null;\n\t\tthis.className = \"tiptap\";\n\t\tthis.editorView = null;\n\t\tthis.isFocused = false;\n\t\tthis.destroyed = false;\n\t\tthis.isInitialized = false;\n\t\tthis.extensionStorage = {};\n\t\tthis.instanceId = Math.random().toString(36).slice(2, 9);\n\t\tthis.hasWarnedStaleDecorationRead = false;\n\t\tthis.options = {\n\t\t\telement: typeof document !== \"undefined\" ? document.createElement(\"div\") : null,\n\t\t\tcontent: \"\",\n\t\t\tinjectCSS: true,\n\t\t\tinjectNonce: void 0,\n\t\t\textensions: [],\n\t\t\tautofocus: false,\n\t\t\teditable: true,\n\t\t\ttextDirection: void 0,\n\t\t\teditorProps: {},\n\t\t\tparseOptions: {},\n\t\t\tcoreExtensionOptions: {},\n\t\t\tenableInputRules: true,\n\t\t\tenablePasteRules: true,\n\t\t\tenableCoreExtensions: true,\n\t\t\tenableContentCheck: false,\n\t\t\temitContentError: false,\n\t\t\tonBeforeCreate: () => null,\n\t\t\tonCreate: () => null,\n\t\t\tonMount: () => null,\n\t\t\tonUnmount: () => null,\n\t\t\tonUpdate: () => null,\n\t\t\tonSelectionUpdate: () => null,\n\t\t\tonTransaction: () => null,\n\t\t\tonFocus: () => null,\n\t\t\tonBlur: () => null,\n\t\t\tonDestroy: () => null,\n\t\t\tonContentError: ({ error }) => {\n\t\t\t\tthrow error;\n\t\t\t},\n\t\t\tonPaste: () => null,\n\t\t\tonDrop: () => null,\n\t\t\tonDelete: () => null,\n\t\t\tenableExtensionDispatchTransaction: true\n\t\t};\n\t\tthis.isCapturingTransaction = false;\n\t\tthis.capturedTransaction = null;\n\t\tthis.utils = {\n\t\t\tgetUpdatedPosition,\n\t\t\tcreateMappablePosition\n\t\t};\n\t\tthis.setOptions(options);\n\t\tthis.createExtensionManager();\n\t\tthis.createCommandManager();\n\t\tthis.createSchema();\n\t\tthis.on(\"beforeCreate\", this.options.onBeforeCreate);\n\t\tthis.emit(\"beforeCreate\", { editor: this });\n\t\tthis.on(\"mount\", this.options.onMount);\n\t\tthis.on(\"unmount\", this.options.onUnmount);\n\t\tthis.on(\"contentError\", this.options.onContentError);\n\t\tthis.on(\"create\", this.options.onCreate);\n\t\tthis.on(\"update\", this.options.onUpdate);\n\t\tthis.on(\"selectionUpdate\", this.options.onSelectionUpdate);\n\t\tthis.on(\"transaction\", this.options.onTransaction);\n\t\tthis.on(\"focus\", this.options.onFocus);\n\t\tthis.on(\"blur\", this.options.onBlur);\n\t\tthis.on(\"destroy\", this.options.onDestroy);\n\t\tthis.on(\"drop\", ({ event, slice, moved }) => this.options.onDrop(event, slice, moved));\n\t\tthis.on(\"paste\", ({ event, slice }) => this.options.onPaste(event, slice));\n\t\tthis.on(\"delete\", this.options.onDelete);\n\t\tconst initialDoc = this.createDoc();\n\t\tif (!this.editorState) {\n\t\t\tconst selection = resolveFocusPosition(initialDoc, this.options.autofocus);\n\t\t\tthis.editorState = EditorState.create({\n\t\t\t\tdoc: initialDoc,\n\t\t\t\tschema: this.schema,\n\t\t\t\tselection: selection || void 0\n\t\t\t});\n\t\t}\n\t\twarnOnDuplicatedProseMirrorModel(this.schema);\n\t\tif (this.options.element) this.mount(this.options.element);\n\t}\n\t/**\n\t* Attach the editor to the DOM, creating a new editor view.\n\t*/\n\tmount(el) {\n\t\tif (typeof document === \"undefined\") throw new Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);\n\t\tthis.createView(el);\n\t\tthis.emit(\"mount\", { editor: this });\n\t\tif (this.css && !document.head.contains(this.css)) document.head.appendChild(this.css);\n\t\twindow.setTimeout(() => {\n\t\t\tif (this.isDestroyed) return;\n\t\t\tif (this.options.autofocus !== false && this.options.autofocus !== null) this.commands.focus(this.options.autofocus);\n\t\t\tthis.emit(\"create\", { editor: this });\n\t\t\tthis.isInitialized = true;\n\t\t}, 0);\n\t}\n\t/**\n\t* Remove the editor from the DOM, but still allow remounting at a different point in time\n\t*/\n\tunmount() {\n\t\tif (this.editorView) {\n\t\t\tthis.editorState = this.editorView.state;\n\t\t\tconst dom = this.editorView.dom;\n\t\t\tif (dom === null || dom === void 0 ? void 0 : dom.editor) delete dom.editor;\n\t\t\tthis.editorView.destroy();\n\t\t}\n\t\tthis.editorView = null;\n\t\tthis.isInitialized = false;\n\t\tif (this.css && !document.querySelectorAll(`.${this.className}`).length) try {\n\t\t\tif (typeof this.css.remove === \"function\") this.css.remove();\n\t\t\telse if (this.css.parentNode) this.css.parentNode.removeChild(this.css);\n\t\t} catch (error) {\n\t\t\tconsole.warn(\"Failed to remove CSS element:\", error);\n\t\t}\n\t\tthis.css = null;\n\t\tthis.emit(\"unmount\", { editor: this });\n\t}\n\t/**\n\t* Returns the editor storage.\n\t*/\n\tget storage() {\n\t\treturn this.extensionStorage;\n\t}\n\t/**\n\t* An object of all registered commands.\n\t*/\n\tget commands() {\n\t\treturn this.commandManager.commands;\n\t}\n\t/**\n\t* Create a command chain to call multiple commands at once.\n\t*/\n\tchain() {\n\t\tif (!this.commandManager) return CommandManager.createFakeChain();\n\t\treturn this.commandManager.chain();\n\t}\n\t/**\n\t* Check if a command or a command chain can be executed. Without executing it.\n\t*/\n\tcan() {\n\t\tif (!this.commandManager) return CommandManager.createFallbackCan();\n\t\treturn this.commandManager.can();\n\t}\n\t/**\n\t* Inject CSS styles.\n\t*/\n\tinjectCSS() {\n\t\tif (this.options.injectCSS && typeof document !== \"undefined\") this.css = createStyleTag(style, this.options.injectNonce);\n\t}\n\t/**\n\t* Update editor options.\n\t*\n\t* @param options A list of options\n\t*/\n\tsetOptions(options = {}) {\n\t\tthis.options = {\n\t\t\t...this.options,\n\t\t\t...options\n\t\t};\n\t\tif (!this.editorView || !this.state || this.isDestroyed) return;\n\t\tif (this.options.editorProps) this.view.setProps(this.options.editorProps);\n\t\tthis.view.updateState(this.state);\n\t}\n\t/**\n\t* Update editable state of the editor.\n\t*/\n\tsetEditable(editable, emitUpdate = true) {\n\t\tthis.setOptions({ editable });\n\t\tif (emitUpdate) this.emit(\"update\", {\n\t\t\teditor: this,\n\t\t\ttransaction: this.state.tr,\n\t\t\tappendedTransactions: []\n\t\t});\n\t}\n\t/**\n\t* Returns whether the editor is editable.\n\t*/\n\tget isEditable() {\n\t\treturn this.options.editable && this.view && this.view.editable;\n\t}\n\t/**\n\t* Returns the editor view.\n\t*/\n\tget view() {\n\t\tif (this.editorView) return this.editorView;\n\t\treturn new Proxy({\n\t\t\tstate: this.editorState,\n\t\t\tupdateState: (state) => {\n\t\t\t\tthis.editorState = state;\n\t\t\t},\n\t\t\tdispatch: (tr) => {\n\t\t\t\tthis.dispatchTransaction(tr);\n\t\t\t},\n\t\t\tcomposing: false,\n\t\t\tdragging: null,\n\t\t\teditable: true,\n\t\t\tisDestroyed: false\n\t\t}, { get: (obj, key) => {\n\t\t\tif (this.editorView) return this.editorView[key];\n\t\t\tif (key === \"state\") return this.editorState;\n\t\t\tif (key in obj) return Reflect.get(obj, key);\n\t\t\tthrow new Error(`[tiptap error]: The editor view is not available. Cannot access view['${key}']. The editor may not be mounted yet.`);\n\t\t} });\n\t}\n\t/**\n\t* Returns the editor state.\n\t*/\n\tget state() {\n\t\tif (isDev && !this.hasWarnedStaleDecorationRead && isInDecorationApplyScope(this)) {\n\t\t\tthis.hasWarnedStaleDecorationRead = true;\n\t\t\tconsole.warn(\"[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.\");\n\t\t}\n\t\tif (this.editorView) this.editorState = this.view.state;\n\t\treturn this.editorState;\n\t}\n\t/**\n\t* Register a ProseMirror plugin.\n\t*\n\t* @param plugin A ProseMirror plugin\n\t* @param handlePlugins Control how to merge the plugin into the existing plugins.\n\t* @returns The new editor state\n\t*/\n\tregisterPlugin(plugin, handlePlugins) {\n\t\tconst plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];\n\t\tconst state = this.state.reconfigure({ plugins });\n\t\tthis.view.updateState(state);\n\t\treturn state;\n\t}\n\t/**\n\t* Unregister a ProseMirror plugin.\n\t*\n\t* @param nameOrPluginKeyToRemove The plugins name\n\t* @returns The new editor state or undefined if the editor is destroyed\n\t*/\n\tunregisterPlugin(nameOrPluginKeyToRemove) {\n\t\tif (this.isDestroyed) return;\n\t\tconst prevPlugins = this.state.plugins;\n\t\tlet plugins = prevPlugins;\n\t\t[].concat(nameOrPluginKeyToRemove).forEach((nameOrPluginKey) => {\n\t\t\tconst name = typeof nameOrPluginKey === \"string\" ? `${nameOrPluginKey}$` : nameOrPluginKey.key;\n\t\t\tplugins = plugins.filter((plugin) => !plugin.key.startsWith(name));\n\t\t});\n\t\tif (prevPlugins.length === plugins.length) return;\n\t\tconst state = this.state.reconfigure({ plugins });\n\t\tthis.view.updateState(state);\n\t\treturn state;\n\t}\n\t/**\n\t* Creates an extension manager.\n\t*/\n\tcreateExtensionManager() {\n\t\tvar _this$options$coreExt, _this$options$coreExt2;\n\t\tconst allExtensions = [...this.options.enableCoreExtensions ? [\n\t\t\tEditable,\n\t\t\tClipboardTextSerializer.configure({ blockSeparator: (_this$options$coreExt = this.options.coreExtensionOptions) === null || _this$options$coreExt === void 0 || (_this$options$coreExt = _this$options$coreExt.clipboardTextSerializer) === null || _this$options$coreExt === void 0 ? void 0 : _this$options$coreExt.blockSeparator }),\n\t\t\tCommands,\n\t\t\tFocusEvents,\n\t\t\tKeymap,\n\t\t\tTabindex.configure({ value: (_this$options$coreExt2 = this.options.coreExtensionOptions) === null || _this$options$coreExt2 === void 0 || (_this$options$coreExt2 = _this$options$coreExt2.tabindex) === null || _this$options$coreExt2 === void 0 ? void 0 : _this$options$coreExt2.value }),\n\t\t\tDrop,\n\t\t\tPaste,\n\t\t\tDelete,\n\t\t\tTextDirection.configure({ direction: this.options.textDirection })\n\t\t].filter((ext) => {\n\t\t\tif (typeof this.options.enableCoreExtensions === \"object\") return this.options.enableCoreExtensions[ext.name] !== false;\n\t\t\treturn true;\n\t\t}) : [], ...this.options.extensions].filter((extension) => {\n\t\t\treturn [\n\t\t\t\t\"extension\",\n\t\t\t\t\"node\",\n\t\t\t\t\"mark\"\n\t\t\t].includes(extension === null || extension === void 0 ? void 0 : extension.type);\n\t\t});\n\t\tthis.extensionManager = new ExtensionManager(allExtensions, this);\n\t}\n\t/**\n\t* Creates an command manager.\n\t*/\n\tcreateCommandManager() {\n\t\tthis.commandManager = new CommandManager({ editor: this });\n\t}\n\t/**\n\t* Creates a ProseMirror schema.\n\t*/\n\tcreateSchema() {\n\t\tthis.schema = this.extensionManager.schema;\n\t}\n\t/**\n\t* Creates the initial document.\n\t*/\n\tcreateDoc() {\n\t\tlet doc;\n\t\ttry {\n\t\t\tdoc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });\n\t\t} catch (e) {\n\t\t\tif (!(e instanceof Error) || ![\"[tiptap error]: Invalid JSON content\", \"[tiptap error]: Invalid HTML content\"].includes(e.message)) throw e;\n\t\t\tconst fallbackDoc = createDocument(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: false });\n\t\t\tthis.editorState = EditorState.create({\n\t\t\t\tdoc: fallbackDoc,\n\t\t\t\tschema: this.schema,\n\t\t\t\tselection: resolveFocusPosition(fallbackDoc, this.options.autofocus) || void 0\n\t\t\t});\n\t\t\tthis.emit(\"contentError\", {\n\t\t\t\teditor: this,\n\t\t\t\terror: e,\n\t\t\t\tdisableCollaboration: () => {\n\t\t\t\t\tif (\"collaboration\" in this.storage && typeof this.storage.collaboration === \"object\" && this.storage.collaboration) this.storage.collaboration.isDisabled = true;\n\t\t\t\t\tthis.options.extensions = this.options.extensions.filter((extension) => extension.name !== \"collaboration\");\n\t\t\t\t\tthis.createExtensionManager();\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn this.editorState.doc;\n\t\t}\n\t\treturn doc;\n\t}\n\t/**\n\t* Creates a ProseMirror view.\n\t*/\n\tcreateView(element) {\n\t\tconst { editorProps, enableExtensionDispatchTransaction } = this.options;\n\t\tconst baseDispatch = editorProps.dispatchTransaction || this.dispatchTransaction.bind(this);\n\t\tconst dispatch = enableExtensionDispatchTransaction ? this.extensionManager.dispatchTransaction(baseDispatch) : baseDispatch;\n\t\tconst baseTransformPastedHTML = editorProps.transformPastedHTML;\n\t\tconst transformPastedHTML = this.extensionManager.transformPastedHTML(baseTransformPastedHTML);\n\t\tthis.editorView = new EditorView(element, {\n\t\t\t...editorProps,\n\t\t\tattributes: {\n\t\t\t\trole: \"textbox\",\n\t\t\t\t...editorProps === null || editorProps === void 0 ? void 0 : editorProps.attributes\n\t\t\t},\n\t\t\tdispatchTransaction: dispatch,\n\t\t\ttransformPastedHTML,\n\t\t\tstate: this.editorState,\n\t\t\tmarkViews: this.extensionManager.markViews,\n\t\t\tnodeViews: this.extensionManager.nodeViews\n\t\t});\n\t\tconst newState = this.state.reconfigure({ plugins: this.extensionManager.plugins });\n\t\tthis.view.updateState(newState);\n\t\tthis.prependClass();\n\t\tthis.injectCSS();\n\t\tconst dom = this.view.dom;\n\t\tdom.editor = this;\n\t}\n\t/**\n\t* Creates all node and mark views.\n\t*/\n\tcreateNodeViews() {\n\t\tif (this.view.isDestroyed) return;\n\t\tthis.view.setProps({\n\t\t\tmarkViews: this.extensionManager.markViews,\n\t\t\tnodeViews: this.extensionManager.nodeViews\n\t\t});\n\t}\n\t/**\n\t* Prepend class name to element.\n\t*/\n\tprependClass() {\n\t\tthis.view.dom.className = `${this.className} ${this.view.dom.className}`;\n\t}\n\tcaptureTransaction(fn) {\n\t\tthis.isCapturingTransaction = true;\n\t\tfn();\n\t\tthis.isCapturingTransaction = false;\n\t\tconst tr = this.capturedTransaction;\n\t\tthis.capturedTransaction = null;\n\t\treturn tr;\n\t}\n\t/**\n\t* The callback over which to send transactions (state updates) produced by the view.\n\t*\n\t* @param transaction An editor state transaction\n\t*/\n\tdispatchTransaction(transaction) {\n\t\tif (this.view.isDestroyed) return;\n\t\tif (this.isCapturingTransaction) {\n\t\t\tif (!this.capturedTransaction) {\n\t\t\t\tthis.capturedTransaction = transaction;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttransaction.steps.forEach((step) => {\n\t\t\t\tvar _this$capturedTransac;\n\t\t\t\treturn (_this$capturedTransac = this.capturedTransaction) === null || _this$capturedTransac === void 0 ? void 0 : _this$capturedTransac.step(step);\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst { state, transactions } = this.state.applyTransaction(transaction);\n\t\tconst selectionHasChanged = !this.state.selection.eq(state.selection);\n\t\tconst rootTrWasApplied = transactions.includes(transaction);\n\t\tconst prevState = this.state;\n\t\tthis.emit(\"beforeTransaction\", {\n\t\t\teditor: this,\n\t\t\ttransaction,\n\t\t\tnextState: state\n\t\t});\n\t\tif (!rootTrWasApplied) return;\n\t\tthis.view.updateState(state);\n\t\tthis.emit(\"transaction\", {\n\t\t\teditor: this,\n\t\t\ttransaction,\n\t\t\tappendedTransactions: transactions.slice(1)\n\t\t});\n\t\tif (selectionHasChanged) this.emit(\"selectionUpdate\", {\n\t\t\teditor: this,\n\t\t\ttransaction\n\t\t});\n\t\tconst mostRecentFocusTr = transactions.findLast((tr) => tr.getMeta(\"focus\") || tr.getMeta(\"blur\"));\n\t\tconst focus = mostRecentFocusTr === null || mostRecentFocusTr === void 0 ? void 0 : mostRecentFocusTr.getMeta(\"focus\");\n\t\tconst blur = mostRecentFocusTr === null || mostRecentFocusTr === void 0 ? void 0 : mostRecentFocusTr.getMeta(\"blur\");\n\t\tif (focus) this.emit(\"focus\", {\n\t\t\teditor: this,\n\t\t\tevent: focus.event,\n\t\t\ttransaction: mostRecentFocusTr\n\t\t});\n\t\tif (blur) this.emit(\"blur\", {\n\t\t\teditor: this,\n\t\t\tevent: blur.event,\n\t\t\ttransaction: mostRecentFocusTr\n\t\t});\n\t\tif (transaction.getMeta(\"preventUpdate\") || !transactions.some((tr) => tr.docChanged) || prevState.doc.eq(state.doc)) return;\n\t\tthis.emit(\"update\", {\n\t\t\teditor: this,\n\t\t\ttransaction,\n\t\t\tappendedTransactions: transactions.slice(1)\n\t\t});\n\t}\n\t/**\n\t* Get attributes of the currently selected node or mark.\n\t*/\n\tgetAttributes(nameOrType) {\n\t\treturn getAttributes(this.state, nameOrType);\n\t}\n\tisActive(nameOrAttributes, attributesOrUndefined) {\n\t\tconst name = typeof nameOrAttributes === \"string\" ? nameOrAttributes : null;\n\t\tconst attributes = typeof nameOrAttributes === \"string\" ? attributesOrUndefined : nameOrAttributes;\n\t\treturn isActive(this.state, name, attributes);\n\t}\n\t/**\n\t* Get the document as JSON.\n\t*/\n\tgetJSON() {\n\t\treturn this.state.doc.toJSON();\n\t}\n\t/**\n\t* Get the document as HTML.\n\t*/\n\tgetHTML() {\n\t\treturn getHTMLFromFragment(this.state.doc.content, this.schema);\n\t}\n\t/**\n\t* Get the document as text.\n\t*/\n\tgetText(options) {\n\t\tconst { blockSeparator = \"\\n\\n\", textSerializers = {} } = options || {};\n\t\treturn getText(this.state.doc, {\n\t\t\tblockSeparator,\n\t\t\ttextSerializers: {\n\t\t\t\t...getTextSerializersFromSchema(this.schema),\n\t\t\t\t...textSerializers\n\t\t\t}\n\t\t});\n\t}\n\t/**\n\t* Check if there is no content.\n\t*/\n\tget isEmpty() {\n\t\treturn isNodeEmpty(this.state.doc);\n\t}\n\t/**\n\t* Destroy the editor.\n\t*/\n\tdestroy() {\n\t\tif (this.destroyed) return;\n\t\tthis.destroyed = true;\n\t\tthis.emit(\"destroy\");\n\t\tthis.unmount();\n\t\tthis.removeAllListeners();\n\t\tthis.extensionManager.destroy();\n\t\tthis.extensionManager = null;\n\t\tthis.schema = null;\n\t\tthis.commandManager = null;\n\t\tthis.extensionStorage = {};\n\t}\n\t/**\n\t* Check if the editor is already destroyed.\n\t*/\n\tget isDestroyed() {\n\t\tvar _this$editorView$isDe, _this$editorView;\n\t\treturn (_this$editorView$isDe = (_this$editorView = this.editorView) === null || _this$editorView === void 0 ? void 0 : _this$editorView.isDestroyed) !== null && _this$editorView$isDe !== void 0 ? _this$editorView$isDe : true;\n\t}\n\t$node(selector, attributes) {\n\t\tvar _this$$doc;\n\t\treturn ((_this$$doc = this.$doc) === null || _this$$doc === void 0 ? void 0 : _this$$doc.querySelector(selector, attributes)) || null;\n\t}\n\t$nodes(selector, attributes) {\n\t\tvar _this$$doc2;\n\t\treturn ((_this$$doc2 = this.$doc) === null || _this$$doc2 === void 0 ? void 0 : _this$$doc2.querySelectorAll(selector, attributes)) || null;\n\t}\n\t$pos(pos) {\n\t\tconst $pos = this.state.doc.resolve(pos);\n\t\tconst node = pos > 0 && $pos.nodeAfter && !$pos.nodeAfter.isText && $pos.nodeAfter.isAtom ? $pos.nodeAfter : null;\n\t\treturn new NodePos($pos, this, false, node);\n\t}\n\tget $doc() {\n\t\treturn this.$pos(0);\n\t}\n};\n//#endregion\n//#region src/decorations/Decoration.ts\n/**\n* Base class for decorations built in `addDecorations()`. Shadows `Decoration`\n* from `@tiptap/pm/view`, like core's `Node` and `Mark` do, so alias one of them\n* in files that need both.\n*\n* @example\n* import { Decoration } from '@tiptap/core'\n* import { Decoration as PMDecoration } from '@tiptap/pm/view'\n*\n* const highlight = Decoration.Inline(1, 5, { class: 'highlight' })\n*/\nvar Decoration = class {\n\tstatic Inline(from, to, attrs = {}, spec) {\n\t\treturn new InlineDecoration(from, to, attrs, spec);\n\t}\n\tstatic Node(pos, to, attrs = {}, spec) {\n\t\treturn new NodeDecoration(pos, to, attrs, spec);\n\t}\n\t/**\n\t* Creates a widget decoration: a DOM node drawn at a document position.\n\t*\n\t* The `key` is the widget's identity. While it stays the same, ProseMirror\n\t* keeps the widget mounted and only its position tracks the document.\n\t* `render`, `side`, `destroy` and other options are fixed on first mount.\n\t* Change the key to remount with new options.\n\t*\n\t* @param pos The document position where the widget is drawn.\n\t* @param render Called once on first mount. Returns the DOM node.\n\t* @param options Must include a unique `key`. See `WidgetDecorationOptions`.\n\t* @returns The widget decoration.\n\t*/\n\tstatic Widget(pos, render, options) {\n\t\tconst { key, ...spec } = options;\n\t\treturn new WidgetDecoration(pos, render, key, spec);\n\t}\n};\n/**\n* Represents an inline decoration (text-level highlighting, etc.).\n*/\nvar InlineDecoration = class extends Decoration {\n\tconstructor(from, to, attrs = {}, spec) {\n\t\tsuper();\n\t\tthis.kind = \"inline\";\n\t\tthis.from = from;\n\t\tthis.to = to;\n\t\tthis.attrs = attrs;\n\t\tthis.spec = spec;\n\t}\n\tget anchor() {\n\t\treturn this.from;\n\t}\n\ttoPMDecoration(extensionName) {\n\t\tconst spec = extensionName ? {\n\t\t\t...this.spec,\n\t\t\textensionName\n\t\t} : this.spec;\n\t\treturn Decoration$1.inline(this.from, this.to, this.attrs, spec);\n\t}\n};\n/**\n* Represents a node-level decoration (block-level highlights, etc.).\n*/\nvar NodeDecoration = class extends Decoration {\n\tconstructor(pos, to, attrs = {}, spec) {\n\t\tsuper();\n\t\tthis.kind = \"node\";\n\t\tthis.from = pos;\n\t\tthis.to = to;\n\t\tthis.attrs = attrs;\n\t\tthis.spec = spec;\n\t}\n\tget anchor() {\n\t\treturn this.from;\n\t}\n\ttoPMDecoration(extensionName) {\n\t\tconst spec = extensionName ? {\n\t\t\t...this.spec,\n\t\t\textensionName\n\t\t} : this.spec;\n\t\treturn Decoration$1.node(this.from, this.to, this.attrs, spec);\n\t}\n};\n/**\n* Represents a widget decoration (inline widgets, etc.).\n*/\nvar WidgetDecoration = class extends Decoration {\n\tconstructor(pos, render, key, spec) {\n\t\tsuper();\n\t\tthis.kind = \"widget\";\n\t\tthis.pos = pos;\n\t\tthis.render = render;\n\t\tthis.key = key;\n\t\tthis.spec = spec;\n\t}\n\tget anchor() {\n\t\treturn this.pos;\n\t}\n\ttoPMDecoration(extensionName) {\n\t\tconst spec = extensionName ? {\n\t\t\t...this.spec,\n\t\t\tkey: this.key,\n\t\t\textensionName\n\t\t} : {\n\t\t\t...this.spec,\n\t\t\tkey: this.key\n\t\t};\n\t\treturn Decoration$1.widget(this.pos, this.render, spec);\n\t}\n};\n//#endregion\n//#region src/decorations/createWidgetDecoration.ts\nfunction getCache(editor, cacheKey) {\n\tconst host = editor;\n\tlet cache = host[cacheKey];\n\tif (!cache) {\n\t\tcache = {\n\t\t\trenderers: /* @__PURE__ */ new Map(),\n\t\t\tprops: /* @__PURE__ */ new Map(),\n\t\t\tpendingProps: /* @__PURE__ */ new Map(),\n\t\t\tflushScheduled: false\n\t\t};\n\t\thost[cacheKey] = cache;\n\t\tconst sweep = cache;\n\t\teditor.on(\"destroy\", () => {\n\t\t\tsweep.pendingProps.clear();\n\t\t\tsweep.renderers.forEach((renderer) => renderer.destroy());\n\t\t\tsweep.renderers.clear();\n\t\t\tsweep.props.clear();\n\t\t});\n\t}\n\treturn cache;\n}\nfunction flushPendingProps(cache) {\n\tcache.flushScheduled = false;\n\tfor (const [key, props] of cache.pendingProps) {\n\t\tconst renderer = cache.renderers.get(key);\n\t\tif (renderer) {\n\t\t\trenderer.updateProps(props);\n\t\t\tcache.props.set(key, { ...props });\n\t\t}\n\t}\n\tcache.pendingProps.clear();\n}\n/**\n* Builds a widget decoration backed by a framework component renderer.\n*\n* Owns everything that is not framework specific: the per-editor renderer\n* cache, prop diffing, the deferred prop flush, the key reassignment guard and\n* the ProseMirror option pass-through. Framework packages supply only `create`,\n* `context` and `materialize`.\n*\n* @param options The widget options plus the three framework hooks.\n* @returns The widget decoration to return from `addDecorations`.\n* @example\n* createWidgetDecoration<ReactRenderer>({\n* editor, pos, key, props, cacheKey: WIDGET_CACHE,\n* context: getPos => ({ editor, getPos }),\n* create: renderProps => new ReactRenderer(component, { editor, props: renderProps }),\n* materialize: renderer => renderer.element,\n* })\n*/\nfunction createWidgetDecoration(options) {\n\tconst { editor, pos, key, props, cacheKey, context, create, materialize, side, relaxedSide, marks, stopEvent, ignoreSelection, destroy } = options;\n\tconst cache = getCache(editor, cacheKey);\n\tif (cache.renderers.has(key)) {\n\t\tvar _cache$pendingProps$g;\n\t\tconst previous = (_cache$pendingProps$g = cache.pendingProps.get(key)) !== null && _cache$pendingProps$g !== void 0 ? _cache$pendingProps$g : cache.props.get(key);\n\t\tif (!previous || !attrsEqual(previous, props)) {\n\t\t\tcache.pendingProps.set(key, props);\n\t\t\tif (!cache.flushScheduled) {\n\t\t\t\tcache.flushScheduled = true;\n\t\t\t\tqueueMicrotask(() => flushPendingProps(cache));\n\t\t\t}\n\t\t}\n\t}\n\tconst render = (_view, getPos) => {\n\t\tconst renderProps = {\n\t\t\t...props,\n\t\t\t...context(getPos)\n\t\t};\n\t\tlet renderer = cache.renderers.get(key);\n\t\tif (renderer) renderer.updateProps(renderProps);\n\t\telse {\n\t\t\trenderer = create(renderProps);\n\t\t\tcache.renderers.set(key, renderer);\n\t\t\tcache.props.set(key, { ...props });\n\t\t}\n\t\treturn materialize(renderer);\n\t};\n\treturn Decoration.Widget(pos, render, {\n\t\tkey,\n\t\tside,\n\t\trelaxedSide,\n\t\tmarks,\n\t\tstopEvent,\n\t\tignoreSelection,\n\t\tdestroy: (rendererElement) => {\n\t\t\tif (liveWidgetKeys(editor).has(key)) return;\n\t\t\ttry {\n\t\t\t\tvar _cache$renderers$get;\n\t\t\t\t(_cache$renderers$get = cache.renderers.get(key)) === null || _cache$renderers$get === void 0 || _cache$renderers$get.destroy();\n\t\t\t\tcache.renderers.delete(key);\n\t\t\t\tcache.props.delete(key);\n\t\t\t\tcache.pendingProps.delete(key);\n\t\t\t} finally {\n\t\t\t\tdestroy === null || destroy === void 0 || destroy(rendererElement);\n\t\t\t}\n\t\t}\n\t});\n}\n//#endregion\n//#region src/inputRules/markInputRule.ts\n/**\n* Build an input rule that adds a mark when the\n* matched text is typed into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction markInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match);\n\t\t\tif (attributes === false || attributes === null) return null;\n\t\t\tconst { tr } = state;\n\t\t\tconst captureGroup = match[match.length - 1];\n\t\t\tconst fullMatch = match[0];\n\t\t\tif (captureGroup) {\n\t\t\t\tconst startSpaces = fullMatch.search(/\\S/);\n\t\t\t\tconst textStart = range.from + fullMatch.indexOf(captureGroup);\n\t\t\t\tconst textEnd = textStart + captureGroup.length;\n\t\t\t\tif (getMarksBetween(range.from, range.to, state.doc).filter((item) => {\n\t\t\t\t\treturn item.mark.type.excluded.find((type) => type === config.type && type !== item.mark.type);\n\t\t\t\t}).filter((item) => item.to > textStart).length) return null;\n\t\t\t\tif (textEnd < range.to) tr.delete(textEnd, range.to);\n\t\t\t\tif (textStart > range.from) tr.delete(range.from + startSpaces, textStart);\n\t\t\t\tconst markEnd = range.from + startSpaces + captureGroup.length;\n\t\t\t\ttr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n\t\t\t\ttr.removeStoredMark(config.type);\n\t\t\t}\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/inputRules/nodeInputRule.ts\n/**\n* Build an input rule that adds a node when the\n* matched text is typed into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction nodeInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n\t\t\tconst { tr } = state;\n\t\t\tconst start = range.from;\n\t\t\tlet end = range.to;\n\t\t\tconst newNode = config.type.create(attributes);\n\t\t\tif (match[1]) {\n\t\t\t\tlet matchStart = start + match[0].lastIndexOf(match[1]);\n\t\t\t\tif (matchStart > end) matchStart = end;\n\t\t\t\telse end = matchStart + match[1].length;\n\t\t\t\tconst lastChar = match[0][match[0].length - 1];\n\t\t\t\ttr.insertText(lastChar, start + match[0].length - 1);\n\t\t\t\ttr.replaceWith(matchStart, end, newNode);\n\t\t\t} else if (match[0]) {\n\t\t\t\tconst insertionStart = config.type.isInline ? start : start - 1;\n\t\t\t\ttr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));\n\t\t\t}\n\t\t\ttr.scrollIntoView();\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/inputRules/textblockTypeInputRule.ts\n/**\n* Build an input rule that changes the type of a textblock when the\n* matched text is typed into it. When using a regular expresion you’ll\n* probably want the regexp to start with `^`, so that the pattern can\n* only occur at the start of a textblock.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction textblockTypeInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tconst $start = state.doc.resolve(range.from);\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n\t\t\tif (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) return null;\n\t\t\tstate.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/inputRules/textInputRule.ts\n/**\n* Build an input rule that replaces text when the\n* matched text is typed into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction textInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tlet insert = config.replace;\n\t\t\tlet start = range.from;\n\t\t\tconst end = range.to;\n\t\t\tif (match[1]) {\n\t\t\t\tconst offset = match[0].lastIndexOf(match[1]);\n\t\t\t\tinsert += match[0].slice(offset + match[1].length);\n\t\t\t\tstart += offset;\n\t\t\t\tconst cutOff = start - end;\n\t\t\t\tif (cutOff > 0) {\n\t\t\t\t\tinsert = match[0].slice(offset - cutOff, offset) + insert;\n\t\t\t\t\tstart = end;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstate.tr.insertText(insert, start, end);\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/inputRules/wrappingInputRule.ts\n/**\n* Build an input rule for automatically wrapping a textblock when a\n* given string is typed. When using a regular expresion you’ll\n* probably want the regexp to start with `^`, so that the pattern can\n* only occur at the start of a textblock.\n*\n* `type` is the type of node to wrap in.\n*\n* By default, if there’s a node with the same type above the newly\n* wrapped node, the rule will try to join those\n* two nodes. You can pass a join predicate, which takes a regular\n* expression match and the node before the wrapped node, and can\n* return a boolean to indicate whether a join should happen.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n*/\nfunction wrappingInputRule(config) {\n\treturn new InputRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match, chain }) => {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match) || {};\n\t\t\tconst tr = state.tr.delete(range.from, range.to);\n\t\t\tconst blockRange = tr.doc.resolve(range.from).blockRange();\n\t\t\tconst wrapping = blockRange && findWrapping(blockRange, config.type, attributes);\n\t\t\tif (!wrapping) return null;\n\t\t\ttr.wrap(blockRange, wrapping);\n\t\t\tif (config.keepMarks && config.editor) {\n\t\t\t\tconst { selection, storedMarks } = state;\n\t\t\t\tconst { splittableMarks } = config.editor.extensionManager;\n\t\t\t\tconst marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n\t\t\t\tif (marks) {\n\t\t\t\t\tconst filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));\n\t\t\t\t\ttr.ensureMarks(filteredMarks);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (config.keepAttributes) {\n\t\t\t\t/** If the nodeType is `bulletList` or `orderedList` set the `nodeType` as `listItem` */\n\t\t\t\tconst nodeType = config.type.name === \"bulletList\" || config.type.name === \"orderedList\" ? \"listItem\" : \"taskList\";\n\t\t\t\tchain().updateAttributes(nodeType, attributes).run();\n\t\t\t}\n\t\t\tconst before = tr.doc.resolve(range.from - 1).nodeBefore;\n\t\t\tif (before && before.type === config.type && canJoin(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) tr.join(range.from - 1);\n\t\t},\n\t\tundoable: config.undoable\n\t});\n}\n//#endregion\n//#region src/jsx-runtime.ts\nconst jsxElements = /* @__PURE__ */ new WeakSet();\nconst jsxFragments = /* @__PURE__ */ new WeakSet();\n/** Create a new JSX element from the given spec */\nfunction createJSXElement(spec) {\n\tconst element = spec;\n\tjsxElements.add(element);\n\treturn element;\n}\n/** Check if a spec is a JSX element */\nfunction isJSXElement(value) {\n\treturn Array.isArray(value) && jsxElements.has(value);\n}\nfunction flattenFragmentChildren(children) {\n\treturn children.flatMap((child) => {\n\t\tif (child == null) return [];\n\t\tif (Array.isArray(child) && jsxFragments.has(child) && !isJSXElement(child)) return flattenFragmentChildren(child);\n\t\treturn [child];\n\t});\n}\nfunction Fragment(props) {\n\tjsxFragments.add(props.children);\n\treturn props.children;\n}\nfunction render(tag, attributes) {\n\tif (tag === \"slot\") return 0;\n\tif (tag instanceof Function) {\n\t\tconst result = tag(attributes);\n\t\tif (Array.isArray(result) && !isJSXElement(result) && !jsxFragments.has(result)) return createJSXElement(result);\n\t\treturn result;\n\t}\n\tconst { children, ...rest } = attributes !== null && attributes !== void 0 ? attributes : {};\n\tif (tag === \"svg\") throw new Error(\"SVG elements are not supported in the JSX syntax, use the array syntax instead\");\n\tif (Array.isArray(children)) {\n\t\tif (isJSXElement(children)) return createJSXElement([\n\t\t\ttag,\n\t\t\trest,\n\t\t\tchildren\n\t\t]);\n\t\tif (children.length === 0) return createJSXElement([tag, rest]);\n\t\tconst flattenedChildren = flattenFragmentChildren(children);\n\t\tif (flattenedChildren.length === 0) return createJSXElement([tag, rest]);\n\t\treturn createJSXElement([\n\t\t\ttag,\n\t\t\trest,\n\t\t\t...flattenedChildren\n\t\t]);\n\t}\n\tif (children !== void 0 && children !== null) return createJSXElement([\n\t\ttag,\n\t\trest,\n\t\tchildren\n\t]);\n\treturn createJSXElement([tag, rest]);\n}\nconst h = (tag, attributes) => render(tag, attributes);\n//#endregion\n//#region src/lib/ResizableNodeView.ts\nconst isTouchEvent = (e) => {\n\treturn \"touches\" in e;\n};\n/**\n* A NodeView implementation that adds resize handles to any DOM element.\n*\n* This class creates a resizable node view for Tiptap/ProseMirror editors.\n* It wraps your element with resize handles and manages the resize interaction,\n* including aspect ratio preservation, min/max constraints, and keyboard modifiers.\n*\n* @example\n* ```ts\n* // Basic usage in a Tiptap extension\n* addNodeView() {\n* return ({ node, getPos }) => {\n* const img = document.createElement('img')\n* img.src = node.attrs.src\n*\n* return new ResizableNodeView({\n* element: img,\n* node,\n* getPos,\n* onResize: (width, height) => {\n* img.style.width = `${width}px`\n* img.style.height = `${height}px`\n* },\n* onCommit: (width, height) => {\n* this.editor.commands.updateAttributes('image', { width, height })\n* },\n* onUpdate: () => true,\n* options: {\n* min: { width: 100, height: 100 },\n* preserveAspectRatio: true\n* }\n* })\n* }\n* }\n* ```\n*/\nvar ResizableNodeView = class {\n\t/**\n\t* Creates a new ResizableNodeView instance.\n\t*\n\t* The constructor sets up the resize handles, applies initial sizing from\n\t* node attributes, and configures all resize behavior options.\n\t*\n\t* @param options - Configuration options for the resizable node view\n\t*/\n\tconstructor(options) {\n\t\tvar _options$options, _options$options2, _options$options3, _options$options4, _options$options5, _options$options6;\n\t\tthis.directions = [\n\t\t\t\"bottom-left\",\n\t\t\t\"bottom-right\",\n\t\t\t\"top-left\",\n\t\t\t\"top-right\"\n\t\t];\n\t\tthis.minSize = {\n\t\t\theight: 8,\n\t\t\twidth: 8\n\t\t};\n\t\tthis.preserveAspectRatio = false;\n\t\tthis.classNames = {\n\t\t\tcontainer: \"\",\n\t\t\twrapper: \"\",\n\t\t\thandle: \"\",\n\t\t\tresizing: \"\"\n\t\t};\n\t\tthis.initialWidth = 0;\n\t\tthis.initialHeight = 0;\n\t\tthis.aspectRatio = 1;\n\t\tthis.isResizing = false;\n\t\tthis.activeHandle = null;\n\t\tthis.startX = 0;\n\t\tthis.startY = 0;\n\t\tthis.startWidth = 0;\n\t\tthis.startHeight = 0;\n\t\tthis.isShiftKeyPressed = false;\n\t\tthis.lastEditableState = void 0;\n\t\tthis.handleMap = /* @__PURE__ */ new Map();\n\t\tthis.handleMouseMove = (event) => {\n\t\t\tif (!this.isResizing || !this.activeHandle) return;\n\t\t\tconst deltaX = event.clientX - this.startX;\n\t\t\tconst deltaY = event.clientY - this.startY;\n\t\t\tthis.handleResize(deltaX, deltaY);\n\t\t};\n\t\tthis.handleTouchMove = (event) => {\n\t\t\tif (!this.isResizing || !this.activeHandle) return;\n\t\t\tconst touch = event.touches[0];\n\t\t\tif (!touch) return;\n\t\t\tconst deltaX = touch.clientX - this.startX;\n\t\t\tconst deltaY = touch.clientY - this.startY;\n\t\t\tthis.handleResize(deltaX, deltaY);\n\t\t};\n\t\tthis.handleMouseUp = () => {\n\t\t\tif (!this.isResizing) return;\n\t\t\tconst finalWidth = this.element.offsetWidth;\n\t\t\tconst finalHeight = this.element.offsetHeight;\n\t\t\tthis.onCommit(finalWidth, finalHeight);\n\t\t\tthis.isResizing = false;\n\t\t\tthis.activeHandle = null;\n\t\t\tthis.container.dataset.resizeState = \"false\";\n\t\t\tif (this.classNames.resizing) this.container.classList.remove(this.classNames.resizing);\n\t\t\tdocument.removeEventListener(\"mousemove\", this.handleMouseMove);\n\t\t\tdocument.removeEventListener(\"mouseup\", this.handleMouseUp);\n\t\t\tdocument.removeEventListener(\"keydown\", this.handleKeyDown);\n\t\t\tdocument.removeEventListener(\"keyup\", this.handleKeyUp);\n\t\t};\n\t\tthis.handleKeyDown = (event) => {\n\t\t\tif (event.key === \"Shift\") this.isShiftKeyPressed = true;\n\t\t};\n\t\tthis.handleKeyUp = (event) => {\n\t\t\tif (event.key === \"Shift\") this.isShiftKeyPressed = false;\n\t\t};\n\t\tthis.node = options.node;\n\t\tthis.editor = options.editor;\n\t\tthis.element = options.element;\n\t\tthis.element.draggable = false;\n\t\tthis.contentElement = options.contentElement;\n\t\tthis.getPos = options.getPos;\n\t\tthis.onResize = options.onResize;\n\t\tthis.onCommit = options.onCommit;\n\t\tthis.onUpdate = options.onUpdate;\n\t\tif ((_options$options = options.options) === null || _options$options === void 0 ? void 0 : _options$options.min) this.minSize = {\n\t\t\t...this.minSize,\n\t\t\t...options.options.min\n\t\t};\n\t\tif ((_options$options2 = options.options) === null || _options$options2 === void 0 ? void 0 : _options$options2.max) this.maxSize = options.options.max;\n\t\tif (options === null || options === void 0 || (_options$options3 = options.options) === null || _options$options3 === void 0 ? void 0 : _options$options3.directions) this.directions = options.options.directions;\n\t\tif ((_options$options4 = options.options) === null || _options$options4 === void 0 ? void 0 : _options$options4.preserveAspectRatio) this.preserveAspectRatio = options.options.preserveAspectRatio;\n\t\tif ((_options$options5 = options.options) === null || _options$options5 === void 0 ? void 0 : _options$options5.className) this.classNames = {\n\t\t\tcontainer: options.options.className.container || \"\",\n\t\t\twrapper: options.options.className.wrapper || \"\",\n\t\t\thandle: options.options.className.handle || \"\",\n\t\t\tresizing: options.options.className.resizing || \"\"\n\t\t};\n\t\tif ((_options$options6 = options.options) === null || _options$options6 === void 0 ? void 0 : _options$options6.createCustomHandle) this.createCustomHandle = options.options.createCustomHandle;\n\t\tthis.wrapper = this.createWrapper();\n\t\tthis.container = this.createContainer();\n\t\tthis.applyInitialSize();\n\t\tthis.attachHandles();\n\t\tthis.editor.on(\"update\", this.handleEditorUpdate.bind(this));\n\t}\n\t/**\n\t* Returns the top-level DOM node that should be placed in the editor.\n\t*\n\t* This is required by the ProseMirror NodeView interface. The container\n\t* includes the wrapper, handles, and the actual content element.\n\t*\n\t* @returns The container element to be inserted into the editor\n\t*/\n\tget dom() {\n\t\treturn this.container;\n\t}\n\tget contentDOM() {\n\t\tvar _this$contentElement;\n\t\treturn (_this$contentElement = this.contentElement) !== null && _this$contentElement !== void 0 ? _this$contentElement : null;\n\t}\n\thandleEditorUpdate() {\n\t\tconst isEditable = this.editor.isEditable;\n\t\tif (isEditable === this.lastEditableState) return;\n\t\tthis.lastEditableState = isEditable;\n\t\tif (!isEditable) this.removeHandles();\n\t\telse if (isEditable && this.handleMap.size === 0) this.attachHandles();\n\t}\n\t/**\n\t* Called when the node's content or attributes change.\n\t*\n\t* Updates the internal node reference. If a custom `onUpdate` callback\n\t* was provided, it will be called to handle additional update logic.\n\t*\n\t* @param node - The new/updated node\n\t* @param decorations - Node decorations\n\t* @param innerDecorations - Inner decorations\n\t* @returns `false` if the node type has changed (requires full rebuild), otherwise the result of `onUpdate` or `true`\n\t*/\n\tupdate(node, decorations, innerDecorations) {\n\t\tif (node.type !== this.node.type) return false;\n\t\tthis.node = node;\n\t\tif (this.onUpdate) return this.onUpdate(node, decorations, innerDecorations);\n\t\treturn true;\n\t}\n\t/**\n\t* Cleanup method called when the node view is being removed.\n\t*\n\t* Removes all event listeners to prevent memory leaks. This is required\n\t* by the ProseMirror NodeView interface. If a resize is active when\n\t* destroy is called, it will be properly cancelled.\n\t*/\n\tdestroy() {\n\t\tif (this.isResizing) {\n\t\t\tthis.container.dataset.resizeState = \"false\";\n\t\t\tif (this.classNames.resizing) this.container.classList.remove(this.classNames.resizing);\n\t\t\tdocument.removeEventListener(\"mousemove\", this.handleMouseMove);\n\t\t\tdocument.removeEventListener(\"mouseup\", this.handleMouseUp);\n\t\t\tdocument.removeEventListener(\"keydown\", this.handleKeyDown);\n\t\t\tdocument.removeEventListener(\"keyup\", this.handleKeyUp);\n\t\t\tthis.isResizing = false;\n\t\t\tthis.activeHandle = null;\n\t\t}\n\t\tthis.editor.off(\"update\", this.handleEditorUpdate.bind(this));\n\t\tthis.container.remove();\n\t}\n\t/**\n\t* Creates the outer container element.\n\t*\n\t* The container is the top-level element returned by the NodeView and\n\t* wraps the entire resizable node. It's set up with flexbox to handle\n\t* alignment and includes data attributes for styling and identification.\n\t*\n\t* @returns The container element\n\t*/\n\tcreateContainer() {\n\t\tconst element = document.createElement(\"div\");\n\t\telement.dataset.resizeContainer = \"\";\n\t\telement.dataset.node = this.node.type.name;\n\t\telement.style.display = this.node.type.isInline ? \"inline-flex\" : \"flex\";\n\t\tif (this.classNames.container) element.className = this.classNames.container;\n\t\telement.appendChild(this.wrapper);\n\t\treturn element;\n\t}\n\t/**\n\t* Creates the wrapper element that contains the content and handles.\n\t*\n\t* The wrapper uses relative positioning so that resize handles can be\n\t* positioned absolutely within it. This is the direct parent of the\n\t* content element being made resizable.\n\t*\n\t* @returns The wrapper element\n\t*/\n\tcreateWrapper() {\n\t\tconst element = document.createElement(\"div\");\n\t\telement.style.position = \"relative\";\n\t\telement.style.display = \"block\";\n\t\telement.dataset.resizeWrapper = \"\";\n\t\tif (this.classNames.wrapper) element.className = this.classNames.wrapper;\n\t\telement.appendChild(this.element);\n\t\treturn element;\n\t}\n\t/**\n\t* Creates a resize handle element for a specific direction.\n\t*\n\t* Each handle is absolutely positioned and includes a data attribute\n\t* identifying its direction for styling purposes.\n\t*\n\t* @param direction - The resize direction for this handle\n\t* @returns The handle element\n\t*/\n\tcreateHandle(direction) {\n\t\tconst handle = document.createElement(\"div\");\n\t\thandle.dataset.resizeHandle = direction;\n\t\thandle.style.position = \"absolute\";\n\t\tif (this.classNames.handle) handle.className = this.classNames.handle;\n\t\treturn handle;\n\t}\n\t/**\n\t* Positions a handle element according to its direction.\n\t*\n\t* Corner handles (e.g., 'top-left') are positioned at the intersection\n\t* of two edges. Edge handles (e.g., 'top') span the full width or height.\n\t*\n\t* @param handle - The handle element to position\n\t* @param direction - The direction determining the position\n\t*/\n\tpositionHandle(handle, direction) {\n\t\tconst isTop = direction.includes(\"top\");\n\t\tconst isBottom = direction.includes(\"bottom\");\n\t\tconst isLeft = direction.includes(\"left\");\n\t\tconst isRight = direction.includes(\"right\");\n\t\tif (isTop) handle.style.top = \"0\";\n\t\tif (isBottom) handle.style.bottom = \"0\";\n\t\tif (isLeft) handle.style.left = \"0\";\n\t\tif (isRight) handle.style.right = \"0\";\n\t\tif (direction === \"top\" || direction === \"bottom\") {\n\t\t\thandle.style.left = \"0\";\n\t\t\thandle.style.right = \"0\";\n\t\t}\n\t\tif (direction === \"left\" || direction === \"right\") {\n\t\t\thandle.style.top = \"0\";\n\t\t\thandle.style.bottom = \"0\";\n\t\t}\n\t}\n\t/**\n\t* Creates and attaches all resize handles to the wrapper.\n\t*\n\t* Iterates through the configured directions, creates a handle for each,\n\t* positions it, attaches the mousedown listener, and appends it to the DOM.\n\t*/\n\tattachHandles() {\n\t\tthis.directions.forEach((direction) => {\n\t\t\tlet handle;\n\t\t\tif (this.createCustomHandle) handle = this.createCustomHandle(direction);\n\t\t\telse handle = this.createHandle(direction);\n\t\t\tif (!(handle instanceof HTMLElement)) {\n\t\t\t\tconsole.warn(`[ResizableNodeView] createCustomHandle(\"${direction}\") did not return an HTMLElement. Falling back to default handle.`);\n\t\t\t\thandle = this.createHandle(direction);\n\t\t\t}\n\t\t\tif (!this.createCustomHandle) this.positionHandle(handle, direction);\n\t\t\thandle.addEventListener(\"mousedown\", (event) => this.handleResizeStart(event, direction));\n\t\t\thandle.addEventListener(\"touchstart\", (event) => this.handleResizeStart(event, direction));\n\t\t\tthis.handleMap.set(direction, handle);\n\t\t\tthis.wrapper.appendChild(handle);\n\t\t});\n\t}\n\t/**\n\t* Removes all resize handles from the wrapper.\n\t*\n\t* Cleans up the handle map and removes each handle element from the DOM.\n\t*/\n\tremoveHandles() {\n\t\tthis.handleMap.forEach((el) => el.remove());\n\t\tthis.handleMap.clear();\n\t}\n\t/**\n\t* Applies initial sizing from node attributes to the element.\n\t*\n\t* If width/height attributes exist on the node, they're applied to the element.\n\t* Otherwise, the element's natural/current dimensions are measured. The aspect\n\t* ratio is calculated for later use in aspect-ratio-preserving resizes.\n\t*/\n\tapplyInitialSize() {\n\t\tconst width = this.node.attrs.width;\n\t\tconst height = this.node.attrs.height;\n\t\tif (width) {\n\t\t\tthis.element.style.width = `${width}px`;\n\t\t\tthis.initialWidth = width;\n\t\t} else this.initialWidth = this.element.offsetWidth;\n\t\tif (height) {\n\t\t\tthis.element.style.height = `${height}px`;\n\t\t\tthis.initialHeight = height;\n\t\t} else this.initialHeight = this.element.offsetHeight;\n\t\tif (this.initialWidth > 0 && this.initialHeight > 0) this.aspectRatio = this.initialWidth / this.initialHeight;\n\t}\n\t/**\n\t* Initiates a resize operation when a handle is clicked.\n\t*\n\t* Captures the starting mouse position and element dimensions, sets up\n\t* the resize state, adds the resizing class and state attribute, and\n\t* attaches document-level listeners for mouse movement and keyboard input.\n\t*\n\t* @param event - The mouse down event\n\t* @param direction - The direction of the handle being dragged\n\t*/\n\thandleResizeStart(event, direction) {\n\t\tevent.preventDefault();\n\t\tevent.stopPropagation();\n\t\tthis.isResizing = true;\n\t\tthis.activeHandle = direction;\n\t\tif (isTouchEvent(event)) {\n\t\t\tthis.startX = event.touches[0].clientX;\n\t\t\tthis.startY = event.touches[0].clientY;\n\t\t} else {\n\t\t\tthis.startX = event.clientX;\n\t\t\tthis.startY = event.clientY;\n\t\t}\n\t\tthis.startWidth = this.element.offsetWidth;\n\t\tthis.startHeight = this.element.offsetHeight;\n\t\tif (this.startWidth > 0 && this.startHeight > 0) this.aspectRatio = this.startWidth / this.startHeight;\n\t\tif (this.getPos() !== void 0) {}\n\t\tthis.container.dataset.resizeState = \"true\";\n\t\tif (this.classNames.resizing) this.container.classList.add(this.classNames.resizing);\n\t\tdocument.addEventListener(\"mousemove\", this.handleMouseMove);\n\t\tdocument.addEventListener(\"touchmove\", this.handleTouchMove);\n\t\tdocument.addEventListener(\"mouseup\", this.handleMouseUp);\n\t\tdocument.addEventListener(\"keydown\", this.handleKeyDown);\n\t\tdocument.addEventListener(\"keyup\", this.handleKeyUp);\n\t}\n\thandleResize(deltaX, deltaY) {\n\t\tif (!this.activeHandle) return;\n\t\tconst shouldPreserveAspectRatio = this.preserveAspectRatio || this.isShiftKeyPressed;\n\t\tconst { width, height } = this.calculateNewDimensions(this.activeHandle, deltaX, deltaY);\n\t\tconst constrained = this.applyConstraints(width, height, shouldPreserveAspectRatio);\n\t\tthis.element.style.width = `${constrained.width}px`;\n\t\tthis.element.style.height = `${constrained.height}px`;\n\t\tif (this.onResize) this.onResize(constrained.width, constrained.height);\n\t}\n\t/**\n\t* Calculates new dimensions based on mouse delta and resize direction.\n\t*\n\t* Takes the starting dimensions and applies the mouse movement delta\n\t* according to the handle direction. For corner handles, both dimensions\n\t* are affected. For edge handles, only one dimension changes. If aspect\n\t* ratio should be preserved, delegates to applyAspectRatio.\n\t*\n\t* @param direction - The active resize handle direction\n\t* @param deltaX - Horizontal mouse movement since resize start\n\t* @param deltaY - Vertical mouse movement since resize start\n\t* @returns The calculated width and height\n\t*/\n\tcalculateNewDimensions(direction, deltaX, deltaY) {\n\t\tlet newWidth = this.startWidth;\n\t\tlet newHeight = this.startHeight;\n\t\tconst isRight = direction.includes(\"right\");\n\t\tconst isLeft = direction.includes(\"left\");\n\t\tconst isBottom = direction.includes(\"bottom\");\n\t\tconst isTop = direction.includes(\"top\");\n\t\tif (isRight) newWidth = this.startWidth + deltaX;\n\t\telse if (isLeft) newWidth = this.startWidth - deltaX;\n\t\tif (isBottom) newHeight = this.startHeight + deltaY;\n\t\telse if (isTop) newHeight = this.startHeight - deltaY;\n\t\tif (direction === \"right\" || direction === \"left\") newWidth = this.startWidth + (isRight ? deltaX : -deltaX);\n\t\tif (direction === \"top\" || direction === \"bottom\") newHeight = this.startHeight + (isBottom ? deltaY : -deltaY);\n\t\tif (this.preserveAspectRatio || this.isShiftKeyPressed) return this.applyAspectRatio(newWidth, newHeight, direction);\n\t\treturn {\n\t\t\twidth: newWidth,\n\t\t\theight: newHeight\n\t\t};\n\t}\n\t/**\n\t* Applies min/max constraints to dimensions.\n\t*\n\t* When aspect ratio is NOT preserved, constraints are applied independently\n\t* to width and height. When aspect ratio IS preserved, constraints are\n\t* applied while maintaining the aspect ratio—if one dimension hits a limit,\n\t* the other is recalculated proportionally.\n\t*\n\t* This ensures that aspect ratio is never broken when constrained.\n\t*\n\t* @param width - The unconstrained width\n\t* @param height - The unconstrained height\n\t* @param preserveAspectRatio - Whether to maintain aspect ratio while constraining\n\t* @returns The constrained dimensions\n\t*/\n\tapplyConstraints(width, height, preserveAspectRatio) {\n\t\tvar _this$maxSize3, _this$maxSize4;\n\t\tif (!preserveAspectRatio) {\n\t\t\tvar _this$maxSize, _this$maxSize2;\n\t\t\tlet constrainedWidth = Math.max(this.minSize.width, width);\n\t\t\tlet constrainedHeight = Math.max(this.minSize.height, height);\n\t\t\tif ((_this$maxSize = this.maxSize) === null || _this$maxSize === void 0 ? void 0 : _this$maxSize.width) constrainedWidth = Math.min(this.maxSize.width, constrainedWidth);\n\t\t\tif ((_this$maxSize2 = this.maxSize) === null || _this$maxSize2 === void 0 ? void 0 : _this$maxSize2.height) constrainedHeight = Math.min(this.maxSize.height, constrainedHeight);\n\t\t\treturn {\n\t\t\t\twidth: constrainedWidth,\n\t\t\t\theight: constrainedHeight\n\t\t\t};\n\t\t}\n\t\tlet constrainedWidth = width;\n\t\tlet constrainedHeight = height;\n\t\tif (constrainedWidth < this.minSize.width) {\n\t\t\tconstrainedWidth = this.minSize.width;\n\t\t\tconstrainedHeight = constrainedWidth / this.aspectRatio;\n\t\t}\n\t\tif (constrainedHeight < this.minSize.height) {\n\t\t\tconstrainedHeight = this.minSize.height;\n\t\t\tconstrainedWidth = constrainedHeight * this.aspectRatio;\n\t\t}\n\t\tif (((_this$maxSize3 = this.maxSize) === null || _this$maxSize3 === void 0 ? void 0 : _this$maxSize3.width) && constrainedWidth > this.maxSize.width) {\n\t\t\tconstrainedWidth = this.maxSize.width;\n\t\t\tconstrainedHeight = constrainedWidth / this.aspectRatio;\n\t\t}\n\t\tif (((_this$maxSize4 = this.maxSize) === null || _this$maxSize4 === void 0 ? void 0 : _this$maxSize4.height) && constrainedHeight > this.maxSize.height) {\n\t\t\tconstrainedHeight = this.maxSize.height;\n\t\t\tconstrainedWidth = constrainedHeight * this.aspectRatio;\n\t\t}\n\t\treturn {\n\t\t\twidth: constrainedWidth,\n\t\t\theight: constrainedHeight\n\t\t};\n\t}\n\t/**\n\t* Adjusts dimensions to maintain the original aspect ratio.\n\t*\n\t* For horizontal handles (left/right), uses width as the primary dimension\n\t* and calculates height from it. For vertical handles (top/bottom), uses\n\t* height as primary and calculates width. For corner handles, uses width\n\t* as the primary dimension.\n\t*\n\t* @param width - The new width\n\t* @param height - The new height\n\t* @param direction - The active resize direction\n\t* @returns Dimensions adjusted to preserve aspect ratio\n\t*/\n\tapplyAspectRatio(width, height, direction) {\n\t\tconst isHorizontal = direction === \"left\" || direction === \"right\";\n\t\tconst isVertical = direction === \"top\" || direction === \"bottom\";\n\t\tif (isHorizontal) return {\n\t\t\twidth,\n\t\t\theight: width / this.aspectRatio\n\t\t};\n\t\tif (isVertical) return {\n\t\t\twidth: height * this.aspectRatio,\n\t\t\theight\n\t\t};\n\t\treturn {\n\t\t\twidth,\n\t\t\theight: width / this.aspectRatio\n\t\t};\n\t}\n};\n/**\n* Alias for ResizableNodeView to maintain consistent naming.\n* @deprecated Use ResizableNodeView instead - will be removed in future versions.\n*/\nconst ResizableNodeview = ResizableNodeView;\n//#endregion\n//#region src/Node.ts\n/**\n* The Node class is used to create custom node extensions.\n* @see https://tiptap.dev/api/extensions#create-a-new-extension\n*/\nvar Node = class Node extends Extendable {\n\tconstructor(..._args) {\n\t\tsuper(..._args);\n\t\tthis.type = \"node\";\n\t}\n\t/**\n\t* Create a new Node instance\n\t* @param config - Node configuration object or a function that returns a configuration object\n\t*/\n\tstatic create(config = {}) {\n\t\tconst resolvedConfig = typeof config === \"function\" ? config() : config;\n\t\treturn new Node(resolvedConfig);\n\t}\n\tconfigure(options) {\n\t\treturn super.configure(options);\n\t}\n\textend(extendedConfig) {\n\t\tconst resolvedConfig = typeof extendedConfig === \"function\" ? extendedConfig() : extendedConfig;\n\t\treturn super.extend(resolvedConfig);\n\t}\n};\n//#endregion\n//#region src/NodeView.ts\n/**\n* Node views are used to customize the rendered DOM structure of a node.\n* @see https://tiptap.dev/guide/node-views\n*/\nvar NodeView = class {\n\tconstructor(component, props, options) {\n\t\tthis.isDragging = false;\n\t\tthis.component = component;\n\t\tthis.editor = props.editor;\n\t\tthis.options = {\n\t\t\tstopEvent: null,\n\t\t\tignoreMutation: null,\n\t\t\t...options\n\t\t};\n\t\tthis.extension = props.extension;\n\t\tthis.node = props.node;\n\t\tthis.decorations = props.decorations;\n\t\tthis.innerDecorations = props.innerDecorations;\n\t\tthis.view = props.view;\n\t\tthis.HTMLAttributes = props.HTMLAttributes;\n\t\tthis.getPos = () => {\n\t\t\ttry {\n\t\t\t\treturn props.getPos();\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t};\n\t\tthis.mount();\n\t}\n\tmount() {}\n\tget dom() {\n\t\treturn this.editor.view.dom;\n\t}\n\tget contentDOM() {\n\t\treturn null;\n\t}\n\tonDragStart(event) {\n\t\tvar _target$parentElement, _this$contentDOM;\n\t\tconst { view } = this.editor;\n\t\tconst target = event.target;\n\t\tconst dragHandle = target.nodeType === 3 ? (_target$parentElement = target.parentElement) === null || _target$parentElement === void 0 ? void 0 : _target$parentElement.closest(\"[data-drag-handle]\") : target.closest(\"[data-drag-handle]\");\n\t\tif (!this.dom || ((_this$contentDOM = this.contentDOM) === null || _this$contentDOM === void 0 ? void 0 : _this$contentDOM.contains(target)) || !dragHandle) return;\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\tif (this.dom !== dragHandle) {\n\t\t\tvar _event$offsetX, _nativeEvent, _event$offsetY, _nativeEvent2;\n\t\t\tconst domBox = this.dom.getBoundingClientRect();\n\t\t\tconst handleBox = dragHandle.getBoundingClientRect();\n\t\t\tconst offsetX = (_event$offsetX = event.offsetX) !== null && _event$offsetX !== void 0 ? _event$offsetX : (_nativeEvent = event.nativeEvent) === null || _nativeEvent === void 0 ? void 0 : _nativeEvent.offsetX;\n\t\t\tconst offsetY = (_event$offsetY = event.offsetY) !== null && _event$offsetY !== void 0 ? _event$offsetY : (_nativeEvent2 = event.nativeEvent) === null || _nativeEvent2 === void 0 ? void 0 : _nativeEvent2.offsetY;\n\t\t\tx = handleBox.x - domBox.x + offsetX;\n\t\t\ty = handleBox.y - domBox.y + offsetY;\n\t\t}\n\t\tconst clonedNode = this.dom.cloneNode(true);\n\t\ttry {\n\t\t\tconst domBox = this.dom.getBoundingClientRect();\n\t\t\tclonedNode.style.width = `${Math.round(domBox.width)}px`;\n\t\t\tclonedNode.style.height = `${Math.round(domBox.height)}px`;\n\t\t\tclonedNode.style.boxSizing = \"border-box\";\n\t\t\tclonedNode.style.pointerEvents = \"none\";\n\t\t} catch {}\n\t\tlet dragImageWrapper = null;\n\t\ttry {\n\t\t\tvar _event$dataTransfer;\n\t\t\tdragImageWrapper = document.createElement(\"div\");\n\t\t\tdragImageWrapper.style.position = \"absolute\";\n\t\t\tdragImageWrapper.style.top = \"-9999px\";\n\t\t\tdragImageWrapper.style.left = \"-9999px\";\n\t\t\tdragImageWrapper.style.pointerEvents = \"none\";\n\t\t\tdragImageWrapper.appendChild(clonedNode);\n\t\t\tdocument.body.appendChild(dragImageWrapper);\n\t\t\t(_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 || _event$dataTransfer.setDragImage(clonedNode, x, y);\n\t\t} finally {\n\t\t\tif (dragImageWrapper) setTimeout(() => {\n\t\t\t\ttry {\n\t\t\t\t\tdragImageWrapper === null || dragImageWrapper === void 0 || dragImageWrapper.remove();\n\t\t\t\t} catch {}\n\t\t\t}, 0);\n\t\t}\n\t\tconst pos = this.getPos();\n\t\tif (typeof pos !== \"number\") return;\n\t\tconst selection = NodeSelection.create(view.state.doc, pos);\n\t\tconst transaction = view.state.tr.setSelection(selection);\n\t\tview.dispatch(transaction);\n\t}\n\tstopEvent(event) {\n\t\tvar _this$contentDOM2;\n\t\tif (!this.dom) return false;\n\t\tif (typeof this.options.stopEvent === \"function\") return this.options.stopEvent({ event });\n\t\tconst target = event.target;\n\t\tif (!(this.dom.contains(target) && !((_this$contentDOM2 = this.contentDOM) === null || _this$contentDOM2 === void 0 ? void 0 : _this$contentDOM2.contains(target)))) return false;\n\t\tconst isDragEvent = event.type.startsWith(\"drag\");\n\t\tconst isDragOverEnterEvent = event.type === \"dragover\" || event.type === \"dragenter\";\n\t\tconst isDropEvent = event.type === \"drop\";\n\t\tif (([\n\t\t\t\"INPUT\",\n\t\t\t\"BUTTON\",\n\t\t\t\"SELECT\",\n\t\t\t\"TEXTAREA\"\n\t\t].includes(target.tagName) || target.isContentEditable) && !isDropEvent && !isDragEvent) return true;\n\t\tconst { isEditable } = this.editor;\n\t\tconst { isDragging } = this;\n\t\tconst isDraggable = !!this.node.type.spec.draggable;\n\t\tconst isSelectable = NodeSelection.isSelectable(this.node);\n\t\tconst isCopyEvent = event.type === \"copy\";\n\t\tconst isPasteEvent = event.type === \"paste\";\n\t\tconst isCutEvent = event.type === \"cut\";\n\t\tconst isClickEvent = event.type === \"mousedown\";\n\t\tif (!isDraggable && isSelectable && isDragEvent && event.target === this.dom) event.preventDefault();\n\t\tif (isDraggable && isDragEvent && !isDragging && event.target === this.dom) {\n\t\t\tevent.preventDefault();\n\t\t\treturn false;\n\t\t}\n\t\tif (isDraggable && isEditable && !isDragging && isClickEvent) {\n\t\t\tconst dragHandle = target.closest(\"[data-drag-handle]\");\n\t\t\tif (dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle))) {\n\t\t\t\tthis.isDragging = true;\n\t\t\t\tdocument.addEventListener(\"dragend\", () => {\n\t\t\t\t\tthis.isDragging = false;\n\t\t\t\t}, { once: true });\n\t\t\t\tdocument.addEventListener(\"drop\", () => {\n\t\t\t\t\tthis.isDragging = false;\n\t\t\t\t}, { once: true });\n\t\t\t\tdocument.addEventListener(\"mouseup\", () => {\n\t\t\t\t\tthis.isDragging = false;\n\t\t\t\t}, { once: true });\n\t\t\t}\n\t\t}\n\t\tif (isDragging || isDragOverEnterEvent || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) return false;\n\t\treturn true;\n\t}\n\t/**\n\t* Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.\n\t* @return `false` if the editor should re-read the selection or re-parse the range around the mutation\n\t* @return `true` if it can safely be ignored.\n\t*/\n\tignoreMutation(mutation) {\n\t\tif (!this.dom || !this.contentDOM) return true;\n\t\tif (typeof this.options.ignoreMutation === \"function\") return this.options.ignoreMutation({ mutation });\n\t\tif (this.node.isLeaf || this.node.isAtom) return true;\n\t\tif (mutation.type === \"selection\") return false;\n\t\tif (this.dom.contains(mutation.target) && mutation.type === \"childList\" && (isiOS() || isAndroid()) && this.editor.isFocused) {\n\t\t\tif ([...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)].every((node) => node.isContentEditable)) return false;\n\t\t}\n\t\tif (this.contentDOM === mutation.target && mutation.type === \"attributes\") return true;\n\t\tif (this.contentDOM.contains(mutation.target)) return false;\n\t\treturn true;\n\t}\n\t/**\n\t* Update the attributes of the prosemirror node.\n\t*/\n\tupdateAttributes(attributes) {\n\t\tthis.editor.commands.command(({ tr }) => {\n\t\t\tconst pos = this.getPos();\n\t\t\tif (typeof pos !== \"number\") return false;\n\t\t\ttr.setNodeMarkup(pos, void 0, {\n\t\t\t\t...this.node.attrs,\n\t\t\t\t...attributes\n\t\t\t});\n\t\t\treturn true;\n\t\t});\n\t}\n\t/**\n\t* Delete the node.\n\t*/\n\tdeleteNode() {\n\t\tconst from = this.getPos();\n\t\tif (typeof from !== \"number\") return;\n\t\tconst to = from + this.node.nodeSize;\n\t\tthis.editor.commands.deleteRange({\n\t\t\tfrom,\n\t\t\tto\n\t\t});\n\t}\n};\n//#endregion\n//#region src/pasteRules/markPasteRule.ts\n/**\n* Build an paste rule that adds a mark when the\n* matched text is pasted into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n*/\nfunction markPasteRule(config) {\n\treturn new PasteRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match, pasteEvent }) => {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);\n\t\t\tif (attributes === false || attributes === null) return null;\n\t\t\tconst { tr } = state;\n\t\t\tconst captureGroup = match[match.length - 1];\n\t\t\tconst fullMatch = match[0];\n\t\t\tlet markEnd = range.to;\n\t\t\tif (captureGroup) {\n\t\t\t\tconst startSpaces = fullMatch.search(/\\S/);\n\t\t\t\tconst textStart = range.from + fullMatch.indexOf(captureGroup);\n\t\t\t\tconst textEnd = textStart + captureGroup.length;\n\t\t\t\tif (getMarksBetween(range.from, range.to, state.doc).filter((item) => {\n\t\t\t\t\treturn item.mark.type.excluded.find((type) => type === config.type && type !== item.mark.type);\n\t\t\t\t}).filter((item) => item.to > textStart).length) return null;\n\t\t\t\tif (textEnd < range.to) tr.delete(textEnd, range.to);\n\t\t\t\tif (textStart > range.from) tr.delete(range.from + startSpaces, textStart);\n\t\t\t\tmarkEnd = range.from + startSpaces + captureGroup.length;\n\t\t\t\ttr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n\t\t\t\tif (!(match.index !== void 0 && match.input !== void 0 && match.index + match[0].length >= match.input.length)) tr.removeStoredMark(config.type);\n\t\t\t}\n\t\t}\n\t});\n}\n//#endregion\n//#region src/pasteRules/nodePasteRule.ts\n/**\n* Build an paste rule that adds a node when the\n* matched text is pasted into it.\n* @see https://tiptap.dev/docs/editor/api/paste-rules\n*/\nfunction nodePasteRule(config) {\n\treturn new PasteRule({\n\t\tfind: config.find,\n\t\thandler({ match, chain, range, pasteEvent }) {\n\t\t\tconst attributes = callOrReturn(config.getAttributes, void 0, match, pasteEvent);\n\t\t\tconst content = callOrReturn(config.getContent, void 0, attributes);\n\t\t\tif (attributes === false || attributes === null) return null;\n\t\t\tconst node = {\n\t\t\t\ttype: config.type.name,\n\t\t\t\tattrs: attributes\n\t\t\t};\n\t\t\tif (content) node.content = content;\n\t\t\tif (match.input) chain().deleteRange(range).insertContentAt(range.from, node);\n\t\t}\n\t});\n}\n//#endregion\n//#region src/pasteRules/textPasteRule.ts\n/**\n* Build an paste rule that replaces text when the\n* matched text is pasted into it.\n* @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n*/\nfunction textPasteRule(config) {\n\treturn new PasteRule({\n\t\tfind: config.find,\n\t\thandler: ({ state, range, match }) => {\n\t\t\tlet insert = config.replace;\n\t\t\tlet start = range.from;\n\t\t\tconst end = range.to;\n\t\t\tif (match[1]) {\n\t\t\t\tconst offset = match[0].lastIndexOf(match[1]);\n\t\t\t\tinsert += match[0].slice(offset + match[1].length);\n\t\t\t\tstart += offset;\n\t\t\t\tconst cutOff = start - end;\n\t\t\t\tif (cutOff > 0) {\n\t\t\t\t\tinsert = match[0].slice(offset - cutOff, offset) + insert;\n\t\t\t\t\tstart = end;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstate.tr.insertText(insert, start, end);\n\t\t}\n\t});\n}\n//#endregion\n//#region src/Tracker.ts\nvar Tracker = class {\n\tconstructor(transaction) {\n\t\tthis.transaction = transaction;\n\t\tthis.currentStep = this.transaction.steps.length;\n\t}\n\tmap(position) {\n\t\tlet deleted = false;\n\t\treturn {\n\t\t\tposition: this.transaction.steps.slice(this.currentStep).reduce((newPosition, step) => {\n\t\t\t\tconst mapResult = step.getMap().mapResult(newPosition);\n\t\t\t\tif (mapResult.deleted) deleted = true;\n\t\t\t\treturn mapResult.pos;\n\t\t\t}, position),\n\t\t\tdeleted\n\t\t};\n\t}\n};\n//#endregion\nexport { CommandManager, DECORATION_MANAGER_PLUGIN_KEY, Decoration, DecorationManager, Editor, Extendable, Extension, Fragment, InlineDecoration, InputRule, MappablePosition, Mark, MarkView, Node, NodeDecoration, NodePos, NodeView, PasteRule, ResizableNodeView, ResizableNodeview, Tracker, WidgetDecoration, attrsEqual, callOrReturn, canInsertNode, combineTransactionSteps, commands_exports as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, h, createInlineMarkdownSpec, createMappablePosition, createNodeFromContent, createStyleTag, createWidgetDecoration, decodeHtmlEntities, defaultBlockAt, deleteProps, elementFromString, encodeHtmlEntities, escapeForRegEx, extensions_exports as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, flattenExtensions, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getPreviousBlockSibling, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getStyleProperty, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getUpdatedPosition, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFirefox, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNodeViewSelected, isNumber, isPlainObject, isProseMirrorAddMarkStep, isProseMirrorAddNodeMarkStep, isProseMirrorAttrStep, isProseMirrorCellSelection, isProseMirrorDocAttrStep, isProseMirrorFragment, isProseMirrorNodeSelection, isProseMirrorRemoveMarkStep, isProseMirrorRemoveNodeMarkStep, isProseMirrorReplaceAroundStep, isProseMirrorReplaceStep, isProseMirrorSlice, isProseMirrorStep, isProseMirrorStepResult, isRegExp, isSafari, isString, isTextSelection, isiOS, liveWidgetKeys, markInputRule, markPasteRule, markdown_exports as markdown, marksEqual, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, pasteRulesPlugin, posToDOMRect, removeDuplicates, renderNestedMarkdownContent, resolveExtensions, resolveFocusPosition, rewriteUnknownContent, selectionToInsertionEnd, serializeAttributes, sortExtensions, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, updateMarkViewAttributes, wrappingInputRule };\n\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;AAcA,SAAS,EAAqB,GAAQ;CACrC,IAAM,EAAE,UAAO,mBAAgB,GAC3B,EAAE,iBAAc,GAChB,EAAE,WAAQ,GACV,EAAE,mBAAgB;CACtB,OAAO;EACN,GAAG;EACH,OAAO,EAAM,MAAM,KAAK,CAAK;EAC7B,kBAAkB,EAAM,iBAAiB,KAAK,CAAK;EACnD,SAAS,EAAM;EACf,QAAQ,EAAM;EACd,aAAa,EAAM,YAAY,KAAK,CAAK;EACzC,QAAQ,EAAM,OAAO,KAAK,CAAK;EAC/B,IAAI,cAAc;GACjB,OAAO;EACR;EACA,IAAI,YAAY;GACf,OAAO;EACR;EACA,IAAI,MAAM;GACT,OAAO;EACR;EACA,IAAI,KAAK;GAIR,OAHA,IAAY,EAAY,WACxB,IAAM,EAAY,KAClB,IAAc,EAAY,aACnB;EACR;CACD;AACD;AAGA,IAAI,IAAiB,MAAM,EAAe;CACzC,YAAY,GAAO;EAGlB,AAFA,KAAK,SAAS,EAAM,QACpB,KAAK,cAA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