@pie-element/shared-editor-runtime 0.1.1-next.0 → 0.1.1-next.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.
Files changed (30) hide show
  1. package/dist/browser/{dist-BzUsSMiM.js → dist-BsIpHitF.js} +3 -3
  2. package/dist/browser/{dist-BzUsSMiM.js.map → dist-BsIpHitF.js.map} +1 -1
  3. package/dist/browser/{dist-DyMj6m6j.js → dist-BwzOz38C.js} +23 -16
  4. package/dist/browser/{dist-DyMj6m6j.js.map → dist-BwzOz38C.js.map} +1 -1
  5. package/dist/browser/{dist-86k79VvK.js → dist-CF7SJxlB.js} +3 -3
  6. package/dist/browser/{dist-86k79VvK.js.map → dist-CF7SJxlB.js.map} +1 -1
  7. package/dist/browser/{dist-DlTupuCB.js → dist-CL31Mguj.js} +1352 -1335
  8. package/dist/browser/dist-CL31Mguj.js.map +1 -0
  9. package/dist/browser/{dist-BiHYI9ZI.js → dist-Pg4oVkv2.js} +146 -147
  10. package/dist/browser/dist-Pg4oVkv2.js.map +1 -0
  11. package/dist/browser/prosemirror-state/index.js +1 -1
  12. package/dist/browser/tiptap-core/index.js +1 -1
  13. package/dist/browser/tiptap-extension-character-count/index.js +1 -1
  14. package/dist/browser/tiptap-extension-image/index.js +1 -1
  15. package/dist/browser/tiptap-extension-list-item/index.js +1 -1
  16. package/dist/browser/tiptap-extension-placeholder/index.js +1 -1
  17. package/dist/browser/tiptap-extension-subscript/index.js +1 -1
  18. package/dist/browser/tiptap-extension-superscript/index.js +1 -1
  19. package/dist/browser/tiptap-extension-table/index.js +1 -1
  20. package/dist/browser/tiptap-extension-table-cell/index.js +1 -1
  21. package/dist/browser/tiptap-extension-table-header/index.js +1 -1
  22. package/dist/browser/tiptap-extension-table-row/index.js +1 -1
  23. package/dist/browser/tiptap-extension-text-align/index.js +1 -1
  24. package/dist/browser/tiptap-extension-text-style/index.js +1 -1
  25. package/dist/browser/tiptap-extensions/index.js +1 -1
  26. package/dist/browser/tiptap-pm-state/index.js +1 -1
  27. package/dist/browser/tiptap-starter-kit/index.js +4 -4
  28. package/package.json +1 -1
  29. package/dist/browser/dist-BiHYI9ZI.js.map +0 -1
  30. package/dist/browser/dist-DlTupuCB.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-CL31Mguj.js","names":["deleteSelection","defaultBlockAt","splitBlock","selectAll","Fragment","Fragment","ie","mac","windows","Fragment","Mark","getText","event","Decoration","mac","normalizeKeyName"],"sources":["../../../../../node_modules/.bun/@tiptap+core@3.31.3+ef29727eaaf819d3/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js","../../../../../node_modules/.bun/prosemirror-commands@1.7.2/node_modules/prosemirror-commands/dist/index.js","../../../../../node_modules/.bun/prosemirror-schema-list@1.5.1/node_modules/prosemirror-schema-list/dist/index.js","../../../../../node_modules/.bun/prosemirror-view@1.42.6/node_modules/prosemirror-view/dist/index.js","../../../../../node_modules/.bun/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.js","../../../../../node_modules/.bun/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.js","../../../../../node_modules/.bun/@tiptap+core@3.31.3+ef29727eaaf819d3/node_modules/@tiptap/core/dist/index.js"],"sourcesContent":["//#region \\0rolldown/runtime.js\nvar __defProp = Object.defineProperty;\nvar __exportAll = (all, no_symbols) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\tif (!no_symbols) __defProp(target, Symbol.toStringTag, { value: \"Module\" });\n\treturn target;\n};\n//#endregion\nexport { __exportAll as t };\n","import { liftTarget, replaceStep, ReplaceStep, canJoin, joinPoint, canSplit, ReplaceAroundStep, findWrapping } from 'prosemirror-transform';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { NodeSelection, Selection, TextSelection, AllSelection, SelectionRange } from 'prosemirror-state';\n\n/**\nDelete the selection, if there is one.\n*/\nconst deleteSelection = (state, dispatch) => {\n if (state.selection.empty)\n return false;\n if (dispatch)\n dispatch(state.tr.deleteSelection().scrollIntoView());\n return true;\n};\nfunction atBlockStart(state, view) {\n let { $cursor } = state.selection;\n if (!$cursor || (view ? !view.endOfTextblock(\"backward\", state)\n : $cursor.parentOffset > 0))\n return null;\n return $cursor;\n}\n/**\nIf the selection is empty and at the start of a textblock, try to\nreduce the distance between that block and the one before it—if\nthere's a block directly before it that can be joined, join them.\nIf not, try to move the selected block closer to the next one in\nthe document structure by lifting it out of its parent or moving it\ninto a parent of the previous block. Will use the view for accurate\n(bidi-aware) start-of-textblock detection if given.\n*/\nconst joinBackward = (state, dispatch, view) => {\n let $cursor = atBlockStart(state, view);\n if (!$cursor)\n return false;\n let $cut = findCutBefore($cursor);\n // If there is no node before this, try to lift\n if (!$cut) {\n let range = $cursor.blockRange(), target = range && liftTarget(range);\n if (target == null)\n return false;\n if (dispatch)\n dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n }\n let before = $cut.nodeBefore;\n // Apply the joining algorithm\n if (deleteBarrier(state, $cut, dispatch, -1))\n return true;\n // If the node below has no content and the node above is\n // selectable, delete the node below and select the one above.\n if ($cursor.parent.content.size == 0 &&\n (textblockAt(before, \"end\") || NodeSelection.isSelectable(before))) {\n for (let depth = $cursor.depth;; depth--) {\n let delStep = replaceStep(state.doc, $cursor.before(depth), $cursor.after(depth), Slice.empty);\n if (delStep && delStep.slice.size < delStep.to - delStep.from) {\n if (dispatch) {\n let tr = state.tr.step(delStep);\n tr.setSelection(textblockAt(before, \"end\")\n ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1)\n : NodeSelection.create(tr.doc, $cut.pos - before.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n if (depth == 1 || $cursor.node(depth - 1).childCount > 1)\n break;\n }\n }\n // If the node before is an atom, delete it\n if (before.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch)\n dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView());\n return true;\n }\n return false;\n};\n/**\nA more limited form of [`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward)\nthat only tries to join the current textblock to the one before\nit, if the cursor is at the start of a textblock.\n*/\nconst joinTextblockBackward = (state, dispatch, view) => {\n let $cursor = atBlockStart(state, view);\n if (!$cursor)\n return false;\n let $cut = findCutBefore($cursor);\n return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;\n};\n/**\nA more limited form of [`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward)\nthat only tries to join the current textblock to the one after\nit, if the cursor is at the end of a textblock.\n*/\nconst joinTextblockForward = (state, dispatch, view) => {\n let $cursor = atBlockEnd(state, view);\n if (!$cursor)\n return false;\n let $cut = findCutAfter($cursor);\n return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;\n};\nfunction joinTextblocksAround(state, $cut, dispatch) {\n let before = $cut.nodeBefore, beforeText = before, beforePos = $cut.pos - 1;\n for (; !beforeText.isTextblock; beforePos--) {\n if (beforeText.type.spec.isolating)\n return false;\n let child = beforeText.lastChild;\n if (!child)\n return false;\n beforeText = child;\n }\n let after = $cut.nodeAfter, afterText = after, afterPos = $cut.pos + 1;\n for (; !afterText.isTextblock; afterPos++) {\n if (afterText.type.spec.isolating)\n return false;\n let child = afterText.firstChild;\n if (!child)\n return false;\n afterText = child;\n }\n let step = replaceStep(state.doc, beforePos, afterPos, Slice.empty);\n if (!step || step.from != beforePos ||\n step instanceof ReplaceStep && step.slice.size >= afterPos - beforePos)\n return false;\n if (dispatch) {\n let tr = state.tr.step(step);\n tr.setSelection(TextSelection.create(tr.doc, beforePos));\n dispatch(tr.scrollIntoView());\n }\n return true;\n}\nfunction textblockAt(node, side, only = false) {\n for (let scan = node; scan; scan = (side == \"start\" ? scan.firstChild : scan.lastChild)) {\n if (scan.isTextblock)\n return true;\n if (only && scan.childCount != 1)\n return false;\n }\n return false;\n}\n/**\nWhen the selection is empty and at the start of a textblock, select\nthe node before that textblock, if possible. This is intended to be\nbound to keys like backspace, after\n[`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward) or other deleting\ncommands, as a fall-back behavior when the schema doesn't allow\ndeletion at the selected point.\n*/\nconst selectNodeBackward = (state, dispatch, view) => {\n let { $head, empty } = state.selection, $cut = $head;\n if (!empty)\n return false;\n if ($head.parent.isTextblock) {\n if (view ? !view.endOfTextblock(\"backward\", state) : $head.parentOffset > 0)\n return false;\n $cut = findCutBefore($head);\n }\n let node = $cut && $cut.nodeBefore;\n if (!node || !NodeSelection.isSelectable(node))\n return false;\n if (dispatch)\n dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView());\n return true;\n};\nfunction findCutBefore($pos) {\n if (!$pos.parent.type.spec.isolating)\n for (let i = $pos.depth - 1; i >= 0; i--) {\n if ($pos.index(i) > 0)\n return $pos.doc.resolve($pos.before(i + 1));\n if ($pos.node(i).type.spec.isolating)\n break;\n }\n return null;\n}\nfunction atBlockEnd(state, view) {\n let { $cursor } = state.selection;\n if (!$cursor || (view ? !view.endOfTextblock(\"forward\", state)\n : $cursor.parentOffset < $cursor.parent.content.size))\n return null;\n return $cursor;\n}\n/**\nIf the selection is empty and the cursor is at the end of a\ntextblock, try to reduce or remove the boundary between that block\nand the one after it, either by joining them or by moving the other\nblock closer to this one in the tree structure. Will use the view\nfor accurate start-of-textblock detection if given.\n*/\nconst joinForward = (state, dispatch, view) => {\n let $cursor = atBlockEnd(state, view);\n if (!$cursor)\n return false;\n let $cut = findCutAfter($cursor);\n // If there is no node after this, there's nothing to do\n if (!$cut)\n return false;\n let after = $cut.nodeAfter;\n // Try the joining algorithm\n if (deleteBarrier(state, $cut, dispatch, 1))\n return true;\n // If the node above has no content and the node below is\n // selectable, delete the node above and select the one below.\n if ($cursor.parent.content.size == 0 &&\n (textblockAt(after, \"start\") || NodeSelection.isSelectable(after))) {\n let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty);\n if (delStep && delStep.slice.size < delStep.to - delStep.from) {\n if (dispatch) {\n let tr = state.tr.step(delStep);\n tr.setSelection(textblockAt(after, \"start\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1)\n : NodeSelection.create(tr.doc, tr.mapping.map($cut.pos)));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n }\n // If the next node is an atom, delete it\n if (after.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch)\n dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView());\n return true;\n }\n return false;\n};\n/**\nWhen the selection is empty and at the end of a textblock, select\nthe node coming after that textblock, if possible. This is intended\nto be bound to keys like delete, after\n[`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward) and similar deleting\ncommands, to provide a fall-back behavior when the schema doesn't\nallow deletion at the selected point.\n*/\nconst selectNodeForward = (state, dispatch, view) => {\n let { $head, empty } = state.selection, $cut = $head;\n if (!empty)\n return false;\n if ($head.parent.isTextblock) {\n if (view ? !view.endOfTextblock(\"forward\", state) : $head.parentOffset < $head.parent.content.size)\n return false;\n $cut = findCutAfter($head);\n }\n let node = $cut && $cut.nodeAfter;\n if (!node || !NodeSelection.isSelectable(node))\n return false;\n if (dispatch)\n dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos)).scrollIntoView());\n return true;\n};\nfunction findCutAfter($pos) {\n if (!$pos.parent.type.spec.isolating)\n for (let i = $pos.depth - 1; i >= 0; i--) {\n let parent = $pos.node(i);\n if ($pos.index(i) + 1 < parent.childCount)\n return $pos.doc.resolve($pos.after(i + 1));\n if (parent.type.spec.isolating)\n break;\n }\n return null;\n}\n/**\nJoin the selected block or, if there is a text selection, the\nclosest ancestor block of the selection that can be joined, with\nthe sibling above it.\n*/\nconst joinUp = (state, dispatch) => {\n let sel = state.selection, nodeSel = sel instanceof NodeSelection, point;\n if (nodeSel) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.from))\n return false;\n point = sel.from;\n }\n else {\n point = joinPoint(state.doc, sel.from, -1);\n if (point == null)\n return false;\n }\n if (dispatch) {\n let tr = state.tr.join(point);\n if (nodeSel)\n tr.setSelection(NodeSelection.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nJoin the selected block, or the closest ancestor of the selection\nthat can be joined, with the sibling after it.\n*/\nconst joinDown = (state, dispatch) => {\n let sel = state.selection, point;\n if (sel instanceof NodeSelection) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.to))\n return false;\n point = sel.to;\n }\n else {\n point = joinPoint(state.doc, sel.to, 1);\n if (point == null)\n return false;\n }\n if (dispatch)\n dispatch(state.tr.join(point).scrollIntoView());\n return true;\n};\n/**\nLift the selected block, or the closest ancestor block of the\nselection that can be lifted, out of its parent node.\n*/\nconst lift = (state, dispatch) => {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to), target = range && liftTarget(range);\n if (target == null)\n return false;\n if (dispatch)\n dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n};\n/**\nIf the selection is in a node whose type has a truthy\n[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, replace the\nselection with a newline character.\n*/\nconst newlineInCode = (state, dispatch) => {\n let { $head, $anchor } = state.selection;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor))\n return false;\n if (dispatch)\n dispatch(state.tr.insertText(\"\\n\").scrollIntoView());\n return true;\n};\nfunction defaultBlockAt(match) {\n for (let i = 0; i < match.edgeCount; i++) {\n let { type } = match.edge(i);\n if (type.isTextblock && !type.hasRequiredAttrs())\n return type;\n }\n return null;\n}\n/**\nWhen the selection is in a node with a truthy\n[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, create a\ndefault block after the code block, and move the cursor there.\n*/\nconst exitCode = (state, dispatch) => {\n let { $head, $anchor } = state.selection;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor))\n return false;\n let above = $head.node(-1), after = $head.indexAfter(-1), type = defaultBlockAt(above.contentMatchAt(after));\n if (!type || !above.canReplaceWith(after, after, type))\n return false;\n if (dispatch) {\n let pos = $head.after(), tr = state.tr.replaceWith(pos, pos, type.createAndFill());\n tr.setSelection(Selection.near(tr.doc.resolve(pos), 1));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nIf a block node is selected, create an empty paragraph before (if\nit is its parent's first child) or after it.\n*/\nconst createParagraphNear = (state, dispatch) => {\n let sel = state.selection, { $from, $to } = sel;\n if (sel instanceof AllSelection || $from.parent.inlineContent || $to.parent.inlineContent)\n return false;\n let type = defaultBlockAt($to.parent.contentMatchAt($to.indexAfter()));\n if (!type || !type.isTextblock)\n return false;\n if (dispatch) {\n let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;\n let tr = state.tr.insert(side, type.createAndFill());\n tr.setSelection(TextSelection.create(tr.doc, side + 1));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nIf the cursor is in an empty textblock that can be lifted, lift the\nblock.\n*/\nconst liftEmptyBlock = (state, dispatch) => {\n let { $cursor } = state.selection;\n if (!$cursor || $cursor.parent.content.size)\n return false;\n if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {\n let before = $cursor.before();\n if (canSplit(state.doc, before)) {\n if (dispatch)\n dispatch(state.tr.split(before).scrollIntoView());\n return true;\n }\n }\n let range = $cursor.blockRange(), target = range && liftTarget(range);\n if (target == null)\n return false;\n if (dispatch)\n dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n};\n/**\nCreate a variant of [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock) that uses\na custom function to determine the type of the newly split off block.\n*/\nfunction splitBlockAs(splitNode) {\n return (state, dispatch) => {\n if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {\n let { $from } = state.selection;\n if (!$from.parentOffset || !canSplit(state.doc, $from.pos))\n return false;\n if (dispatch)\n dispatch(state.tr.split($from.pos).scrollIntoView());\n return true;\n }\n if (!state.selection.$from.depth)\n return false;\n let tr = state.tr;\n if (!state.selection.empty && (state.selection instanceof TextSelection || state.selection instanceof AllSelection))\n tr.deleteSelection();\n let { $from } = tr.selection, mapFrom = tr.steps.length;\n let types = [];\n let splitDepth, deflt, atEnd = false, atStart = false;\n for (let d = $from.depth;; d--) {\n let node = $from.node(d);\n if (node.isBlock) {\n atEnd = $from.end(d) == $from.pos + ($from.depth - d);\n atStart = $from.start(d) == $from.pos - ($from.depth - d);\n deflt = defaultBlockAt($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));\n let splitType = splitNode && splitNode($from.parent, atEnd, $from);\n types.unshift(splitType || (atEnd && deflt ? { type: deflt } : null));\n splitDepth = d;\n break;\n }\n else {\n if (d == 1)\n return false;\n types.unshift(null);\n }\n }\n let splitPos = $from.pos;\n let can = canSplit(tr.doc, splitPos, types.length, types);\n if (!can) {\n types[0] = deflt ? { type: deflt } : null;\n can = canSplit(tr.doc, splitPos, types.length, types);\n }\n if (!can)\n return false;\n tr.split(splitPos, types.length, types);\n if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {\n let mapping = tr.mapping.slice(mapFrom);\n let first = mapping.map($from.before(splitDepth)), $first = tr.doc.resolve(first);\n if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt))\n tr.setNodeMarkup(mapping.map($from.before(splitDepth)), deflt);\n }\n if (dispatch)\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n/**\nSplit the parent block of the selection. If the selection is a text\nselection, also delete its content.\n*/\nconst splitBlock = splitBlockAs();\n/**\nActs like [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock), but without\nresetting the set of active marks at the cursor.\n*/\nconst splitBlockKeepMarks = (state, dispatch) => {\n return splitBlock(state, dispatch && (tr => {\n let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n if (marks)\n tr.ensureMarks(marks);\n dispatch(tr);\n }));\n};\n/**\nMove the selection to the node wrapping the current selection, if\nany. (Will not select the document node.)\n*/\nconst selectParentNode = (state, dispatch) => {\n let { $from, to } = state.selection, pos;\n let same = $from.sharedDepth(to);\n if (same == 0)\n return false;\n pos = $from.before(same);\n if (dispatch)\n dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos)));\n return true;\n};\n/**\nSelect the whole document.\n*/\nconst selectAll = (state, dispatch) => {\n if (dispatch)\n dispatch(state.tr.setSelection(new AllSelection(state.doc)));\n return true;\n};\nfunction joinMaybeClear(state, $pos, dispatch) {\n let before = $pos.nodeBefore, after = $pos.nodeAfter, index = $pos.index();\n if (!before || !after || !before.type.compatibleContent(after.type))\n return false;\n if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {\n if (dispatch)\n dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView());\n return true;\n }\n if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos)))\n return false;\n if (dispatch)\n dispatch(state.tr.join($pos.pos).scrollIntoView());\n return true;\n}\nfunction deleteBarrier(state, $cut, dispatch, dir) {\n let before = $cut.nodeBefore, after = $cut.nodeAfter, conn, match;\n let isolated = before.type.spec.isolating || after.type.spec.isolating;\n if (!isolated && joinMaybeClear(state, $cut, dispatch))\n return true;\n let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);\n if (canDelAfter &&\n (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) &&\n match.matchType(conn[0] || after.type).validEnd) {\n if (dispatch) {\n let end = $cut.pos + after.nodeSize, wrap = Fragment.empty;\n for (let i = conn.length - 1; i >= 0; i--)\n wrap = Fragment.from(conn[i].create(null, wrap));\n wrap = Fragment.from(before.copy(wrap));\n let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap, 1, 0), conn.length, true));\n let $joinAt = tr.doc.resolve(end + 2 * conn.length);\n if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type &&\n canJoin(tr.doc, $joinAt.pos))\n tr.join($joinAt.pos);\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n let selAfter = after.type.spec.isolating || (dir > 0 && isolated) ? null : Selection.findFrom($cut, 1);\n let range = selAfter && selAfter.$from.blockRange(selAfter.$to), target = range && liftTarget(range);\n if (target != null && target >= $cut.depth) {\n if (dispatch)\n dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n }\n if (canDelAfter && textblockAt(after, \"start\", true) && textblockAt(before, \"end\")) {\n let at = before, wrap = [];\n for (;;) {\n wrap.push(at);\n if (at.isTextblock)\n break;\n at = at.lastChild;\n }\n let afterText = after, afterDepth = 1;\n for (; !afterText.isTextblock; afterText = afterText.firstChild)\n afterDepth++;\n if (at.canReplace(at.childCount, at.childCount, afterText.content)) {\n if (dispatch) {\n let end = Fragment.empty;\n for (let i = wrap.length - 1; i >= 0; i--)\n end = Fragment.from(wrap[i].copy(end));\n let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap.length, 0), 0, true));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n }\n return false;\n}\nfunction selectTextblockSide(side) {\n return function (state, dispatch) {\n let sel = state.selection, $pos = side < 0 ? sel.$from : sel.$to;\n let depth = $pos.depth;\n while ($pos.node(depth).isInline) {\n if (!depth)\n return false;\n depth--;\n }\n if (!$pos.node(depth).isTextblock)\n return false;\n if (dispatch)\n dispatch(state.tr.setSelection(TextSelection.create(state.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));\n return true;\n };\n}\n/**\nMoves the cursor to the start of current text block.\n*/\nconst selectTextblockStart = selectTextblockSide(-1);\n/**\nMoves the cursor to the end of current text block.\n*/\nconst selectTextblockEnd = selectTextblockSide(1);\n// Parameterized commands\n/**\nWrap the selection in a node of the given type with the given\nattributes.\n*/\nfunction wrapIn(nodeType, attrs = null) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to), wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping)\n return false;\n if (dispatch)\n dispatch(state.tr.wrap(range, wrapping).scrollIntoView());\n return true;\n };\n}\n/**\nReturns a command that tries to set the selected textblocks to the\ngiven node type with the given attributes.\n*/\nfunction setBlockType(nodeType, attrs = null) {\n return function (state, dispatch) {\n let applicable = false;\n for (let i = 0; i < state.selection.ranges.length && !applicable; i++) {\n let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (applicable)\n return false;\n if (!node.isTextblock || node.hasMarkup(nodeType, attrs))\n return;\n if (node.type == nodeType) {\n applicable = true;\n }\n else {\n let $pos = state.doc.resolve(pos), index = $pos.index();\n applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);\n }\n });\n }\n if (!applicable)\n return false;\n if (dispatch) {\n let tr = state.tr;\n for (let i = 0; i < state.selection.ranges.length; i++) {\n let { $from: { pos: from }, $to: { pos: to } } = state.selection.ranges[i];\n tr.setBlockType(from, to, nodeType, attrs);\n }\n dispatch(tr.scrollIntoView());\n }\n return true;\n };\n}\nfunction markApplies(doc, ranges, type, enterAtoms) {\n for (let i = 0; i < ranges.length; i++) {\n let { $from, $to } = ranges[i];\n let can = $from.depth == 0 ? doc.inlineContent && doc.type.allowsMarkType(type) : false;\n doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (can || !enterAtoms && node.isAtom && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos)\n return false;\n can = node.inlineContent && node.type.allowsMarkType(type);\n });\n if (can)\n return true;\n }\n return false;\n}\nfunction removeInlineAtoms(ranges) {\n let result = [];\n for (let i = 0; i < ranges.length; i++) {\n let { $from, $to } = ranges[i];\n $from.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (node.isAtom && node.content.size && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos) {\n if (pos + 1 > $from.pos)\n result.push(new SelectionRange($from, $from.doc.resolve(pos + 1)));\n $from = $from.doc.resolve(pos + 1 + node.content.size);\n return false;\n }\n });\n if ($from.pos < $to.pos)\n result.push(new SelectionRange($from, $to));\n }\n return result;\n}\n/**\nCreate a command function that toggles the given mark with the\ngiven attributes. Will return `false` when the current selection\ndoesn't support that mark. This will remove the mark if any marks\nof that type exist in the selection, or add it otherwise. If the\nselection is empty, this applies to the [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks) instead of a range of the\ndocument.\n*/\nfunction toggleMark(markType, attrs = null, options) {\n let removeWhenPresent = (options && options.removeWhenPresent) !== false;\n let enterAtoms = (options && options.enterInlineAtoms) !== false;\n let dropSpace = !(options && options.includeWhitespace);\n return function (state, dispatch) {\n let { empty, $cursor, ranges } = state.selection;\n if ((empty && !$cursor) || !markApplies(state.doc, ranges, markType, enterAtoms))\n return false;\n if (dispatch) {\n if ($cursor) {\n if (markType.isInSet(state.storedMarks || $cursor.marks()))\n dispatch(state.tr.removeStoredMark(markType));\n else\n dispatch(state.tr.addStoredMark(markType.create(attrs)));\n }\n else {\n let add, tr = state.tr;\n if (!enterAtoms)\n ranges = removeInlineAtoms(ranges);\n if (removeWhenPresent) {\n add = !ranges.some(r => state.doc.rangeHasMark(r.$from.pos, r.$to.pos, markType));\n }\n else {\n add = !ranges.every(r => {\n let missing = false;\n tr.doc.nodesBetween(r.$from.pos, r.$to.pos, (node, pos, parent) => {\n if (missing)\n return false;\n missing = !markType.isInSet(node.marks) && !!parent && parent.type.allowsMarkType(markType) &&\n !(node.isText && /^\\s*$/.test(node.textBetween(Math.max(0, r.$from.pos - pos), Math.min(node.nodeSize, r.$to.pos - pos))));\n });\n return !missing;\n });\n }\n for (let i = 0; i < ranges.length; i++) {\n let { $from, $to } = ranges[i];\n if (!add) {\n tr.removeMark($from.pos, $to.pos, markType);\n }\n else {\n let from = $from.pos, to = $to.pos, start = $from.nodeAfter, end = $to.nodeBefore;\n let spaceStart = dropSpace && start && start.isText ? /^\\s*/.exec(start.text)[0].length : 0;\n let spaceEnd = dropSpace && end && end.isText ? /\\s*$/.exec(end.text)[0].length : 0;\n if (from + spaceStart < to) {\n from += spaceStart;\n to -= spaceEnd;\n }\n tr.addMark(from, to, markType.create(attrs));\n }\n }\n dispatch(tr.scrollIntoView());\n }\n }\n return true;\n };\n}\nfunction wrapDispatchForJoin(dispatch, isJoinable) {\n return (tr) => {\n if (!tr.isGeneric)\n return dispatch(tr);\n let ranges = [];\n for (let i = 0; i < tr.mapping.maps.length; i++) {\n let map = tr.mapping.maps[i];\n for (let j = 0; j < ranges.length; j++)\n ranges[j] = map.map(ranges[j]);\n map.forEach((_s, _e, from, to) => ranges.push(from, to));\n }\n // Figure out which joinable points exist inside those ranges,\n // by checking all node boundaries in their parent nodes.\n let joinable = [];\n for (let i = 0; i < ranges.length; i += 2) {\n let from = ranges[i], to = ranges[i + 1];\n let $from = tr.doc.resolve(from), depth = $from.sharedDepth(to), parent = $from.node(depth);\n for (let index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {\n let after = parent.maybeChild(index);\n if (!after)\n break;\n if (index && joinable.indexOf(pos) == -1) {\n let before = parent.child(index - 1);\n if (before.type == after.type && isJoinable(before, after))\n joinable.push(pos);\n }\n pos += after.nodeSize;\n }\n }\n // Join the joinable points\n joinable.sort((a, b) => a - b);\n for (let i = joinable.length - 1; i >= 0; i--) {\n if (canJoin(tr.doc, joinable[i]))\n tr.join(joinable[i]);\n }\n dispatch(tr);\n };\n}\n/**\nWrap a command so that, when it produces a transform that causes\ntwo joinable nodes to end up next to each other, those are joined.\nNodes are considered joinable when they are of the same type and\nwhen the `isJoinable` predicate returns true for them or, if an\narray of strings was passed, if their node type name is in that\narray.\n*/\nfunction autoJoin(command, isJoinable) {\n let canJoin = Array.isArray(isJoinable) ? (node) => isJoinable.indexOf(node.type.name) > -1\n : isJoinable;\n return (state, dispatch, view) => command(state, dispatch && wrapDispatchForJoin(dispatch, canJoin), view);\n}\n/**\nCombine a number of command functions into a single function (which\ncalls them one by one until one returns true).\n*/\nfunction chainCommands(...commands) {\n return function (state, dispatch, view) {\n for (let i = 0; i < commands.length; i++)\n if (commands[i](state, dispatch, view))\n return true;\n return false;\n };\n}\nlet backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward);\nlet del = chainCommands(deleteSelection, joinForward, selectNodeForward);\n/**\nA basic keymap containing bindings not specific to any schema.\nBinds the following keys (when multiple commands are listed, they\nare chained with [`chainCommands`](https://prosemirror.net/docs/ref/#commands.chainCommands)):\n\n* **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`\n* **Mod-Enter** to `exitCode`\n* **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`\n* **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n* **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n* **Mod-a** to `selectAll`\n*/\nconst pcBaseKeymap = {\n \"Enter\": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock),\n \"Mod-Enter\": exitCode,\n \"Backspace\": backspace,\n \"Mod-Backspace\": backspace,\n \"Shift-Backspace\": backspace,\n \"Delete\": del,\n \"Mod-Delete\": del,\n \"Mod-a\": selectAll\n};\n/**\nA copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,\n**Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and\n**Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like\nCtrl-Delete.\n*/\nconst macBaseKeymap = {\n \"Ctrl-h\": pcBaseKeymap[\"Backspace\"],\n \"Alt-Backspace\": pcBaseKeymap[\"Mod-Backspace\"],\n \"Ctrl-d\": pcBaseKeymap[\"Delete\"],\n \"Ctrl-Alt-Backspace\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-Delete\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-d\": pcBaseKeymap[\"Mod-Delete\"],\n \"Ctrl-a\": selectTextblockStart,\n \"Ctrl-e\": selectTextblockEnd\n};\nfor (let key in pcBaseKeymap)\n macBaseKeymap[key] = pcBaseKeymap[key];\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform)\n // @ts-ignore\n : typeof os != \"undefined\" && os.platform ? os.platform() == \"darwin\" : false;\n/**\nDepending on the detected platform, this will hold\n[`pcBasekeymap`](https://prosemirror.net/docs/ref/#commands.pcBaseKeymap) or\n[`macBaseKeymap`](https://prosemirror.net/docs/ref/#commands.macBaseKeymap).\n*/\nconst baseKeymap = mac ? macBaseKeymap : pcBaseKeymap;\n\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinTextblockBackward, joinTextblockForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, setBlockType, splitBlock, splitBlockAs, splitBlockKeepMarks, toggleMark, wrapIn };\n","import { findWrapping, ReplaceAroundStep, canSplit, liftTarget, canJoin } from 'prosemirror-transform';\nimport { NodeRange, Fragment, Slice } from 'prosemirror-model';\nimport { Selection } from 'prosemirror-state';\n\nconst olDOM = [\"ol\", 0], ulDOM = [\"ul\", 0], liDOM = [\"li\", 0];\n/**\nAn ordered list [node spec](https://prosemirror.net/docs/ref/#model.NodeSpec). Has a single\nattribute, `order`, which determines the number at which the list\nstarts counting, and defaults to 1. Represented as an `<ol>`\nelement.\n*/\nconst orderedList = {\n attrs: { order: { default: 1, validate: \"number\" } },\n parseDOM: [{ tag: \"ol\", getAttrs(dom) {\n return { order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1 };\n } }],\n toDOM(node) {\n return node.attrs.order == 1 ? olDOM : [\"ol\", { start: node.attrs.order }, 0];\n }\n};\n/**\nA bullet list node spec, represented in the DOM as `<ul>`.\n*/\nconst bulletList = {\n parseDOM: [{ tag: \"ul\" }],\n toDOM() { return ulDOM; }\n};\n/**\nA list item (`<li>`) spec.\n*/\nconst listItem = {\n parseDOM: [{ tag: \"li\" }],\n toDOM() { return liDOM; },\n defining: true\n};\nfunction add(obj, props) {\n let copy = {};\n for (let prop in obj)\n copy[prop] = obj[prop];\n for (let prop in props)\n copy[prop] = props[prop];\n return copy;\n}\n/**\nConvenience function for adding list-related node types to a map\nspecifying the nodes for a schema. Adds\n[`orderedList`](https://prosemirror.net/docs/ref/#schema-list.orderedList) as `\"ordered_list\"`,\n[`bulletList`](https://prosemirror.net/docs/ref/#schema-list.bulletList) as `\"bullet_list\"`, and\n[`listItem`](https://prosemirror.net/docs/ref/#schema-list.listItem) as `\"list_item\"`.\n\n`itemContent` determines the content expression for the list items.\nIf you want the commands defined in this module to apply to your\nlist structure, it should have a shape like `\"paragraph block*\"` or\n`\"paragraph (ordered_list | bullet_list)*\"`. `listGroup` can be\ngiven to assign a group name to the list node types, for example\n`\"block\"`.\n*/\nfunction addListNodes(nodes, itemContent, listGroup) {\n return nodes.append({\n ordered_list: add(orderedList, { content: \"list_item+\", group: listGroup }),\n bullet_list: add(bulletList, { content: \"list_item+\", group: listGroup }),\n list_item: add(listItem, { content: itemContent })\n });\n}\n/**\nReturns a command function that wraps the selection in a list with\nthe given type an attributes. If `dispatch` is null, only return a\nvalue to indicate whether this is possible, but don't actually\nperform the change.\n*/\nfunction wrapInList(listType, attrs = null) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to);\n if (!range)\n return false;\n let tr = dispatch ? state.tr : null;\n if (!wrapRangeInList(tr, range, listType, attrs))\n return false;\n if (dispatch)\n dispatch(tr.scrollIntoView());\n return true;\n };\n}\n/**\nTry to wrap the given node range in a list of the given type.\nReturn `true` when this is possible, `false` otherwise. When `tr`\nis non-null, the wrapping is added to that transaction. When it is\n`null`, the function only queries whether the wrapping is\npossible.\n*/\nfunction wrapRangeInList(tr, range, listType, attrs = null) {\n let doJoin = false, outerRange = range, doc = range.$from.doc;\n // This is at the top of an existing list item\n if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {\n // Don't do anything if this is the top of the list\n if (range.$from.index(range.depth - 1) == 0)\n return false;\n let $insert = doc.resolve(range.start - 2);\n outerRange = new NodeRange($insert, $insert, range.depth);\n if (range.endIndex < range.parent.childCount)\n range = new NodeRange(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);\n doJoin = true;\n }\n let wrap = findWrapping(outerRange, listType, attrs, range);\n if (!wrap)\n return false;\n if (tr)\n doWrapInList(tr, range, wrap, doJoin, listType);\n return true;\n}\nfunction doWrapInList(tr, range, wrappers, joinBefore, listType) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--)\n content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));\n let found = 0;\n for (let i = 0; i < wrappers.length; i++)\n if (wrappers[i].type == listType)\n found = i + 1;\n let splitDepth = wrappers.length - found;\n let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0), parent = range.parent;\n for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {\n if (!first && canSplit(tr.doc, splitPos, splitDepth)) {\n tr.split(splitPos, splitDepth);\n splitPos += 2 * splitDepth;\n }\n splitPos += parent.child(i).nodeSize;\n }\n return tr;\n}\n/**\nBuild a command that splits a non-empty textblock at the top level\nof a list item by also splitting that list item.\n*/\nfunction splitListItem(itemType, itemAttrs) {\n return function (state, dispatch) {\n let { $from, $to, node } = state.selection;\n if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to))\n return false;\n let grandParent = $from.node(-1);\n if (grandParent.type != itemType)\n return false;\n if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 3 || $from.node(-3).type != itemType ||\n $from.index(-2) != $from.node(-2).childCount - 1)\n return false;\n if (dispatch) {\n let wrap = Fragment.empty;\n let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--)\n wrap = Fragment.from($from.node(d).copy(wrap));\n let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1\n : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n // Add a second list item with an empty default start node\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n let start = $from.before($from.depth - (depthBefore - 1));\n let tr = state.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, (node, pos) => {\n if (sel > -1)\n return false;\n if (node.isTextblock && node.content.size == 0)\n sel = pos + 1;\n });\n if (sel > -1)\n tr.setSelection(Selection.near(tr.doc.resolve(sel)));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n let tr = state.tr.delete($from.pos, $to.pos);\n let types = nextType ? [itemAttrs ? { type: itemType, attrs: itemAttrs } : null, { type: nextType }] : undefined;\n if (!canSplit(tr.doc, $from.pos, 2, types))\n return false;\n if (dispatch)\n dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n return true;\n };\n}\n/**\nActs like [`splitListItem`](https://prosemirror.net/docs/ref/#schema-list.splitListItem), but\nwithout resetting the set of active marks at the cursor.\n*/\nfunction splitListItemKeepMarks(itemType, itemAttrs) {\n let split = splitListItem(itemType, itemAttrs);\n return (state, dispatch) => {\n return split(state, dispatch && (tr => {\n let marks = state.storedMarks || (state.selection.$to.parentOffset && state.selection.$from.marks());\n if (marks)\n tr.ensureMarks(marks);\n dispatch(tr);\n }));\n };\n}\n/**\nCreate a command to lift the list item around the selection up into\na wrapping list.\n*/\nfunction liftListItem(itemType) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n if (!range)\n return false;\n if (!dispatch)\n return true;\n if ($from.node(range.depth - 1).type == itemType) // Inside a parent list\n return liftToOuterList(state, dispatch, itemType, range);\n else // Outer list node\n return liftOutOfList(state, dispatch, range);\n };\n}\nfunction liftToOuterList(state, dispatch, itemType, range) {\n let tr = state.tr, end = range.end, endOfList = range.$to.end(range.depth);\n if (end < endOfList) {\n // There are siblings after the lifted items, which must become\n // children of the last item\n tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));\n range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);\n }\n const target = liftTarget(range);\n if (target == null)\n return false;\n tr.lift(range, target);\n let $after = tr.doc.resolve(tr.mapping.map(end, -1) - 1);\n if (canJoin(tr.doc, $after.pos) && $after.nodeBefore.type == $after.nodeAfter.type)\n tr.join($after.pos);\n dispatch(tr.scrollIntoView());\n return true;\n}\nfunction liftOutOfList(state, dispatch, range) {\n let tr = state.tr, list = range.parent;\n // Merge the list items into a single big item\n for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {\n pos -= list.child(i).nodeSize;\n tr.delete(pos - 1, pos + 1);\n }\n let $start = tr.doc.resolve(range.start), item = $start.nodeAfter;\n if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize)\n return false;\n let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;\n let parent = $start.node(-1), indexBefore = $start.index(-1);\n if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list))))\n return false;\n let start = $start.pos, end = start + item.nodeSize;\n // Strip off the surrounding list. At the sides where we're not at\n // the end of the list, the existing list is closed. At sides where\n // this is the end, it is overwritten to its end.\n tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty)))\n .append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));\n dispatch(tr.scrollIntoView());\n return true;\n}\n/**\nCreate a command to sink the list item around the selection down\ninto an inner list.\n*/\nfunction sinkListItem(itemType) {\n return function (state, dispatch) {\n let { $from, $to } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n if (!range)\n return false;\n let startIndex = range.startIndex;\n if (startIndex == 0)\n return false;\n let parent = range.parent, nodeBefore = parent.child(startIndex - 1);\n if (nodeBefore.type != itemType)\n return false;\n if (dispatch) {\n let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;\n let inner = Fragment.from(nestedBefore ? itemType.create() : null);\n let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);\n let before = range.start, after = range.end;\n dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true))\n .scrollIntoView());\n }\n return true;\n };\n}\n\nexport { addListNodes, bulletList, liftListItem, listItem, orderedList, sinkListItem, splitListItem, splitListItemKeepMarks, wrapInList, wrapRangeInList };\n","import { TextSelection, NodeSelection, Selection, AllSelection } from 'prosemirror-state';\nimport { DOMSerializer, Fragment, Mark, Slice, DOMParser } from 'prosemirror-model';\nimport { dropPoint } from 'prosemirror-transform';\n\nconst domIndex = function (node) {\n for (var index = 0;; index++) {\n node = node.previousSibling;\n if (!node)\n return index;\n }\n};\nconst parentNode = function (node) {\n let parent = node.assignedSlot || node.parentNode;\n return parent && parent.nodeType == 11 ? parent.host : parent;\n};\nlet reusedRange = null;\n// Note that this will always return the same range, because DOM range\n// objects are every expensive, and keep slowing down subsequent DOM\n// updates, for some reason.\nconst textRange = function (node, from, to) {\n let range = reusedRange || (reusedRange = document.createRange());\n range.setEnd(node, to == null ? node.nodeValue.length : to);\n range.setStart(node, from || 0);\n return range;\n};\nconst clearReusedRange = function () {\n reusedRange = null;\n};\n// Scans forward and backward through DOM positions equivalent to the\n// given one to see if the two are in the same place (i.e. after a\n// text node vs at the end of that text node)\nconst isEquivalentPosition = function (node, off, targetNode, targetOff) {\n return targetNode && (scanFor(node, off, targetNode, targetOff, -1) ||\n scanFor(node, off, targetNode, targetOff, 1));\n};\nconst atomElements = /^(img|br|input|textarea|hr)$/i;\nfunction scanFor(node, off, targetNode, targetOff, dir) {\n var _a;\n for (;;) {\n if (node == targetNode && off == targetOff)\n return true;\n if (off == (dir < 0 ? 0 : nodeSize(node))) {\n let parent = node.parentNode;\n if (!parent || !isElt(parent) || hasBlockDesc(node) || atomElements.test(node.nodeName) ||\n node.contentEditable == \"false\")\n return false;\n off = domIndex(node) + (dir < 0 ? 0 : 1);\n node = parent;\n }\n else if (isElt(node)) {\n let child = node.childNodes[off + (dir < 0 ? -1 : 0)];\n if (isElt(child) && child.contentEditable == \"false\") {\n if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection)\n off += dir;\n else\n return false;\n }\n else {\n node = child;\n off = dir < 0 ? nodeSize(node) : 0;\n }\n }\n else {\n return false;\n }\n }\n}\nfunction nodeSize(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;\n}\nfunction isElt(node) { return node.nodeType == 1; }\nfunction isText(node) { return node.nodeType == 3; }\nfunction contains(parent, child) {\n return child ? parent.contains(isElt(child) ? child : child.parentNode) : false;\n}\nfunction textNodeBefore$1(node, offset) {\n for (;;) {\n if (isText(node) && offset)\n return node;\n if (isElt(node) && offset > 0) {\n if (node.contentEditable == \"false\")\n return null;\n node = node.childNodes[offset - 1];\n offset = nodeSize(node);\n }\n else if (node.parentNode && !hasBlockDesc(node)) {\n offset = domIndex(node);\n node = node.parentNode;\n }\n else {\n return null;\n }\n }\n}\nfunction textNodeAfter$1(node, offset) {\n for (;;) {\n if (isText(node) && offset < node.nodeValue.length)\n return node;\n if (isElt(node) && offset < node.childNodes.length) {\n if (node.contentEditable == \"false\")\n return null;\n node = node.childNodes[offset];\n offset = 0;\n }\n else if (node.parentNode && !hasBlockDesc(node)) {\n offset = domIndex(node) + 1;\n node = node.parentNode;\n }\n else {\n return null;\n }\n }\n}\nfunction isOnEdge(node, offset, parent) {\n for (let atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {\n if (node == parent)\n return true;\n let index = domIndex(node);\n node = node.parentNode;\n if (!node)\n return false;\n atStart = atStart && index == 0;\n atEnd = atEnd && index == nodeSize(node);\n }\n}\nfunction hasBlockDesc(dom) {\n let desc;\n for (let cur = dom; cur; cur = cur.parentNode)\n if (desc = cur.pmViewDesc)\n break;\n return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom);\n}\n// Work around Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=447523\n// (isCollapsed inappropriately returns true in shadow dom)\nconst selectionCollapsed = function (domSel) {\n return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset);\n};\nfunction keyEvent(keyCode, key) {\n let event = document.createEvent(\"Event\");\n event.initEvent(\"keydown\", true, true);\n event.keyCode = keyCode;\n event.key = event.code = key;\n return event;\n}\nfunction deepActiveElement(doc) {\n let elt = doc.activeElement;\n while (elt && elt.shadowRoot)\n elt = elt.shadowRoot.activeElement;\n return elt;\n}\nfunction caretFromPoint(doc, x, y) {\n if (doc.caretPositionFromPoint) {\n try { // Firefox throws for this call in hard-to-predict circumstances (#994)\n let pos = doc.caretPositionFromPoint(x, y);\n // Clip the offset, because Chrome will return a text offset\n // into <input> nodes, which can't be treated as a regular DOM\n // offset\n if (pos)\n return { node: pos.offsetNode, offset: Math.min(nodeSize(pos.offsetNode), pos.offset) };\n }\n catch (_) { }\n }\n if (doc.caretRangeFromPoint) {\n let range = doc.caretRangeFromPoint(x, y);\n if (range)\n return { node: range.startContainer, offset: Math.min(nodeSize(range.startContainer), range.startOffset) };\n }\n}\n\nconst nav = typeof navigator != \"undefined\" ? navigator : null;\nconst doc = typeof document != \"undefined\" ? document : null;\nconst agent = (nav && nav.userAgent) || \"\";\nconst ie_edge = /Edge\\/(\\d+)/.exec(agent);\nconst ie_upto10 = /MSIE \\d/.exec(agent);\nconst ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(agent);\nconst ie = !!(ie_upto10 || ie_11up || ie_edge);\nconst ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0;\nconst gecko = !ie && /gecko\\/(\\d+)/i.test(agent);\ngecko && +(/Firefox\\/(\\d+)/.exec(agent) || [0, 0])[1];\nconst _chrome = !ie && /Chrome\\/(\\d+)/.exec(agent);\nconst chrome = !!_chrome;\nconst chrome_version = _chrome ? +_chrome[1] : 0;\nconst safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);\n// Is true for both iOS and iPadOS for convenience\nconst ios = safari && (/Mobile\\/\\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2);\nconst mac = ios || (nav ? /Mac/.test(nav.platform) : false);\nconst windows = nav ? /Win/.test(nav.platform) : false;\nconst android = /Android \\d/.test(agent);\nconst webkit = !!doc && \"webkitFontSmoothing\" in doc.documentElement.style;\nconst webkit_version = webkit ? +(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;\n\nfunction windowRect(doc) {\n let vp = doc.defaultView && doc.defaultView.visualViewport;\n if (vp)\n return {\n left: 0, right: vp.width,\n top: 0, bottom: vp.height\n };\n return { left: 0, right: doc.documentElement.clientWidth,\n top: 0, bottom: doc.documentElement.clientHeight };\n}\nfunction getSide(value, side) {\n return typeof value == \"number\" ? value : value[side];\n}\nfunction clientRect(node) {\n let rect = node.getBoundingClientRect();\n // Adjust for elements with style \"transform: scale()\"\n let scaleX = (rect.width / node.offsetWidth) || 1;\n let scaleY = (rect.height / node.offsetHeight) || 1;\n // Make sure scrollbar width isn't included in the rectangle\n return { left: rect.left, right: rect.left + node.clientWidth * scaleX,\n top: rect.top, bottom: rect.top + node.clientHeight * scaleY };\n}\nfunction scrollRectIntoView(view, rect, startDOM) {\n // Skip empty rects with all sides at 0, for example, when the element has no CSS box (display: none)\n if (!nonZero(rect) && rect.left == 0)\n return;\n let scrollThreshold = view.someProp(\"scrollThreshold\") || 0, scrollMargin = view.someProp(\"scrollMargin\") || 5;\n let doc = view.dom.ownerDocument;\n for (let parent = startDOM || view.dom;;) {\n if (!parent)\n break;\n if (!isElt(parent)) {\n parent = parentNode(parent);\n continue;\n }\n let atTop = parent == doc.body;\n let bounding = atTop ? windowRect(doc) : clientRect(parent);\n let moveX = 0, moveY = 0;\n if (rect.top < bounding.top + getSide(scrollThreshold, \"top\"))\n moveY = -(bounding.top - rect.top + getSide(scrollMargin, \"top\"));\n else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, \"bottom\"))\n moveY = rect.bottom - rect.top > bounding.bottom - bounding.top\n ? rect.top + getSide(scrollMargin, \"top\") - bounding.top\n : rect.bottom - bounding.bottom + getSide(scrollMargin, \"bottom\");\n if (rect.left < bounding.left + getSide(scrollThreshold, \"left\"))\n moveX = -(bounding.left - rect.left + getSide(scrollMargin, \"left\"));\n else if (rect.right > bounding.right - getSide(scrollThreshold, \"right\"))\n moveX = rect.right - bounding.right + getSide(scrollMargin, \"right\");\n if (moveX || moveY) {\n if (atTop) {\n doc.defaultView.scrollBy(moveX, moveY);\n }\n else {\n let startX = parent.scrollLeft, startY = parent.scrollTop;\n if (moveY)\n parent.scrollTop += moveY;\n if (moveX)\n parent.scrollLeft += moveX;\n let dX = parent.scrollLeft - startX, dY = parent.scrollTop - startY;\n rect = { left: rect.left - dX, top: rect.top - dY, right: rect.right - dX, bottom: rect.bottom - dY };\n }\n }\n let pos = atTop ? \"fixed\" : getComputedStyle(parent).position;\n if (/^(fixed|sticky)$/.test(pos))\n break;\n parent = pos == \"absolute\" ? parent.offsetParent : parentNode(parent);\n }\n}\n// Store the scroll position of the editor's parent nodes, along with\n// the top position of an element near the top of the editor, which\n// will be used to make sure the visible viewport remains stable even\n// when the size of the content above changes.\nfunction storeScrollPos(view) {\n let rect = view.dom.getBoundingClientRect(), startY = Math.max(0, rect.top);\n let refDOM, refTop;\n for (let x = (rect.left + rect.right) / 2, y = startY + 1; y < Math.min(innerHeight, rect.bottom); y += 5) {\n let dom = view.root.elementFromPoint(x, y);\n if (!dom || dom == view.dom || !view.dom.contains(dom))\n continue;\n let localRect = dom.getBoundingClientRect();\n if (localRect.top >= startY - 20) {\n refDOM = dom;\n refTop = localRect.top;\n break;\n }\n }\n return { refDOM: refDOM, refTop: refTop, stack: scrollStack(view.dom) };\n}\nfunction scrollStack(dom) {\n let stack = [], doc = dom.ownerDocument;\n for (let cur = dom; cur; cur = parentNode(cur)) {\n stack.push({ dom: cur, top: cur.scrollTop, left: cur.scrollLeft });\n if (dom == doc)\n break;\n }\n return stack;\n}\n// Reset the scroll position of the editor's parent nodes to that what\n// it was before, when storeScrollPos was called.\nfunction resetScrollPos({ refDOM, refTop, stack }) {\n let newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;\n restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);\n}\nfunction restoreScrollStack(stack, dTop) {\n for (let i = 0; i < stack.length; i++) {\n let { dom, top, left } = stack[i];\n if (dom.scrollTop != top + dTop)\n dom.scrollTop = top + dTop;\n if (dom.scrollLeft != left)\n dom.scrollLeft = left;\n }\n}\nlet preventScrollSupported = null;\n// Feature-detects support for .focus({preventScroll: true}), and uses\n// a fallback kludge when not supported.\nfunction focusPreventScroll(dom) {\n if (dom.setActive)\n return dom.setActive(); // in IE\n if (preventScrollSupported)\n return dom.focus(preventScrollSupported);\n let stored = scrollStack(dom);\n dom.focus(preventScrollSupported == null ? {\n get preventScroll() {\n preventScrollSupported = { preventScroll: true };\n return true;\n }\n } : undefined);\n if (!preventScrollSupported) {\n preventScrollSupported = false;\n restoreScrollStack(stored, 0);\n }\n}\nfunction findOffsetInNode(node, coords) {\n let closest;\n let dxClosest = 2e8, coordsClosest, offset = 0;\n let rowBot = coords.top, rowTop = coords.top;\n let firstBelow, coordsBelow;\n for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {\n let rects;\n if (isElt(child))\n rects = child.getClientRects();\n else if (isText(child))\n rects = textRange(child).getClientRects();\n else\n continue;\n for (let i = 0; i < rects.length; i++) {\n let rect = rects[i];\n if (rect.top <= rowBot && rect.bottom >= rowTop) {\n rowBot = Math.max(rect.bottom, rowBot);\n rowTop = Math.min(rect.top, rowTop);\n let dx = rect.left > coords.left ? rect.left - coords.left\n : rect.right < coords.left ? coords.left - rect.right : 0;\n if (dx < dxClosest) {\n closest = child;\n dxClosest = dx;\n coordsClosest = dx && isText(closest) ? {\n left: rect.right < coords.left ? rect.right : rect.left,\n top: coords.top\n } : coords;\n if (isElt(child) && dx)\n offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);\n continue;\n }\n }\n else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {\n firstBelow = child;\n coordsBelow = { left: Math.max(rect.left, Math.min(rect.right, coords.left)), top: rect.top };\n }\n if (!closest && (coords.left >= rect.right && coords.top >= rect.top ||\n coords.left >= rect.left && coords.top >= rect.bottom))\n offset = childIndex + 1;\n }\n }\n if (!closest && firstBelow) {\n closest = firstBelow;\n coordsClosest = coordsBelow;\n dxClosest = 0;\n }\n if (closest && isText(closest))\n return findOffsetInText(closest, coordsClosest);\n if (!closest || dxClosest)\n return { node, offset };\n return findOffsetInNode(closest, coordsClosest);\n}\nfunction findOffsetInText(node, coords) {\n let len = node.nodeValue.length;\n let range = document.createRange(), result;\n for (let i = 0; i < len; i++) {\n range.setEnd(node, i + 1);\n range.setStart(node, i);\n let rect = singleRect(range, 1);\n if (rect.top == rect.bottom)\n continue;\n if (inRect(coords, rect)) {\n result = { node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0) };\n break;\n }\n }\n range.detach();\n return result || { node, offset: 0 };\n}\nfunction inRect(coords, rect) {\n return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 &&\n coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1;\n}\nfunction targetKludge(dom, coords) {\n let parent = dom.parentNode;\n if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left)\n return parent;\n return dom;\n}\nfunction posFromElement(view, elt, coords) {\n let { node, offset } = findOffsetInNode(elt, coords), bias = -1;\n if (isElt(node) && !node.firstChild) {\n let rect = node.getBoundingClientRect();\n bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;\n }\n return view.docView.posFromDOM(node, offset, bias);\n}\nfunction posFromCaret(view, node, offset, coords) {\n // Browser (in caretPosition/RangeFromPoint) will agressively\n // normalize towards nearby inline nodes. Since we are interested in\n // positions between block nodes too, we first walk up the hierarchy\n // of nodes to see if there are block nodes that the coordinates\n // fall outside of. If so, we take the position before/after that\n // block. If not, we call `posFromDOM` on the raw node/offset.\n let outsideBlock = -1;\n for (let cur = node, sawBlock = false;;) {\n if (cur == view.dom)\n break;\n let desc = view.docView.nearestDesc(cur, true), rect;\n if (!desc)\n return null;\n if (isElt(desc.dom) && (desc.node.isBlock && desc.parent || !desc.contentDOM) &&\n // Ignore elements with zero-size bounding rectangles\n ((rect = desc.dom.getBoundingClientRect()).width || rect.height)) {\n if (desc.node.isBlock && desc.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(desc.dom.nodeName)) {\n // Only apply the horizontal test to the innermost block. Vertical for any parent.\n if (!sawBlock && rect.left > coords.left || rect.top > coords.top)\n outsideBlock = desc.posBefore;\n else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top)\n outsideBlock = desc.posAfter;\n sawBlock = true;\n }\n if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {\n // If we are inside a leaf, return the side of the leaf closer to the coords\n let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2\n : coords.left < (rect.left + rect.right) / 2;\n return before ? desc.posBefore : desc.posAfter;\n }\n }\n cur = desc.dom.parentNode;\n }\n return outsideBlock > -1 ? outsideBlock : view.docView.posFromDOM(node, offset, -1);\n}\nfunction elementFromPoint(element, coords, box) {\n let len = element.childNodes.length;\n if (len && box.top < box.bottom) {\n for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {\n let child = element.childNodes[i];\n if (isElt(child)) {\n let rects = child.getClientRects();\n for (let j = 0; j < rects.length; j++) {\n let rect = rects[j];\n if (inRect(coords, rect))\n return elementFromPoint(child, coords, rect);\n }\n }\n if ((i = (i + 1) % len) == startI)\n break;\n }\n }\n return element;\n}\n// Given an x,y position on the editor, get the position in the document.\nfunction posAtCoords(view, coords) {\n let doc = view.dom.ownerDocument, node, offset = 0;\n let caret = caretFromPoint(doc, coords.left, coords.top);\n if (caret)\n ({ node, offset } = caret);\n let elt = (view.root.elementFromPoint ? view.root : doc)\n .elementFromPoint(coords.left, coords.top);\n let pos;\n if (!elt || !view.dom.contains(elt)) {\n let box = view.dom.getBoundingClientRect();\n if (!inRect(coords, box))\n return null;\n elt = elementFromPoint(view.dom, coords, box);\n if (!elt)\n return null;\n }\n // Safari's caretRangeFromPoint returns nonsense when on a draggable element\n if (safari) {\n for (let p = elt; node && p; p = parentNode(p))\n if (p.draggable)\n node = undefined;\n }\n elt = targetKludge(elt, coords);\n if (node) {\n if (gecko && isElt(node)) {\n // Firefox will sometimes return offsets into <input> nodes, which\n // have no actual children, from caretPositionFromPoint (#953)\n offset = Math.min(offset, node.childNodes.length);\n // It'll also move the returned position before image nodes,\n // even if those are behind it.\n if (offset < node.childNodes.length) {\n let next = node.childNodes[offset], box;\n if (next.nodeName == \"IMG\" && (box = next.getBoundingClientRect()).right <= coords.left &&\n box.bottom > coords.top)\n offset++;\n }\n }\n let prev;\n // When clicking above the right side of an uneditable node, Chrome will report a cursor position after that node.\n if (webkit && offset && isElt(node) && isElt(prev = node.childNodes[offset - 1]) &&\n prev.contentEditable == \"false\" && prev.getBoundingClientRect().top >= coords.top)\n offset--;\n // Suspiciously specific kludge to work around caret*FromPoint\n // never returning a position at the end of the document\n if (node == view.dom && offset == node.childNodes.length - 1 && isElt(node.lastChild) &&\n coords.top > node.lastChild.getBoundingClientRect().bottom)\n pos = view.state.doc.content.size;\n // Ignore positions directly after a BR, since caret*FromPoint\n // 'round up' positions that would be more accurately placed\n // before the BR node.\n else if (offset == 0 || !isElt(node) || node.childNodes[offset - 1].nodeName != \"BR\")\n pos = posFromCaret(view, node, offset, coords);\n }\n if (pos == null)\n pos = posFromElement(view, elt, coords);\n let desc = view.docView.nearestDesc(elt, true);\n return { pos, inside: desc ? desc.posAtStart - desc.border : -1 };\n}\nfunction nonZero(rect) {\n return rect.top < rect.bottom || rect.left < rect.right;\n}\nfunction singleRect(target, bias) {\n let rects = target.getClientRects();\n if (rects.length) {\n let first = rects[bias < 0 ? 0 : rects.length - 1];\n if (nonZero(first))\n return first;\n }\n return Array.prototype.find.call(rects, nonZero) || target.getBoundingClientRect();\n}\nconst BIDI = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n// Given a position in the document model, get a bounding box of the\n// character at that position, relative to the window.\nfunction coordsAtPos(view, pos, side) {\n let { node, offset, atom } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);\n let supportEmptyRange = webkit || gecko;\n if (isText(node)) {\n // These browsers support querying empty text ranges. Prefer that in\n // bidi context or when at the end of a node.\n if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {\n let rect = singleRect(textRange(node, offset, offset), side);\n // Firefox returns bad results (the position before the space)\n // when querying a position directly after line-broken\n // whitespace. Detect this situation and and kludge around it\n if (gecko && offset && /\\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {\n let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);\n if (rectBefore.top == rect.top) {\n let rectAfter = singleRect(textRange(node, offset, offset + 1), -1);\n if (rectAfter.top != rect.top)\n return flattenV(rectAfter, rectAfter.left < rectBefore.left);\n }\n }\n return rect;\n }\n else {\n let from = offset, to = offset, takeSide = side < 0 ? 1 : -1;\n if (side < 0 && !offset) {\n to++;\n takeSide = -1;\n }\n else if (side >= 0 && offset == node.nodeValue.length) {\n from--;\n takeSide = 1;\n }\n else if (side < 0) {\n from--;\n }\n else {\n to++;\n }\n return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0);\n }\n }\n let $dom = view.state.doc.resolve(pos - (atom || 0));\n // Return a horizontal line in block context\n if (!$dom.parent.inlineContent) {\n if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {\n let before = node.childNodes[offset - 1];\n if (isElt(before))\n return flattenH(before.getBoundingClientRect(), false);\n }\n if (atom == null && offset < nodeSize(node)) {\n let after = node.childNodes[offset];\n if (isElt(after))\n return flattenH(after.getBoundingClientRect(), true);\n }\n return flattenH(node.getBoundingClientRect(), side >= 0);\n }\n // Inline, not in text node (this is not Bidi-safe)\n if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {\n let before = node.childNodes[offset - 1];\n let target = isText(before) ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1))\n // BR nodes tend to only return the rectangle before them.\n // Only use them if they are the last element in their parent\n : isElt(before) && (before.nodeName != \"BR\" || !before.nextSibling) ? before : null;\n if (target)\n return flattenV(singleRect(target, 1), false);\n }\n if (atom == null && offset < nodeSize(node)) {\n let after = node.childNodes[offset];\n while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords)\n after = after.nextSibling;\n let target = !after ? null : isText(after) ? textRange(after, 0, (supportEmptyRange ? 0 : 1))\n : isElt(after) ? after : null;\n if (target)\n return flattenV(singleRect(target, -1), true);\n }\n // All else failed, just try to get a rectangle for the target node\n return flattenV(singleRect(isText(node) ? textRange(node) : node, -side), side >= 0);\n}\nfunction flattenV(rect, left) {\n if (rect.width == 0)\n return rect;\n let x = left ? rect.left : rect.right;\n return { top: rect.top, bottom: rect.bottom, left: x, right: x };\n}\nfunction flattenH(rect, top) {\n if (rect.height == 0)\n return rect;\n let y = top ? rect.top : rect.bottom;\n return { top: y, bottom: y, left: rect.left, right: rect.right };\n}\nfunction withFlushedState(view, state, f) {\n let viewState = view.state, active = view.root.activeElement;\n if (viewState != state)\n view.updateState(state);\n if (active != view.dom)\n view.focus();\n try {\n return f();\n }\n finally {\n if (viewState != state)\n view.updateState(viewState);\n if (active != view.dom && active)\n active.focus();\n }\n}\n// Whether vertical position motion in a given direction\n// from a position would leave a text block.\nfunction endOfTextblockVertical(view, state, dir) {\n let sel = state.selection;\n let $pos = dir == \"up\" ? sel.$from : sel.$to;\n return withFlushedState(view, state, () => {\n let { node: dom } = view.docView.domFromPos($pos.pos, dir == \"up\" ? -1 : 1);\n for (;;) {\n let nearest = view.docView.nearestDesc(dom, true);\n if (!nearest)\n break;\n if (nearest.node.isBlock) {\n dom = nearest.contentDOM || nearest.dom;\n break;\n }\n dom = nearest.dom.parentNode;\n }\n let coords = coordsAtPos(view, $pos.pos, 1);\n for (let child = dom.firstChild; child; child = child.nextSibling) {\n let boxes;\n if (isElt(child))\n boxes = child.getClientRects();\n else if (isText(child))\n boxes = textRange(child, 0, child.nodeValue.length).getClientRects();\n else\n continue;\n for (let i = 0; i < boxes.length; i++) {\n let box = boxes[i];\n if (box.bottom > box.top + 1 &&\n (dir == \"up\" ? coords.top - box.top > (box.bottom - coords.top) * 2\n : box.bottom - coords.bottom > (coords.bottom - box.top) * 2))\n return false;\n }\n }\n return true;\n });\n}\nconst maybeRTL = /[\\u0590-\\u08ac]/;\nfunction endOfTextblockHorizontal(view, state, dir) {\n let { $head } = state.selection;\n if (!$head.parent.isTextblock)\n return false;\n let offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size;\n let sel = view.domSelection();\n if (!sel)\n return $head.pos == $head.start() || $head.pos == $head.end();\n // If the textblock is all LTR, or the browser doesn't support\n // Selection.modify (Edge), fall back to a primitive approach\n if (!maybeRTL.test($head.parent.textContent) || !sel.modify)\n return dir == \"left\" || dir == \"backward\" ? atStart : atEnd;\n return withFlushedState(view, state, () => {\n // This is a huge hack, but appears to be the best we can\n // currently do: use `Selection.modify` to move the selection by\n // one character, and see if that moves the cursor out of the\n // textblock (or doesn't move it at all, when at the start/end of\n // the document).\n let { focusNode: oldNode, focusOffset: oldOff, anchorNode, anchorOffset } = view.domSelectionRange();\n let oldBidiLevel = sel.caretBidiLevel // Only for Firefox\n ;\n sel.modify(\"move\", dir, \"character\");\n let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;\n let { focusNode: newNode, focusOffset: newOff } = view.domSelectionRange();\n let result = newNode && !contains(parentDOM, newNode) || (oldNode == newNode && oldOff == newOff);\n // Restore the previous selection\n try {\n sel.collapse(anchorNode, anchorOffset);\n if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend)\n sel.extend(oldNode, oldOff);\n }\n catch (_) { }\n if (oldBidiLevel != null)\n sel.caretBidiLevel = oldBidiLevel;\n return result;\n });\n}\nlet cachedState = null;\nlet cachedDir = null;\nlet cachedResult = false;\nfunction endOfTextblock(view, state, dir) {\n if (cachedState == state && cachedDir == dir)\n return cachedResult;\n cachedState = state;\n cachedDir = dir;\n return cachedResult = dir == \"up\" || dir == \"down\"\n ? endOfTextblockVertical(view, state, dir)\n : endOfTextblockHorizontal(view, state, dir);\n}\n\n// View descriptions are data structures that describe the DOM that is\n// used to represent the editor's content. They are used for:\n//\n// - Incremental redrawing when the document changes\n//\n// - Figuring out what part of the document a given DOM position\n// corresponds to\n//\n// - Wiring in custom implementations of the editing interface for a\n// given node\n//\n// They form a doubly-linked mutable tree, starting at `view.docView`.\nconst NOT_DIRTY = 0, CHILD_DIRTY = 1, CONTENT_DIRTY = 2, NODE_DIRTY = 3;\n// Superclass for the various kinds of descriptions. Defines their\n// basic structure and shared methods.\nclass ViewDesc {\n constructor(parent, children, dom, \n // This is the node that holds the child views. It may be null for\n // descs that don't have children.\n contentDOM) {\n this.parent = parent;\n this.children = children;\n this.dom = dom;\n this.contentDOM = contentDOM;\n this.dirty = NOT_DIRTY;\n // An expando property on the DOM node provides a link back to its\n // description.\n dom.pmViewDesc = this;\n }\n // Used to check whether a given description corresponds to a\n // widget/mark/node.\n matchesWidget(widget) { return false; }\n matchesMark(mark) { return false; }\n matchesNode(node, outerDeco, innerDeco) { return false; }\n matchesHack(nodeName) { return false; }\n // When parsing in-editor content (in domchange.js), we allow\n // descriptions to determine the parse rules that should be used to\n // parse them.\n parseRule(addedNodes) { return null; }\n // Used by the editor's event handler to ignore events that come\n // from certain descs.\n stopEvent(event) { return false; }\n // The size of the content represented by this desc.\n get size() {\n let size = 0;\n for (let i = 0; i < this.children.length; i++)\n size += this.children[i].size;\n return size;\n }\n // For block nodes, this represents the space taken up by their\n // start/end tokens.\n get border() { return 0; }\n destroy() {\n this.parent = undefined;\n if (this.dom.pmViewDesc == this)\n this.dom.pmViewDesc = undefined;\n for (let i = 0; i < this.children.length; i++)\n this.children[i].destroy();\n }\n posBeforeChild(child) {\n for (let i = 0, pos = this.posAtStart;; i++) {\n let cur = this.children[i];\n if (cur == child)\n return pos;\n pos += cur.size;\n }\n }\n get posBefore() {\n return this.parent.posBeforeChild(this);\n }\n get posAtStart() {\n return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;\n }\n get posAfter() {\n return this.posBefore + this.size;\n }\n get posAtEnd() {\n return this.posAtStart + this.size - 2 * this.border;\n }\n localPosFromDOM(dom, offset, bias) {\n // If the DOM position is in the content, use the child desc after\n // it to figure out a position.\n if (this.contentDOM && contains(this.contentDOM, dom)) {\n if (bias < 0) {\n let domBefore, desc;\n if (dom == this.contentDOM) {\n domBefore = dom.childNodes[offset - 1];\n }\n else {\n while (dom.parentNode != this.contentDOM)\n dom = dom.parentNode;\n domBefore = dom.previousSibling;\n }\n while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this))\n domBefore = domBefore.previousSibling;\n return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart;\n }\n else {\n let domAfter, desc;\n if (dom == this.contentDOM) {\n domAfter = dom.childNodes[offset];\n }\n else {\n while (dom.parentNode != this.contentDOM)\n dom = dom.parentNode;\n domAfter = dom.nextSibling;\n }\n while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this))\n domAfter = domAfter.nextSibling;\n return domAfter ? this.posBeforeChild(desc) : this.posAtEnd;\n }\n }\n // Otherwise, use various heuristics, falling back on the bias\n // parameter, to determine whether to return the position at the\n // start or at the end of this view desc.\n let atEnd;\n if (dom == this.dom && this.contentDOM) {\n atEnd = offset > domIndex(this.contentDOM);\n }\n else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {\n atEnd = !!(dom.compareDocumentPosition(this.contentDOM) & 4);\n }\n else if (this.dom.firstChild) {\n if (offset == 0)\n for (let search = dom;; search = search.parentNode) {\n if (search == this.dom) {\n atEnd = false;\n break;\n }\n if (search.previousSibling)\n break;\n }\n if (atEnd == null && offset == dom.childNodes.length)\n for (let search = dom;; search = search.parentNode) {\n if (search == this.dom) {\n atEnd = true;\n break;\n }\n if (search.nextSibling)\n break;\n }\n }\n return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart;\n }\n nearestDesc(dom, onlyNodes = false) {\n for (let first = true, cur = dom; cur; cur = cur.parentNode) {\n let desc = this.getDesc(cur), nodeDOM;\n if (desc && (!onlyNodes || desc.node)) {\n // If dom is outside of this desc's nodeDOM, don't count it.\n if (first && (nodeDOM = desc.nodeDOM) &&\n !(isElt(nodeDOM) ? contains(nodeDOM, dom) : nodeDOM == dom))\n first = false;\n else\n return desc;\n }\n }\n }\n getDesc(dom) {\n let desc = dom.pmViewDesc;\n for (let cur = desc; cur; cur = cur.parent)\n if (cur == this)\n return desc;\n }\n posFromDOM(dom, offset, bias) {\n for (let scan = dom; scan; scan = scan.parentNode) {\n let desc = this.getDesc(scan);\n if (desc)\n return desc.localPosFromDOM(dom, offset, bias);\n }\n return -1;\n }\n // Find the desc for the node after the given pos, if any. (When a\n // parent node overrode rendering, there might not be one.)\n descAt(pos) {\n for (let i = 0, offset = 0; i < this.children.length; i++) {\n let child = this.children[i], end = offset + child.size;\n if (offset == pos && end != offset) {\n while (!child.border && child.children.length) {\n for (let i = 0; i < child.children.length; i++) {\n let inner = child.children[i];\n if (inner.size) {\n child = inner;\n break;\n }\n }\n }\n return child;\n }\n if (pos < end)\n return child.descAt(pos - offset - child.border);\n offset = end;\n }\n }\n domFromPos(pos, side) {\n if (!this.contentDOM)\n return { node: this.dom, offset: 0, atom: pos + 1 };\n // First find the position in the child array\n let i = 0, offset = 0;\n for (let curPos = 0; i < this.children.length; i++) {\n let child = this.children[i], end = curPos + child.size;\n if (end > pos) {\n offset = pos - curPos;\n break;\n }\n curPos = end;\n }\n // If this points into the middle of a child, call through\n if (offset)\n return this.children[i].domFromPos(offset - this.children[i].border, side);\n // Go back if there were any zero-length widgets with side >= 0 before this point\n for (; i > 0; i--) {\n let prev = this.children[i - 1];\n if (prev.size || !(prev instanceof BufferHackViewDesc || prev instanceof WidgetViewDesc && prev.side >= 0))\n break;\n }\n // Scan towards the first useable node\n if (side <= 0) {\n let prev, enter = true;\n for (;; i--, enter = false) {\n prev = i ? this.children[i - 1] : null;\n if (!prev || prev.dom.parentNode == this.contentDOM)\n break;\n }\n if (prev && side && enter && !prev.border && !prev.domAtom)\n return prev.domFromPos(prev.size, side);\n return { node: this.contentDOM, offset: prev ? domIndex(prev.dom) + 1 : 0 };\n }\n else {\n let next, enter = true;\n for (;; i++, enter = false) {\n next = i < this.children.length ? this.children[i] : null;\n if (!next || next.dom.parentNode == this.contentDOM)\n break;\n }\n if (next && enter && !next.border && !next.domAtom)\n return next.domFromPos(0, side);\n return { node: this.contentDOM, offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length };\n }\n }\n // Used to find a DOM range in a single parent for a given changed\n // range.\n parseRange(from, to, base = 0) {\n if (this.children.length == 0)\n return { node: this.contentDOM, from, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };\n let fromOffset = -1, toOffset = -1;\n for (let offset = base, i = 0;; i++) {\n let child = this.children[i], end = offset + child.size;\n if (fromOffset == -1 && from <= end) {\n let childBase = offset + child.border;\n // FIXME maybe descend mark views to parse a narrower range?\n if (from >= childBase && to <= end - child.border && child.node &&\n child.contentDOM && this.contentDOM.contains(child.contentDOM))\n return child.parseRange(from, to, childBase);\n from = offset;\n for (let j = i; j > 0; j--) {\n let prev = this.children[j - 1];\n if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {\n fromOffset = domIndex(prev.dom) + 1;\n break;\n }\n from -= prev.size;\n }\n if (fromOffset == -1)\n fromOffset = 0;\n }\n if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {\n to = end;\n for (let j = i + 1; j < this.children.length; j++) {\n let next = this.children[j];\n if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {\n toOffset = domIndex(next.dom);\n break;\n }\n to += next.size;\n }\n if (toOffset == -1)\n toOffset = this.contentDOM.childNodes.length;\n break;\n }\n offset = end;\n }\n return { node: this.contentDOM, from, to, fromOffset, toOffset };\n }\n emptyChildAt(side) {\n if (this.border || !this.contentDOM || !this.children.length)\n return false;\n let child = this.children[side < 0 ? 0 : this.children.length - 1];\n return child.size == 0 || child.emptyChildAt(side);\n }\n domAfterPos(pos) {\n let { node, offset } = this.domFromPos(pos, 0);\n if (!isElt(node) || offset == node.childNodes.length)\n throw new RangeError(\"No node after pos \" + pos);\n return node.childNodes[offset];\n }\n // View descs are responsible for setting any selection that falls\n // entirely inside of them, so that custom implementations can do\n // custom things with the selection. Note that this falls apart when\n // a selection starts in such a node and ends in another, in which\n // case we just use whatever domFromPos produces as a best effort.\n setSelection(anchor, head, view, force = false) {\n // If the selection falls entirely in a child, give it to that child\n let from = Math.min(anchor, head), to = Math.max(anchor, head);\n for (let i = 0, offset = 0; i < this.children.length; i++) {\n let child = this.children[i], end = offset + child.size;\n if (from > offset && to < end)\n return child.setSelection(anchor - offset - child.border, head - offset - child.border, view, force);\n offset = end;\n }\n let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);\n let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);\n let domSel = view.root.getSelection();\n let selRange = view.domSelectionRange();\n let brKludge = false;\n // On Firefox, using Selection.collapse to put the cursor after a\n // BR node for some reason doesn't always work (#1073). On Safari,\n // the cursor sometimes inexplicable visually lags behind its\n // reported position in such situations (#1092).\n if ((gecko || safari) && anchor == head) {\n let { node, offset } = anchorDOM;\n if (isText(node)) {\n brKludge = !!(offset && node.nodeValue[offset - 1] == \"\\n\");\n // Issue #1128\n if (brKludge && offset == node.nodeValue.length) {\n for (let scan = node, after; scan; scan = scan.parentNode) {\n if (after = scan.nextSibling) {\n if (after.nodeName == \"BR\")\n anchorDOM = headDOM = { node: after.parentNode, offset: domIndex(after) + 1 };\n break;\n }\n let desc = scan.pmViewDesc;\n if (desc && desc.node && desc.node.isBlock)\n break;\n }\n }\n }\n else {\n let prev = node.childNodes[offset - 1];\n brKludge = prev && (prev.nodeName == \"BR\" || prev.contentEditable == \"false\");\n }\n }\n // Firefox can act strangely when the selection is in front of an\n // uneditable node. See #1163 and https://bugzilla.mozilla.org/show_bug.cgi?id=1709536\n if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && isElt(selRange.focusNode)) {\n let after = selRange.focusNode.childNodes[selRange.focusOffset];\n if (after && after.contentEditable == \"false\")\n force = true;\n }\n if (!(force || brKludge && safari) &&\n isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) &&\n isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset))\n return;\n // Selection.extend can be used to create an 'inverted' selection\n // (one where the focus is before the anchor), but not all\n // browsers support it yet.\n let domSelExtended = false;\n if ((domSel.extend || anchor == head) && !(brKludge && gecko)) {\n domSel.collapse(anchorDOM.node, anchorDOM.offset);\n try {\n if (anchor != head)\n domSel.extend(headDOM.node, headDOM.offset);\n domSelExtended = true;\n }\n catch (_) {\n // In some cases with Chrome the selection is empty after calling\n // collapse, even when it should be valid. This appears to be a bug, but\n // it is difficult to isolate. If this happens fallback to the old path\n // without using extend.\n // Similarly, this could crash on Safari if the editor is hidden, and\n // there was no selection.\n }\n }\n if (!domSelExtended) {\n if (anchor > head) {\n let tmp = anchorDOM;\n anchorDOM = headDOM;\n headDOM = tmp;\n }\n let range = document.createRange();\n range.setEnd(headDOM.node, headDOM.offset);\n range.setStart(anchorDOM.node, anchorDOM.offset);\n domSel.removeAllRanges();\n domSel.addRange(range);\n }\n }\n ignoreMutation(mutation) {\n return !this.contentDOM && mutation.type != \"selection\";\n }\n get contentLost() {\n return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);\n }\n // Remove a subtree of the element tree that has been touched\n // by a DOM change, so that the next update will redraw it.\n markDirty(from, to) {\n for (let offset = 0, i = 0; i < this.children.length; i++) {\n let child = this.children[i], end = offset + child.size;\n if (offset == end ? from <= end && to >= offset : from < end && to > offset) {\n let startInside = offset + child.border, endInside = end - child.border;\n if (from >= startInside && to <= endInside) {\n this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;\n if (from == startInside && to == endInside &&\n (child.contentLost || child.dom.parentNode != this.contentDOM))\n child.dirty = NODE_DIRTY;\n else\n child.markDirty(from - startInside, to - startInside);\n return;\n }\n else {\n child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length\n ? CONTENT_DIRTY : NODE_DIRTY;\n }\n }\n offset = end;\n }\n this.dirty = CONTENT_DIRTY;\n }\n markParentsDirty() {\n let level = 1;\n for (let node = this.parent; node; node = node.parent, level++) {\n let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;\n if (node.dirty < dirty)\n node.dirty = dirty;\n }\n }\n get domAtom() { return false; }\n get ignoreForCoords() { return false; }\n get ignoreForSelection() { return false; }\n isText(text) { return false; }\n}\n// A widget desc represents a widget decoration, which is a DOM node\n// drawn between the document nodes.\nclass WidgetViewDesc extends ViewDesc {\n constructor(parent, widget, view, pos) {\n let self, dom = widget.type.toDOM;\n if (typeof dom == \"function\")\n dom = dom(view, () => {\n if (!self)\n return pos;\n if (self.parent)\n return self.parent.posBeforeChild(self);\n });\n if (!widget.type.spec.raw) {\n let elt = isElt(dom) ? dom : document.createElement(\"span\");\n if (elt != dom)\n elt.appendChild(dom);\n if (!elt.hasAttribute(\"contenteditable\"))\n elt.contentEditable = \"false\";\n elt.classList.add(\"ProseMirror-widget\");\n }\n super(parent, [], dom, null);\n this.widget = widget;\n this.widget = widget;\n self = this;\n }\n matchesWidget(widget) {\n return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type);\n }\n parseRule() { return { ignore: true }; }\n stopEvent(event) {\n let stop = this.widget.spec.stopEvent;\n return stop ? stop(event) : false;\n }\n ignoreMutation(mutation) {\n return mutation.type != \"selection\" || this.widget.spec.ignoreSelection;\n }\n destroy() {\n this.widget.type.destroy(this.dom);\n super.destroy();\n }\n get domAtom() { return true; }\n get ignoreForSelection() { return !!this.widget.type.spec.relaxedSide; }\n get side() { return this.widget.type.side; }\n}\nclass CompositionViewDesc extends ViewDesc {\n constructor(parent, dom, textDOM, text) {\n super(parent, [], dom, null);\n this.textDOM = textDOM;\n this.text = text;\n }\n get size() { return this.text.length; }\n localPosFromDOM(dom, offset) {\n if (dom != this.textDOM)\n return this.posAtStart + (offset ? this.size : 0);\n return this.posAtStart + offset;\n }\n domFromPos(pos) {\n return { node: this.textDOM, offset: pos };\n }\n ignoreMutation(mut) {\n return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue;\n }\n}\n// A mark desc represents a mark. May have multiple children,\n// depending on how the mark is split. Note that marks are drawn using\n// a fixed nesting order, for simplicity and predictability, so in\n// some cases they will be split more often than would appear\n// necessary.\nclass MarkViewDesc extends ViewDesc {\n constructor(parent, mark, dom, contentDOM, spec) {\n super(parent, [], dom, contentDOM);\n this.mark = mark;\n this.spec = spec;\n }\n static create(parent, mark, inline, view) {\n let custom = view.nodeViews[mark.type.name];\n let spec = custom && custom(mark, view, inline);\n if (!spec || !spec.dom)\n spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline), null, mark.attrs);\n return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom, spec);\n }\n parseRule() {\n if ((this.dirty & NODE_DIRTY) || this.mark.type.spec.reparseInView)\n return null;\n return { mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM };\n }\n matchesMark(mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark); }\n markDirty(from, to) {\n super.markDirty(from, to);\n // Move dirty info to nearest node view\n if (this.dirty != NOT_DIRTY) {\n let parent = this.parent;\n while (!parent.node)\n parent = parent.parent;\n if (parent.dirty < this.dirty)\n parent.dirty = this.dirty;\n this.dirty = NOT_DIRTY;\n }\n }\n slice(from, to, view) {\n let copy = MarkViewDesc.create(this.parent, this.mark, true, view);\n let nodes = this.children, size = this.size;\n if (to < size)\n nodes = replaceNodes(nodes, to, size, view);\n if (from > 0)\n nodes = replaceNodes(nodes, 0, from, view);\n for (let i = 0; i < nodes.length; i++)\n nodes[i].parent = copy;\n copy.children = nodes;\n return copy;\n }\n ignoreMutation(mutation) {\n return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);\n }\n destroy() {\n if (this.spec.destroy)\n this.spec.destroy();\n super.destroy();\n }\n}\n// Node view descs are the main, most common type of view desc, and\n// correspond to an actual node in the document. Unlike mark descs,\n// they populate their child array themselves.\nclass NodeViewDesc extends ViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM) {\n super(parent, [], dom, contentDOM);\n this.node = node;\n this.outerDeco = outerDeco;\n this.innerDeco = innerDeco;\n this.nodeDOM = nodeDOM;\n }\n // By default, a node is rendered using the `toDOM` method from the\n // node type spec. But client code can use the `nodeViews` spec to\n // supply a custom node view, which can influence various aspects of\n // the way the node works.\n //\n // (Using subclassing for this was intentionally decided against,\n // since it'd require exposing a whole slew of finicky\n // implementation details to the user code that they probably will\n // never need.)\n static create(parent, node, outerDeco, innerDeco, view, pos) {\n let custom = view.nodeViews[node.type.name], descObj;\n let spec = custom && custom(node, view, () => {\n // (This is a function that allows the custom view to find its\n // own position)\n if (!descObj)\n return pos;\n if (descObj.parent)\n return descObj.parent.posBeforeChild(descObj);\n }, outerDeco, innerDeco);\n let dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;\n if (node.isText) {\n if (!dom)\n dom = document.createTextNode(node.text);\n else if (!isText(dom))\n throw new RangeError(\"Text must be rendered as a DOM text node\");\n }\n else if (!dom) {\n let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);\n ({ dom, contentDOM } = spec);\n }\n if (!contentDOM && !node.isText && dom.nodeName != \"BR\") { // Chrome gets confused by <br contenteditable=false>\n if (!dom.hasAttribute(\"contenteditable\"))\n dom.contentEditable = \"false\";\n if (node.type.spec.draggable)\n dom.draggable = true;\n }\n let nodeDOM = dom;\n dom = applyOuterDeco(dom, outerDeco, node);\n if (spec)\n return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec);\n else if (node.isText)\n return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM);\n else\n return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM);\n }\n parseRule(addedNodes) {\n // Experimental kludge to allow opt-in re-parsing of nodes\n if (this.node.type.spec.reparseInView)\n return null;\n // FIXME the assumption that this can always return the current\n // attrs means that if the user somehow manages to change the\n // attrs in the dom, that won't be picked up. Not entirely sure\n // whether this is a problem\n let rule = { node: this.node.type.name, attrs: this.node.attrs };\n if (this.node.type.whitespace == \"pre\")\n rule.preserveWhitespace = \"full\";\n if (!this.contentDOM) {\n rule.getContent = () => this.node.content;\n }\n else if (!this.contentLost) {\n rule.contentElement = this.contentDOM;\n }\n else {\n // Chrome likes to randomly recreate parent nodes when\n // backspacing things. When that happens, this tries to find the\n // new parent.\n for (let i = this.children.length - 1; i >= 0; i--) {\n let child = this.children[i];\n if (this.dom.contains(child.dom.parentNode)) {\n rule.contentElement = child.dom.parentNode;\n break;\n }\n }\n if (!rule.contentElement) {\n let found = addedNodes &&\n addedNodes.find(n => isElt(n) && addedNodes.indexOf(n.parentNode) < 0 && this.dom.contains(n));\n if (found)\n rule.contentElement = found;\n else\n rule.getContent = () => Fragment.empty;\n }\n }\n return rule;\n }\n matchesNode(node, outerDeco, innerDeco) {\n return this.dirty == NOT_DIRTY && node.eq(this.node) &&\n sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco);\n }\n get size() { return this.node.nodeSize; }\n get border() { return this.node.isLeaf ? 0 : 1; }\n // Syncs `this.children` to match `this.node.content` and the local\n // decorations, possibly introducing nesting for marks. Then, in a\n // separate step, syncs the DOM inside `this.contentDOM` to\n // `this.children`.\n updateChildren(view, pos) {\n let inline = this.node.inlineContent, off = pos;\n let composition = view.composing ? this.localCompositionInfo(view, pos) : null;\n let localComposition = composition && composition.pos > -1 ? composition : null;\n let compositionInChild = composition && composition.pos < 0;\n let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);\n let addBuffers = this.node.inlineContent, atBufferPos = addBuffers && this.node.isBlock;\n iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {\n if (widget.spec.marks)\n updater.syncToMarks(widget.spec.marks, inline, view, i);\n else if (widget.type.side >= 0 && !insideNode)\n updater.syncToMarks(i == this.node.childCount ? Mark.none : this.node.child(i).marks, inline, view, i);\n // If the next node is a desc matching this widget, reuse it,\n // otherwise insert the widget as a new view desc.\n updater.placeWidget(widget, view, off);\n }, (child, outerDeco, innerDeco, i) => {\n // Make sure the wrapping mark descs match the node's marks.\n updater.syncToMarks(child.marks, inline, view, i);\n if (atBufferPos && child.isAtom && !child.isText)\n updater.addHackNode(\"IMG\", updater.top);\n // Try several strategies for drawing this node\n let compIndex;\n if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) ;\n else if (compositionInChild && view.state.selection.from > off &&\n view.state.selection.to < off + child.nodeSize &&\n (compIndex = updater.findIndexWithChild(composition.node)) > -1 &&\n updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view)) ;\n else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off)) ;\n else {\n // Add it as a new view\n updater.addNode(child, outerDeco, innerDeco, view, off);\n }\n off += child.nodeSize;\n if (addBuffers)\n atBufferPos = child.isAtom && !child.isText;\n });\n // Drop all remaining descs after the current position.\n updater.syncToMarks([], inline, view, 0);\n if (this.node.isTextblock)\n updater.addTextblockHacks();\n updater.destroyRest();\n // Sync the DOM if anything changed\n if (updater.changed || this.dirty == CONTENT_DIRTY) {\n // May have to protect focused DOM from being changed if a composition is active\n if (localComposition)\n this.protectLocalComposition(view, localComposition);\n renderDescs(this.contentDOM, this.children, view);\n if (ios)\n iosHacks(this.dom);\n }\n }\n localCompositionInfo(view, pos) {\n // Only do something if both the selection and a focused text node\n // are inside of this node\n let { from, to } = view.state.selection;\n if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size)\n return null;\n let textNode = view.input.compositionNode;\n if (!textNode || !this.dom.contains(textNode.parentNode))\n return null;\n if (this.node.inlineContent) {\n // Find the text in the focused node in the node, stop if it's not\n // there (may have been modified through other means, in which\n // case it should overwritten)\n let text = textNode.nodeValue;\n let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);\n return textPos < 0 ? null : { node: textNode, pos: textPos, text };\n }\n else {\n return { node: textNode, pos: -1, text: \"\" };\n }\n }\n protectLocalComposition(view, { node, pos, text }) {\n // The node is already part of a local view desc, leave it there\n if (this.getDesc(node))\n return;\n // Create a composition view for the orphaned nodes\n let topNode = node;\n for (;; topNode = topNode.parentNode) {\n if (topNode.parentNode == this.contentDOM)\n break;\n while (topNode.previousSibling)\n topNode.parentNode.removeChild(topNode.previousSibling);\n while (topNode.nextSibling)\n topNode.parentNode.removeChild(topNode.nextSibling);\n if (topNode.pmViewDesc)\n topNode.pmViewDesc = undefined;\n }\n let desc = new CompositionViewDesc(this, topNode, node, text);\n view.input.compositionNodes.push(desc);\n // Patch up this.children to contain the composition view\n this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);\n }\n // If this desc must be updated to match the given node decoration,\n // do so and return true.\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY ||\n !node.sameMarkup(this.node))\n return false;\n this.updateInner(node, outerDeco, innerDeco, view);\n return true;\n }\n updateInner(node, outerDeco, innerDeco, view) {\n this.updateOuterDeco(outerDeco);\n this.node = node;\n this.innerDeco = innerDeco;\n if (this.contentDOM)\n this.updateChildren(view, this.posAtStart);\n this.dirty = NOT_DIRTY;\n }\n updateOuterDeco(outerDeco) {\n if (sameOuterDeco(outerDeco, this.outerDeco))\n return;\n let needsWrap = !isElt(this.nodeDOM);\n let oldDOM = this.dom;\n this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));\n if (this.dom != oldDOM) {\n oldDOM.pmViewDesc = undefined;\n this.dom.pmViewDesc = this;\n }\n this.outerDeco = outerDeco;\n }\n // Mark this node as being the selected node.\n selectNode() {\n if (isElt(this.nodeDOM)) {\n this.nodeDOM.classList.add(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable)\n this.nodeDOM.draggable = true;\n }\n }\n // Remove selected node marking from this node.\n deselectNode() {\n if (isElt(this.nodeDOM)) {\n this.nodeDOM.classList.remove(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable)\n this.nodeDOM.removeAttribute(\"draggable\");\n }\n }\n get domAtom() { return this.node.isAtom; }\n}\n// Create a view desc for the top-level document node, to be exported\n// and used by the view class.\nfunction docViewDesc(doc, outerDeco, innerDeco, dom, view) {\n applyOuterDeco(dom, outerDeco, doc);\n let docView = new NodeViewDesc(undefined, doc, outerDeco, innerDeco, dom, dom, dom);\n if (docView.contentDOM)\n docView.updateChildren(view, 0);\n return docView;\n}\nclass TextViewDesc extends NodeViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, nodeDOM) {\n super(parent, node, outerDeco, innerDeco, dom, null, nodeDOM);\n }\n parseRule() {\n let skip = this.nodeDOM.parentNode;\n while (skip && skip != this.dom && !skip.pmIsDeco)\n skip = skip.parentNode;\n return { skip: (skip || true) };\n }\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) ||\n !node.sameMarkup(this.node))\n return false;\n this.updateOuterDeco(outerDeco);\n if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue) {\n this.nodeDOM.nodeValue = node.text;\n if (view.trackWrites == this.nodeDOM)\n view.trackWrites = null;\n }\n this.node = node;\n this.dirty = NOT_DIRTY;\n return true;\n }\n inParent() {\n let parentDOM = this.parent.contentDOM;\n for (let n = this.nodeDOM; n; n = n.parentNode)\n if (n == parentDOM)\n return true;\n return false;\n }\n domFromPos(pos) {\n return { node: this.nodeDOM, offset: pos };\n }\n localPosFromDOM(dom, offset, bias) {\n if (dom == this.nodeDOM)\n return this.posAtStart + Math.min(offset, this.node.text.length);\n return super.localPosFromDOM(dom, offset, bias);\n }\n ignoreMutation(mutation) {\n return mutation.type != \"characterData\" && mutation.type != \"selection\";\n }\n slice(from, to, _view) {\n let node = this.node.cut(from, to), dom = document.createTextNode(node.text);\n return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom);\n }\n markDirty(from, to) {\n super.markDirty(from, to);\n if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length))\n this.dirty = NODE_DIRTY;\n }\n get domAtom() { return false; }\n isText(text) { return this.node.text == text; }\n}\n// A dummy desc used to tag extra BR or IMG nodes created to work\n// around contentEditable terribleness.\nclass BufferHackViewDesc extends ViewDesc {\n parseRule() { return { ignore: true }; }\n matchesHack(nodeName) { return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName; }\n get domAtom() { return true; }\n get ignoreForCoords() { return this.dom.nodeName == \"IMG\"; }\n}\n// A separate subclass is used for customized node views, so that the\n// extra checks only have to be made for nodes that are actually\n// customized.\nclass CustomNodeViewDesc extends NodeViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec) {\n super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM);\n this.spec = spec;\n }\n // A custom `update` method gets to decide whether the update goes\n // through. If it does, and there's a `contentDOM` node, our logic\n // updates the children.\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY)\n return false;\n if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {\n let result = this.spec.update(node, outerDeco, innerDeco);\n if (result)\n this.updateInner(node, outerDeco, innerDeco, view);\n return result;\n }\n else if (!this.contentDOM && !node.isLeaf) {\n return false;\n }\n else {\n return super.update(node, outerDeco, innerDeco, view);\n }\n }\n selectNode() {\n this.spec.selectNode ? this.spec.selectNode() : super.selectNode();\n }\n deselectNode() {\n this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();\n }\n setSelection(anchor, head, view, force) {\n this.spec.setSelection ? this.spec.setSelection(anchor, head, view.root)\n : super.setSelection(anchor, head, view, force);\n }\n destroy() {\n if (this.spec.destroy)\n this.spec.destroy();\n super.destroy();\n }\n stopEvent(event) {\n return this.spec.stopEvent ? this.spec.stopEvent(event) : false;\n }\n ignoreMutation(mutation) {\n return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);\n }\n}\n// Sync the content of the given DOM node with the nodes associated\n// with the given array of view descs, recursing into mark descs\n// because this should sync the subtree for a whole node at a time.\nfunction renderDescs(parentDOM, descs, view) {\n let dom = parentDOM.firstChild, written = false;\n for (let i = 0; i < descs.length; i++) {\n let desc = descs[i], childDOM = desc.dom;\n if (childDOM.parentNode == parentDOM) {\n while (childDOM != dom) {\n dom = rm(dom);\n written = true;\n }\n dom = dom.nextSibling;\n }\n else {\n written = true;\n parentDOM.insertBefore(childDOM, dom);\n }\n if (desc instanceof MarkViewDesc) {\n let pos = dom ? dom.previousSibling : parentDOM.lastChild;\n renderDescs(desc.contentDOM, desc.children, view);\n dom = pos ? pos.nextSibling : parentDOM.firstChild;\n }\n }\n while (dom) {\n dom = rm(dom);\n written = true;\n }\n if (written && view.trackWrites == parentDOM)\n view.trackWrites = null;\n}\nconst OuterDecoLevel = function (nodeName) {\n if (nodeName)\n this.nodeName = nodeName;\n};\nOuterDecoLevel.prototype = Object.create(null);\nconst noDeco = [new OuterDecoLevel];\nfunction computeOuterDeco(outerDeco, node, needsWrap) {\n if (outerDeco.length == 0)\n return noDeco;\n let top = needsWrap ? noDeco[0] : new OuterDecoLevel, result = [top];\n for (let i = 0; i < outerDeco.length; i++) {\n let attrs = outerDeco[i].type.attrs;\n if (!attrs)\n continue;\n if (attrs.nodeName)\n result.push(top = new OuterDecoLevel(attrs.nodeName));\n for (let name in attrs) {\n let val = attrs[name];\n if (val == null)\n continue;\n if (needsWrap && result.length == 1)\n result.push(top = new OuterDecoLevel(node.isInline ? \"span\" : \"div\"));\n if (name == \"class\")\n top.class = (top.class ? top.class + \" \" : \"\") + val;\n else if (name == \"style\")\n top.style = (top.style ? top.style + \";\" : \"\") + val;\n else if (name != \"nodeName\")\n top[name] = val;\n }\n }\n return result;\n}\nfunction patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {\n // Shortcut for trivial case\n if (prevComputed == noDeco && curComputed == noDeco)\n return nodeDOM;\n let curDOM = nodeDOM;\n for (let i = 0; i < curComputed.length; i++) {\n let deco = curComputed[i], prev = prevComputed[i];\n if (i) {\n let parent;\n if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM &&\n (parent = curDOM.parentNode) && parent.nodeName.toLowerCase() == deco.nodeName) {\n curDOM = parent;\n }\n else {\n parent = document.createElement(deco.nodeName);\n parent.pmIsDeco = true;\n parent.appendChild(curDOM);\n prev = noDeco[0];\n curDOM = parent;\n }\n }\n patchAttributes(curDOM, prev || noDeco[0], deco);\n }\n return curDOM;\n}\nfunction patchAttributes(dom, prev, cur) {\n for (let name in prev)\n if (name != \"class\" && name != \"style\" && name != \"nodeName\" && !(name in cur))\n dom.removeAttribute(name);\n for (let name in cur)\n if (name != \"class\" && name != \"style\" && name != \"nodeName\" && cur[name] != prev[name])\n dom.setAttribute(name, cur[name]);\n if (prev.class != cur.class) {\n let prevList = prev.class ? prev.class.split(\" \").filter(Boolean) : [];\n let curList = cur.class ? cur.class.split(\" \").filter(Boolean) : [];\n for (let i = 0; i < prevList.length; i++)\n if (curList.indexOf(prevList[i]) == -1)\n dom.classList.remove(prevList[i]);\n for (let i = 0; i < curList.length; i++)\n if (prevList.indexOf(curList[i]) == -1)\n dom.classList.add(curList[i]);\n if (dom.classList.length == 0)\n dom.removeAttribute(\"class\");\n }\n if (prev.style != cur.style) {\n if (prev.style) {\n let prop = /\\s*([\\w\\-\\xa1-\\uffff]+)\\s*:(?:\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|\\(.*?\\)|[^;])*/g, m;\n while (m = prop.exec(prev.style))\n dom.style.removeProperty(m[1]);\n }\n if (cur.style)\n dom.style.cssText += cur.style;\n }\n}\nfunction applyOuterDeco(dom, deco, node) {\n return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, !isElt(dom)));\n}\nfunction sameOuterDeco(a, b) {\n if (a.length != b.length)\n return false;\n for (let i = 0; i < a.length; i++)\n if (!a[i].type.eq(b[i].type))\n return false;\n return true;\n}\n// Remove a DOM node and return its next sibling.\nfunction rm(dom) {\n let next = dom.nextSibling;\n dom.parentNode.removeChild(dom);\n return next;\n}\n// Helper class for incrementally updating a tree of mark descs and\n// the widget and node descs inside of them.\nclass ViewTreeUpdater {\n constructor(top, lock, view) {\n this.lock = lock;\n this.view = view;\n // Index into `this.top`'s child array, represents the current\n // update position.\n this.index = 0;\n // When entering a mark, the current top and index are pushed\n // onto this.\n this.stack = [];\n // Tracks whether anything was changed\n this.changed = false;\n this.top = top;\n this.preMatch = preMatch(top.node.content, top);\n }\n // Destroy and remove the children between the given indices in\n // `this.top`.\n destroyBetween(start, end) {\n if (start == end)\n return;\n for (let i = start; i < end; i++)\n this.top.children[i].destroy();\n this.top.children.splice(start, end - start);\n this.changed = true;\n }\n // Destroy all remaining children in `this.top`.\n destroyRest() {\n this.destroyBetween(this.index, this.top.children.length);\n }\n // Sync the current stack of mark descs with the given array of\n // marks, reusing existing mark descs when possible.\n syncToMarks(marks, inline, view, parentIndex) {\n let keep = 0, depth = this.stack.length >> 1;\n let maxKeep = Math.min(depth, marks.length);\n while (keep < maxKeep &&\n (keep == depth - 1 ? this.top : this.stack[(keep + 1) << 1])\n .matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)\n keep++;\n while (keep < depth) {\n this.destroyRest();\n this.top.dirty = NOT_DIRTY;\n this.index = this.stack.pop();\n this.top = this.stack.pop();\n depth--;\n }\n while (depth < marks.length) {\n this.stack.push(this.top, this.index + 1);\n let found = -1, scanTo = this.top.children.length;\n if (parentIndex < this.preMatch.index)\n scanTo = Math.min(this.index + 3, scanTo);\n for (let i = this.index; i < scanTo; i++) {\n let next = this.top.children[i];\n if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {\n found = i;\n break;\n }\n }\n // When nothing matches, try to update the mark view at this position\n // in place, so a custom mark view can adapt to a changed mark without\n // re-creating its DOM.\n if (found < 0 && this.index < this.top.children.length) {\n let cur = this.top.children[this.index];\n if (cur instanceof MarkViewDesc && cur.dirty != NODE_DIRTY &&\n cur.mark.type == marks[depth].type && cur.spec.update &&\n !this.isLocked(cur.dom) && cur.spec.update(marks[depth])) {\n cur.mark = marks[depth];\n found = this.index;\n this.changed = true;\n }\n }\n if (found > -1) {\n if (found > this.index) {\n this.changed = true;\n this.destroyBetween(this.index, found);\n }\n this.top = this.top.children[this.index];\n }\n else {\n let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);\n this.top.children.splice(this.index, 0, markDesc);\n this.top = markDesc;\n this.changed = true;\n }\n this.index = 0;\n depth++;\n }\n }\n // Try to find a node desc matching the given data. Skip over it and\n // return true when successful.\n findNodeMatch(node, outerDeco, innerDeco, index) {\n let found = -1, targetDesc;\n if (index >= this.preMatch.index &&\n (targetDesc = this.preMatch.matches[index - this.preMatch.index]).parent == this.top &&\n targetDesc.matchesNode(node, outerDeco, innerDeco)) {\n found = this.top.children.indexOf(targetDesc, this.index);\n }\n else {\n for (let i = this.index, e = Math.min(this.top.children.length, i + 5); i < e; i++) {\n let child = this.top.children[i];\n if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {\n found = i;\n break;\n }\n }\n }\n if (found < 0)\n return false;\n this.destroyBetween(this.index, found);\n this.index++;\n return true;\n }\n updateNodeAt(node, outerDeco, innerDeco, index, view) {\n let child = this.top.children[index];\n if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM)\n child.dirty = CONTENT_DIRTY;\n if (!child.update(node, outerDeco, innerDeco, view))\n return false;\n this.destroyBetween(this.index, index);\n this.index++;\n return true;\n }\n findIndexWithChild(domNode) {\n for (;;) {\n let parent = domNode.parentNode;\n if (!parent)\n return -1;\n if (parent == this.top.contentDOM) {\n let desc = domNode.pmViewDesc;\n if (desc)\n for (let i = this.index; i < this.top.children.length; i++) {\n if (this.top.children[i] == desc)\n return i;\n }\n return -1;\n }\n domNode = parent;\n }\n }\n // Try to update the next node, if any, to the given data. Checks\n // pre-matches to avoid overwriting nodes that could still be used.\n updateNextNode(node, outerDeco, innerDeco, view, index, pos) {\n for (let i = this.index; i < this.top.children.length; i++) {\n let next = this.top.children[i];\n if (next instanceof NodeViewDesc) {\n let preMatch = this.preMatch.matched.get(next);\n if (preMatch != null && preMatch != index)\n return false;\n let nextDOM = next.dom, updated;\n // Can't update if nextDOM is or contains this.lock, except if\n // it's a text node whose content already matches the new text\n // and whose decorations match the new ones.\n let locked = this.isLocked(nextDOM) &&\n !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text &&\n next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));\n if (!locked && next.update(node, outerDeco, innerDeco, view)) {\n this.destroyBetween(this.index, i);\n if (next.dom != nextDOM)\n this.changed = true;\n this.index++;\n return true;\n }\n else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {\n this.destroyBetween(this.index, i);\n this.top.children[this.index] = updated;\n if (updated.contentDOM) {\n updated.dirty = CONTENT_DIRTY;\n updated.updateChildren(view, pos + 1);\n updated.dirty = NOT_DIRTY;\n }\n this.changed = true;\n this.index++;\n return true;\n }\n break;\n }\n }\n return false;\n }\n // When a node with content is replaced by a different node with\n // identical content, move over its children.\n recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {\n if (next.dirty || node.isAtom || !next.children.length ||\n !next.node.content.eq(node.content) ||\n !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco))\n return null;\n let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);\n if (wrapper.contentDOM) {\n wrapper.children = next.children;\n next.children = [];\n for (let ch of wrapper.children)\n ch.parent = wrapper;\n }\n next.destroy();\n return wrapper;\n }\n // Insert the node as a newly created node desc.\n addNode(node, outerDeco, innerDeco, view, pos) {\n let desc = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);\n if (desc.contentDOM)\n desc.updateChildren(view, pos + 1);\n this.top.children.splice(this.index++, 0, desc);\n this.changed = true;\n }\n placeWidget(widget, view, pos) {\n let next = this.index < this.top.children.length ? this.top.children[this.index] : null;\n if (next && next.matchesWidget(widget) &&\n (widget == next.widget || !next.widget.type.toDOM.parentNode)) {\n this.index++;\n }\n else {\n let desc = new WidgetViewDesc(this.top, widget, view, pos);\n this.top.children.splice(this.index++, 0, desc);\n this.changed = true;\n }\n }\n // Make sure a textblock looks and behaves correctly in\n // contentEditable.\n addTextblockHacks() {\n let lastChild = this.top.children[this.index - 1], parent = this.top;\n while (lastChild instanceof MarkViewDesc) {\n parent = lastChild;\n lastChild = parent.children[parent.children.length - 1];\n }\n if (!lastChild || // Empty textblock\n !(lastChild instanceof TextViewDesc) ||\n /\\n$/.test(lastChild.node.text) ||\n (this.view.requiresGeckoHackNode && /\\s$/.test(lastChild.node.text))) {\n // Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)\n if ((safari || chrome) && lastChild && lastChild.dom.contentEditable == \"false\")\n this.addHackNode(\"IMG\", parent);\n this.addHackNode(\"BR\", this.top);\n }\n }\n addHackNode(nodeName, parent) {\n if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) {\n this.index++;\n }\n else {\n let dom = document.createElement(nodeName);\n if (nodeName == \"IMG\") {\n dom.className = \"ProseMirror-separator\";\n dom.alt = \"\";\n }\n if (nodeName == \"BR\")\n dom.className = \"ProseMirror-trailingBreak\";\n let hack = new BufferHackViewDesc(this.top, [], dom, null);\n if (parent != this.top)\n parent.children.push(hack);\n else\n parent.children.splice(this.index++, 0, hack);\n this.changed = true;\n }\n }\n isLocked(node) {\n return this.lock && (node == this.lock || isElt(node) && node.contains(this.lock.parentNode));\n }\n}\n// Iterate from the end of the fragment and array of descs to find\n// directly matching ones, in order to avoid overeagerly reusing those\n// for other nodes.\nfunction preMatch(frag, parentDesc) {\n let curDesc = parentDesc, descI = curDesc.children.length;\n let fI = frag.childCount, matched = new Map, matches = [];\n outer: while (fI > 0) {\n let desc;\n for (;;) {\n if (descI) {\n let next = curDesc.children[descI - 1];\n if (next instanceof MarkViewDesc) {\n curDesc = next;\n descI = next.children.length;\n }\n else {\n desc = next;\n descI--;\n break;\n }\n }\n else if (curDesc == parentDesc) {\n break outer;\n }\n else {\n descI = curDesc.parent.children.indexOf(curDesc);\n curDesc = curDesc.parent;\n }\n }\n let node = desc.node;\n if (!node)\n continue;\n if (node != frag.child(fI - 1))\n break;\n --fI;\n matched.set(desc, fI);\n matches.push(desc);\n }\n return { index: fI, matched, matches: matches.reverse() };\n}\nfunction compareSide(a, b) {\n return a.type.side - b.type.side;\n}\n// This function abstracts iterating over the nodes and decorations in\n// a fragment. Calls `onNode` for each node, with its local and child\n// decorations. Splits text nodes when there is a decoration starting\n// or ending inside of them. Calls `onWidget` for each widget.\nfunction iterDeco(parent, deco, onWidget, onNode) {\n let locals = deco.locals(parent), offset = 0;\n // Simple, cheap variant for when there are no local decorations\n if (locals.length == 0) {\n for (let i = 0; i < parent.childCount; i++) {\n let child = parent.child(i);\n onNode(child, locals, deco.forChild(offset, child), i);\n offset += child.nodeSize;\n }\n return;\n }\n let decoIndex = 0, active = [], restNode = null;\n for (let parentIndex = 0;;) {\n let widget, widgets;\n while (decoIndex < locals.length && locals[decoIndex].to == offset) {\n let next = locals[decoIndex++];\n if (next.widget) {\n if (!widget)\n widget = next;\n else\n (widgets || (widgets = [widget])).push(next);\n }\n }\n if (widget) {\n if (widgets) {\n widgets.sort(compareSide);\n for (let i = 0; i < widgets.length; i++)\n onWidget(widgets[i], parentIndex, !!restNode);\n }\n else {\n onWidget(widget, parentIndex, !!restNode);\n }\n }\n let child, index;\n if (restNode) {\n index = -1;\n child = restNode;\n restNode = null;\n }\n else if (parentIndex < parent.childCount) {\n index = parentIndex;\n child = parent.child(parentIndex++);\n }\n else {\n break;\n }\n for (let i = 0; i < active.length; i++)\n if (active[i].to <= offset)\n active.splice(i--, 1);\n while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset)\n active.push(locals[decoIndex++]);\n let end = offset + child.nodeSize;\n if (child.isText) {\n let cutAt = end;\n if (decoIndex < locals.length && locals[decoIndex].from < cutAt)\n cutAt = locals[decoIndex].from;\n for (let i = 0; i < active.length; i++)\n if (active[i].to < cutAt)\n cutAt = active[i].to;\n if (cutAt < end) {\n restNode = child.cut(cutAt - offset);\n child = child.cut(0, cutAt - offset);\n end = cutAt;\n index = -1;\n }\n }\n else {\n while (decoIndex < locals.length && locals[decoIndex].to < end)\n decoIndex++;\n }\n let outerDeco = child.isInline && !child.isLeaf ? active.filter(d => !d.inline) : active.slice();\n onNode(child, outerDeco, deco.forChild(offset, child), index);\n offset = end;\n }\n}\n// List markers in Mobile Safari will mysteriously disappear\n// sometimes. This works around that.\nfunction iosHacks(dom) {\n if (dom.nodeName == \"UL\" || dom.nodeName == \"OL\") {\n let oldCSS = dom.style.cssText;\n dom.style.cssText = oldCSS + \"; list-style: square !important\";\n window.getComputedStyle(dom).listStyle;\n dom.style.cssText = oldCSS;\n }\n}\n// Find a piece of text in an inline fragment, overlapping from-to\nfunction findTextInFragment(frag, text, from, to) {\n for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {\n let child = frag.child(i++), childStart = pos;\n pos += child.nodeSize;\n if (!child.isText)\n continue;\n let str = child.text;\n while (i < frag.childCount) {\n let next = frag.child(i++);\n pos += next.nodeSize;\n if (!next.isText)\n break;\n str += next.text;\n }\n if (pos >= from) {\n if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text)\n return to - text.length;\n let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;\n if (found >= 0 && found + text.length + childStart >= from)\n return childStart + found;\n if (from == to && str.length >= (to + text.length) - childStart &&\n str.slice(to - childStart, to - childStart + text.length) == text)\n return to;\n }\n }\n return -1;\n}\n// Replace range from-to in an array of view descs with replacement\n// (may be null to just delete). This goes very much against the grain\n// of the rest of this code, which tends to create nodes with the\n// right shape in one go, rather than messing with them after\n// creation, but is necessary in the composition hack.\nfunction replaceNodes(nodes, from, to, view, replacement) {\n let result = [];\n for (let i = 0, off = 0; i < nodes.length; i++) {\n let child = nodes[i], start = off, end = off += child.size;\n if (start >= to || end <= from) {\n result.push(child);\n }\n else {\n if (start < from)\n result.push(child.slice(0, from - start, view));\n if (replacement) {\n result.push(replacement);\n replacement = undefined;\n }\n if (end > to)\n result.push(child.slice(to - start, child.size, view));\n }\n }\n return result;\n}\n\nfunction selectionFromDOM(view, origin = null) {\n let domSel = view.domSelectionRange(), doc = view.state.doc;\n if (!domSel.focusNode)\n return null;\n let nearestDesc = view.docView.nearestDesc(domSel.focusNode), inWidget = nearestDesc && nearestDesc.size == 0;\n let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);\n if (head < 0)\n return null;\n let $head = doc.resolve(head), anchor, selection;\n if (selectionCollapsed(domSel)) {\n anchor = head;\n while (nearestDesc && !nearestDesc.node)\n nearestDesc = nearestDesc.parent;\n if (nearestDesc && nearestDesc.node.isAtom && NodeSelection.isSelectable(nearestDesc.node) &&\n nearestDesc.parent &&\n !(nearestDesc.node.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {\n let pos = nearestDesc.posBefore;\n selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));\n }\n else if (gecko && origin == \"key\" && head > view.state.selection.to &&\n isElt(domSel.focusNode) && domSel.focusOffset == domSel.focusNode.childNodes.length &&\n nearestDesc && nearestDesc.posAtStart > view.state.selection.to) {\n // Firefox will jump across scrollable wrapper nodes on keyboard\n // cursor motion (#1594). This tries to detect this situation\n // and work around it.\n for (let scan = domSel.focusNode;; scan = scan.parentNode) {\n if (getComputedStyle(scan).overflow != \"visible\") {\n selection = Selection.findFrom(doc.resolve(nearestDesc.posAtStart), 1);\n break;\n }\n if (scan == nearestDesc.dom || scan.nextSibling || !scan.parentNode || !isElt(scan.parentNode))\n break;\n }\n }\n }\n else {\n if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {\n let min = head, max = head;\n for (let i = 0; i < domSel.rangeCount; i++) {\n let range = domSel.getRangeAt(i);\n min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1));\n max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1));\n }\n if (min < 0)\n return null;\n [anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max];\n $head = doc.resolve(head);\n }\n else {\n anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);\n }\n if (anchor < 0)\n return null;\n }\n let $anchor = doc.resolve(anchor);\n if (!selection) {\n let bias = origin == \"pointer\" || (view.state.selection.head < $head.pos && !inWidget) ? 1 : -1;\n selection = selectionBetween(view, $anchor, $head, bias);\n }\n return selection;\n}\nfunction editorOwnsSelection(view) {\n return view.editable ? view.hasFocus() :\n hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom);\n}\nfunction selectionToDOM(view, force = false) {\n let sel = view.state.selection;\n syncNodeSelection(view, sel);\n if (!editorOwnsSelection(view))\n return;\n // Need to delay selection normalization during a native selection\n // drag on Chrome, or it will cause further dragging to glitch.\n let mouseDown = view.input.mouseDown;\n if (!force && chrome && mouseDown) {\n let domSel = view.domSelectionRange(), curSel = view.domObserver.currentSelection;\n if (domSel.anchorNode && curSel.anchorNode &&\n isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset) &&\n mouseDown.delaySelUpdate()) {\n view.domObserver.setCurSelection();\n return;\n }\n }\n view.domObserver.disconnectSelection();\n if (view.cursorWrapper) {\n selectCursorWrapper(view);\n }\n else {\n let { anchor, head } = sel, resetEditableFrom, resetEditableTo;\n if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {\n if (!sel.$from.parent.inlineContent)\n resetEditableFrom = temporarilyEditableNear(view, sel.from);\n if (!sel.empty && !sel.$from.parent.inlineContent)\n resetEditableTo = temporarilyEditableNear(view, sel.to);\n }\n view.docView.setSelection(anchor, head, view, force);\n if (brokenSelectBetweenUneditable) {\n if (resetEditableFrom)\n resetEditable(resetEditableFrom);\n if (resetEditableTo)\n resetEditable(resetEditableTo);\n }\n if (sel.visible) {\n view.dom.classList.remove(\"ProseMirror-hideselection\");\n }\n else {\n view.dom.classList.add(\"ProseMirror-hideselection\");\n if (\"onselectionchange\" in document)\n removeClassOnSelectionChange(view);\n }\n }\n view.domObserver.setCurSelection();\n view.domObserver.connectSelection();\n}\n// Kludge to work around Webkit not allowing a selection to start/end\n// between non-editable block nodes. We briefly make something\n// editable, set the selection, then set it uneditable again.\nconst brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63;\nfunction temporarilyEditableNear(view, pos) {\n let { node, offset } = view.docView.domFromPos(pos, 0);\n let after = offset < node.childNodes.length ? node.childNodes[offset] : null;\n let before = offset ? node.childNodes[offset - 1] : null;\n if (safari && after && after.contentEditable == \"false\")\n return setEditable(after);\n if ((!after || after.contentEditable == \"false\") &&\n (!before || before.contentEditable == \"false\")) {\n if (after)\n return setEditable(after);\n else if (before)\n return setEditable(before);\n }\n}\nfunction setEditable(element) {\n element.contentEditable = \"true\";\n if (safari && element.draggable) {\n element.draggable = false;\n element.wasDraggable = true;\n }\n return element;\n}\nfunction resetEditable(element) {\n element.contentEditable = \"false\";\n if (element.wasDraggable) {\n element.draggable = true;\n element.wasDraggable = null;\n }\n}\nfunction removeClassOnSelectionChange(view) {\n let doc = view.dom.ownerDocument;\n doc.removeEventListener(\"selectionchange\", view.input.hideSelectionGuard);\n let domSel = view.domSelectionRange();\n let node = domSel.anchorNode, offset = domSel.anchorOffset;\n doc.addEventListener(\"selectionchange\", view.input.hideSelectionGuard = () => {\n if (domSel.anchorNode != node || domSel.anchorOffset != offset) {\n doc.removeEventListener(\"selectionchange\", view.input.hideSelectionGuard);\n setTimeout(() => {\n if (!editorOwnsSelection(view) || view.state.selection.visible)\n view.dom.classList.remove(\"ProseMirror-hideselection\");\n }, 20);\n }\n });\n}\nfunction selectCursorWrapper(view) {\n let domSel = view.domSelection();\n if (!domSel)\n return;\n let node = view.cursorWrapper.dom, img = node.nodeName == \"IMG\";\n if (img)\n domSel.collapse(node.parentNode, domIndex(node) + 1);\n else\n domSel.collapse(node, 0);\n // Kludge to kill 'control selection' in IE11 when selecting an\n // invisible cursor wrapper, since that would result in those weird\n // resize handles and a selection that considers the absolutely\n // positioned wrapper, rather than the root editable node, the\n // focused element.\n if (!img && !view.state.selection.visible && ie && ie_version <= 11) {\n node.disabled = true;\n node.disabled = false;\n }\n}\nfunction syncNodeSelection(view, sel) {\n if (sel instanceof NodeSelection) {\n let desc = view.docView.descAt(sel.from);\n if (desc != view.lastSelectedViewDesc) {\n clearNodeSelection(view);\n if (desc)\n desc.selectNode();\n view.lastSelectedViewDesc = desc;\n }\n }\n else {\n clearNodeSelection(view);\n }\n}\n// Clear all DOM statefulness of the last node selection.\nfunction clearNodeSelection(view) {\n if (view.lastSelectedViewDesc) {\n if (view.lastSelectedViewDesc.parent)\n view.lastSelectedViewDesc.deselectNode();\n view.lastSelectedViewDesc = undefined;\n }\n}\nfunction selectionBetween(view, $anchor, $head, bias) {\n return view.someProp(\"createSelectionBetween\", f => f(view, $anchor, $head))\n || TextSelection.between($anchor, $head, bias);\n}\nfunction hasFocusAndSelection(view) {\n if (view.editable && !view.hasFocus())\n return false;\n return hasSelection(view);\n}\nfunction hasSelection(view) {\n let sel = view.domSelectionRange();\n if (!sel.anchorNode)\n return false;\n try {\n // Firefox will raise 'permission denied' errors when accessing\n // properties of `sel.anchorNode` when it's in a generated CSS\n // element.\n return contains(view.dom, sel.anchorNode) && (view.editable || contains(view.dom, sel.focusNode));\n }\n catch (_) {\n return false;\n }\n}\nfunction anchorInRightPlace(view) {\n let anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0);\n let domSel = view.domSelectionRange();\n return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset);\n}\n\nfunction moveSelectionBlock(state, dir) {\n let { $anchor, $head } = state.selection;\n let $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);\n let $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;\n return $start && Selection.findFrom($start, dir);\n}\nfunction apply(view, sel) {\n view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());\n return true;\n}\nfunction selectHorizontally(view, dir, mods) {\n let sel = view.state.selection;\n if (sel instanceof TextSelection) {\n if (mods.indexOf(\"s\") > -1) {\n let { $head } = sel, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;\n if (!node || node.isText || !node.isLeaf)\n return false;\n let $newHead = view.state.doc.resolve($head.pos + node.nodeSize * (dir < 0 ? -1 : 1));\n return apply(view, new TextSelection(sel.$anchor, $newHead));\n }\n else if (!sel.empty) {\n return false;\n }\n else if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) {\n let next = moveSelectionBlock(view.state, dir);\n if (next && (next instanceof NodeSelection))\n return apply(view, next);\n return false;\n }\n else if (!(mac && mods.indexOf(\"m\") > -1)) {\n let $head = sel.$head, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc;\n if (!node || node.isText)\n return false;\n let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;\n if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM))\n return false;\n if (NodeSelection.isSelectable(node)) {\n return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));\n }\n else {\n // Chrome and Safari will introduce extra pointless cursor\n // positions around inline uneditable nodes (#937), and\n // Firefox will sometimes just plain refuse to move across\n // them (#1592), so in this situation we move the cursor\n // ourselves.\n return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));\n }\n }\n }\n else if (sel instanceof NodeSelection && sel.node.isInline) {\n return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));\n }\n else {\n let next = moveSelectionBlock(view.state, dir);\n if (next)\n return apply(view, next);\n return false;\n }\n}\nfunction isIgnorable(dom, dir) {\n let desc = dom.pmViewDesc;\n return desc ? desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != \"BR\")\n : isElt(dom) && dom.contentEditable == \"false\";\n}\nfunction skipIgnoredNodes(view, dir) {\n return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);\n}\n// Make sure the cursor isn't directly after one or more ignored\n// nodes, which will confuse the browser's cursor motion logic.\nfunction skipIgnoredNodesBefore(view) {\n let sel = view.domSelectionRange();\n let node = sel.focusNode, offset = sel.focusOffset;\n if (!node)\n return;\n let moveNode, moveOffset, force = false;\n // Gecko will do odd things when the selection is directly in front\n // of a non-editable node, so in that case, move it into the next\n // node if possible. Issue prosemirror/prosemirror#832.\n if (gecko && isElt(node) && offset < nodeSize(node) && isIgnorable(node.childNodes[offset], -1))\n force = true;\n for (;;) {\n if (offset > 0) {\n if (!isElt(node))\n break;\n let before = node.childNodes[offset - 1];\n if (isIgnorable(before, -1)) {\n moveNode = node;\n moveOffset = --offset;\n }\n else if (isText(before)) {\n node = before;\n offset = node.nodeValue.length;\n }\n else {\n break;\n }\n }\n else if (isBlockNode(node)) {\n break;\n }\n else {\n let prev = node.previousSibling;\n while (prev && isIgnorable(prev, -1)) {\n moveNode = node.parentNode;\n moveOffset = domIndex(prev);\n prev = prev.previousSibling;\n }\n if (!prev) {\n node = node.parentNode;\n if (node == view.dom)\n break;\n offset = 0;\n }\n else {\n node = prev;\n offset = nodeSize(node);\n }\n }\n }\n if (force)\n setSelFocus(view, node, offset);\n else if (moveNode)\n setSelFocus(view, moveNode, moveOffset);\n}\n// Make sure the cursor isn't directly before one or more ignored\n// nodes.\nfunction skipIgnoredNodesAfter(view) {\n let sel = view.domSelectionRange();\n let node = sel.focusNode, offset = sel.focusOffset;\n if (!node)\n return;\n let len = nodeSize(node);\n let moveNode, moveOffset;\n for (;;) {\n if (offset < len) {\n if (!isElt(node))\n break;\n let after = node.childNodes[offset];\n if (isIgnorable(after, 1)) {\n moveNode = node;\n moveOffset = ++offset;\n }\n else {\n break;\n }\n }\n else if (isBlockNode(node)) {\n break;\n }\n else {\n let next = node.nextSibling;\n while (next && isIgnorable(next, 1)) {\n moveNode = next.parentNode;\n moveOffset = domIndex(next) + 1;\n next = next.nextSibling;\n }\n if (!next) {\n node = node.parentNode;\n if (node == view.dom)\n break;\n offset = len = 0;\n }\n else {\n node = next;\n offset = 0;\n len = nodeSize(node);\n }\n }\n }\n if (moveNode)\n setSelFocus(view, moveNode, moveOffset);\n}\nfunction isBlockNode(dom) {\n let desc = dom.pmViewDesc;\n return desc && desc.node && desc.node.isBlock;\n}\nfunction textNodeAfter(node, offset) {\n while (node && offset == node.childNodes.length && !hasBlockDesc(node)) {\n offset = domIndex(node) + 1;\n node = node.parentNode;\n }\n while (node && offset < node.childNodes.length) {\n let next = node.childNodes[offset];\n if (isText(next))\n return next;\n if (isElt(next) && next.contentEditable == \"false\")\n break;\n node = next;\n offset = 0;\n }\n}\nfunction textNodeBefore(node, offset) {\n while (node && !offset && !hasBlockDesc(node)) {\n offset = domIndex(node);\n node = node.parentNode;\n }\n while (node && offset) {\n let next = node.childNodes[offset - 1];\n if (isText(next))\n return next;\n if (isElt(next) && next.contentEditable == \"false\")\n break;\n node = next;\n offset = node.childNodes.length;\n }\n}\nfunction setSelFocus(view, node, offset) {\n if (!isText(node)) {\n let before, after;\n if (after = textNodeAfter(node, offset)) {\n node = after;\n offset = 0;\n }\n else if (before = textNodeBefore(node, offset)) {\n node = before;\n offset = before.nodeValue.length;\n }\n }\n let sel = view.domSelection();\n if (!sel)\n return;\n if (selectionCollapsed(sel)) {\n let range = document.createRange();\n range.setEnd(node, offset);\n range.setStart(node, offset);\n sel.removeAllRanges();\n sel.addRange(range);\n }\n else if (sel.extend) {\n sel.extend(node, offset);\n }\n view.domObserver.setCurSelection();\n let { state } = view;\n // If no state update ends up happening, reset the selection.\n setTimeout(() => {\n if (view.state == state)\n selectionToDOM(view);\n }, 50);\n}\nfunction findDirection(view, pos) {\n let $pos = view.state.doc.resolve(pos);\n if (!(chrome || windows) && $pos.parent.inlineContent) {\n let coords = view.coordsAtPos(pos);\n if (pos > $pos.start()) {\n let before = view.coordsAtPos(pos - 1);\n let mid = (before.top + before.bottom) / 2;\n if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1)\n return before.left < coords.left ? \"ltr\" : \"rtl\";\n }\n if (pos < $pos.end()) {\n let after = view.coordsAtPos(pos + 1);\n let mid = (after.top + after.bottom) / 2;\n if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1)\n return after.left > coords.left ? \"ltr\" : \"rtl\";\n }\n }\n let computed = getComputedStyle(view.dom).direction;\n return computed == \"rtl\" ? \"rtl\" : \"ltr\";\n}\n// Check whether vertical selection motion would involve node\n// selections. If so, apply it (if not, the result is left to the\n// browser)\nfunction selectVertically(view, dir, mods) {\n let sel = view.state.selection;\n if (sel instanceof TextSelection && !sel.empty || mods.indexOf(\"s\") > -1)\n return false;\n if (mac && mods.indexOf(\"m\") > -1)\n return false;\n let { $from, $to } = sel;\n if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? \"up\" : \"down\")) {\n let next = moveSelectionBlock(view.state, dir);\n if (next && (next instanceof NodeSelection))\n return apply(view, next);\n }\n if (!$from.parent.inlineContent) {\n let side = dir < 0 ? $from : $to;\n let beyond = sel instanceof AllSelection ? Selection.near(side, dir) : Selection.findFrom(side, dir);\n return beyond ? apply(view, beyond) : false;\n }\n return false;\n}\nfunction stopNativeHorizontalDelete(view, dir) {\n if (!(view.state.selection instanceof TextSelection))\n return true;\n let { $head, $anchor, empty } = view.state.selection;\n if (!$head.sameParent($anchor))\n return true;\n if (!empty)\n return false;\n if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\"))\n return true;\n let nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);\n if (nextNode && !nextNode.isText) {\n let tr = view.state.tr;\n if (dir < 0)\n tr.delete($head.pos - nextNode.nodeSize, $head.pos);\n else\n tr.delete($head.pos, $head.pos + nextNode.nodeSize);\n view.dispatch(tr);\n return true;\n }\n return false;\n}\nfunction switchEditable(view, node, state) {\n view.domObserver.stop();\n node.contentEditable = state;\n view.domObserver.start();\n}\n// Issue #867 / #1090 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821\n// In which Safari (and at some point in the past, Chrome) does really\n// wrong things when the down arrow is pressed when the cursor is\n// directly at the start of a textblock and has an uneditable node\n// after it\nfunction safariDownArrowBug(view) {\n if (!safari || view.state.selection.$head.parentOffset > 0)\n return false;\n let { focusNode, focusOffset } = view.domSelectionRange();\n if (focusNode && isElt(focusNode) && focusOffset == 0 &&\n focusNode.firstChild && isElt(focusNode.firstChild) && focusNode.firstChild.contentEditable == \"false\") {\n let child = focusNode.firstChild;\n switchEditable(view, child, \"true\");\n setTimeout(() => switchEditable(view, child, \"false\"), 20);\n }\n return false;\n}\n// A backdrop key mapping used to make sure we always suppress keys\n// that have a dangerous default effect, even if the commands they are\n// bound to return false, and to make sure that cursor-motion keys\n// find a cursor (as opposed to a node selection) when pressed. For\n// cursor-motion keys, the code in the handlers also takes care of\n// block selections.\nfunction getMods(event) {\n let result = \"\";\n if (event.ctrlKey)\n result += \"c\";\n if (event.metaKey)\n result += \"m\";\n if (event.altKey)\n result += \"a\";\n if (event.shiftKey)\n result += \"s\";\n return result;\n}\nfunction captureKeyDown(view, event) {\n let code = event.keyCode, mods = getMods(event);\n if (code == 8 || (mac && code == 72 && mods == \"c\")) { // Backspace, Ctrl-h on Mac\n return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodes(view, -1);\n }\n else if ((code == 46 && !event.shiftKey) || (mac && code == 68 && mods == \"c\")) { // Delete, Ctrl-d on Mac\n return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodes(view, 1);\n }\n else if (code == 13 || code == 27) { // Enter, Esc\n return true;\n }\n else if (code == 37 || (mac && code == 66 && mods == \"c\")) { // Left arrow, Ctrl-b on Mac\n let dir = code == 37 ? (findDirection(view, view.state.selection.from) == \"ltr\" ? -1 : 1) : -1;\n return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);\n }\n else if (code == 39 || (mac && code == 70 && mods == \"c\")) { // Right arrow, Ctrl-f on Mac\n let dir = code == 39 ? (findDirection(view, view.state.selection.from) == \"ltr\" ? 1 : -1) : 1;\n return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);\n }\n else if (code == 38 || (mac && code == 80 && mods == \"c\")) { // Up arrow, Ctrl-p on Mac\n return selectVertically(view, -1, mods) || skipIgnoredNodes(view, -1);\n }\n else if (code == 40 || (mac && code == 78 && mods == \"c\")) { // Down arrow, Ctrl-n on Mac\n return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodes(view, 1);\n }\n else if (mods == (mac ? \"m\" : \"c\") &&\n (code == 66 || code == 73 || code == 89 || code == 90)) { // Mod-[biyz]\n return true;\n }\n return false;\n}\n\nfunction serializeForClipboard(view, slice) {\n view.someProp(\"transformCopied\", f => { slice = f(slice, view); });\n let context = [], { content, openStart, openEnd } = slice;\n while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {\n openStart--;\n openEnd--;\n let node = content.firstChild;\n context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);\n content = node.content;\n }\n let serializer = view.someProp(\"clipboardSerializer\") || DOMSerializer.fromSchema(view.state.schema);\n let doc = detachedDoc(), wrap = doc.createElement(\"div\");\n wrap.appendChild(serializer.serializeFragment(content, { document: doc }));\n let firstChild = wrap.firstChild, needsWrap, wrappers = 0;\n while (firstChild && isElt(firstChild) && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {\n for (let i = needsWrap.length - 1; i >= 0; i--) {\n let wrapper = doc.createElement(needsWrap[i]);\n while (wrap.firstChild)\n wrapper.appendChild(wrap.firstChild);\n wrap.appendChild(wrapper);\n wrappers++;\n }\n firstChild = wrap.firstChild;\n }\n if (firstChild && isElt(firstChild))\n firstChild.setAttribute(\"data-pm-slice\", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : \"\"} ${JSON.stringify(context)}`);\n let text = view.someProp(\"clipboardTextSerializer\", f => f(slice, view)) ||\n slice.content.textBetween(0, slice.content.size, \"\\n\\n\");\n return { dom: wrap, text, slice };\n}\n// Read a slice of content from the clipboard (or drop data).\nfunction parseFromClipboard(view, text, html, plainText, $context) {\n let inCode = $context.parent.type.spec.code;\n let dom, slice;\n if (!html && !text)\n return null;\n let asText = !!text && (plainText || inCode || !html);\n if (asText) {\n view.someProp(\"transformPastedText\", f => { text = f(text, inCode || plainText, view); });\n if (inCode) {\n slice = new Slice(Fragment.from(view.state.schema.text(text.replace(/\\r\\n?/g, \"\\n\"))), 0, 0);\n view.someProp(\"transformPasted\", f => { slice = f(slice, view, true); });\n return slice;\n }\n let parsed = view.someProp(\"clipboardTextParser\", f => f(text, $context, plainText, view));\n if (parsed) {\n slice = parsed;\n }\n else {\n let marks = $context.marks();\n let { schema } = view.state, serializer = DOMSerializer.fromSchema(schema);\n dom = document.createElement(\"div\");\n text.split(/(?:\\r\\n?|\\n)+/).forEach(block => {\n let p = dom.appendChild(document.createElement(\"p\"));\n if (block)\n p.appendChild(serializer.serializeNode(schema.text(block, marks)));\n });\n }\n }\n else {\n view.someProp(\"transformPastedHTML\", f => { html = f(html, view); });\n dom = readHTML(html);\n if (webkit)\n restoreReplacedSpaces(dom);\n }\n let contextNode = dom && dom.querySelector(\"[data-pm-slice]\");\n let sliceData = contextNode && /^(\\d+) (\\d+)(?: -(\\d+))? (.*)/.exec(contextNode.getAttribute(\"data-pm-slice\") || \"\");\n if (sliceData && sliceData[3])\n for (let i = +sliceData[3]; i > 0; i--) {\n let child = dom.firstChild;\n while (child && !isElt(child))\n child = child.nextSibling;\n if (!child)\n break;\n dom = child;\n }\n if (!slice) {\n let parser = view.someProp(\"clipboardParser\") || view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n slice = parser.parseSlice(dom, {\n preserveWhitespace: !!(asText || sliceData),\n context: $context,\n ruleFromNode(dom) {\n if (dom.nodeName == \"BR\" && !dom.nextSibling &&\n dom.parentNode && !inlineParents.test(dom.parentNode.nodeName))\n return { ignore: true };\n return null;\n }\n });\n }\n if (sliceData) {\n slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]);\n }\n else { // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent\n slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), true);\n if (slice.openStart || slice.openEnd) {\n let openStart = 0, openEnd = 0;\n for (let node = slice.content.firstChild; openStart < slice.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild) { }\n for (let node = slice.content.lastChild; openEnd < slice.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild) { }\n slice = closeSlice(slice, openStart, openEnd);\n }\n }\n view.someProp(\"transformPasted\", f => { slice = f(slice, view, asText); });\n return slice;\n}\nconst inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;\n// Takes a slice parsed with parseSlice, which means there hasn't been\n// any content-expression checking done on the top nodes, tries to\n// find a parent node in the current context that might fit the nodes,\n// and if successful, rebuilds the slice so that it fits into that parent.\n//\n// This addresses the problem that Transform.replace expects a\n// coherent slice, and will fail to place a set of siblings that don't\n// fit anywhere in the schema.\nfunction normalizeSiblings(fragment, $context) {\n if (fragment.childCount < 2)\n return fragment;\n for (let d = $context.depth; d >= 0; d--) {\n let parent = $context.node(d);\n let match = parent.contentMatchAt($context.index(d));\n let lastWrap, result = [];\n fragment.forEach(node => {\n if (!result)\n return;\n let wrap = match.findWrapping(node.type), inLast;\n if (!wrap)\n return result = null;\n if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) {\n result[result.length - 1] = inLast;\n }\n else {\n if (result.length)\n result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length);\n let wrapped = withWrappers(node, wrap);\n result.push(wrapped);\n match = match.matchType(wrapped.type);\n lastWrap = wrap;\n }\n });\n if (result)\n return Fragment.from(result);\n }\n return fragment;\n}\nfunction withWrappers(node, wrap, from = 0) {\n for (let i = wrap.length - 1; i >= from; i--)\n node = wrap[i].create(null, Fragment.from(node));\n return node;\n}\n// Used to group adjacent nodes wrapped in similar parents by\n// normalizeSiblings into the same parent node\nfunction addToSibling(wrap, lastWrap, node, sibling, depth) {\n if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {\n let inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);\n if (inner)\n return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));\n let match = sibling.contentMatchAt(sibling.childCount);\n if (match.matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1]))\n return sibling.copy(sibling.content.append(Fragment.from(withWrappers(node, wrap, depth + 1))));\n }\n}\nfunction closeRight(node, depth) {\n if (depth == 0)\n return node;\n let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));\n let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);\n return node.copy(fragment.append(fill));\n}\nfunction closeRange(fragment, side, from, to, depth, openEnd) {\n let node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;\n if (fragment.childCount > 1)\n openEnd = 0;\n if (depth < to - 1)\n inner = closeRange(inner, side, from, to, depth + 1, openEnd);\n if (depth >= from)\n inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner)\n : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true));\n return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));\n}\nfunction closeSlice(slice, openStart, openEnd) {\n if (openStart < slice.openStart)\n slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd);\n if (openEnd < slice.openEnd)\n slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd);\n return slice;\n}\n// Trick from jQuery -- some elements must be wrapped in other\n// elements for innerHTML to work. I.e. if you do `div.innerHTML =\n// \"<td>..</td>\"` the table cells are ignored.\nconst wrapMap = {\n thead: [\"table\"],\n tbody: [\"table\"],\n tfoot: [\"table\"],\n caption: [\"table\"],\n colgroup: [\"table\"],\n col: [\"table\", \"colgroup\"],\n tr: [\"table\", \"tbody\"],\n td: [\"table\", \"tbody\", \"tr\"],\n th: [\"table\", \"tbody\", \"tr\"]\n};\nfunction detachedDoc() {\n return document.implementation.createHTMLDocument(\"title\");\n}\nlet _policy = null;\nfunction maybeWrapTrusted(html) {\n let trustedTypes = window.trustedTypes;\n if (!trustedTypes)\n return html;\n // With the require-trusted-types-for CSP, Chrome will block\n // innerHTML, even on a detached document. This wraps the string in\n // a way that makes the browser allow us to use its parser again.\n if (!_policy) {\n if (_policy = trustedTypes.defaultPolicy)\n try {\n return _policy.createHTML(html);\n }\n catch (_a) { }\n _policy = trustedTypes.createPolicy(\"ProseMirrorClipboard\", { createHTML: (s) => s });\n }\n return _policy.createHTML(html);\n}\nfunction readHTML(html) {\n let metas = /^(\\s*<meta [^>]*>)*/.exec(html);\n if (metas)\n html = html.slice(metas[0].length);\n let doc = detachedDoc(), elt = doc.body;\n let firstTag = /<([a-z][^>\\s]+)/i.exec(html), wrap;\n if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()])\n html = wrap.map(n => \"<\" + n + \">\").join(\"\") + html + wrap.map(n => \"</\" + n + \">\").reverse().join(\"\");\n elt.innerHTML = maybeWrapTrusted(html);\n if (wrap)\n for (let i = 0; i < wrap.length; i++)\n elt = elt.querySelector(wrap[i]) || elt;\n // Inline styles defined in the pasted content, so that parse rules pick them up\n for (let i = 0; i < doc.styleSheets.length; i++) {\n let style = doc.styleSheets[i];\n for (let j = 0; j < style.rules.length; j++) {\n let rule = style.rules[j];\n if (rule instanceof CSSStyleRule) {\n let matches = elt.querySelectorAll(rule.selectorText);\n for (let k = 0; k < matches.length; k++)\n matches[k].style.cssText += rule.style.cssText;\n }\n }\n }\n return elt;\n}\n// Webkit browsers do some hard-to-predict replacement of regular\n// spaces with non-breaking spaces when putting content on the\n// clipboard. This tries to convert such non-breaking spaces (which\n// will be wrapped in a plain span on Chrome, a span with class\n// Apple-converted-space on Safari) back to regular spaces.\nfunction restoreReplacedSpaces(dom) {\n let nodes = dom.querySelectorAll(chrome ? \"span:not([class]):not([style])\" : \"span.Apple-converted-space\");\n for (let i = 0; i < nodes.length; i++) {\n let node = nodes[i];\n if (node.childNodes.length == 1 && node.textContent == \"\\u00a0\" && node.parentNode)\n node.parentNode.replaceChild(dom.ownerDocument.createTextNode(\" \"), node);\n }\n}\nfunction addContext(slice, context) {\n if (!slice.size)\n return slice;\n let schema = slice.content.firstChild.type.schema, array;\n try {\n array = JSON.parse(context);\n }\n catch (e) {\n return slice;\n }\n let { content, openStart, openEnd } = slice;\n for (let i = array.length - 2; i >= 0; i -= 2) {\n let type = schema.nodes[array[i]];\n if (!type || type.hasRequiredAttrs())\n break;\n try {\n content = Fragment.from(type.create(array[i + 1], content));\n }\n catch (e) {\n break;\n }\n openStart++;\n openEnd++;\n }\n return new Slice(content, openStart, openEnd);\n}\n\n// A collection of DOM events that occur within the editor, and callback functions\n// to invoke when the event fires.\nconst handlers = {};\nconst editHandlers = {};\nconst passiveHandlers = { touchstart: true, touchmove: true };\nclass InputState {\n constructor() {\n this.shiftKey = false;\n this.mouseDown = null;\n this.lastKeyCode = null;\n this.lastKeyCodeTime = 0;\n this.lastClick = { time: 0, x: 0, y: 0, type: \"\", button: 0 };\n this.lastSelectionOrigin = null;\n this.lastSelectionTime = 0;\n this.lastIOSEnter = 0;\n this.lastIOSEnterFallbackTimeout = -1;\n this.lastFocus = 0;\n this.lastTouch = 0;\n this.lastChromeDelete = 0;\n this.composing = false;\n this.compositionNode = null;\n this.composingTimeout = -1;\n this.compositionNodes = [];\n this.compositionEndedAt = -2e8;\n this.compositionID = 1;\n this.badSafariComposition = false;\n // Set to a composition ID when there are pending changes at compositionend\n this.compositionPendingChanges = 0;\n this.domChangeCount = 0;\n this.eventHandlers = Object.create(null);\n this.hideSelectionGuard = null;\n }\n}\nfunction initInput(view) {\n for (let event in handlers) {\n let handler = handlers[event];\n view.dom.addEventListener(event, view.input.eventHandlers[event] = (event) => {\n if (eventBelongsToView(view, event) && !runCustomHandler(view, event) &&\n (view.editable || !(event.type in editHandlers)))\n handler(view, event);\n }, passiveHandlers[event] ? { passive: true } : undefined);\n }\n // On Safari, for reasons beyond my understanding, adding an input\n // event handler makes an issue where the composition vanishes when\n // you press enter go away.\n if (safari)\n view.dom.addEventListener(\"input\", () => null);\n ensureListeners(view);\n}\nfunction setSelectionOrigin(view, origin) {\n view.input.lastSelectionOrigin = origin;\n view.input.lastSelectionTime = Date.now();\n}\nfunction destroyInput(view) {\n if (view.input.mouseDown)\n view.input.mouseDown.done();\n view.domObserver.stop();\n for (let type in view.input.eventHandlers)\n view.dom.removeEventListener(type, view.input.eventHandlers[type]);\n clearTimeout(view.input.composingTimeout);\n clearTimeout(view.input.lastIOSEnterFallbackTimeout);\n}\nfunction ensureListeners(view) {\n view.someProp(\"handleDOMEvents\", currentHandlers => {\n for (let type in currentHandlers)\n if (!view.input.eventHandlers[type])\n view.dom.addEventListener(type, view.input.eventHandlers[type] = event => runCustomHandler(view, event));\n });\n}\nfunction runCustomHandler(view, event) {\n return view.someProp(\"handleDOMEvents\", handlers => {\n let handler = handlers[event.type];\n return handler ? handler(view, event) || event.defaultPrevented : false;\n });\n}\nfunction eventBelongsToView(view, event) {\n if (!event.bubbles)\n return true;\n if (event.defaultPrevented)\n return false;\n for (let node = event.target; node != view.dom; node = node.parentNode)\n if (!node || node.nodeType == 11 ||\n (node.pmViewDesc && node.pmViewDesc.stopEvent(event)))\n return false;\n return true;\n}\nfunction dispatchEvent(view, event) {\n if (!runCustomHandler(view, event) && handlers[event.type] &&\n (view.editable || !(event.type in editHandlers)))\n handlers[event.type](view, event);\n}\neditHandlers.keydown = (view, _event) => {\n let event = _event;\n view.input.shiftKey = event.keyCode == 16 || event.shiftKey;\n if (inOrNearComposition(view))\n return;\n view.input.lastKeyCode = event.keyCode;\n view.input.lastKeyCodeTime = Date.now();\n // Suppress enter key events on Chrome Android, because those tend\n // to be part of a confused sequence of composition events fired,\n // and handling them eagerly tends to corrupt the input.\n if (android && chrome && event.keyCode == 13)\n return;\n if (event.keyCode != 229)\n view.domObserver.forceFlush();\n // On iOS, if we preventDefault enter key presses, the virtual\n // keyboard gets confused. So the hack here is to set a flag that\n // makes the DOM change code recognize that what just happens should\n // be replaced by whatever the Enter key handlers do.\n if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {\n let now = Date.now();\n view.input.lastIOSEnter = now;\n view.input.lastIOSEnterFallbackTimeout = setTimeout(() => {\n if (view.input.lastIOSEnter == now) {\n view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")));\n view.input.lastIOSEnter = 0;\n }\n }, 200);\n }\n else if (view.someProp(\"handleKeyDown\", f => f(view, event)) || captureKeyDown(view, event)) {\n event.preventDefault();\n }\n else {\n setSelectionOrigin(view, \"key\");\n }\n};\neditHandlers.keyup = (view, event) => {\n if (event.keyCode == 16)\n view.input.shiftKey = false;\n};\neditHandlers.keypress = (view, _event) => {\n let event = _event;\n if (inOrNearComposition(view) || !event.charCode ||\n event.ctrlKey && !event.altKey || mac && event.metaKey)\n return;\n if (view.someProp(\"handleKeyPress\", f => f(view, event))) {\n event.preventDefault();\n return;\n }\n let sel = view.state.selection;\n if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {\n let text = String.fromCharCode(event.charCode);\n let deflt = () => view.state.tr.insertText(text).scrollIntoView();\n if (!/[\\r\\n]/.test(text) && !view.someProp(\"handleTextInput\", f => f(view, sel.$from.pos, sel.$to.pos, text, deflt)))\n view.dispatch(deflt());\n event.preventDefault();\n }\n};\nfunction eventCoords(event) { return { left: event.clientX, top: event.clientY }; }\nfunction isNear(event, click) {\n let dx = click.x - event.clientX, dy = click.y - event.clientY;\n return dx * dx + dy * dy < 100;\n}\nfunction runHandlerOnContext(view, propName, pos, inside, event) {\n if (inside == -1)\n return false;\n let $pos = view.state.doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n if (view.someProp(propName, f => i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true)\n : f(view, pos, $pos.node(i), $pos.before(i), event, false)))\n return true;\n }\n return false;\n}\nfunction updateSelection(view, selection, origin) {\n if (!view.focused)\n view.focus();\n if (view.state.selection.eq(selection))\n return;\n let tr = view.state.tr.setSelection(selection);\n tr.setMeta(\"pointer\", true);\n view.dispatch(tr);\n}\nfunction selectClickedLeaf(view, inside) {\n if (inside == -1)\n return false;\n let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;\n if (node && node.isAtom && NodeSelection.isSelectable(node)) {\n updateSelection(view, new NodeSelection($pos));\n return true;\n }\n return false;\n}\nfunction selectClickedNode(view, inside) {\n if (inside == -1)\n return false;\n let sel = view.state.selection, selectedNode, selectAt;\n if (sel instanceof NodeSelection)\n selectedNode = sel.node;\n let $pos = view.state.doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n if (NodeSelection.isSelectable(node)) {\n if (selectedNode && sel.$from.depth > 0 &&\n i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos)\n selectAt = $pos.before(sel.$from.depth);\n else\n selectAt = $pos.before(i);\n break;\n }\n }\n if (selectAt != null) {\n updateSelection(view, NodeSelection.create(view.state.doc, selectAt));\n return true;\n }\n else {\n return false;\n }\n}\nfunction handleSingleClick(view, pos, inside, event, selectNode) {\n return runHandlerOnContext(view, \"handleClickOn\", pos, inside, event) ||\n view.someProp(\"handleClick\", f => f(view, pos, event)) ||\n (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside));\n}\nfunction handleDoubleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleDoubleClickOn\", pos, inside, event) ||\n view.someProp(\"handleDoubleClick\", f => f(view, pos, event));\n}\nfunction handleTripleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleTripleClickOn\", pos, inside, event) ||\n view.someProp(\"handleTripleClick\", f => f(view, pos, event)) ||\n defaultTripleClick(view, inside, event);\n}\nfunction defaultTripleClick(view, inside, event) {\n if (event.button != 0)\n return false;\n let selection = selectionForTripleClick(view, inside, true), doc = view.state.doc;\n if (!selection)\n return false;\n updateSelection(view, selection);\n if (selection instanceof TextSelection && doc.eq(view.state.doc))\n view.input.mouseDown = new TripleClickDrag(view, selection);\n return true;\n}\nfunction selectionForTripleClick(view, inside, selectNodes) {\n let doc = view.state.doc;\n if (inside == -1)\n return doc.inlineContent ? TextSelection.create(doc, 0, doc.content.size) : null;\n let $pos = doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n let nodePos = $pos.before(i);\n if (node.inlineContent)\n return TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size);\n else if (selectNodes && NodeSelection.isSelectable(node))\n return NodeSelection.create(doc, nodePos);\n }\n return null;\n}\nfunction forceDOMFlush(view) {\n return endComposition(view);\n}\nconst selectNodeModifier = mac ? \"metaKey\" : \"ctrlKey\";\nhandlers.mousedown = (view, _event) => {\n let event = _event;\n view.input.shiftKey = event.shiftKey;\n let flushed = forceDOMFlush(view);\n let now = Date.now(), type = \"singleClick\";\n if (now - view.input.lastClick.time < 500 && isNear(event, view.input.lastClick) && !event[selectNodeModifier] &&\n view.input.lastClick.button == event.button) {\n if (view.input.lastClick.type == \"singleClick\")\n type = \"doubleClick\";\n else if (view.input.lastClick.type == \"doubleClick\")\n type = \"tripleClick\";\n }\n view.input.lastClick = { time: now, x: event.clientX, y: event.clientY, type, button: event.button };\n if (view.input.mouseDown)\n view.input.mouseDown.done();\n let pos = view.posAtCoords(eventCoords(event));\n if (!pos)\n return;\n if (type == \"singleClick\") {\n view.input.mouseDown = new LeftMouseDown(view, pos, event, !!flushed);\n }\n else if ((type == \"doubleClick\" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {\n event.preventDefault();\n }\n else {\n setSelectionOrigin(view, \"pointer\");\n }\n};\nclass MouseDown {\n constructor(view) {\n this.view = view;\n this.mightDrag = null;\n view.root.addEventListener(\"mouseup\", this.up = this.up.bind(this));\n view.root.addEventListener(\"mousemove\", this.move = this.move.bind(this));\n }\n up(event) {\n this.done();\n }\n move(event) {\n if (event.buttons == 0)\n this.done();\n }\n done() {\n this.view.root.removeEventListener(\"mouseup\", this.up);\n this.view.root.removeEventListener(\"mousemove\", this.move);\n if (this.view.input.mouseDown == this)\n this.view.input.mouseDown = null;\n }\n delaySelUpdate() { return false; }\n}\nclass LeftMouseDown extends MouseDown {\n constructor(view, pos, event, flushed) {\n super(view);\n this.pos = pos;\n this.event = event;\n this.flushed = flushed;\n this.delayedSelectionSync = false;\n this.startDoc = view.state.doc;\n this.selectNode = !!event[selectNodeModifier];\n this.allowDefault = event.shiftKey;\n let targetNode, targetPos;\n if (pos.inside > -1) {\n targetNode = view.state.doc.nodeAt(pos.inside);\n targetPos = pos.inside;\n }\n else {\n let $pos = view.state.doc.resolve(pos.pos);\n targetNode = $pos.parent;\n targetPos = $pos.depth ? $pos.before() : 0;\n }\n const target = flushed ? null : event.target;\n const targetDesc = target ? view.docView.nearestDesc(target, true) : null;\n this.target = targetDesc && isElt(targetDesc.nodeDOM) ? targetDesc.nodeDOM : null;\n let { selection } = view.state;\n if (event.button == 0 &&\n (targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false ||\n selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos))\n this.mightDrag = {\n node: targetNode,\n pos: targetPos,\n addAttr: !!(this.target && !this.target.draggable),\n setUneditable: !!(this.target && gecko && !this.target.hasAttribute(\"contentEditable\"))\n };\n if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr)\n this.target.draggable = true;\n if (this.mightDrag.setUneditable)\n setTimeout(() => {\n if (this.view.input.mouseDown == this)\n this.target.setAttribute(\"contentEditable\", \"false\");\n }, 20);\n this.view.domObserver.start();\n }\n setSelectionOrigin(view, \"pointer\");\n }\n done() {\n super.done();\n if (this.mightDrag && this.target) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr)\n this.target.removeAttribute(\"draggable\");\n if (this.mightDrag.setUneditable)\n this.target.removeAttribute(\"contentEditable\");\n this.view.domObserver.start();\n }\n if (this.delayedSelectionSync)\n setTimeout(() => {\n if (!this.view.isDestroyed)\n selectionToDOM(this.view);\n });\n }\n up(event) {\n this.done();\n if (!this.view.dom.contains(event.target))\n return;\n let pos = this.pos;\n if (this.view.state.doc != this.startDoc)\n pos = this.view.posAtCoords(eventCoords(event));\n this.updateAllowDefault(event);\n if (this.allowDefault || !pos) {\n setSelectionOrigin(this.view, \"pointer\");\n }\n else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) {\n event.preventDefault();\n }\n else if (event.button == 0 &&\n (this.flushed ||\n // Safari ignores clicks on draggable elements\n (safari && this.mightDrag && !this.mightDrag.node.isAtom) ||\n // Chrome will sometimes treat a node selection as a\n // cursor, but still report that the node is selected\n // when asked through getSelection. You'll then get a\n // situation where clicking at the point where that\n // (hidden) cursor is doesn't change the selection, and\n // thus doesn't get a reaction from ProseMirror. This\n // works around that.\n (chrome && !this.view.state.selection.visible &&\n Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2))) {\n updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)));\n event.preventDefault();\n }\n else {\n setSelectionOrigin(this.view, \"pointer\");\n }\n }\n move(event) {\n this.updateAllowDefault(event);\n setSelectionOrigin(this.view, \"pointer\");\n super.move(event);\n }\n updateAllowDefault(event) {\n if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 ||\n Math.abs(this.event.y - event.clientY) > 4))\n this.allowDefault = true;\n }\n delaySelUpdate() {\n if (!this.allowDefault)\n return false;\n this.delayedSelectionSync = true;\n return true;\n }\n}\nclass TripleClickDrag extends MouseDown {\n constructor(view, startSelection) {\n super(view);\n this.startSelection = startSelection;\n this.startDoc = view.state.doc;\n }\n move(event) {\n if (event.buttons == 0 || this.view.isDestroyed || !this.view.state.doc.eq(this.startDoc)) {\n this.done();\n return;\n }\n event.preventDefault();\n setSelectionOrigin(this.view, \"pointer\");\n let pos = this.view.posAtCoords(eventCoords(event));\n let target = pos && selectionForTripleClick(this.view, pos.inside, false);\n if (!target)\n return;\n let { doc } = this.view.state, start = this.startSelection;\n let [anchor, head] = target.from < start.from ? [start.to, target.from] : [start.from, target.to];\n updateSelection(this.view, TextSelection.create(doc, anchor, head));\n }\n}\nhandlers.touchstart = view => {\n view.input.lastTouch = Date.now();\n forceDOMFlush(view);\n setSelectionOrigin(view, \"pointer\");\n};\nhandlers.touchmove = view => {\n view.input.lastTouch = Date.now();\n setSelectionOrigin(view, \"pointer\");\n};\nhandlers.contextmenu = view => forceDOMFlush(view);\nfunction inOrNearComposition(view, event) {\n if (view.composing)\n return true;\n // See https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/.\n // On Japanese input method editors (IMEs), the Enter key is used to confirm character\n // selection. On Safari, when Enter is pressed, compositionend and keydown events are\n // emitted. The keydown event triggers newline insertion, which we don't want.\n // This method returns true if the keydown event should be ignored.\n // We only ignore it once, as pressing Enter a second time *should* insert a newline.\n // Furthermore, the keydown event timestamp must be close to the compositionEndedAt timestamp.\n // This guards against the case where compositionend is triggered without the keyboard\n // (e.g. character confirmation may be done with the mouse), and keydown is triggered\n // afterwards- we wouldn't want to ignore the keydown event in this case.\n if (safari && Math.abs(Date.now() - view.input.compositionEndedAt) < 500) {\n view.input.compositionEndedAt = -2e8;\n return true;\n }\n return false;\n}\n// Drop active composition after 5 seconds of inactivity on Android\nconst timeoutComposition = android ? 5000 : -1;\neditHandlers.compositionstart = editHandlers.compositionupdate = view => {\n if (!view.composing) {\n view.domObserver.flush();\n let { state } = view, $pos = state.selection.$to;\n if (state.selection instanceof TextSelection && state.selection.empty &&\n (state.storedMarks ||\n (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false)) ||\n chrome && windows && selectionBeforeUneditable(view))) { // Issue #1500\n // Need to wrap the cursor in mark nodes different from the ones in the DOM context\n view.markCursor = view.state.storedMarks || $pos.marks();\n endComposition(view, true);\n view.markCursor = null;\n }\n else {\n endComposition(view, !state.selection.empty);\n // In firefox, if the cursor is after but outside a marked node,\n // the inserted text won't inherit the marks. So this moves it\n // inside if necessary.\n if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {\n let sel = view.domSelectionRange();\n for (let node = sel.focusNode, offset = sel.focusOffset; node && isElt(node) && offset != 0;) {\n let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];\n if (!before)\n break;\n if (isText(before)) {\n let sel = view.domSelection();\n if (sel)\n sel.collapse(before, before.nodeValue.length);\n break;\n }\n else {\n node = before;\n offset = -1;\n }\n }\n }\n }\n view.input.composing = true;\n }\n scheduleComposeEnd(view, timeoutComposition);\n};\nfunction selectionBeforeUneditable(view) {\n let { focusNode, focusOffset } = view.domSelectionRange();\n if (!focusNode || !isElt(focusNode) || focusOffset >= focusNode.childNodes.length)\n return false;\n let next = focusNode.childNodes[focusOffset];\n return isElt(next) && next.contentEditable == \"false\";\n}\neditHandlers.compositionend = (view, event) => {\n if (view.composing) {\n view.input.composing = false;\n view.input.compositionEndedAt = Date.now();\n view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;\n view.input.compositionNode = null;\n if (view.input.badSafariComposition)\n view.domObserver.forceFlush();\n else if (view.input.compositionPendingChanges)\n Promise.resolve().then(() => view.domObserver.flush());\n view.input.compositionID++;\n scheduleComposeEnd(view, 20);\n }\n};\nfunction scheduleComposeEnd(view, delay) {\n clearTimeout(view.input.composingTimeout);\n if (delay > -1)\n view.input.composingTimeout = setTimeout(() => endComposition(view), delay);\n}\nfunction clearComposition(view) {\n if (view.composing) {\n view.input.composing = false;\n view.input.compositionEndedAt = Date.now();\n }\n while (view.input.compositionNodes.length > 0)\n view.input.compositionNodes.pop().markParentsDirty();\n}\nfunction findCompositionNode(view) {\n let sel = view.domSelectionRange();\n if (!sel.focusNode)\n return null;\n let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);\n let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);\n if (textBefore && textAfter && textBefore != textAfter) {\n let descAfter = textAfter.pmViewDesc, lastChanged = view.domObserver.lastChangedTextNode;\n if (textBefore == lastChanged || textAfter == lastChanged)\n return lastChanged;\n if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {\n return textAfter;\n }\n else if (view.input.compositionNode == textAfter) {\n let descBefore = textBefore.pmViewDesc;\n if (!(!descBefore || !descBefore.isText(textBefore.nodeValue)))\n return textAfter;\n }\n }\n return textBefore || textAfter;\n}\n/**\n@internal\n*/\nfunction endComposition(view, restarting = false) {\n if (android && view.domObserver.flushingSoon >= 0)\n return;\n view.domObserver.forceFlush();\n clearComposition(view);\n if (restarting || view.docView && view.docView.dirty) {\n let sel = selectionFromDOM(view), cur = view.state.selection;\n if (sel && !sel.eq(cur))\n view.dispatch(view.state.tr.setSelection(sel));\n else if ((view.markCursor || restarting) && !cur.$from.node(cur.$from.sharedDepth(cur.to)).inlineContent)\n view.dispatch(view.state.tr.deleteSelection());\n else\n view.updateState(view.state);\n return true;\n }\n return false;\n}\nfunction captureCopy(view, dom) {\n // The extra wrapper is somehow necessary on IE/Edge to prevent the\n // content from being mangled when it is put onto the clipboard\n if (!view.dom.parentNode)\n return;\n let wrap = view.dom.parentNode.appendChild(document.createElement(\"div\"));\n wrap.appendChild(dom);\n wrap.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n let sel = getSelection(), range = document.createRange();\n range.selectNodeContents(dom);\n // Done because IE will fire a selectionchange moving the selection\n // to its start when removeAllRanges is called and the editor still\n // has focus (which will mess up the editor's selection state).\n view.dom.blur();\n sel.removeAllRanges();\n sel.addRange(range);\n setTimeout(() => {\n if (wrap.parentNode)\n wrap.parentNode.removeChild(wrap);\n view.focus();\n }, 50);\n}\n// This is very crude, but unfortunately both these browsers _pretend_\n// that they have a clipboard API—all the objects and methods are\n// there, they just don't work, and they are hard to test.\nconst brokenClipboardAPI = (ie && ie_version < 15) ||\n (ios && webkit_version < 604);\nhandlers.copy = editHandlers.cut = (view, _event) => {\n let event = _event;\n let sel = view.state.selection, cut = event.type == \"cut\";\n if (sel.empty)\n return;\n // IE and Edge's clipboard interface is completely broken\n let data = brokenClipboardAPI ? null : event.clipboardData;\n let slice = sel.content(), { dom, text } = serializeForClipboard(view, slice);\n if (data) {\n event.preventDefault();\n data.clearData();\n data.setData(\"text/html\", dom.innerHTML);\n data.setData(\"text/plain\", text);\n }\n else {\n captureCopy(view, dom);\n }\n if (cut)\n view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta(\"uiEvent\", \"cut\"));\n};\nfunction sliceSingleNode(slice) {\n return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null;\n}\nfunction capturePaste(view, event) {\n if (!view.dom.parentNode)\n return;\n let plainText = view.input.shiftKey || view.state.selection.$from.parent.type.spec.code;\n let target = view.dom.parentNode.appendChild(document.createElement(plainText ? \"textarea\" : \"div\"));\n if (!plainText)\n target.contentEditable = \"true\";\n target.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n target.focus();\n let plain = view.input.shiftKey && view.input.lastKeyCode != 45;\n setTimeout(() => {\n view.focus();\n if (target.parentNode)\n target.parentNode.removeChild(target);\n if (plainText)\n doPaste(view, target.value, null, plain, event);\n else\n doPaste(view, target.textContent, target.innerHTML, plain, event);\n }, 50);\n}\nfunction doPaste(view, text, html, preferPlain, event) {\n let slice = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);\n if (view.someProp(\"handlePaste\", f => f(view, event, slice || Slice.empty)))\n return true;\n if (!slice)\n return false;\n let singleNode = sliceSingleNode(slice);\n let tr = singleNode\n ? view.state.tr.replaceSelectionWith(singleNode, preferPlain)\n : view.state.tr.replaceSelection(slice);\n view.dispatch(tr.scrollIntoView().setMeta(\"paste\", true).setMeta(\"uiEvent\", \"paste\"));\n return true;\n}\nfunction getText(clipboardData) {\n let text = clipboardData.getData(\"text/plain\") || clipboardData.getData(\"Text\");\n if (text)\n return text;\n let uris = clipboardData.getData(\"text/uri-list\");\n return uris ? uris.replace(/\\r?\\n/g, \" \") : \"\";\n}\neditHandlers.paste = (view, _event) => {\n let event = _event;\n // Handling paste from JavaScript during composition is very poorly\n // handled by browsers, so as a dodgy but preferable kludge, we just\n // let the browser do its native thing there, except on Android,\n // where the editor is almost always composing.\n if (view.composing && !android)\n return;\n let data = brokenClipboardAPI ? null : event.clipboardData;\n let plain = view.input.shiftKey && view.input.lastKeyCode != 45;\n if (data && doPaste(view, getText(data), data.getData(\"text/html\"), plain, event))\n event.preventDefault();\n else\n capturePaste(view, event);\n};\nclass Dragging {\n constructor(slice, move, node) {\n this.slice = slice;\n this.move = move;\n this.node = node;\n }\n}\nconst dragCopyModifier = mac ? \"altKey\" : \"ctrlKey\";\nfunction dragMoves(view, event) {\n let copy;\n view.someProp(\"dragCopies\", test => { copy = copy || test(event); });\n return copy != null ? !copy : !event[dragCopyModifier];\n}\nhandlers.dragstart = (view, _event) => {\n let event = _event;\n let mouseDown = view.input.mouseDown;\n if (mouseDown)\n mouseDown.done();\n if (!event.dataTransfer)\n return;\n let sel = view.state.selection;\n let pos = sel.empty ? null : view.posAtCoords(eventCoords(event));\n let node;\n if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to)) ;\n else if (mouseDown && mouseDown.mightDrag) {\n node = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);\n }\n else if (event.target && isElt(event.target)) {\n let desc = view.docView.nearestDesc(event.target, true);\n if (desc && desc.node.type.spec.draggable && desc != view.docView)\n node = NodeSelection.create(view.state.doc, desc.posBefore);\n }\n let draggedSlice = (node || view.state.selection).content();\n let { dom, text, slice } = serializeForClipboard(view, draggedSlice);\n // Pre-120 Chrome versions clear files when calling `clearData` (#1472)\n if (!event.dataTransfer.files.length || !chrome || chrome_version > 120)\n event.dataTransfer.clearData();\n event.dataTransfer.setData(brokenClipboardAPI ? \"Text\" : \"text/html\", dom.innerHTML);\n // See https://code.haverbeke.berlin/prosemirror/prosemirror/issues/1156\n event.dataTransfer.effectAllowed = \"copyMove\";\n if (!brokenClipboardAPI)\n event.dataTransfer.setData(\"text/plain\", text);\n view.dragging = new Dragging(slice, dragMoves(view, event), node);\n};\nhandlers.dragend = view => {\n let dragging = view.dragging;\n window.setTimeout(() => {\n if (view.dragging == dragging)\n view.dragging = null;\n }, 50);\n};\neditHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();\neditHandlers.drop = (view, event) => {\n try {\n handleDrop(view, event, view.dragging);\n }\n finally {\n view.dragging = null;\n }\n};\nfunction handleDrop(view, event, dragging) {\n if (!event.dataTransfer)\n return;\n let eventPos = view.posAtCoords(eventCoords(event));\n if (!eventPos)\n return;\n let $mouse = view.state.doc.resolve(eventPos.pos);\n let slice = dragging && dragging.slice;\n if (slice) {\n view.someProp(\"transformPasted\", f => { slice = f(slice, view, false); });\n }\n else {\n slice = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData(\"text/html\"), false, $mouse);\n }\n let move = !!(dragging && dragMoves(view, event));\n if (view.someProp(\"handleDrop\", f => f(view, event, slice || Slice.empty, move))) {\n event.preventDefault();\n return;\n }\n if (!slice)\n return;\n event.preventDefault();\n let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;\n if (insertPos == null)\n insertPos = $mouse.pos;\n let tr = view.state.tr;\n if (move) {\n let { node } = dragging;\n if (node)\n node.replace(tr);\n else\n tr.deleteSelection();\n }\n let pos = tr.mapping.map(insertPos);\n let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;\n let beforeInsert = tr.doc;\n if (isNode)\n tr.replaceRangeWith(pos, pos, slice.content.firstChild);\n else\n tr.replaceRange(pos, pos, slice);\n if (tr.doc.eq(beforeInsert))\n return;\n let $pos = tr.doc.resolve(pos);\n if (isNode && NodeSelection.isSelectable(slice.content.firstChild) &&\n $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) {\n tr.setSelection(new NodeSelection($pos));\n }\n else {\n let end = tr.mapping.map(insertPos);\n tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo);\n tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));\n }\n view.focus();\n view.dispatch(tr.setMeta(\"uiEvent\", \"drop\"));\n}\nhandlers.focus = view => {\n view.input.lastFocus = Date.now();\n if (!view.focused) {\n view.domObserver.stop();\n view.dom.classList.add(\"ProseMirror-focused\");\n view.domObserver.start();\n view.focused = true;\n setTimeout(() => {\n if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange()))\n selectionToDOM(view);\n }, 20);\n }\n};\nhandlers.blur = (view, _event) => {\n let event = _event;\n if (view.focused) {\n view.domObserver.stop();\n view.dom.classList.remove(\"ProseMirror-focused\");\n view.domObserver.start();\n if (event.relatedTarget && view.dom.contains(event.relatedTarget))\n view.domObserver.currentSelection.clear();\n view.focused = false;\n }\n};\nhandlers.beforeinput = (view, _event) => {\n let event = _event;\n // We should probably do more with beforeinput events, but support\n // is so spotty that I'm still waiting to see where they are going.\n // Very specific hack to deal with backspace sometimes failing on\n // Chrome and Firefox Android when after an uneditable node.\n if (android && event.inputType == \"deleteContentBackward\") {\n view.domObserver.flushSoon();\n let { domChangeCount } = view.input;\n setTimeout(() => {\n if (view.input.domChangeCount != domChangeCount)\n return; // Event already had some effect\n // This bug tends to close the virtual keyboard, so we refocus\n view.dom.blur();\n view.focus();\n if (view.someProp(\"handleKeyDown\", f => f(view, keyEvent(8, \"Backspace\"))))\n return;\n let { $cursor } = view.state.selection;\n // Crude approximation of backspace behavior when no command handled it\n if ($cursor && $cursor.pos > 0)\n view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView());\n }, 50);\n }\n};\n// Make sure all handlers get registered\nfor (let prop in editHandlers)\n handlers[prop] = editHandlers[prop];\n\nfunction compareObjs(a, b) {\n if (a == b)\n return true;\n for (let p in a)\n if (a[p] !== b[p])\n return false;\n for (let p in b)\n if (!(p in a))\n return false;\n return true;\n}\nclass WidgetType {\n constructor(toDOM, spec) {\n this.toDOM = toDOM;\n this.spec = spec || noSpec;\n this.side = this.spec.side || 0;\n }\n map(mapping, span, offset, oldOffset) {\n let { pos, deleted } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);\n return deleted ? null : new Decoration(pos - offset, pos - offset, this);\n }\n valid() { return true; }\n eq(other) {\n return this == other ||\n (other instanceof WidgetType &&\n (this.spec.key && this.spec.key == other.spec.key ||\n this.toDOM == other.toDOM && compareObjs(this.spec, other.spec)));\n }\n destroy(node) {\n if (this.spec.destroy)\n this.spec.destroy(node);\n }\n}\nclass InlineType {\n constructor(attrs, spec) {\n this.attrs = attrs;\n this.spec = spec || noSpec;\n }\n map(mapping, span, offset, oldOffset) {\n let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;\n let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;\n return from >= to ? null : new Decoration(from, to, this);\n }\n valid(_, span) { return span.from < span.to; }\n eq(other) {\n return this == other ||\n (other instanceof InlineType && compareObjs(this.attrs, other.attrs) &&\n compareObjs(this.spec, other.spec));\n }\n static is(span) { return span.type instanceof InlineType; }\n destroy() { }\n}\nclass NodeType {\n constructor(attrs, spec) {\n this.attrs = attrs;\n this.spec = spec || noSpec;\n }\n map(mapping, span, offset, oldOffset) {\n let from = mapping.mapResult(span.from + oldOffset, 1);\n if (from.deleted)\n return null;\n let to = mapping.mapResult(span.to + oldOffset, -1);\n if (to.deleted || to.pos <= from.pos)\n return null;\n return new Decoration(from.pos - offset, to.pos - offset, this);\n }\n valid(node, span) {\n let { index, offset } = node.content.findIndex(span.from), child;\n return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to;\n }\n eq(other) {\n return this == other ||\n (other instanceof NodeType && compareObjs(this.attrs, other.attrs) &&\n compareObjs(this.spec, other.spec));\n }\n destroy() { }\n}\n/**\nDecoration objects can be provided to the view through the\n[`decorations` prop](https://prosemirror.net/docs/ref/#view.EditorProps.decorations). They come in\nseveral variants—see the static members of this class for details.\n*/\nclass Decoration {\n /**\n @internal\n */\n constructor(\n /**\n The start position of the decoration.\n */\n from, \n /**\n The end position. Will be the same as `from` for [widget\n decorations](https://prosemirror.net/docs/ref/#view.Decoration^widget).\n */\n to, \n /**\n @internal\n */\n type) {\n this.from = from;\n this.to = to;\n this.type = type;\n }\n /**\n @internal\n */\n copy(from, to) {\n return new Decoration(from, to, this.type);\n }\n /**\n @internal\n */\n eq(other, offset = 0) {\n return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to;\n }\n /**\n @internal\n */\n map(mapping, offset, oldOffset) {\n return this.type.map(mapping, this, offset, oldOffset);\n }\n /**\n Creates a widget decoration, which is a DOM node that's shown in\n the document at the given position. It is recommended that you\n delay rendering the widget by passing a function that will be\n called when the widget is actually drawn in a view, but you can\n also directly pass a DOM node. `getPos` can be used to find the\n widget's current document position.\n */\n static widget(pos, toDOM, spec) {\n return new Decoration(pos, pos, new WidgetType(toDOM, spec));\n }\n /**\n Creates an inline decoration, which adds the given attributes to\n each inline node between `from` and `to`.\n */\n static inline(from, to, attrs, spec) {\n return new Decoration(from, to, new InlineType(attrs, spec));\n }\n /**\n Creates a node decoration. `from` and `to` should point precisely\n before and after a node in the document. That node, and only that\n node, will receive the given attributes.\n */\n static node(from, to, attrs, spec) {\n return new Decoration(from, to, new NodeType(attrs, spec));\n }\n /**\n The spec provided when creating this decoration. Can be useful\n if you've stored extra information in that object.\n */\n get spec() { return this.type.spec; }\n /**\n @internal\n */\n get inline() { return this.type instanceof InlineType; }\n /**\n @internal\n */\n get widget() { return this.type instanceof WidgetType; }\n}\nconst none = [], noSpec = {};\n/**\nA collection of [decorations](https://prosemirror.net/docs/ref/#view.Decoration), organized in such\na way that the drawing algorithm can efficiently use and compare\nthem. This is a persistent data structure—it is not modified,\nupdates create a new value.\n*/\nclass DecorationSet {\n /**\n @internal\n */\n constructor(local, children) {\n this.local = local.length ? local : none;\n this.children = children.length ? children : none;\n }\n /**\n Create a set of decorations, using the structure of the given\n document. This will consume (modify) the `decorations` array, so\n you must make a copy if you want need to preserve that.\n */\n static create(doc, decorations) {\n return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty;\n }\n /**\n Find all decorations in this set which touch the given range\n (including decorations that start or end directly at the\n boundaries) and match the given predicate on their spec. When\n `start` and `end` are omitted, all decorations in the set are\n considered. When `predicate` isn't given, all decorations are\n assumed to match.\n */\n find(start, end, predicate) {\n let result = [];\n this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);\n return result;\n }\n findInner(start, end, result, offset, predicate) {\n for (let i = 0; i < this.local.length; i++) {\n let span = this.local[i];\n if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec)))\n result.push(span.copy(span.from + offset, span.to + offset));\n }\n for (let i = 0; i < this.children.length; i += 3) {\n if (this.children[i] < end && this.children[i + 1] > start) {\n let childOff = this.children[i] + 1;\n this.children[i + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);\n }\n }\n }\n /**\n Map the set of decorations in response to a change in the\n document.\n */\n map(mapping, doc, options) {\n if (this == empty || mapping.maps.length == 0)\n return this;\n return this.mapInner(mapping, doc, 0, 0, options || noSpec);\n }\n /**\n @internal\n */\n mapInner(mapping, node, offset, oldOffset, options) {\n let newLocal;\n for (let i = 0; i < this.local.length; i++) {\n let mapped = this.local[i].map(mapping, offset, oldOffset);\n if (mapped && mapped.type.valid(node, mapped))\n (newLocal || (newLocal = [])).push(mapped);\n else if (options.onRemove)\n options.onRemove(this.local[i].spec);\n }\n if (this.children.length)\n return mapChildren(this.children, newLocal || [], mapping, node, offset, oldOffset, options);\n else\n return newLocal ? new DecorationSet(newLocal.sort(byPos), none) : empty;\n }\n /**\n Add the given array of decorations to the ones in the set,\n producing a new set. Consumes the `decorations` array. Needs\n access to the current document to create the appropriate tree\n structure.\n */\n add(doc, decorations) {\n if (!decorations.length)\n return this;\n if (this == empty)\n return DecorationSet.create(doc, decorations);\n return this.addInner(doc, decorations, 0);\n }\n addInner(doc, decorations, offset) {\n let children, childIndex = 0;\n doc.forEach((childNode, childOffset) => {\n let baseOffset = childOffset + offset, found;\n if (!(found = takeSpansForNode(decorations, childNode, baseOffset)))\n return;\n if (!children)\n children = this.children.slice();\n while (childIndex < children.length && children[childIndex] < childOffset)\n childIndex += 3;\n if (children[childIndex] == childOffset)\n children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1);\n else\n children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec));\n childIndex += 3;\n });\n let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);\n for (let i = 0; i < local.length; i++)\n if (!local[i].type.valid(doc, local[i]))\n local.splice(i--, 1);\n return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children);\n }\n /**\n Create a new set that contains the decorations in this set, minus\n the ones in the given array.\n */\n remove(decorations) {\n if (decorations.length == 0 || this == empty)\n return this;\n return this.removeInner(decorations, 0);\n }\n removeInner(decorations, offset) {\n let children = this.children, local = this.local;\n for (let i = 0; i < children.length; i += 3) {\n let found;\n let from = children[i] + offset, to = children[i + 1] + offset;\n for (let j = 0, span; j < decorations.length; j++)\n if (span = decorations[j]) {\n if (span.from > from && span.to < to) {\n decorations[j] = null;\n (found || (found = [])).push(span);\n }\n }\n if (!found)\n continue;\n if (children == this.children)\n children = this.children.slice();\n let removed = children[i + 2].removeInner(found, from + 1);\n if (removed != empty) {\n children[i + 2] = removed;\n }\n else {\n children.splice(i, 3);\n i -= 3;\n }\n }\n if (local.length)\n for (let i = 0, span; i < decorations.length; i++)\n if (span = decorations[i]) {\n for (let j = 0; j < local.length; j++)\n if (local[j].eq(span, offset)) {\n if (local == this.local)\n local = this.local.slice();\n local.splice(j--, 1);\n }\n }\n if (children == this.children && local == this.local)\n return this;\n return local.length || children.length ? new DecorationSet(local, children) : empty;\n }\n forChild(offset, node) {\n if (this == empty)\n return this;\n if (node.isLeaf)\n return DecorationSet.empty;\n let child, local;\n for (let i = 0; i < this.children.length; i += 3)\n if (this.children[i] >= offset) {\n if (this.children[i] == offset)\n child = this.children[i + 2];\n break;\n }\n let start = offset + 1, end = start + node.content.size;\n for (let i = 0; i < this.local.length; i++) {\n let dec = this.local[i];\n if (dec.from < end && dec.to > start && (dec.type instanceof InlineType)) {\n let from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;\n if (from < to)\n (local || (local = [])).push(dec.copy(from, to));\n }\n }\n if (local) {\n let localSet = new DecorationSet(local.sort(byPos), none);\n return child ? new DecorationGroup([localSet, child]) : localSet;\n }\n return child || empty;\n }\n /**\n @internal\n */\n eq(other) {\n if (this == other)\n return true;\n if (!(other instanceof DecorationSet) ||\n this.local.length != other.local.length ||\n this.children.length != other.children.length)\n return false;\n for (let i = 0; i < this.local.length; i++)\n if (!this.local[i].eq(other.local[i]))\n return false;\n for (let i = 0; i < this.children.length; i += 3)\n if (this.children[i] != other.children[i] ||\n this.children[i + 1] != other.children[i + 1] ||\n !this.children[i + 2].eq(other.children[i + 2]))\n return false;\n return true;\n }\n /**\n @internal\n */\n locals(node) {\n return removeOverlap(this.localsInner(node));\n }\n /**\n @internal\n */\n localsInner(node) {\n if (this == empty)\n return none;\n if (node.inlineContent || !this.local.some(InlineType.is))\n return this.local;\n let result = [];\n for (let i = 0; i < this.local.length; i++) {\n if (!(this.local[i].type instanceof InlineType))\n result.push(this.local[i]);\n }\n return result;\n }\n forEachSet(f) { f(this); }\n}\n/**\nThe empty set of decorations.\n*/\nDecorationSet.empty = new DecorationSet([], []);\n/**\n@internal\n*/\nDecorationSet.removeOverlap = removeOverlap;\nconst empty = DecorationSet.empty;\n// An abstraction that allows the code dealing with decorations to\n// treat multiple DecorationSet objects as if it were a single object\n// with (a subset of) the same interface.\nclass DecorationGroup {\n constructor(members) {\n this.members = members;\n }\n map(mapping, doc) {\n const mappedDecos = this.members.map(member => member.map(mapping, doc, noSpec));\n return DecorationGroup.from(mappedDecos);\n }\n forChild(offset, child) {\n if (child.isLeaf)\n return DecorationSet.empty;\n let found = [];\n for (let i = 0; i < this.members.length; i++) {\n let result = this.members[i].forChild(offset, child);\n if (result == empty)\n continue;\n if (result instanceof DecorationGroup)\n found = found.concat(result.members);\n else\n found.push(result);\n }\n return DecorationGroup.from(found);\n }\n eq(other) {\n if (!(other instanceof DecorationGroup) ||\n other.members.length != this.members.length)\n return false;\n for (let i = 0; i < this.members.length; i++)\n if (!this.members[i].eq(other.members[i]))\n return false;\n return true;\n }\n locals(node) {\n let result, sorted = true;\n for (let i = 0; i < this.members.length; i++) {\n let locals = this.members[i].localsInner(node);\n if (!locals.length)\n continue;\n if (!result) {\n result = locals;\n }\n else {\n if (sorted) {\n result = result.slice();\n sorted = false;\n }\n for (let j = 0; j < locals.length; j++)\n result.push(locals[j]);\n }\n }\n return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none;\n }\n // Create a group for the given array of decoration sets, or return\n // a single set when possible.\n static from(members) {\n switch (members.length) {\n case 0: return empty;\n case 1: return members[0];\n default: return new DecorationGroup(members.every(m => m instanceof DecorationSet) ? members :\n members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), []));\n }\n }\n forEachSet(f) {\n for (let i = 0; i < this.members.length; i++)\n this.members[i].forEachSet(f);\n }\n}\nfunction mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {\n let children = oldChildren.slice();\n // Mark the children that are directly touched by changes, and\n // move those that are after the changes.\n for (let i = 0, baseOffset = oldOffset; i < mapping.maps.length; i++) {\n let moved = 0;\n mapping.maps[i].forEach((oldStart, oldEnd, newStart, newEnd) => {\n let dSize = (newEnd - newStart) - (oldEnd - oldStart);\n for (let i = 0; i < children.length; i += 3) {\n let end = children[i + 1];\n if (end < 0 || oldStart > end + baseOffset - moved)\n continue;\n let start = children[i] + baseOffset - moved;\n if (oldEnd >= start) {\n children[i + 1] = oldStart <= start ? -2 : -1;\n }\n else if (oldStart >= baseOffset && dSize) {\n children[i] += dSize;\n children[i + 1] += dSize;\n }\n }\n moved += dSize;\n });\n baseOffset = mapping.maps[i].map(baseOffset, -1);\n }\n // Find the child nodes that still correspond to a single node,\n // recursively call mapInner on them and update their positions.\n let mustRebuild = false;\n for (let i = 0; i < children.length; i += 3)\n if (children[i + 1] < 0) { // Touched nodes\n if (children[i + 1] == -2) {\n mustRebuild = true;\n children[i + 1] = -1;\n continue;\n }\n let from = mapping.map(oldChildren[i] + oldOffset), fromLocal = from - offset;\n if (fromLocal < 0 || fromLocal >= node.content.size) {\n mustRebuild = true;\n continue;\n }\n // Must read oldChildren because children was tagged with -1\n let to = mapping.map(oldChildren[i + 1] + oldOffset, -1), toLocal = to - offset;\n let { index, offset: childOffset } = node.content.findIndex(fromLocal);\n let childNode = node.maybeChild(index);\n if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {\n let mapped = children[i + 2]\n .mapInner(mapping, childNode, from + 1, oldChildren[i] + oldOffset + 1, options);\n if (mapped != empty) {\n children[i] = fromLocal;\n children[i + 1] = toLocal;\n children[i + 2] = mapped;\n }\n else {\n children[i + 1] = -2;\n mustRebuild = true;\n }\n }\n else {\n mustRebuild = true;\n }\n }\n // Remaining children must be collected and rebuilt into the appropriate structure\n if (mustRebuild) {\n let decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal, mapping, offset, oldOffset, options);\n let built = buildTree(decorations, node, 0, options);\n newLocal = built.local;\n for (let i = 0; i < children.length; i += 3)\n if (children[i + 1] < 0) {\n children.splice(i, 3);\n i -= 3;\n }\n for (let i = 0, j = 0; i < built.children.length; i += 3) {\n let from = built.children[i];\n while (j < children.length && children[j] < from)\n j += 3;\n children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);\n }\n }\n return new DecorationSet(newLocal.sort(byPos), children);\n}\nfunction moveSpans(spans, offset) {\n if (!offset || !spans.length)\n return spans;\n let result = [];\n for (let i = 0; i < spans.length; i++) {\n let span = spans[i];\n result.push(new Decoration(span.from + offset, span.to + offset, span.type));\n }\n return result;\n}\nfunction mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {\n // Gather all decorations from the remaining marked children\n function gather(set, oldOffset) {\n for (let i = 0; i < set.local.length; i++) {\n let mapped = set.local[i].map(mapping, offset, oldOffset);\n if (mapped)\n decorations.push(mapped);\n else if (options.onRemove)\n options.onRemove(set.local[i].spec);\n }\n for (let i = 0; i < set.children.length; i += 3)\n gather(set.children[i + 2], set.children[i] + oldOffset + 1);\n }\n for (let i = 0; i < children.length; i += 3)\n if (children[i + 1] == -1)\n gather(children[i + 2], oldChildren[i] + oldOffset + 1);\n return decorations;\n}\nfunction takeSpansForNode(spans, node, offset) {\n if (node.isLeaf)\n return null;\n let end = offset + node.nodeSize, found = null;\n for (let i = 0, span; i < spans.length; i++) {\n if ((span = spans[i]) && span.from > offset && span.to < end) {\n (found || (found = [])).push(span);\n spans[i] = null;\n }\n }\n return found;\n}\nfunction withoutNulls(array) {\n let result = [];\n for (let i = 0; i < array.length; i++)\n if (array[i] != null)\n result.push(array[i]);\n return result;\n}\n// Build up a tree that corresponds to a set of decorations. `offset`\n// is a base offset that should be subtracted from the `from` and `to`\n// positions in the spans (so that we don't have to allocate new spans\n// for recursive calls).\nfunction buildTree(spans, node, offset, options) {\n let children = [], hasNulls = false;\n node.forEach((childNode, localStart) => {\n let found = takeSpansForNode(spans, childNode, localStart + offset);\n if (found) {\n hasNulls = true;\n let subtree = buildTree(found, childNode, offset + localStart + 1, options);\n if (subtree != empty)\n children.push(localStart, localStart + childNode.nodeSize, subtree);\n }\n });\n let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);\n for (let i = 0; i < locals.length; i++)\n if (!locals[i].type.valid(node, locals[i])) {\n if (options.onRemove)\n options.onRemove(locals[i].spec);\n locals.splice(i--, 1);\n }\n return locals.length || children.length ? new DecorationSet(locals, children) : empty;\n}\n// Used to sort decorations so that ones with a low start position\n// come first, and within a set with the same start position, those\n// with an smaller end position come first.\nfunction byPos(a, b) {\n return a.from - b.from || a.to - b.to;\n}\n// Scan a sorted array of decorations for partially overlapping spans,\n// and split those so that only fully overlapping spans are left (to\n// make subsequent rendering easier). Will return the input array if\n// no partially overlapping spans are found (the common case).\nfunction removeOverlap(spans) {\n let working = spans;\n for (let i = 0; i < working.length - 1; i++) {\n let span = working[i];\n if (span.from != span.to)\n for (let j = i + 1; j < working.length; j++) {\n let next = working[j];\n if (next.from == span.from) {\n if (next.to != span.to) {\n if (working == spans)\n working = spans.slice();\n // Followed by a partially overlapping larger span. Split that\n // span.\n working[j] = next.copy(next.from, span.to);\n insertAhead(working, j + 1, next.copy(span.to, next.to));\n }\n continue;\n }\n else {\n if (next.from < span.to) {\n if (working == spans)\n working = spans.slice();\n // The end of this one overlaps with a subsequent span. Split\n // this one.\n working[i] = span.copy(span.from, next.from);\n insertAhead(working, j, span.copy(next.from, span.to));\n }\n break;\n }\n }\n }\n return working;\n}\nfunction insertAhead(array, i, deco) {\n while (i < array.length && byPos(deco, array[i]) > 0)\n i++;\n array.splice(i, 0, deco);\n}\n// Get the decorations associated with the current props of a view.\nfunction viewDecorations(view) {\n let found = [];\n view.someProp(\"decorations\", f => {\n let result = f(view.state);\n if (result && result != empty)\n found.push(result);\n });\n if (view.cursorWrapper)\n found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco]));\n return DecorationGroup.from(found);\n}\n\nconst observeOptions = {\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n attributes: true,\n attributeOldValue: true,\n subtree: true\n};\n// IE11 has very broken mutation observers, so we also listen to DOMCharacterDataModified\nconst useCharData = ie && ie_version <= 11;\nclass SelectionState {\n constructor() {\n this.anchorNode = null;\n this.anchorOffset = 0;\n this.focusNode = null;\n this.focusOffset = 0;\n }\n set(sel) {\n this.anchorNode = sel.anchorNode;\n this.anchorOffset = sel.anchorOffset;\n this.focusNode = sel.focusNode;\n this.focusOffset = sel.focusOffset;\n }\n clear() {\n this.anchorNode = this.focusNode = null;\n }\n eq(sel) {\n return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset &&\n sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset;\n }\n}\nclass DOMObserver {\n constructor(view, handleDOMChange) {\n this.view = view;\n this.handleDOMChange = handleDOMChange;\n this.queue = [];\n this.flushingSoon = -1;\n this.observer = null;\n this.currentSelection = new SelectionState;\n this.onCharData = null;\n this.suppressingSelectionUpdates = false;\n this.lastChangedTextNode = null;\n this.observer = window.MutationObserver &&\n new window.MutationObserver(mutations => {\n for (let i = 0; i < mutations.length; i++)\n this.queue.push(mutations[i]);\n if (ie && ie_version <= 11 && mutations.some(m => m.type == \"childList\" && m.removedNodes.length ||\n m.type == \"characterData\" && m.oldValue.length > m.target.nodeValue.length)) {\n // IE11 will sometimes (on backspacing out a single character\n // text node after a BR node) call the observer callback\n // before actually updating the DOM, which will cause\n // ProseMirror to miss the change (see #930)\n this.flushSoon();\n }\n else if (safari && view.composing && mutations.some(m => m.type == \"childList\" && m.target.nodeName == \"TR\")) {\n // Safari does weird stuff when finishing a composition in a\n // table cell, which tends to involve inserting inappropriate\n // nodes in the table row.\n view.input.badSafariComposition = true;\n this.flushSoon();\n }\n else {\n this.flush();\n }\n });\n if (useCharData) {\n this.onCharData = e => {\n this.queue.push({ target: e.target, type: \"characterData\", oldValue: e.prevValue });\n this.flushSoon();\n };\n }\n this.onSelectionChange = this.onSelectionChange.bind(this);\n }\n flushSoon() {\n if (this.flushingSoon < 0)\n this.flushingSoon = window.setTimeout(() => { this.flushingSoon = -1; this.flush(); }, 20);\n }\n forceFlush() {\n if (this.flushingSoon > -1) {\n window.clearTimeout(this.flushingSoon);\n this.flushingSoon = -1;\n this.flush();\n }\n }\n start() {\n if (this.observer) {\n this.observer.takeRecords();\n this.observer.observe(this.view.dom, observeOptions);\n }\n if (this.onCharData)\n this.view.dom.addEventListener(\"DOMCharacterDataModified\", this.onCharData);\n this.connectSelection();\n }\n stop() {\n if (this.observer) {\n let take = this.observer.takeRecords();\n if (take.length) {\n for (let i = 0; i < take.length; i++)\n this.queue.push(take[i]);\n window.setTimeout(() => this.flush(), 20);\n }\n this.observer.disconnect();\n }\n if (this.onCharData)\n this.view.dom.removeEventListener(\"DOMCharacterDataModified\", this.onCharData);\n this.disconnectSelection();\n }\n connectSelection() {\n this.view.dom.ownerDocument.addEventListener(\"selectionchange\", this.onSelectionChange);\n }\n disconnectSelection() {\n this.view.dom.ownerDocument.removeEventListener(\"selectionchange\", this.onSelectionChange);\n }\n suppressSelectionUpdates() {\n this.suppressingSelectionUpdates = true;\n setTimeout(() => this.suppressingSelectionUpdates = false, 50);\n }\n onSelectionChange() {\n if (!hasFocusAndSelection(this.view))\n return;\n if (this.suppressingSelectionUpdates)\n return selectionToDOM(this.view);\n // Deletions on IE11 fire their events in the wrong order, giving\n // us a selection change event before the DOM changes are\n // reported.\n if (ie && ie_version <= 11 && !this.view.state.selection.empty) {\n let sel = this.view.domSelectionRange();\n // Selection.isCollapsed isn't reliable on IE\n if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset))\n return this.flushSoon();\n }\n this.flush();\n }\n setCurSelection() {\n this.currentSelection.set(this.view.domSelectionRange());\n }\n ignoreSelectionChange(sel) {\n if (!sel.focusNode)\n return true;\n let ancestors = new Set, container;\n for (let scan = sel.focusNode; scan; scan = parentNode(scan))\n ancestors.add(scan);\n for (let scan = sel.anchorNode; scan; scan = parentNode(scan))\n if (ancestors.has(scan)) {\n container = scan;\n break;\n }\n let desc = container && this.view.docView.nearestDesc(container);\n if (desc && desc.ignoreMutation({\n type: \"selection\",\n target: isText(container) ? container.parentNode : container\n })) {\n this.setCurSelection();\n return true;\n }\n }\n pendingRecords() {\n if (this.observer)\n for (let mut of this.observer.takeRecords())\n this.queue.push(mut);\n return this.queue;\n }\n flush() {\n let { view } = this;\n if (!view.docView || this.flushingSoon > -1)\n return;\n let mutations = this.pendingRecords();\n if (mutations.length)\n this.queue = [];\n let sel = view.domSelectionRange();\n let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);\n let from = -1, to = -1, typeOver = false, added = [];\n if (view.editable) {\n for (let i = 0; i < mutations.length; i++) {\n let result = this.registerMutation(mutations[i], added);\n if (result) {\n from = from < 0 ? result.from : Math.min(result.from, from);\n to = to < 0 ? result.to : Math.max(result.to, to);\n if (result.typeOver)\n typeOver = true;\n }\n }\n }\n if (added.some(n => n.nodeName == \"BR\") &&\n (view.input.lastKeyCode == 8 || view.input.lastKeyCode == 46 ||\n chrome && (view.composing || view.input.compositionEndedAt > Date.now() - 50) &&\n mutations.some(m => m.type == \"childList\" && m.removedNodes.length))) {\n // Browsers sometimes insert a bogus break node if you\n // backspace out the last bit of text before an inline-flex node (#1552)\n for (let node of added)\n if (node.nodeName == \"BR\" && node.parentNode) {\n let after = node.nextSibling;\n while (after && isElt(after)) {\n if (after.contentEditable == \"false\") {\n node.parentNode.removeChild(node);\n break;\n }\n after = after.firstChild;\n }\n }\n }\n else if (gecko && added.length) {\n let brs = added.filter(n => n.nodeName == \"BR\");\n if (brs.length == 2) {\n let [a, b] = brs;\n if (a.parentNode && a.parentNode.parentNode == b.parentNode)\n b.remove();\n else\n a.remove();\n }\n else {\n let { focusNode } = this.currentSelection;\n for (let br of brs) {\n let parent = br.parentNode;\n if (parent && parent.nodeName == \"LI\" && (!focusNode || blockParent(view, focusNode) != parent))\n br.remove();\n }\n }\n }\n let readSel = null;\n // If it looks like the browser has reset the selection to the\n // start of the document after focus, restore the selection from\n // the state\n if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 &&\n Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 &&\n selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) &&\n readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {\n view.input.lastFocus = 0;\n selectionToDOM(view);\n this.currentSelection.set(sel);\n view.scrollToSelection();\n }\n else if (from > -1 || newSel) {\n if (from > -1) {\n view.docView.markDirty(from, to);\n checkCSS(view);\n }\n if (view.input.badSafariComposition) {\n view.input.badSafariComposition = false;\n fixUpBadSafariComposition(view, added);\n }\n this.handleDOMChange(from, to, typeOver, added);\n if (view.docView && view.docView.dirty)\n view.updateState(view.state);\n else if (!this.currentSelection.eq(sel))\n selectionToDOM(view);\n this.currentSelection.set(sel);\n }\n }\n registerMutation(mut, added) {\n // Ignore mutations inside nodes that were already noted as inserted\n if (added.indexOf(mut.target) > -1)\n return null;\n let desc = this.view.docView.nearestDesc(mut.target);\n if (mut.type == \"attributes\" &&\n (desc == this.view.docView || mut.attributeName == \"contenteditable\" ||\n // Firefox sometimes fires spurious events for null/empty styles\n (mut.attributeName == \"style\" && !mut.oldValue && !mut.target.getAttribute(\"style\"))))\n return null;\n if (!desc || desc.ignoreMutation(mut))\n return null;\n if (mut.type == \"childList\") {\n for (let i = 0; i < mut.addedNodes.length; i++) {\n let node = mut.addedNodes[i];\n added.push(node);\n if (isText(node))\n this.lastChangedTextNode = node;\n }\n if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))\n return { from: desc.posBefore, to: desc.posAfter };\n let prev = mut.previousSibling, next = mut.nextSibling;\n if (ie && ie_version <= 11 && mut.addedNodes.length) {\n // IE11 gives us incorrect next/prev siblings for some\n // insertions, so if there are added nodes, recompute those\n for (let i = 0; i < mut.addedNodes.length; i++) {\n let { previousSibling, nextSibling } = mut.addedNodes[i];\n if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0)\n prev = previousSibling;\n if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0)\n next = nextSibling;\n }\n }\n let fromOffset = prev && prev.parentNode == mut.target\n ? domIndex(prev) + 1 : 0;\n let from = desc.localPosFromDOM(mut.target, fromOffset, -1);\n let toOffset = next && next.parentNode == mut.target\n ? domIndex(next) : mut.target.childNodes.length;\n let to = desc.localPosFromDOM(mut.target, toOffset, 1);\n return { from, to };\n }\n else if (mut.type == \"attributes\") {\n return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };\n }\n else { // \"characterData\"\n this.lastChangedTextNode = mut.target;\n return {\n from: desc.posAtStart,\n to: desc.posAtEnd,\n // An event was generated for a text change that didn't change\n // any text. Mark the dom change to fall back to assuming the\n // selection was typed over with an identical value if it can't\n // find another change.\n typeOver: mut.target.nodeValue == mut.oldValue\n };\n }\n }\n}\nlet cssChecked = new WeakMap();\nlet cssCheckWarned = false;\nfunction checkCSS(view) {\n if (cssChecked.has(view))\n return;\n cssChecked.set(view, null);\n if (['normal', 'nowrap', 'pre-line'].indexOf(getComputedStyle(view.dom).whiteSpace) !== -1) {\n view.requiresGeckoHackNode = gecko;\n if (cssCheckWarned)\n return;\n console[\"warn\"](\"ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.\");\n cssCheckWarned = true;\n }\n}\nfunction rangeToSelectionRange(view, range) {\n let anchorNode = range.startContainer, anchorOffset = range.startOffset;\n let focusNode = range.endContainer, focusOffset = range.endOffset;\n let currentAnchor = view.domAtPos(view.state.selection.anchor);\n // Since such a range doesn't distinguish between anchor and head,\n // use a heuristic that flips it around if its end matches the\n // current anchor.\n if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset))\n [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];\n return { anchorNode, anchorOffset, focusNode, focusOffset };\n}\n// Used to work around a Safari Selection/shadow DOM bug\n// Based on https://github.com/codemirror/dev/issues/414 fix\nfunction safariShadowSelectionRange(view, selection) {\n if (selection.getComposedRanges) {\n let range = selection.getComposedRanges(view.root)[0];\n if (range)\n return rangeToSelectionRange(view, range);\n }\n let found;\n function read(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n found = event.getTargetRanges()[0];\n }\n // Because Safari (at least in 2018-2022) doesn't provide regular\n // access to the selection inside a shadowRoot, we have to perform a\n // ridiculous hack to get at it—using `execCommand` to trigger a\n // `beforeInput` event so that we can read the target range from the\n // event.\n view.dom.addEventListener(\"beforeinput\", read, true);\n document.execCommand(\"indent\");\n view.dom.removeEventListener(\"beforeinput\", read, true);\n return found ? rangeToSelectionRange(view, found) : null;\n}\nfunction blockParent(view, node) {\n for (let p = node.parentNode; p && p != view.dom; p = p.parentNode) {\n let desc = view.docView.nearestDesc(p, true);\n if (desc && desc.node.isBlock)\n return p;\n }\n return null;\n}\n// Kludge for a Safari bug where, on ending a composition in an\n// otherwise empty table cell, it randomly moves the composed text\n// into the table row around that cell, greatly confusing everything\n// (#188).\nfunction fixUpBadSafariComposition(view, addedNodes) {\n var _a;\n let { focusNode, focusOffset } = view.domSelectionRange();\n for (let node of addedNodes) {\n if (((_a = node.parentNode) === null || _a === void 0 ? void 0 : _a.nodeName) == \"TR\") {\n let nextCell = node.nextSibling;\n while (nextCell && (nextCell.nodeName != \"TD\" && nextCell.nodeName != \"TH\"))\n nextCell = nextCell.nextSibling;\n if (nextCell) {\n let parent = nextCell;\n for (;;) {\n let first = parent.firstChild;\n if (!first || !isElt(first) || first.contentEditable == \"false\" || /^(BR|IMG)$/.test(first.nodeName))\n break;\n parent = first;\n }\n parent.insertBefore(node, parent.firstChild);\n if (focusNode == node)\n view.domSelection().collapse(node, focusOffset);\n }\n else {\n node.parentNode.removeChild(node);\n }\n }\n }\n}\n\n// Note that all referencing and parsing is done with the\n// start-of-operation selection and document, since that's the one\n// that the DOM represents. If any changes came in in the meantime,\n// the modification is mapped over those before it is applied, in\n// readDOMChange.\nfunction parseBetween(view, from_, to_, addedNodes) {\n let { node: parent, fromOffset, toOffset, from, to } = view.docView.parseRange(from_, to_);\n let domSel = view.domSelectionRange();\n let find;\n let anchor = domSel.anchorNode;\n if (anchor && contains(view.dom, anchor)) {\n find = [{ node: anchor, offset: domSel.anchorOffset }];\n if (!selectionCollapsed(domSel))\n find.push({ node: domSel.focusNode, offset: domSel.focusOffset });\n }\n // Work around issue in Chrome where backspacing sometimes replaces\n // the deleted content with a random BR node (issues #799, #831)\n if (chrome && view.input.lastKeyCode === 8) {\n for (let off = toOffset; off > fromOffset; off--) {\n let node = parent.childNodes[off - 1], desc = node.pmViewDesc;\n if (node.nodeName == \"BR\" && !desc) {\n toOffset = off;\n break;\n }\n if (!desc || desc.size)\n break;\n }\n }\n let startDoc = view.state.doc;\n let parser = view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n let $from = startDoc.resolve(from);\n let sel = null, doc = parser.parse(parent, {\n topNode: $from.parent,\n topMatch: $from.parent.contentMatchAt($from.index()),\n topOpen: true,\n from: fromOffset,\n to: toOffset,\n preserveWhitespace: $from.parent.type.whitespace == \"pre\" ? \"full\" : true,\n findPositions: find,\n ruleFromNode: ruleFromNode(addedNodes),\n context: $from\n });\n if (find && find[0].pos != null) {\n let anchor = find[0].pos, head = find[1] && find[1].pos;\n if (head == null)\n head = anchor;\n sel = { anchor: anchor + from, head: head + from };\n }\n return { doc, sel, from, to };\n}\nconst ruleFromNode = (added) => (dom) => {\n let desc = dom.pmViewDesc;\n if (desc) {\n return desc.parseRule(added);\n }\n else if (dom.nodeName == \"BR\" && dom.parentNode) {\n // Safari replaces the list item or table cell with a BR\n // directly in the list node (?!) if you delete the last\n // character in a list item or table cell (#708, #862)\n if (safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {\n let skip = document.createElement(\"div\");\n skip.appendChild(document.createElement(\"li\"));\n return { skip };\n }\n else if (dom.parentNode.lastChild == dom || safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) {\n return { ignore: true };\n }\n }\n else if (dom.nodeName == \"IMG\" && dom.getAttribute(\"mark-placeholder\")) {\n return { ignore: true };\n }\n return null;\n};\nconst isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;\nfunction readDOMChange(view, from, to, typeOver, addedNodes) {\n let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);\n view.input.compositionPendingChanges = 0;\n if (from < 0) {\n let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;\n let newSel = selectionFromDOM(view, origin);\n if (newSel && !view.state.selection.eq(newSel)) {\n if (chrome && android &&\n view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime &&\n view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\"))))\n return;\n let tr = view.state.tr.setSelection(newSel);\n if (origin == \"pointer\")\n tr.setMeta(\"pointer\", true);\n else if (origin == \"key\")\n tr.scrollIntoView();\n if (compositionID)\n tr.setMeta(\"composition\", compositionID);\n view.dispatch(tr);\n }\n return;\n }\n let $before = view.state.doc.resolve(from);\n let shared = $before.sharedDepth(to);\n from = $before.before(shared + 1);\n to = view.state.doc.resolve(to).after(shared + 1);\n let sel = view.state.selection;\n let parse = parseBetween(view, from, to, addedNodes);\n let doc = view.state.doc, compare = doc.slice(parse.from, parse.to);\n let preferredPos, preferredSide;\n // Prefer anchoring to end when Backspace is pressed\n if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {\n preferredPos = view.state.selection.to;\n preferredSide = \"end\";\n }\n else {\n preferredPos = view.state.selection.from;\n preferredSide = \"start\";\n }\n view.input.lastKeyCode = null;\n let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);\n if (change)\n view.input.domChangeCount++;\n if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) &&\n addedNodes.some(n => isElt(n) && !isInline.test(n.nodeName)) &&\n (!change || change.endA >= change.endB) &&\n view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) {\n view.input.lastIOSEnter = 0;\n return;\n }\n if (!change) {\n if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) &&\n !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) {\n change = { start: sel.from, endA: sel.to, endB: sel.to };\n }\n else {\n if (parse.sel) {\n let sel = resolveSelection(view, view.state.doc, parse.sel);\n if (sel && !sel.eq(view.state.selection)) {\n let tr = view.state.tr.setSelection(sel);\n if (compositionID)\n tr.setMeta(\"composition\", compositionID);\n view.dispatch(tr);\n }\n }\n return;\n }\n }\n // Handle the case where overwriting a selection by typing matches\n // the start or end of the selected content, creating a change\n // that's smaller than what was actually overwritten.\n if (view.state.selection.from < view.state.selection.to &&\n change.start == change.endB &&\n view.state.selection instanceof TextSelection) {\n if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 &&\n view.state.selection.from >= parse.from) {\n change.start = view.state.selection.from;\n }\n else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 &&\n view.state.selection.to <= parse.to) {\n change.endB += (view.state.selection.to - change.endA);\n change.endA = view.state.selection.to;\n }\n }\n // IE11 will insert a non-breaking space _ahead_ of the space after\n // the cursor space when adding a space before another space. When\n // that happened, adjust the change to cover the space instead.\n if (ie && ie_version <= 11 && change.endB == change.start + 1 &&\n change.endA == change.start && change.start > parse.from &&\n parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == \" \\u00a0\") {\n change.start--;\n change.endA--;\n change.endB--;\n }\n let $from = parse.doc.resolveNoCache(change.start - parse.from);\n let $to = parse.doc.resolveNoCache(change.endB - parse.from);\n let $fromA = doc.resolve(change.start);\n let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;\n // If this looks like the effect of pressing Enter (or was recorded\n // as being an iOS enter press), just dispatch an Enter key instead.\n if (((ios && view.input.lastIOSEnter > Date.now() - 225 &&\n (!inlineChange || addedNodes.some(n => n.nodeName == \"DIV\" || n.nodeName == \"P\"))) ||\n (!inlineChange && looksLikeEnter(parse.doc, $from.pos, $to.pos))) &&\n view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) {\n view.input.lastIOSEnter = 0;\n return;\n }\n // Same for backspace\n if (view.state.selection.anchor > change.start &&\n looksLikeBackspace(doc, change.start, change.endA, $from, $to) &&\n view.someProp(\"handleKeyDown\", f => f(view, keyEvent(8, \"Backspace\")))) {\n if (android && chrome)\n view.domObserver.suppressSelectionUpdates(); // #820\n return;\n }\n // Chrome will occasionally, during composition, delete the\n // entire composition and then immediately insert it again. This is\n // used to detect that situation.\n if (chrome && change.endB == change.start)\n view.input.lastChromeDelete = Date.now();\n // This tries to detect Android virtual keyboard\n // enter-and-pick-suggestion action. That sometimes (see issue\n // #1059) first fires a DOM mutation, before moving the selection to\n // the newly created block. And then, because ProseMirror cleans up\n // the DOM selection, it gives up moving the selection entirely,\n // leaving the cursor in the wrong place. When that happens, we drop\n // the new paragraph from the initial change, and fire a simulated\n // enter key afterwards.\n if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth &&\n parse.sel && parse.sel.anchor == parse.sel.head && parse.sel.head == change.endA) {\n change.endB -= 2;\n $to = parse.doc.resolveNoCache(change.endB - parse.from);\n setTimeout(() => {\n view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); });\n }, 20);\n }\n let chFrom = change.start, chTo = change.endA;\n let mkTr = (base) => {\n let tr = base || view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));\n if (parse.sel) {\n let sel = resolveSelection(view, tr.doc, parse.sel);\n // Chrome will sometimes, during composition, report the\n // selection in the wrong place. If it looks like that is\n // happening, don't update the selection.\n // Edge just doesn't move the cursor forward when you start typing\n // in an empty block or between br nodes.\n if (sel && !(chrome && view.composing && sel.empty &&\n (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) &&\n (sel.head == chFrom || sel.head == tr.mapping.map(chTo) - 1) ||\n ie && sel.empty && sel.head == chFrom))\n tr.setSelection(sel);\n }\n if (compositionID)\n tr.setMeta(\"composition\", compositionID);\n return tr.scrollIntoView();\n };\n let markChange;\n if (inlineChange) {\n if ($from.pos == $to.pos) { // Deletion\n // IE11 sometimes weirdly moves the DOM selection around after\n // backspacing out the first element in a textblock\n if (ie && ie_version <= 11 && $from.parentOffset == 0) {\n view.domObserver.suppressSelectionUpdates();\n setTimeout(() => selectionToDOM(view), 20);\n }\n let tr = mkTr(view.state.tr.delete(chFrom, chTo));\n let marks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));\n if (marks)\n tr.ensureMarks(marks);\n view.dispatch(tr);\n }\n else if ( // Adding or removing a mark\n change.endA == change.endB &&\n (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))) {\n let tr = mkTr(view.state.tr);\n if (markChange.type == \"add\")\n tr.addMark(chFrom, chTo, markChange.mark);\n else\n tr.removeMark(chFrom, chTo, markChange.mark);\n view.dispatch(tr);\n }\n else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {\n // Both positions in the same text node -- simply insert text\n let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);\n let deflt = () => mkTr(view.state.tr.insertText(text, chFrom, chTo));\n if (!view.someProp(\"handleTextInput\", f => f(view, chFrom, chTo, text, deflt)))\n view.dispatch(deflt());\n }\n else {\n view.dispatch(mkTr());\n }\n }\n else {\n view.dispatch(mkTr());\n }\n}\nfunction resolveSelection(view, doc, parsedSel) {\n if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size)\n return null;\n return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head));\n}\n// Given two same-length, non-empty fragments of inline content,\n// determine whether the first could be created from the second by\n// removing or adding a single mark type.\nfunction isMarkChange(cur, prev) {\n let curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks;\n let added = curMarks, removed = prevMarks, type, mark, update;\n for (let i = 0; i < prevMarks.length; i++)\n added = prevMarks[i].removeFromSet(added);\n for (let i = 0; i < curMarks.length; i++)\n removed = curMarks[i].removeFromSet(removed);\n if (added.length == 1 && removed.length == 0) {\n mark = added[0];\n type = \"add\";\n update = (node) => node.mark(mark.addToSet(node.marks));\n }\n else if (added.length == 0 && removed.length == 1) {\n mark = removed[0];\n type = \"remove\";\n update = (node) => node.mark(mark.removeFromSet(node.marks));\n }\n else {\n return null;\n }\n let updated = [];\n for (let i = 0; i < prev.childCount; i++)\n updated.push(update(prev.child(i)));\n if (Fragment.from(updated).eq(cur))\n return { mark, type };\n}\nfunction looksLikeBackspace(old, start, end, $newStart, $newEnd) {\n if ( // The content must have shrunk\n end - start <= $newEnd.pos - $newStart.pos ||\n // newEnd must point directly at or after the end of the block that newStart points into\n skipClosingAndOpening($newStart, true, false) < $newEnd.pos)\n return false;\n let $start = old.resolve(start);\n // Handle the case where, rather than joining blocks, the change just removed an entire block\n if (!$newStart.parent.isTextblock) {\n let after = $start.nodeAfter;\n return after != null && end == start + after.nodeSize;\n }\n // Start must be at the end of a block\n if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock)\n return false;\n let $next = old.resolve(skipClosingAndOpening($start, true, true));\n // The next textblock must start before end and end near it\n if (!$next.parent.isTextblock || $next.pos > end ||\n skipClosingAndOpening($next, true, false) < end)\n return false;\n // The fragments after the join point must match\n return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);\n}\nfunction looksLikeEnter(content, from, to) {\n let newTextlines = 0, newLeaves = 0;\n content.nodesBetween(from, to, (node, pos) => {\n if (node.isTextblock && pos >= from && pos < to)\n newTextlines++;\n else if (node.isText ? /\\S/.test(node.text.slice(Math.max(0, from - pos), Math.min(node.nodeSize, to - pos))) : node.isLeaf)\n newLeaves++;\n });\n return newLeaves == 0 && newTextlines == 1;\n}\nfunction skipClosingAndOpening($pos, fromEnd, mayOpen) {\n let depth = $pos.depth, end = fromEnd ? $pos.end() : $pos.pos;\n while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {\n depth--;\n end++;\n fromEnd = false;\n }\n if (mayOpen) {\n let next = $pos.node(depth).maybeChild($pos.indexAfter(depth));\n while (next && !next.isLeaf) {\n next = next.firstChild;\n end++;\n }\n }\n return end;\n}\nfunction findDiff(a, b, pos, preferredPos, preferredSide) {\n let start = a.findDiffStart(b, pos), lenA = pos + a.size, lenB = pos + b.size;\n if (start == null)\n return null;\n let { a: endA, b: endB } = a.findDiffEnd(b, lenA, lenB);\n if (preferredSide == \"end\") {\n let adjust = Math.max(0, start - Math.min(endA, endB));\n preferredPos -= endA + adjust - start;\n }\n if (endA < start && lenA < lenB) {\n let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;\n start -= move;\n endB = start + (endB - endA);\n endA = start;\n }\n else if (endB < start) {\n let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;\n start -= move;\n endA = start + (endA - endB);\n endB = start;\n }\n return { start, endA, endB };\n}\n\n/**\n@internal\n*/\nconst __parseFromClipboard = parseFromClipboard;\n/**\n@internal\n*/\nconst __endComposition = endComposition;\n/**\nAn editor view manages the DOM structure that represents an\neditable document. Its state and behavior are determined by its\n[props](https://prosemirror.net/docs/ref/#view.DirectEditorProps).\n*/\nclass EditorView {\n /**\n Create a view. `place` may be a DOM node that the editor should\n be appended to, a function that will place it into the document,\n or an object whose `mount` property holds the node to use as the\n document container. If it is `null`, the editor will not be\n added to the document.\n */\n constructor(place, props) {\n this._root = null;\n /**\n @internal\n */\n this.focused = false;\n /**\n Kludge used to work around a Chrome bug @internal\n */\n this.trackWrites = null;\n this.mounted = false;\n /**\n @internal\n */\n this.markCursor = null;\n /**\n @internal\n */\n this.cursorWrapper = null;\n /**\n @internal\n */\n this.lastSelectedViewDesc = undefined;\n /**\n @internal\n */\n this.input = new InputState;\n this.prevDirectPlugins = [];\n this.pluginViews = [];\n /**\n Holds `true` when a hack node is needed in Firefox to prevent the\n [space is eaten issue](https://code.haverbeke.berlin/prosemirror/prosemirror/issues/651)\n @internal\n */\n this.requiresGeckoHackNode = false;\n /**\n When editor content is being dragged, this object contains\n information about the dragged slice and whether it is being\n copied or moved. At any other time, it is null.\n */\n this.dragging = null;\n this._props = props;\n this.state = props.state;\n this.directPlugins = props.plugins || [];\n this.directPlugins.forEach(checkStateComponent);\n this.dispatch = this.dispatch.bind(this);\n this.dom = (place && place.mount) || document.createElement(\"div\");\n if (place) {\n if (place.appendChild)\n place.appendChild(this.dom);\n else if (typeof place == \"function\")\n place(this.dom);\n else if (place.mount)\n this.mounted = true;\n }\n this.editable = getEditable(this);\n updateCursorWrapper(this);\n this.nodeViews = buildNodeViews(this);\n this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);\n this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added));\n this.domObserver.start();\n initInput(this);\n this.updatePluginViews();\n }\n /**\n Holds `true` when a\n [composition](https://w3c.github.io/uievents/#events-compositionevents)\n is active.\n */\n get composing() { return this.input.composing; }\n /**\n The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).\n */\n get props() {\n if (this._props.state != this.state) {\n let prev = this._props;\n this._props = {};\n for (let name in prev)\n this._props[name] = prev[name];\n this._props.state = this.state;\n }\n return this._props;\n }\n /**\n Update the view's props. Will immediately cause an update to\n the DOM.\n */\n update(props) {\n if (props.handleDOMEvents != this._props.handleDOMEvents)\n ensureListeners(this);\n let prevProps = this._props;\n this._props = props;\n if (props.plugins) {\n props.plugins.forEach(checkStateComponent);\n this.directPlugins = props.plugins;\n }\n this.updateStateInner(props.state, prevProps);\n }\n /**\n Update the view by updating existing props object with the object\n given as argument. Equivalent to `view.update(Object.assign({},\n view.props, props))`.\n */\n setProps(props) {\n let updated = {};\n for (let name in this._props)\n updated[name] = this._props[name];\n updated.state = this.state;\n for (let name in props)\n updated[name] = props[name];\n this.update(updated);\n }\n /**\n Update the editor's `state` prop, without touching any of the\n other props.\n */\n updateState(state) {\n this.updateStateInner(state, this._props);\n }\n updateStateInner(state, prevProps) {\n var _a;\n let prev = this.state, redraw = false, updateSel = false;\n // When stored marks are added, stop composition, so that they can\n // be displayed.\n if (state.storedMarks && this.composing) {\n clearComposition(this);\n updateSel = true;\n }\n this.state = state;\n let pluginsChanged = prev.plugins != state.plugins || this._props.plugins != prevProps.plugins;\n if (pluginsChanged || this._props.plugins != prevProps.plugins || this._props.nodeViews != prevProps.nodeViews) {\n let nodeViews = buildNodeViews(this);\n if (changedNodeViews(nodeViews, this.nodeViews)) {\n this.nodeViews = nodeViews;\n redraw = true;\n }\n }\n if (pluginsChanged || prevProps.handleDOMEvents != this._props.handleDOMEvents) {\n ensureListeners(this);\n }\n this.editable = getEditable(this);\n updateCursorWrapper(this);\n let innerDeco = viewDecorations(this), outerDeco = computeDocDeco(this);\n let scroll = prev.plugins != state.plugins && !prev.doc.eq(state.doc) ? \"reset\"\n : state.scrollToSelection > prev.scrollToSelection ? \"to selection\" : \"preserve\";\n let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);\n if (updateDoc || !state.selection.eq(prev.selection))\n updateSel = true;\n let oldScrollPos = scroll == \"preserve\" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);\n if (updateSel) {\n this.domObserver.stop();\n // Work around an issue in Chrome, IE, and Edge where changing\n // the DOM around an active selection puts it into a broken\n // state where the thing the user sees differs from the\n // selection reported by the Selection object (#710, #973,\n // #1011, #1013, #1035).\n let forceSelUpdate = updateDoc && (ie || chrome) && !this.composing &&\n !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);\n if (updateDoc) {\n // If the node that the selection points into is written to,\n // Chrome sometimes starts misreporting the selection, so this\n // tracks that and forces a selection reset when our update\n // did write to the node.\n let chromeKludge = chrome ? (this.trackWrites = this.domSelectionRange().focusNode) : null;\n if (this.composing)\n this.input.compositionNode = findCompositionNode(this);\n if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {\n this.docView.updateOuterDeco(outerDeco);\n this.docView.destroy();\n this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);\n }\n if (chromeKludge && (!this.trackWrites || !this.dom.contains(this.trackWrites)))\n forceSelUpdate = true;\n }\n // Work around for an issue where an update arriving right between\n // a DOM selection change and the \"selectionchange\" event for it\n // can cause a spurious DOM selection update, disrupting mouse\n // drag selection.\n let mouseDown = this.input.mouseDown;\n if (forceSelUpdate ||\n !(mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) &&\n anchorInRightPlace(this) && mouseDown.delaySelUpdate())) {\n selectionToDOM(this, forceSelUpdate);\n }\n else {\n syncNodeSelection(this, state.selection);\n this.domObserver.setCurSelection();\n }\n this.domObserver.start();\n }\n this.updatePluginViews(prev);\n if (((_a = this.dragging) === null || _a === void 0 ? void 0 : _a.node) && !prev.doc.eq(state.doc))\n this.updateDraggedNode(this.dragging, prev);\n if (scroll == \"reset\") {\n this.dom.scrollTop = 0;\n }\n else if (scroll == \"to selection\") {\n this.scrollToSelection();\n }\n else if (oldScrollPos) {\n resetScrollPos(oldScrollPos);\n }\n }\n /**\n @internal\n */\n scrollToSelection() {\n let startDOM = this.domSelectionRange().focusNode;\n if (!startDOM || !contains(this.dom, startDOM)) ;\n else if (this.someProp(\"handleScrollToSelection\", f => f(this))) ;\n else if (this.state.selection instanceof NodeSelection) {\n let target = this.docView.domAfterPos(this.state.selection.from);\n if (isElt(target))\n scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);\n }\n else {\n scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);\n }\n }\n destroyPluginViews() {\n let view;\n while (view = this.pluginViews.pop())\n if (view.destroy)\n view.destroy();\n }\n updatePluginViews(prevState) {\n if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {\n this.prevDirectPlugins = this.directPlugins;\n this.destroyPluginViews();\n for (let i = 0; i < this.directPlugins.length; i++) {\n let plugin = this.directPlugins[i];\n if (plugin.spec.view)\n this.pluginViews.push(plugin.spec.view(this));\n }\n for (let i = 0; i < this.state.plugins.length; i++) {\n let plugin = this.state.plugins[i];\n if (plugin.spec.view)\n this.pluginViews.push(plugin.spec.view(this));\n }\n }\n else {\n for (let i = 0; i < this.pluginViews.length; i++) {\n let pluginView = this.pluginViews[i];\n if (pluginView.update)\n pluginView.update(this, prevState);\n }\n }\n }\n updateDraggedNode(dragging, prev) {\n let sel = dragging.node, found = -1;\n if (sel.from < this.state.doc.content.size && this.state.doc.nodeAt(sel.from) == sel.node) {\n found = sel.from;\n }\n else {\n let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);\n let moved = movedPos > 0 && movedPos < this.state.doc.content.size && this.state.doc.nodeAt(movedPos);\n if (moved == sel.node)\n found = movedPos;\n }\n this.dragging = new Dragging(dragging.slice, dragging.move, found < 0 ? undefined : NodeSelection.create(this.state.doc, found));\n }\n someProp(propName, f) {\n let prop = this._props && this._props[propName], value;\n if (prop != null && (value = f ? f(prop) : prop))\n return value;\n for (let i = 0; i < this.directPlugins.length; i++) {\n let prop = this.directPlugins[i].props[propName];\n if (prop != null && (value = f ? f(prop) : prop))\n return value;\n }\n let plugins = this.state.plugins;\n if (plugins)\n for (let i = 0; i < plugins.length; i++) {\n let prop = plugins[i].props[propName];\n if (prop != null && (value = f ? f(prop) : prop))\n return value;\n }\n }\n /**\n Query whether the view has focus.\n */\n hasFocus() {\n // Work around IE not handling focus correctly if resize handles are shown.\n // If the cursor is inside an element with resize handles, activeElement\n // will be that element instead of this.dom.\n if (ie) {\n // If activeElement is within this.dom, and there are no other elements\n // setting `contenteditable` to false in between, treat it as focused.\n let node = this.root.activeElement;\n if (node == this.dom)\n return true;\n if (!node || !this.dom.contains(node))\n return false;\n while (node && this.dom != node && this.dom.contains(node)) {\n if (node.contentEditable == 'false')\n return false;\n node = node.parentElement;\n }\n return true;\n }\n return this.root.activeElement == this.dom;\n }\n /**\n Focus the editor.\n */\n focus() {\n this.domObserver.stop();\n if (this.editable)\n focusPreventScroll(this.dom);\n selectionToDOM(this);\n this.domObserver.start();\n }\n /**\n Get the document root in which the editor exists. This will\n usually be the top-level `document`, but might be a [shadow\n DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)\n root if the editor is inside one.\n */\n get root() {\n let cached = this._root;\n if (cached == null)\n for (let search = this.dom.parentNode; search; search = search.parentNode) {\n if (search.nodeType == 9 || (search.nodeType == 11 && search.host)) {\n if (!search.getSelection)\n Object.getPrototypeOf(search).getSelection = () => search.ownerDocument.getSelection();\n return this._root = search;\n }\n }\n return cached || document;\n }\n /**\n When an existing editor view is moved to a new document or\n shadow tree, call this to make it recompute its root.\n */\n updateRoot() {\n this._root = null;\n }\n /**\n Given a pair of viewport coordinates, return the document\n position that corresponds to them. May return null if the given\n coordinates aren't inside of the editor. When an object is\n returned, its `pos` property is the position nearest to the\n coordinates, and its `inside` property holds the position of the\n inner node that the position falls inside of, or -1 if it is at\n the top level, not in any node.\n */\n posAtCoords(coords) {\n return posAtCoords(this, coords);\n }\n /**\n Returns the viewport rectangle at a given document position.\n `left` and `right` will be the same number, as this returns a\n flat cursor-ish rectangle. If the position is between two things\n that aren't directly adjacent, `side` determines which element\n is used. When < 0, the element before the position is used,\n otherwise the element after.\n */\n coordsAtPos(pos, side = 1) {\n return coordsAtPos(this, pos, side);\n }\n /**\n Find the DOM position that corresponds to the given document\n position. When `side` is negative, find the position as close as\n possible to the content before the position. When positive,\n prefer positions close to the content after the position. When\n zero, prefer as shallow a position as possible.\n \n Note that you should **not** mutate the editor's internal DOM,\n only inspect it (and even that is usually not necessary).\n */\n domAtPos(pos, side = 0) {\n return this.docView.domFromPos(pos, side);\n }\n /**\n Find the DOM node that represents the document node after the\n given position. May return `null` when the position doesn't point\n in front of a node or if the node is inside an opaque node view.\n \n This is intended to be able to call things like\n `getBoundingClientRect` on that DOM node. Do **not** mutate the\n editor DOM directly, or add styling this way, since that will be\n immediately overriden by the editor as it redraws the node.\n */\n nodeDOM(pos) {\n let desc = this.docView.descAt(pos);\n return desc ? desc.nodeDOM : null;\n }\n /**\n Find the document position that corresponds to a given DOM\n position. (Whenever possible, it is preferable to inspect the\n document structure directly, rather than poking around in the\n DOM, but sometimes—for example when interpreting an event\n target—you don't have a choice.)\n \n The `bias` parameter can be used to influence which side of a DOM\n node to use when the position is inside a leaf node.\n */\n posAtDOM(node, offset, bias = -1) {\n let pos = this.docView.posFromDOM(node, offset, bias);\n if (pos == null)\n throw new RangeError(\"DOM position not inside the editor\");\n return pos;\n }\n /**\n Find out whether the selection is at the end of a textblock when\n moving in a given direction. When, for example, given `\"left\"`,\n it will return true if moving left from the current cursor\n position would leave that position's parent textblock. Will apply\n to the view's current state by default, but it is possible to\n pass a different state.\n */\n endOfTextblock(dir, state) {\n return endOfTextblock(this, state || this.state, dir);\n }\n /**\n Run the editor's paste logic with the given HTML string. The\n `event`, if given, will be passed to the\n [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.\n */\n pasteHTML(html, event) {\n return doPaste(this, \"\", html, false, event || new ClipboardEvent(\"paste\"));\n }\n /**\n Run the editor's paste logic with the given plain-text input.\n */\n pasteText(text, event) {\n return doPaste(this, text, null, true, event || new ClipboardEvent(\"paste\"));\n }\n /**\n Serialize the given slice as it would be if it was copied from\n this editor. Returns a DOM element that contains a\n representation of the slice as its children, a textual\n representation, and the transformed slice (which can be\n different from the given input due to hooks like\n [`transformCopied`](https://prosemirror.net/docs/ref/#view.EditorProps.transformCopied)).\n */\n serializeForClipboard(slice) {\n return serializeForClipboard(this, slice);\n }\n /**\n Removes the editor from the DOM and destroys all [node\n views](https://prosemirror.net/docs/ref/#view.NodeView).\n */\n destroy() {\n if (!this.docView)\n return;\n destroyInput(this);\n this.destroyPluginViews();\n if (this.mounted) {\n this.docView.update(this.state.doc, [], viewDecorations(this), this);\n this.dom.textContent = \"\";\n }\n else if (this.dom.parentNode) {\n this.dom.parentNode.removeChild(this.dom);\n }\n this.docView.destroy();\n this.docView = null;\n clearReusedRange();\n }\n /**\n This is true when the view has been\n [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be\n used anymore).\n */\n get isDestroyed() {\n return this.docView == null;\n }\n /**\n Used for testing.\n */\n dispatchEvent(event) {\n return dispatchEvent(this, event);\n }\n /**\n @internal\n */\n domSelectionRange() {\n let sel = this.dom.isConnected !== false && this.domSelection();\n if (!sel)\n return { focusNode: null, focusOffset: 0, anchorNode: null, anchorOffset: 0 };\n return safari && this.root.nodeType === 11 &&\n deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;\n }\n /**\n @internal\n */\n domSelection() {\n return this.root.getSelection();\n }\n}\nEditorView.prototype.dispatch = function (tr) {\n let dispatchTransaction = this._props.dispatchTransaction;\n if (dispatchTransaction)\n dispatchTransaction.call(this, tr);\n else\n this.updateState(this.state.apply(tr));\n};\nfunction computeDocDeco(view) {\n let attrs = Object.create(null);\n attrs.class = \"ProseMirror\";\n attrs.contenteditable = String(view.editable);\n view.someProp(\"attributes\", value => {\n if (typeof value == \"function\")\n value = value(view.state);\n if (value)\n for (let attr in value) {\n if (attr == \"class\")\n attrs.class += \" \" + value[attr];\n else if (attr == \"style\")\n attrs.style = (attrs.style ? attrs.style + \";\" : \"\") + value[attr];\n else if (!attrs[attr] && attr != \"contenteditable\" && attr != \"nodeName\")\n attrs[attr] = String(value[attr]);\n }\n });\n if (!attrs.translate)\n attrs.translate = \"no\";\n return [Decoration.node(0, view.state.doc.content.size, attrs)];\n}\nfunction updateCursorWrapper(view) {\n if (view.markCursor) {\n let dom = document.createElement(\"img\");\n dom.className = \"ProseMirror-separator\";\n dom.setAttribute(\"mark-placeholder\", \"true\");\n dom.setAttribute(\"alt\", \"\");\n view.cursorWrapper = { dom, deco: Decoration.widget(view.state.selection.from, dom, { raw: true, marks: view.markCursor }) };\n }\n else {\n view.cursorWrapper = null;\n }\n}\nfunction getEditable(view) {\n return !view.someProp(\"editable\", value => value(view.state) === false);\n}\nfunction selectionContextChanged(sel1, sel2) {\n let depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));\n return sel1.$anchor.start(depth) != sel2.$anchor.start(depth);\n}\nfunction buildNodeViews(view) {\n let result = Object.create(null);\n function add(obj) {\n for (let prop in obj)\n if (!Object.prototype.hasOwnProperty.call(result, prop))\n result[prop] = obj[prop];\n }\n view.someProp(\"nodeViews\", add);\n view.someProp(\"markViews\", add);\n return result;\n}\nfunction changedNodeViews(a, b) {\n let nA = 0, nB = 0;\n for (let prop in a) {\n if (a[prop] != b[prop])\n return true;\n nA++;\n }\n for (let _ in b)\n nB++;\n return nA != nB;\n}\nfunction checkStateComponent(plugin) {\n if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction)\n throw new RangeError(\"Plugins passed directly to the view must not have a state component\");\n}\n\nexport { Decoration, DecorationSet, EditorView, __endComposition, __parseFromClipboard };\n","export var base = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 10: \"Enter\",\n 12: \"NumLock\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 44: \"PrintScreen\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Meta\",\n 92: \"Meta\",\n 106: \"*\",\n 107: \"+\",\n 108: \",\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 160: \"Shift\",\n 161: \"Shift\",\n 162: \"Control\",\n 163: \"Control\",\n 164: \"Alt\",\n 165: \"Alt\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\"\n}\n\nexport var shift = {\n 48: \")\",\n 49: \"!\",\n 50: \"@\",\n 51: \"#\",\n 52: \"$\",\n 53: \"%\",\n 54: \"^\",\n 55: \"&\",\n 56: \"*\",\n 57: \"(\",\n 59: \":\",\n 61: \"+\",\n 173: \"_\",\n 186: \":\",\n 187: \"+\",\n 188: \"<\",\n 189: \"_\",\n 190: \">\",\n 191: \"?\",\n 192: \"~\",\n 219: \"{\",\n 220: \"|\",\n 221: \"}\",\n 222: \"\\\"\"\n}\n\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform)\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent)\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i)\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n base[i] = String.fromCharCode(i + 32)\n shift[i] = String.fromCharCode(i)\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code]\n\nexport function keyName(event) {\n // On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.\n // On IE, shift effect is never included in `.key`.\n var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey ||\n ie && event.shiftKey && event.key && event.key.length == 1 ||\n event.key == \"Unidentified\"\n var name = (!ignoreKey && event.key) ||\n (event.shiftKey ? shift : base)[event.keyCode] ||\n event.key || \"Unidentified\"\n // Edge sometimes produces wrong names (Issue #3)\n if (name == \"Esc\") name = \"Escape\"\n if (name == \"Del\") name = \"Delete\"\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n if (name == \"Left\") name = \"ArrowLeft\"\n if (name == \"Up\") name = \"ArrowUp\"\n if (name == \"Right\") name = \"ArrowRight\"\n if (name == \"Down\") name = \"ArrowDown\"\n return name\n}\n","import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\n\nconst mac = typeof navigator != \"undefined\" && /Mac|iP(hone|[oa]d)/.test(navigator.platform);\nconst windows = typeof navigator != \"undefined\" && /Win/.test(navigator.platform);\nfunction normalizeKeyName(name) {\n let parts = name.split(/-(?!$)/), result = parts[parts.length - 1];\n if (result == \"Space\")\n result = \" \";\n let alt, ctrl, shift, meta;\n for (let i = 0; i < parts.length - 1; i++) {\n let mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod))\n meta = true;\n else if (/^a(lt)?$/i.test(mod))\n alt = true;\n else if (/^(c|ctrl|control)$/i.test(mod))\n ctrl = true;\n else if (/^s(hift)?$/i.test(mod))\n shift = true;\n else if (/^mod$/i.test(mod)) {\n if (mac)\n meta = true;\n else\n ctrl = true;\n }\n else\n throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt)\n result = \"Alt-\" + result;\n if (ctrl)\n result = \"Ctrl-\" + result;\n if (meta)\n result = \"Meta-\" + result;\n if (shift)\n result = \"Shift-\" + result;\n return result;\n}\nfunction normalize(map) {\n let copy = Object.create(null);\n for (let prop in map)\n copy[normalizeKeyName(prop)] = map[prop];\n return copy;\n}\nfunction modifiers(name, event, shift = true) {\n if (event.altKey)\n name = \"Alt-\" + name;\n if (event.ctrlKey)\n name = \"Ctrl-\" + name;\n if (event.metaKey)\n name = \"Meta-\" + name;\n if (shift && event.shiftKey)\n name = \"Shift-\" + name;\n return name;\n}\n/**\nCreate a keymap plugin for the given set of bindings.\n\nBindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style\nfunctions, which will be called with `(EditorState, dispatch,\nEditorView)` arguments, and should return true when they've handled\nthe key. Note that the view argument isn't part of the command\nprotocol, but can be used as an escape hatch if a binding needs to\ndirectly interact with the UI.\n\nKey names may be strings like `\"Shift-Ctrl-Enter\"`—a key\nidentifier prefixed with zero or more modifiers. Key identifiers\nare based on the strings that can appear in\n[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\nUse lowercase letters to refer to letter keys (or uppercase letters\nif you want shift to be held). You may use `\"Space\"` as an alias\nfor the `\" \"` name.\n\nModifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n`Meta-`) are recognized. For characters that are created by holding\nshift, the `Shift-` prefix is implied, and should not be added\nexplicitly.\n\nYou can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\nother platforms.\n\nYou can add multiple keymap plugins to an editor. The order in\nwhich they appear determines their precedence (the ones early in\nthe array get to dispatch first).\n*/\nfunction keymap(bindings) {\n return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });\n}\n/**\nGiven a set of bindings (using the same format as\n[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown\nhandler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.\n*/\nfunction keydownHandler(bindings) {\n let map = normalize(bindings);\n return function (view, event) {\n let name = keyName(event), baseName, direct = map[modifiers(name, event)];\n if (direct && direct(view.state, view.dispatch, view))\n return true;\n // A character key\n if (name.length == 1 && name != \" \") {\n if (event.shiftKey) {\n // In case the name was already modified by shift, try looking\n // it up without its shift modifier\n let noShift = map[modifiers(name, event, false)];\n if (noShift && noShift(view.state, view.dispatch, view))\n return true;\n }\n if ((event.altKey || event.metaKey || event.ctrlKey) &&\n // Ctrl-Alt may be used for AltGr on Windows\n !(windows && event.ctrlKey && event.altKey) &&\n (baseName = base[event.keyCode]) && baseName != name) {\n // Try falling back to the keyCode when there's a modifier\n // active or the character produced isn't ASCII, and our table\n // produces a different name from the the keyCode. See #668,\n // #1060, #1529.\n let fromCode = map[modifiers(baseName, event)];\n if (fromCode && fromCode(view.state, view.dispatch, view))\n return true;\n }\n }\n return false;\n };\n}\n\nexport { keydownHandler, keymap };\n","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* @param options - Optional rendering options\n* @param options.alignNestedToPrefix - Indent nested content to the width of the prefix\n* instead of the configured indent size, when the configured one is narrower\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 an ordered list item, where the nested block has to line up with the marker\n* return renderNestedMarkdownContent(node, h, '10. ', ctx, { alignNestedToPrefix: true })\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*/\nconst TAB_STOP = 4;\n/** Width of indentation in Markdown columns, where a tab runs to the next tab stop. */\nfunction columnWidth(text) {\n\tlet width = 0;\n\tfor (const character of text) width = character === \"\t\" ? width + TAB_STOP - width % TAB_STOP : width + 1;\n\treturn width;\n}\nfunction renderNestedMarkdownContent(node, h, prefixOrGenerator, ctx, options) {\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 indentLine = (line) => {\n\t\t\t\tif (!(options === null || options === void 0 ? void 0 : options.alignNestedToPrefix)) return h.indent(line);\n\t\t\t\tconst configured = h.indent(\"\");\n\t\t\t\tconst prefixWidth = columnWidth(prefix);\n\t\t\t\treturn (columnWidth(configured) >= prefixWidth ? configured : \" \".repeat(prefixWidth)) + line;\n\t\t\t};\n\t\t\tconst indentedChild = childContent.split(\"\\n\").map((line) => line ? indentLine(line) : indentLine(\"\")).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.contentDOM.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.contentDOM.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,1,2,3,4,5,6],"mappings":";;AACA,IAAI,KAAY,OAAO,gBACnB,MAAe,GAAK,MAAe;CACtC,IAAI,IAAS,CAAC;CACd,KAAK,IAAI,KAAQ,GAAK,GAAU,GAAQ,GAAM;EAC7C,KAAK,EAAI;EACT,YAAY;CACb,CAAC;CAED,OADK,KAAY,GAAU,GAAQ,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC,GACnE;AACR,GCHMA,MAAmB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