{"version":3,"sources":["webpack:///./node_modules/prosemirror-view/dist/index.es.js"],"names":["result","navigator","document","ie_edge","exec","userAgent","ie_upto10","test","ie_11up","mac","platform","ie","ie_version","documentMode","gecko","gecko_version","chrome","chrome_version","safari","vendor","ios","maxTouchPoints","android","webkit","documentElement","style","webkit_version","domIndex","node","index","previousSibling","parentNode","parent","assignedSlot","nodeType","host","reusedRange","textRange","from","to","range","createRange","setEnd","nodeValue","length","setStart","isEquivalentPosition","off","targetNode","targetOff","scanFor","atomElements","dir","nodeSize","hasBlockDesc","nodeName","contentEditable","childNodes","isOnEdge","offset","atStart","atEnd","dom","desc","cur","pmViewDesc","isBlock","contentDOM","selectionCollapsed","domSel","collapsed","isCollapsed","rangeCount","getRangeAt","keyEvent","keyCode","key","event","createEvent","initEvent","code","windowRect","doc","left","right","clientWidth","top","bottom","clientHeight","getSide","value","side","clientRect","rect","getBoundingClientRect","scaleX","width","offsetWidth","scaleY","height","offsetHeight","scrollRectIntoView","view","startDOM","scrollThreshold","someProp","scrollMargin","ownerDocument","atTop","body","bounding","moveX","moveY","defaultView","scrollBy","startX","scrollLeft","startY","scrollTop","dX","dY","storeScrollPos","refDOM","refTop","Math","max","x","y","min","innerHeight","root","elementFromPoint","contains","localRect","stack","scrollStack","push","resetScrollPos","ref","newRefTop","restoreScrollStack","dTop","i","preventScrollSupported","focusPreventScroll","setActive","focus","stored","preventScroll","undefined","findOffsetInNode","coords","closest","coordsClosest","dxClosest","rowBot","rowTop","child","firstChild","childIndex","nextSibling","rects","getClientRects","dx","findOffsetInText","len","singleRect","inRect","targetKludge","posFromElement","elt","bias","docView","posFromDOM","posFromCaret","outside","nearestDesc","posBefore","posAfter","element","box","startI","floor","j","posAtCoords","assign","assign$1","caretPositionFromPoint","pos$1","offsetNode","_","caretRangeFromPoint","startContainer","startOffset","pos","p","draggable","box$1","next","lastChild","state","content","size","inside","posAtStart","border","object","BIDI","coordsAtPos","domFromPos","supportEmptyRange","takeSide","flattenV","rectBefore","rectAfter","resolve","inlineContent","before","flattenH","after","before$1","target","after$1","ignoreForCoords","target$1","withFlushedState","f","viewState","active","activeElement","updateState","endOfTextblockVertical","sel","selection","$pos","$from","$to","nearest","boxes","maybeRTL","endOfTextblockHorizontal","$head","isTextblock","parentOffset","getSelection","textContent","modify","oldRange","oldNode","focusNode","oldOff","focusOffset","oldBidiLevel","caretBidiLevel","parentDOM","depth","domAfterPos","removeAllRanges","addRange","cachedState","cachedDir","cachedResult","endOfTextblock","NOT_DIRTY","CHILD_DIRTY","CONTENT_DIRTY","NODE_DIRTY","ViewDesc","children","this","dirty","prototypeAccessors","configurable","posAtEnd","contentLost","domAtom","prototype","matchesWidget","matchesMark","matchesNode","matchesHack","_nodeName","parseRule","stopEvent","get","destroy","posBeforeChild","localPosFromDOM","domBefore","domAfter","desc$1","compareDocumentPosition","search","search$1","onlyNodes","first","getDesc","nodeDOM","scan","descAt","end","curPos","TrailingHackViewDesc","prev","WidgetViewDesc","widget","type","prev$1","enter","enter$1","parseRange","base","fromOffset","toOffset","childBase","emptyChildAt","j$1","RangeError","setSelection","anchor","head","force","anchorDOM","headDOM","brKludge","offset$1","anchorNode","anchorOffset","domSelExtended","extend","collapse","err","DOMException","tmp","ignoreMutation","mutation","markDirty","startInside","endInside","markParentsDirty","level","Object","defineProperties","nothing","self","toDOM","spec","raw","wrap","createElement","appendChild","classList","add","call","__proto__","create","constructor","prototypeAccessors$1","eq","ignore","stop","ignoreSelection","CompositionViewDesc","textDOM","text","prototypeAccessors$2","mut","oldValue","MarkViewDesc","mark","inline","custom","nodeViews","name","renderSpec","attrs","contentElement","slice","copy","nodes","replaceNodes","NodeViewDesc","outerDeco","innerDeco","isLeaf","updateChildren","prototypeAccessors$3","descObj","isText","createTextNode","hasAttribute","applyOuterDeco","CustomNodeViewDesc","TextViewDesc","this$1","reparseInView","rule","preserveWhitespace","getContent","empty","sameOuterDeco","composition","composing","localCompositionInfo","localComposition","compositionInChild","updater","ViewTreeUpdater","iterDeco","insideNode","marks","syncToMarks","childCount","none","placeWidget","compIndex","findNodeMatch","findIndexWithChild","updateNodeAt","updateNextNode","addNode","addTextblockHacks","destroyRest","changed","protectLocalComposition","renderDescs","iosHacks","textNode","nearbyTextNode","textPos","findTextInFragment","topNode","removeChild","compositionNodes","update","sameMarkup","updateInner","updateOuterDeco","needsWrap","oldDOM","patchOuterDeco","computeOuterDeco","selectNode","deselectNode","remove","removeAttribute","isAtom","docViewDesc","prototypeAccessors$4","skip","pmIsDeco","inParent","trackWrites","n","cut","apply","arguments","prototypeAccessors$5","descs","written","childDOM","rm","insertBefore","OuterDecoLevel","noDeco","val","isInline","class","outerDOM","prevComputed","curComputed","curDOM","deco","tagName","toLowerCase","patchAttributes","name$1","setAttribute","prevList","split","filter","Boolean","curList","indexOf","i$1","m","prop","removeProperty","cssText","a","b","lockedNode","lock","preMatch","frag","fI","dI","matched","Map","set","compareSide","onWidget","onNode","locals","decoIndex","restNode","parentIndex","widgets","sort","child$1","i$2","splice","cutAt","i$3","d","forChild","oldCSS","window","getComputedStyle","listStyle","childStart","str","found","lastIndexOf","replacement","start","selectionFromDOM","origin","inWidget","$anchor","isSelectable","selectionBetween","editorOwnsSelection","editable","hasFocus","hasSelection","selectionToDOM","syncNodeSelection","mouseDown","allowDefault","delayedSelectionSync","domObserver","setCurSelection","disconnectSelection","cursorWrapper","selectCursorWrapper","resetEditableFrom","resetEditableTo","brokenSelectBetweenUneditable","temporarilyEditableNear","resetEditable","visible","removeClassOnSelectionChange","connectSelection","destroyBetween","keep","maxKeep","spanning","pop","markDesc","e","has","domNode","nextDOM","locked","addHackNode","className","setEditable","wasDraggable","removeEventListener","hideSelectionGuard","addEventListener","setTimeout","img","disabled","lastSelectedViewDesc","clearNodeSelection","between","hasFocusAndSelection","anchorInRightPlace","moveSelectionBlock","$side","$start","findFrom","dispatch","tr","scrollIntoView","selectHorizontally","mods","next$1","textOffset","nodeBefore","nodeAfter","nodePos","nodeLen","isIgnorable","skipIgnoredNodesLeft","moveNode","moveOffset","isBlockNode","setSelFocus","skipIgnoredNodesRight","selectVertically","beyond","near","stopNativeHorizontalDelete","sameParent","nextNode","delete","switchEditable","safariDownArrowBug","getMods","ctrlKey","metaKey","altKey","shiftKey","captureKeyDown","parseBetween","from_","to_","find","lastKeyCode","startDoc","parser","fromSchema","schema","parse","topMatch","contentMatchAt","topOpen","editableContent","findPositions","ruleFromNode","context","anchor$1","getAttribute","readDOMChange","typeOver","addedNodes","lastSelectionTime","Date","now","lastSelectionOrigin","newSel","tr$1","setMeta","$before","shared","sharedDepth","preferredPos","preferredSide","compare","lastKeyCodeTime","change","findDiff","lastIOSEnter","some","sel$1","resolveSelection","endA","endB","domChangeCount","textBetween","nextSel","resolveNoCache","inlineChange","looksLikeJoin","suppressSelectionUpdates","toB","lastAndroidDelete","storedMarks","markChange","$from1","chFrom","chTo","marksAcross","isMarkChange","addMark","removeMark","text$1","insertText","replace","sel$2","mapping","map","ensureMarks","parsedSel","curMarks","prevMarks","added","removed","removeFromSet","addToSet","updated","old","$newStart","$newEnd","skipClosingAndOpening","$next","fromEnd","mayOpen","indexAfter","maybeChild","findDiffStart","findDiffEnd","adjust","move","move$1","serializeForClipboard","openStart","openEnd","defaultAttrs","serializer","detachedDoc","serializeFragment","wrapMap","wrapper","JSON","stringify","parseFromClipboard","html","plainText","$context","inCode","asText","parsed","trim","forEach","block","serializeNode","readHTML","restoreReplacedSpaces","contextNode","querySelector","sliceData","parseSlice","addContext","closeSlice","maxOpen","normalizeSiblings","fragment","loop","match","lastWrap","inLast","findWrapping","addToSibling","closeRight","wrapped","withWrappers","matchType","v","returned","sibling","inner","replaceChild","append","fill","fillBefore","closeRange","thead","tbody","tfoot","caption","colgroup","col","td","th","_detachedDoc","implementation","createHTMLDocument","metas","firstTag","join","reverse","innerHTML","querySelectorAll","array","hasRequiredAttrs","observeOptions","childList","characterData","characterDataOldValue","attributes","attributeOldValue","subtree","useCharData","SelectionState","DOMObserver","handleDOMChange","queue","flushingSoon","observer","MutationObserver","mutations","removedNodes","flushSoon","flush","currentSelection","onCharData","prevValue","onSelectionChange","bind","suppressingSelectionUpdates","forceFlush","clearTimeout","observe","take","takeRecords","disconnect","ignoreSelectionChange","container","commonAncestorContainer","concat","result$1","registerMutation","brs","checkCSS","attributeName","Array","cssChecked","whiteSpace","console","handlers","editHandlers","initInput","lastClick","time","lastIOSEnterFallbackTimeout","composingTimeout","compositionEndedAt","eventHandlers","handler","eventBelongsToView","runCustomHandler","ensureListeners","setSelectionOrigin","destroyInput","currentHandlers","defaultPrevented","bubbles","dispatchEvent","eventCoords","clientX","clientY","isNear","click","dy","runHandlerOnContext","propName","updateSelection","focused","selectClickedLeaf","selectClickedNode","selectedNode","selectAt","handleSingleClick","handleDoubleClick","handleTripleClick","defaultTripleClick","button","forceDOMFlush","endComposition","keydown","inOrNearComposition","preventDefault","keyup","keypress","charCode","String","fromCharCode","selectNodeModifier","mousedown","flushed","done","MouseDown","targetPos","nodeAt","mightDrag","targetDesc","selectable","addAttr","setUneditable","up","abs","timeStamp","buttons","touchdown","contextmenu","timeoutComposition","scheduleComposeEnd","delay","clearComposition","timestampFromCustomEvent","forceUpdate","captureCopy","selectNodeContents","blur","compositionstart","compositionupdate","inclusive","markCursor","compositionend","brokenClipboardAPI","sliceSingleNode","capturePaste","doPaste","singleNode","replaceSelectionWith","replaceSelection","data","clipboardData","clearData","setData","deleteSelection","paste","getData","Dragging","dragCopyModifier","dragstart","dataTransfer","effectAllowed","dragging","dragend","dragover","dragenter","drop","eventPos","$mouse","insertPos","isNode","beforeInsert","replaceRangeWith","replaceRange","maps","_from","_to","_newFrom","newTo","relatedTarget","beforeinput","inputType","$cursor","compareObjs","p$1","WidgetType","noSpec","span","oldOffset","mapResult","deleted","Decoration","valid","other","InlineType","inclusiveStart","inclusiveEnd","is","NodeType","findIndex","DecorationSet","local","decorations","buildTree","predicate","findInner","childOff","options","mapInner","newLocal","mapped","onRemove","mapChildren","byPos","addInner","childNode","childOffset","baseOffset","takeSpansForNode","moveSpans","withoutNulls","removeInner","span$1","dec","localSet","DecorationGroup","removeOverlap","localsInner","members","oldChildren","shift","oldStart","oldEnd","newStart","newEnd","dSize","mustRebuild","fromLocal","toLocal","mapAndGatherRemainingDecorations","built","from$1","spans","gather","hasNulls","localStart","working","insertAhead","viewDecorations","mappedDecos","member","sorted","EditorView","place","props","_props","directPlugins","plugins","checkStateComponent","_root","mount","mounted","getEditable","updateCursorWrapper","buildNodeViews","computeDocDeco","prevDirectPlugins","pluginViews","updatePluginViews","contenteditable","translate","attr","selectionContextChanged","sel1","sel2","obj","hasOwnProperty","changedNodeViews","nA","nB","plugin","filterTransaction","appendTransaction","handleDOMEvents","updateStateInner","setProps","reconfigured","redraw","updateSel","scroll","scrollToSelection","updateDoc","oldScrollPos","overflowAnchor","forceSelUpdate","chromeKludge","destroyPluginViews","prevState","pluginView","plugin$1","prop$1","prop$2","cached","getPrototypeOf","domAtPos","posAtDOM","dispatchTransaction"],"mappings":"0HAAA,iJAIIA,EAAS,GAEb,GAAwB,oBAAbC,WAA+C,oBAAZC,SAAyB,CACrE,IAAIC,EAAU,cAAcC,KAAKH,UAAUI,WACvCC,EAAY,UAAUC,KAAKN,UAAUI,WACrCG,EAAU,wCAAwCJ,KAAKH,UAAUI,WAErEL,EAAOS,IAAM,MAAMF,KAAKN,UAAUS,UAClC,IAAIC,EAAKX,EAAOW,MAAQL,GAAaE,GAAWL,GAChDH,EAAOY,WAAaN,EAAYJ,SAASW,cAAgB,EAAIL,GAAWA,EAAQ,GAAKL,GAAWA,EAAQ,GAAK,KAC7GH,EAAOc,OAASH,GAAM,gBAAgBJ,KAAKN,UAAUI,WACrDL,EAAOe,cAAgBf,EAAOc,SAAW,iBAAiBV,KAAKH,UAAUI,YAAc,CAAC,EAAG,IAAI,GAC/F,IAAIW,GAAUL,GAAM,gBAAgBP,KAAKH,UAAUI,WACnDL,EAAOgB,SAAWA,EAClBhB,EAAOiB,eAAiBD,IAAWA,EAAO,GAE1ChB,EAAOkB,QAAUP,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,UAAWyF","file":"js/chunk-vendors~17f7a19a.f313703d.js","sourcesContent":["import { TextSelection, NodeSelection, Selection, AllSelection } from 'prosemirror-state';\nimport { DOMSerializer, Fragment, Mark, DOMParser, Slice } from 'prosemirror-model';\nimport { dropPoint } from 'prosemirror-transform';\n\nvar result = {};\n\nif (typeof navigator != \"undefined\" && typeof document != \"undefined\") {\n  var ie_edge = /Edge\\/(\\d+)/.exec(navigator.userAgent);\n  var ie_upto10 = /MSIE \\d/.test(navigator.userAgent);\n  var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);\n\n  result.mac = /Mac/.test(navigator.platform);\n  var ie = result.ie = !!(ie_upto10 || ie_11up || ie_edge);\n  result.ie_version = ie_upto10 ? document.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : null;\n  result.gecko = !ie && /gecko\\/(\\d+)/i.test(navigator.userAgent);\n  result.gecko_version = result.gecko && +(/Firefox\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1];\n  var chrome = !ie && /Chrome\\/(\\d+)/.exec(navigator.userAgent);\n  result.chrome = !!chrome;\n  result.chrome_version = chrome && +chrome[1];\n  // Is true for both iOS and iPadOS for convenience\n  result.safari = !ie && /Apple Computer/.test(navigator.vendor);\n  result.ios = result.safari && (/Mobile\\/\\w+/.test(navigator.userAgent) || navigator.maxTouchPoints > 2);\n  result.android = /Android \\d/.test(navigator.userAgent);\n  result.webkit = \"webkitFontSmoothing\" in document.documentElement.style;\n  result.webkit_version = result.webkit && +(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1];\n}\n\nvar domIndex = function(node) {\n  for (var index = 0;; index++) {\n    node = node.previousSibling;\n    if (!node) { return index }\n  }\n};\n\nvar parentNode = function(node) {\n  var parent = node.assignedSlot || node.parentNode;\n  return parent && parent.nodeType == 11 ? parent.host : parent\n};\n\nvar reusedRange = null;\n\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.\nvar textRange = function(node, from, to) {\n  var 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};\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)\nvar isEquivalentPosition = function(node, off, targetNode, targetOff) {\n  return targetNode && (scanFor(node, off, targetNode, targetOff, -1) ||\n                        scanFor(node, off, targetNode, targetOff, 1))\n};\n\nvar atomElements = /^(img|br|input|textarea|hr)$/i;\n\nfunction scanFor(node, off, targetNode, targetOff, dir) {\n  for (;;) {\n    if (node == targetNode && off == targetOff) { return true }\n    if (off == (dir < 0 ? 0 : nodeSize(node))) {\n      var parent = node.parentNode;\n      if (parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == \"false\")\n        { return false }\n      off = domIndex(node) + (dir < 0 ? 0 : 1);\n      node = parent;\n    } else if (node.nodeType == 1) {\n      node = node.childNodes[off + (dir < 0 ? -1 : 0)];\n      if (node.contentEditable == \"false\") { return false }\n      off = dir < 0 ? nodeSize(node) : 0;\n    } else {\n      return false\n    }\n  }\n}\n\nfunction nodeSize(node) {\n  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length\n}\n\nfunction isOnEdge(node, offset, parent) {\n  for (var atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {\n    if (node == parent) { return true }\n    var index = domIndex(node);\n    node = node.parentNode;\n    if (!node) { return false }\n    atStart = atStart && index == 0;\n    atEnd = atEnd && index == nodeSize(node);\n  }\n}\n\nfunction hasBlockDesc(dom) {\n  var desc;\n  for (var cur = dom; cur; cur = cur.parentNode) { if (desc = cur.pmViewDesc) { break } }\n  return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom)\n}\n\n// Work around Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=447523\n// (isCollapsed inappropriately returns true in shadow dom)\nvar selectionCollapsed = function(domSel) {\n  var collapsed = domSel.isCollapsed;\n  if (collapsed && result.chrome && domSel.rangeCount && !domSel.getRangeAt(0).collapsed)\n    { collapsed = false; }\n  return collapsed\n};\n\nfunction keyEvent(keyCode, key) {\n  var event = document.createEvent(\"Event\");\n  event.initEvent(\"keydown\", true, true);\n  event.keyCode = keyCode;\n  event.key = event.code = key;\n  return event\n}\n\nfunction windowRect(doc) {\n  return {left: 0, right: doc.documentElement.clientWidth,\n          top: 0, bottom: doc.documentElement.clientHeight}\n}\n\nfunction getSide(value, side) {\n  return typeof value == \"number\" ? value : value[side]\n}\n\nfunction clientRect(node) {\n  var rect = node.getBoundingClientRect();\n  // Adjust for elements with style \"transform: scale()\"\n  var scaleX = (rect.width / node.offsetWidth) || 1;\n  var 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}\n\nfunction scrollRectIntoView(view, rect, startDOM) {\n  var scrollThreshold = view.someProp(\"scrollThreshold\") || 0, scrollMargin = view.someProp(\"scrollMargin\") || 5;\n  var doc = view.dom.ownerDocument;\n  for (var parent = startDOM || view.dom;; parent = parentNode(parent)) {\n    if (!parent) { break }\n    if (parent.nodeType != 1) { continue }\n    var atTop = parent == doc.body || parent.nodeType != 1;\n    var bounding = atTop ? windowRect(doc) : clientRect(parent);\n    var 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 - 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      } else {\n        var startX = parent.scrollLeft, startY = parent.scrollTop;\n        if (moveY) { parent.scrollTop += moveY; }\n        if (moveX) { parent.scrollLeft += moveX; }\n        var 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    if (atTop) { break }\n  }\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  var rect = view.dom.getBoundingClientRect(), startY = Math.max(0, rect.top);\n  var refDOM, refTop;\n  for (var x = (rect.left + rect.right) / 2, y = startY + 1;\n       y < Math.min(innerHeight, rect.bottom); y += 5) {\n    var dom = view.root.elementFromPoint(x, y);\n    if (dom == view.dom || !view.dom.contains(dom)) { continue }\n    var 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}\n\nfunction scrollStack(dom) {\n  var stack = [], doc = dom.ownerDocument;\n  for (; dom; dom = parentNode(dom)) {\n    stack.push({dom: dom, top: dom.scrollTop, left: dom.scrollLeft});\n    if (dom == doc) { break }\n  }\n  return stack\n}\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(ref) {\n  var refDOM = ref.refDOM;\n  var refTop = ref.refTop;\n  var stack = ref.stack;\n\n  var newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;\n  restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);\n}\n\nfunction restoreScrollStack(stack, dTop) {\n  for (var i = 0; i < stack.length; i++) {\n    var ref = stack[i];\n    var dom = ref.dom;\n    var top = ref.top;\n    var left = ref.left;\n    if (dom.scrollTop != top + dTop) { dom.scrollTop = top + dTop; }\n    if (dom.scrollLeft != left) { dom.scrollLeft = left; }\n  }\n}\n\nvar 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) { return dom.setActive() } // in IE\n  if (preventScrollSupported) { return dom.focus(preventScrollSupported) }\n\n  var 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}\n\nfunction findOffsetInNode(node, coords) {\n  var closest, dxClosest = 2e8, coordsClosest, offset = 0;\n  var rowBot = coords.top, rowTop = coords.top;\n  for (var child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {\n    var rects = (void 0);\n    if (child.nodeType == 1) { rects = child.getClientRects(); }\n    else if (child.nodeType == 3) { rects = textRange(child).getClientRects(); }\n    else { continue }\n\n    for (var i = 0; i < rects.length; i++) {\n      var 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        var 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 && closest.nodeType == 3 ? {left: rect.right < coords.left ? rect.right : rect.left, top: coords.top} : coords;\n          if (child.nodeType == 1 && dx)\n            { offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0); }\n          continue\n        }\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 && closest.nodeType == 3) { return findOffsetInText(closest, coordsClosest) }\n  if (!closest || (dxClosest && closest.nodeType == 1)) { return {node: node, offset: offset} }\n  return findOffsetInNode(closest, coordsClosest)\n}\n\nfunction findOffsetInText(node, coords) {\n  var len = node.nodeValue.length;\n  var range = document.createRange();\n  for (var i = 0; i < len; i++) {\n    range.setEnd(node, i + 1);\n    range.setStart(node, i);\n    var rect = singleRect(range, 1);\n    if (rect.top == rect.bottom) { continue }\n    if (inRect(coords, rect))\n      { return {node: node, offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0)} }\n  }\n  return {node: node, offset: 0}\n}\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}\n\nfunction targetKludge(dom, coords) {\n  var parent = dom.parentNode;\n  if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left)\n    { return parent }\n  return dom\n}\n\nfunction posFromElement(view, elt, coords) {\n  var ref = findOffsetInNode(elt, coords);\n  var node = ref.node;\n  var offset = ref.offset;\n  var bias = -1;\n  if (node.nodeType == 1 && !node.firstChild) {\n    var 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}\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  var outside = -1;\n  for (var cur = node;;) {\n    if (cur == view.dom) { break }\n    var desc = view.docView.nearestDesc(cur, true);\n    if (!desc) { return null }\n    if (desc.node.isBlock && desc.parent) {\n      var rect = desc.dom.getBoundingClientRect();\n      if (rect.left > coords.left || rect.top > coords.top) { outside = desc.posBefore; }\n      else if (rect.right < coords.left || rect.bottom < coords.top) { outside = desc.posAfter; }\n      else { break }\n    }\n    cur = desc.dom.parentNode;\n  }\n  return outside > -1 ? outside : view.docView.posFromDOM(node, offset)\n}\n\nfunction elementFromPoint(element, coords, box) {\n  var len = element.childNodes.length;\n  if (len && box.top < box.bottom) {\n    for (var startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {\n      var child = element.childNodes[i];\n      if (child.nodeType == 1) {\n        var rects = child.getClientRects();\n        for (var j = 0; j < rects.length; j++) {\n          var rect = rects[j];\n          if (inRect(coords, rect)) { return elementFromPoint(child, coords, rect) }\n        }\n      }\n      if ((i = (i + 1) % len) == startI) { break }\n    }\n  }\n  return element\n}\n\n// Given an x,y position on the editor, get the position in the document.\nfunction posAtCoords(view, coords) {\n  var assign, assign$1;\n\n  var root = view.root, node, offset;\n  if (root.caretPositionFromPoint) {\n    try { // Firefox throws for this call in hard-to-predict circumstances (#994)\n      var pos$1 = root.caretPositionFromPoint(coords.left, coords.top);\n      if (pos$1) { ((assign = pos$1, node = assign.offsetNode, offset = assign.offset)); }\n    } catch (_) {}\n  }\n  if (!node && root.caretRangeFromPoint) {\n    var range = root.caretRangeFromPoint(coords.left, coords.top);\n    if (range) { ((assign$1 = range, node = assign$1.startContainer, offset = assign$1.startOffset)); }\n  }\n\n  var elt = root.elementFromPoint(coords.left, coords.top + 1), pos;\n  if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {\n    var box = view.dom.getBoundingClientRect();\n    if (!inRect(coords, box)) { return null }\n    elt = elementFromPoint(view.dom, coords, box);\n    if (!elt) { return null }\n  }\n  // Safari's caretRangeFromPoint returns nonsense when on a draggable element\n  if (result.safari) {\n    for (var p = elt; node && p; p = parentNode(p))\n      { if (p.draggable) { node = offset = null; } }\n  }\n  elt = targetKludge(elt, coords);\n  if (node) {\n    if (result.gecko && node.nodeType == 1) {\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        var next = node.childNodes[offset], box$1;\n        if (next.nodeName == \"IMG\" && (box$1 = next.getBoundingClientRect()).right <= coords.left &&\n            box$1.bottom > coords.top)\n          { offset++; }\n      }\n    }\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 && node.lastChild.nodeType == 1 &&\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 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != \"BR\")\n      { pos = posFromCaret(view, node, offset, coords); }\n  }\n  if (pos == null) { pos = posFromElement(view, elt, coords); }\n\n  var desc = view.docView.nearestDesc(elt, true);\n  return {pos: pos, inside: desc ? desc.posAtStart - desc.border : -1}\n}\n\nfunction singleRect(object, bias) {\n  var rects = object.getClientRects();\n  return !rects.length ? object.getBoundingClientRect() : rects[bias < 0 ? 0 : rects.length - 1]\n}\n\nvar BIDI = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n\n// : (EditorView, number, number) → {left: number, top: number, right: number, bottom: number}\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  var ref = view.docView.domFromPos(pos, side < 0 ? -1 : 1);\n  var node = ref.node;\n  var offset = ref.offset;\n\n  var supportEmptyRange = result.webkit || result.gecko;\n  if (node.nodeType == 3) {\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      var 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 (result.gecko && offset && /\\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {\n        var rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);\n        if (rectBefore.top == rect.top) {\n          var 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    } else {\n      var from = offset, to = offset, takeSide = side < 0 ? 1 : -1;\n      if (side < 0 && !offset) { to++; takeSide = -1; }\n      else if (side >= 0 && offset == node.nodeValue.length) { from--; takeSide = 1; }\n      else if (side < 0) { from--; }\n      else { to ++; }\n      return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0)\n    }\n  }\n\n  // Return a horizontal line in block context\n  if (!view.state.doc.resolve(pos).parent.inlineContent) {\n    if (offset && (side < 0 || offset == nodeSize(node))) {\n      var before = node.childNodes[offset - 1];\n      if (before.nodeType == 1) { return flattenH(before.getBoundingClientRect(), false) }\n    }\n    if (offset < nodeSize(node)) {\n      var after = node.childNodes[offset];\n      if (after.nodeType == 1) { return flattenH(after.getBoundingClientRect(), true) }\n    }\n    return flattenH(node.getBoundingClientRect(), side >= 0)\n  }\n\n  // Inline, not in text node (this is not Bidi-safe)\n  if (offset && (side < 0 || offset == nodeSize(node))) {\n    var before$1 = node.childNodes[offset - 1];\n    var target = before$1.nodeType == 3 ? textRange(before$1, nodeSize(before$1) - (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        : before$1.nodeType == 1 && (before$1.nodeName != \"BR\" || !before$1.nextSibling) ? before$1 : null;\n    if (target) { return flattenV(singleRect(target, 1), false) }\n  }\n  if (offset < nodeSize(node)) {\n    var after$1 = node.childNodes[offset];\n    while (after$1.pmViewDesc && after$1.pmViewDesc.ignoreForCoords) { after$1 = after$1.nextSibling; }\n    var target$1 = !after$1 ? null : after$1.nodeType == 3 ? textRange(after$1, 0, (supportEmptyRange ? 0 : 1))\n        : after$1.nodeType == 1 ? after$1 : null;\n    if (target$1) { return flattenV(singleRect(target$1, -1), true) }\n  }\n  // All else failed, just try to get a rectangle for the target node\n  return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0)\n}\n\nfunction flattenV(rect, left) {\n  if (rect.width == 0) { return rect }\n  var x = left ? rect.left : rect.right;\n  return {top: rect.top, bottom: rect.bottom, left: x, right: x}\n}\n\nfunction flattenH(rect, top) {\n  if (rect.height == 0) { return rect }\n  var y = top ? rect.top : rect.bottom;\n  return {top: y, bottom: y, left: rect.left, right: rect.right}\n}\n\nfunction withFlushedState(view, state, f) {\n  var viewState = view.state, active = view.root.activeElement;\n  if (viewState != state) { view.updateState(state); }\n  if (active != view.dom) { view.focus(); }\n  try {\n    return f()\n  } finally {\n    if (viewState != state) { view.updateState(viewState); }\n    if (active != view.dom && active) { active.focus(); }\n  }\n}\n\n// : (EditorView, number, number)\n// Whether vertical position motion in a given direction\n// from a position would leave a text block.\nfunction endOfTextblockVertical(view, state, dir) {\n  var sel = state.selection;\n  var $pos = dir == \"up\" ? sel.$from : sel.$to;\n  return withFlushedState(view, state, function () {\n    var ref = view.docView.domFromPos($pos.pos, dir == \"up\" ? -1 : 1);\n    var dom = ref.node;\n    for (;;) {\n      var nearest = view.docView.nearestDesc(dom, true);\n      if (!nearest) { break }\n      if (nearest.node.isBlock) { dom = nearest.dom; break }\n      dom = nearest.dom.parentNode;\n    }\n    var coords = coordsAtPos(view, $pos.pos, 1);\n    for (var child = dom.firstChild; child; child = child.nextSibling) {\n      var boxes = (void 0);\n      if (child.nodeType == 1) { boxes = child.getClientRects(); }\n      else if (child.nodeType == 3) { boxes = textRange(child, 0, child.nodeValue.length).getClientRects(); }\n      else { continue }\n      for (var i = 0; i < boxes.length; i++) {\n        var 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}\n\nvar maybeRTL = /[\\u0590-\\u08ac]/;\n\nfunction endOfTextblockHorizontal(view, state, dir) {\n  var ref = state.selection;\n  var $head = ref.$head;\n  if (!$head.parent.isTextblock) { return false }\n  var offset = $head.parentOffset, atStart = !offset, atEnd = offset == $head.parent.content.size;\n  var sel = view.root.getSelection();\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\n  return withFlushedState(view, state, function () {\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    var oldRange = sel.getRangeAt(0), oldNode = sel.focusNode, oldOff = sel.focusOffset;\n    var oldBidiLevel = sel.caretBidiLevel; // Only for Firefox\n    sel.modify(\"move\", dir, \"character\");\n    var parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;\n    var result = !parentDOM.contains(sel.focusNode.nodeType == 1 ? sel.focusNode : sel.focusNode.parentNode) ||\n        (oldNode == sel.focusNode && oldOff == sel.focusOffset);\n    // Restore the previous selection\n    sel.removeAllRanges();\n    sel.addRange(oldRange);\n    if (oldBidiLevel != null) { sel.caretBidiLevel = oldBidiLevel; }\n    return result\n  })\n}\n\nvar cachedState = null, cachedDir = null, cachedResult = false;\nfunction endOfTextblock(view, state, dir) {\n  if (cachedState == state && cachedDir == dir) { return cachedResult }\n  cachedState = state; cachedDir = dir;\n  return cachedResult = dir == \"up\" || dir == \"down\"\n    ? endOfTextblockVertical(view, state, dir)\n    : endOfTextblockHorizontal(view, state, dir)\n}\n\n// NodeView:: interface\n//\n// By default, document nodes are rendered using the result of the\n// [`toDOM`](#model.NodeSpec.toDOM) method of their spec, and managed\n// entirely by the editor. For some use cases, such as embedded\n// node-specific editing interfaces, you want more control over\n// the behavior of a node's in-editor representation, and need to\n// [define](#view.EditorProps.nodeViews) a custom node view.\n//\n// Mark views only support `dom` and `contentDOM`, and don't support\n// any of the node view methods.\n//\n// Objects returned as node views must conform to this interface.\n//\n//   dom:: ?dom.Node\n//   The outer DOM node that represents the document node. When not\n//   given, the default strategy is used to create a DOM node.\n//\n//   contentDOM:: ?dom.Node\n//   The DOM node that should hold the node's content. Only meaningful\n//   if the node view also defines a `dom` property and if its node\n//   type is not a leaf node type. When this is present, ProseMirror\n//   will take care of rendering the node's children into it. When it\n//   is not present, the node view itself is responsible for rendering\n//   (or deciding not to render) its child nodes.\n//\n//   update:: ?(node: Node, decorations: [Decoration], innerDecorations: DecorationSource) → bool\n//   When given, this will be called when the view is updating itself.\n//   It will be given a node (possibly of a different type), an array\n//   of active decorations around the node (which are automatically\n//   drawn, and the node view may ignore if it isn't interested in\n//   them), and a [decoration source](#view.DecorationSource) that\n//   represents any decorations that apply to the content of the node\n//   (which again may be ignored). It should return true if it was\n//   able to update to that node, and false otherwise. If the node\n//   view has a `contentDOM` property (or no `dom` property), updating\n//   its child nodes will be handled by ProseMirror.\n//\n//   selectNode:: ?()\n//   Can be used to override the way the node's selected status (as a\n//   node selection) is displayed.\n//\n//   deselectNode:: ?()\n//   When defining a `selectNode` method, you should also provide a\n//   `deselectNode` method to remove the effect again.\n//\n//   setSelection:: ?(anchor: number, head: number, root: dom.Document)\n//   This will be called to handle setting the selection inside the\n//   node. The `anchor` and `head` positions are relative to the start\n//   of the node. By default, a DOM selection will be created between\n//   the DOM positions corresponding to those positions, but if you\n//   override it you can do something else.\n//\n//   stopEvent:: ?(event: dom.Event) → bool\n//   Can be used to prevent the editor view from trying to handle some\n//   or all DOM events that bubble up from the node view. Events for\n//   which this returns true are not handled by the editor.\n//\n//   ignoreMutation:: ?(dom.MutationRecord) → bool\n//   Called when a DOM\n//   [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver)\n//   or a selection change happens within the view. When the change is\n//   a selection change, the record will have a `type` property of\n//   `\"selection\"` (which doesn't occur for native mutation records).\n//   Return false if the editor should re-read the selection or\n//   re-parse the range around the mutation, true if it can safely be\n//   ignored.\n//\n//   destroy:: ?()\n//   Called when the node view is removed from the editor or the whole\n//   editor is destroyed. (Not available for marks.)\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`.\n\nvar NOT_DIRTY = 0, CHILD_DIRTY = 1, CONTENT_DIRTY = 2, NODE_DIRTY = 3;\n\n// Superclass for the various kinds of descriptions. Defines their\n// basic structure and shared methods.\nvar ViewDesc = function ViewDesc(parent, children, dom, contentDOM) {\n  this.parent = parent;\n  this.children = children;\n  this.dom = dom;\n  // An expando property on the DOM node provides a link back to its\n  // description.\n  dom.pmViewDesc = this;\n  // This is the node that holds the child views. It may be null for\n  // descs that don't have children.\n  this.contentDOM = contentDOM;\n  this.dirty = NOT_DIRTY;\n};\n\nvar prototypeAccessors = { size: { configurable: true },border: { configurable: true },posBefore: { configurable: true },posAtStart: { configurable: true },posAfter: { configurable: true },posAtEnd: { configurable: true },contentLost: { configurable: true },domAtom: { configurable: true },ignoreForCoords: { configurable: true } };\n\n// Used to check whether a given description corresponds to a\n// widget/mark/node.\nViewDesc.prototype.matchesWidget = function matchesWidget () { return false };\nViewDesc.prototype.matchesMark = function matchesMark () { return false };\nViewDesc.prototype.matchesNode = function matchesNode () { return false };\nViewDesc.prototype.matchesHack = function matchesHack (_nodeName) { return false };\n\n// : () → ?ParseRule\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.\nViewDesc.prototype.parseRule = function parseRule () { return null };\n\n// : (dom.Event) → bool\n// Used by the editor's event handler to ignore events that come\n// from certain descs.\nViewDesc.prototype.stopEvent = function stopEvent () { return false };\n\n// The size of the content represented by this desc.\nprototypeAccessors.size.get = function () {\n  var size = 0;\n  for (var i = 0; i < this.children.length; i++) { size += this.children[i].size; }\n  return size\n};\n\n// For block nodes, this represents the space taken up by their\n// start/end tokens.\nprototypeAccessors.border.get = function () { return 0 };\n\nViewDesc.prototype.destroy = function destroy () {\n  this.parent = null;\n  if (this.dom.pmViewDesc == this) { this.dom.pmViewDesc = null; }\n  for (var i = 0; i < this.children.length; i++)\n    { this.children[i].destroy(); }\n};\n\nViewDesc.prototype.posBeforeChild = function posBeforeChild (child) {\n  for (var i = 0, pos = this.posAtStart; i < this.children.length; i++) {\n    var cur = this.children[i];\n    if (cur == child) { return pos }\n    pos += cur.size;\n  }\n};\n\nprototypeAccessors.posBefore.get = function () {\n  return this.parent.posBeforeChild(this)\n};\n\nprototypeAccessors.posAtStart.get = function () {\n  return this.parent ? this.parent.posBeforeChild(this) + this.border : 0\n};\n\nprototypeAccessors.posAfter.get = function () {\n  return this.posBefore + this.size\n};\n\nprototypeAccessors.posAtEnd.get = function () {\n  return this.posAtStart + this.size - 2 * this.border\n};\n\n// : (dom.Node, number, ?number) → number\nViewDesc.prototype.localPosFromDOM = function 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 && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) {\n    if (bias < 0) {\n      var domBefore, desc;\n      if (dom == this.contentDOM) {\n        domBefore = dom.childNodes[offset - 1];\n      } else {\n        while (dom.parentNode != this.contentDOM) { dom = dom.parentNode; }\n        domBefore = dom.previousSibling;\n      }\n      while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) { domBefore = domBefore.previousSibling; }\n      return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart\n    } else {\n      var domAfter, desc$1;\n      if (dom == this.contentDOM) {\n        domAfter = dom.childNodes[offset];\n      } else {\n        while (dom.parentNode != this.contentDOM) { dom = dom.parentNode; }\n        domAfter = dom.nextSibling;\n      }\n      while (domAfter && !((desc$1 = domAfter.pmViewDesc) && desc$1.parent == this)) { domAfter = domAfter.nextSibling; }\n      return domAfter ? this.posBeforeChild(desc$1) : 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  var atEnd;\n  if (dom == this.dom && this.contentDOM) {\n    atEnd = offset > domIndex(this.contentDOM);\n  } else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {\n    atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;\n  } else if (this.dom.firstChild) {\n    if (offset == 0) { for (var search = dom;; search = search.parentNode) {\n      if (search == this.dom) { atEnd = false; break }\n      if (search.parentNode.firstChild != search) { break }\n    } }\n    if (atEnd == null && offset == dom.childNodes.length) { for (var search$1 = dom;; search$1 = search$1.parentNode) {\n      if (search$1 == this.dom) { atEnd = true; break }\n      if (search$1.parentNode.lastChild != search$1) { break }\n    } }\n  }\n  return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart\n};\n\n// Scan up the dom finding the first desc that is a descendant of\n// this one.\nViewDesc.prototype.nearestDesc = function nearestDesc (dom, onlyNodes) {\n  for (var first = true, cur = dom; cur; cur = cur.parentNode) {\n    var desc = this.getDesc(cur);\n    if (desc && (!onlyNodes || desc.node)) {\n      // If dom is outside of this desc's nodeDOM, don't count it.\n      if (first && desc.nodeDOM &&\n          !(desc.nodeDOM.nodeType == 1 ? desc.nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : desc.nodeDOM == dom))\n        { first = false; }\n      else\n        { return desc }\n    }\n  }\n};\n\nViewDesc.prototype.getDesc = function getDesc (dom) {\n  var desc = dom.pmViewDesc;\n  for (var cur = desc; cur; cur = cur.parent) { if (cur == this) { return desc } }\n};\n\nViewDesc.prototype.posFromDOM = function posFromDOM (dom, offset, bias) {\n  for (var scan = dom; scan; scan = scan.parentNode) {\n    var desc = this.getDesc(scan);\n    if (desc) { return desc.localPosFromDOM(dom, offset, bias) }\n  }\n  return -1\n};\n\n// : (number) → ?NodeViewDesc\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.)\nViewDesc.prototype.descAt = function descAt (pos) {\n  for (var i = 0, offset = 0; i < this.children.length; i++) {\n    var child = this.children[i], end = offset + child.size;\n    if (offset == pos && end != offset) {\n      while (!child.border && child.children.length) { child = child.children[0]; }\n      return child\n    }\n    if (pos < end) { return child.descAt(pos - offset - child.border) }\n    offset = end;\n  }\n};\n\n// : (number, number) → {node: dom.Node, offset: number}\nViewDesc.prototype.domFromPos = function domFromPos (pos, side) {\n  if (!this.contentDOM) { return {node: this.dom, offset: 0} }\n  // First find the position in the child array\n  var i = 0, offset = 0;\n  for (var curPos = 0; i < this.children.length; i++) {\n    var child = this.children[i], end = curPos + child.size;\n    if (end > pos || child instanceof TrailingHackViewDesc) { offset = pos - curPos; break }\n    curPos = end;\n  }\n  // If this points into the middle of a child, call through\n  if (offset) { 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 (var prev = (void 0); i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.widget.type.side >= 0; i--) {}\n  // Scan towards the first useable node\n  if (side <= 0) {\n    var prev$1, enter = true;\n    for (;; i--, enter = false) {\n      prev$1 = i ? this.children[i - 1] : null;\n      if (!prev$1 || prev$1.dom.parentNode == this.contentDOM) { break }\n    }\n    if (prev$1 && side && enter && !prev$1.border && !prev$1.domAtom) { return prev$1.domFromPos(prev$1.size, side) }\n    return {node: this.contentDOM, offset: prev$1 ? domIndex(prev$1.dom) + 1 : 0}\n  } else {\n    var next, enter$1 = true;\n    for (;; i++, enter$1 = false) {\n      next = i < this.children.length ? this.children[i] : null;\n      if (!next || next.dom.parentNode == this.contentDOM) { break }\n    }\n    if (next && enter$1 && !next.border && !next.domAtom) { return next.domFromPos(0, side) }\n    return {node: this.contentDOM, offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length}\n  }\n};\n\n// Used to find a DOM range in a single parent for a given changed\n// range.\nViewDesc.prototype.parseRange = function parseRange (from, to, base) {\n    if ( base === void 0 ) base = 0;\n\n  if (this.children.length == 0)\n    { return {node: this.contentDOM, from: from, to: to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length} }\n\n  var fromOffset = -1, toOffset = -1;\n  for (var offset = base, i = 0;; i++) {\n    var child = this.children[i], end = offset + child.size;\n    if (fromOffset == -1 && from <= end) {\n      var 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\n      from = offset;\n      for (var j = i; j > 0; j--) {\n        var 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) { fromOffset = 0; }\n    }\n    if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {\n      to = end;\n      for (var j$1 = i + 1; j$1 < this.children.length; j$1++) {\n        var next = this.children[j$1];\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) { toOffset = this.contentDOM.childNodes.length; }\n      break\n    }\n    offset = end;\n  }\n  return {node: this.contentDOM, from: from, to: to, fromOffset: fromOffset, toOffset: toOffset}\n};\n\nViewDesc.prototype.emptyChildAt = function emptyChildAt (side) {\n  if (this.border || !this.contentDOM || !this.children.length) { return false }\n  var child = this.children[side < 0 ? 0 : this.children.length - 1];\n  return child.size == 0 || child.emptyChildAt(side)\n};\n\n// : (number) → dom.Node\nViewDesc.prototype.domAfterPos = function domAfterPos (pos) {\n  var ref = this.domFromPos(pos, 0);\n    var node = ref.node;\n    var offset = ref.offset;\n  if (node.nodeType != 1 || offset == node.childNodes.length)\n    { throw new RangeError(\"No node after pos \" + pos) }\n  return node.childNodes[offset]\n};\n\n// : (number, number, dom.Document)\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.\nViewDesc.prototype.setSelection = function setSelection (anchor, head, root, force) {\n  // If the selection falls entirely in a child, give it to that child\n  var from = Math.min(anchor, head), to = Math.max(anchor, head);\n  for (var i = 0, offset = 0; i < this.children.length; i++) {\n    var 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, root, force) }\n    offset = end;\n  }\n\n  var anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);\n  var headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);\n  var domSel = root.getSelection();\n\n  var 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 ((result.gecko || result.safari) && anchor == head) {\n    var node = anchorDOM.node;\n      var offset$1 = anchorDOM.offset;\n    if (node.nodeType == 3) {\n      brKludge = offset$1 && node.nodeValue[offset$1 - 1] == \"\\n\";\n      // Issue #1128\n      if (brKludge && offset$1 == node.nodeValue.length) {\n        for (var scan = node, after = (void 0); 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          var desc = scan.pmViewDesc;\n          if (desc && desc.node && desc.node.isBlock) { break }\n        }\n      }\n    } else {\n      var prev = node.childNodes[offset$1 - 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 (result.gecko && domSel.focusNode && domSel.focusNode != headDOM.node && domSel.focusNode.nodeType == 1) {\n    var after$1 = domSel.focusNode.childNodes[domSel.focusOffset];\n    if (after$1 && after$1.contentEditable == \"false\") { force = true; }\n  }\n\n  if (!(force || brKludge && result.safari) &&\n      isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset) &&\n      isEquivalentPosition(headDOM.node, headDOM.offset, domSel.focusNode, domSel.focusOffset))\n    { return }\n\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  var domSelExtended = false;\n  if ((domSel.extend || anchor == head) && !brKludge) {\n    domSel.collapse(anchorDOM.node, anchorDOM.offset);\n    try {\n      if (anchor != head) { domSel.extend(headDOM.node, headDOM.offset); }\n      domSelExtended = true;\n    } catch (err) {\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      if (!(err instanceof DOMException)) { throw err }\n      // declare global: DOMException\n    }\n  }\n  if (!domSelExtended) {\n    if (anchor > head) { var tmp = anchorDOM; anchorDOM = headDOM; headDOM = tmp; }\n    var 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\n// : (dom.MutationRecord) → bool\nViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n  return !this.contentDOM && mutation.type != \"selection\"\n};\n\nprototypeAccessors.contentLost.get = function () {\n  return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM)\n};\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.\nViewDesc.prototype.markDirty = function markDirty (from, to) {\n  for (var offset = 0, i = 0; i < this.children.length; i++) {\n    var child = this.children[i], end = offset + child.size;\n    if (offset == end ? from <= end && to >= offset : from < end && to > offset) {\n      var 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)) { child.dirty = NODE_DIRTY; }\n        else { child.markDirty(from - startInside, to - startInside); }\n        return\n      } else {\n        child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM ? CONTENT_DIRTY : NODE_DIRTY;\n      }\n    }\n    offset = end;\n  }\n  this.dirty = CONTENT_DIRTY;\n};\n\nViewDesc.prototype.markParentsDirty = function markParentsDirty () {\n  var level = 1;\n  for (var node = this.parent; node; node = node.parent, level++) {\n    var dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;\n    if (node.dirty < dirty) { node.dirty = dirty; }\n  }\n};\n\nprototypeAccessors.domAtom.get = function () { return false };\n\nprototypeAccessors.ignoreForCoords.get = function () { return false };\n\nObject.defineProperties( ViewDesc.prototype, prototypeAccessors );\n\n// Reused array to avoid allocating fresh arrays for things that will\n// stay empty anyway.\nvar nothing = [];\n\n// A widget desc represents a widget decoration, which is a DOM node\n// drawn between the document nodes.\nvar WidgetViewDesc = /*@__PURE__*/(function (ViewDesc) {\n  function WidgetViewDesc(parent, widget, view, pos) {\n    var self, dom = widget.type.toDOM;\n    if (typeof dom == \"function\") { dom = dom(view, function () {\n      if (!self) { return pos }\n      if (self.parent) { return self.parent.posBeforeChild(self) }\n    }); }\n    if (!widget.type.spec.raw) {\n      if (dom.nodeType != 1) {\n        var wrap = document.createElement(\"span\");\n        wrap.appendChild(dom);\n        dom = wrap;\n      }\n      dom.contentEditable = false;\n      dom.classList.add(\"ProseMirror-widget\");\n    }\n    ViewDesc.call(this, parent, nothing, dom, null);\n    this.widget = widget;\n    self = this;\n  }\n\n  if ( ViewDesc ) WidgetViewDesc.__proto__ = ViewDesc;\n  WidgetViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n  WidgetViewDesc.prototype.constructor = WidgetViewDesc;\n\n  var prototypeAccessors$1 = { domAtom: { configurable: true } };\n\n  WidgetViewDesc.prototype.matchesWidget = function matchesWidget (widget) {\n    return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type)\n  };\n\n  WidgetViewDesc.prototype.parseRule = function parseRule () { return {ignore: true} };\n\n  WidgetViewDesc.prototype.stopEvent = function stopEvent (event) {\n    var stop = this.widget.spec.stopEvent;\n    return stop ? stop(event) : false\n  };\n\n  WidgetViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n    return mutation.type != \"selection\" || this.widget.spec.ignoreSelection\n  };\n\n  prototypeAccessors$1.domAtom.get = function () { return true };\n\n  Object.defineProperties( WidgetViewDesc.prototype, prototypeAccessors$1 );\n\n  return WidgetViewDesc;\n}(ViewDesc));\n\nvar CompositionViewDesc = /*@__PURE__*/(function (ViewDesc) {\n  function CompositionViewDesc(parent, dom, textDOM, text) {\n    ViewDesc.call(this, parent, nothing, dom, null);\n    this.textDOM = textDOM;\n    this.text = text;\n  }\n\n  if ( ViewDesc ) CompositionViewDesc.__proto__ = ViewDesc;\n  CompositionViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n  CompositionViewDesc.prototype.constructor = CompositionViewDesc;\n\n  var prototypeAccessors$2 = { size: { configurable: true } };\n\n  prototypeAccessors$2.size.get = function () { return this.text.length };\n\n  CompositionViewDesc.prototype.localPosFromDOM = function localPosFromDOM (dom, offset) {\n    if (dom != this.textDOM) { return this.posAtStart + (offset ? this.size : 0) }\n    return this.posAtStart + offset\n  };\n\n  CompositionViewDesc.prototype.domFromPos = function domFromPos (pos) {\n    return {node: this.textDOM, offset: pos}\n  };\n\n  CompositionViewDesc.prototype.ignoreMutation = function ignoreMutation (mut) {\n    return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue\n   };\n\n  Object.defineProperties( CompositionViewDesc.prototype, prototypeAccessors$2 );\n\n  return CompositionViewDesc;\n}(ViewDesc));\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.\nvar MarkViewDesc = /*@__PURE__*/(function (ViewDesc) {\n  function MarkViewDesc(parent, mark, dom, contentDOM) {\n    ViewDesc.call(this, parent, [], dom, contentDOM);\n    this.mark = mark;\n  }\n\n  if ( ViewDesc ) MarkViewDesc.__proto__ = ViewDesc;\n  MarkViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n  MarkViewDesc.prototype.constructor = MarkViewDesc;\n\n  MarkViewDesc.create = function create (parent, mark, inline, view) {\n    var custom = view.nodeViews[mark.type.name];\n    var spec = custom && custom(mark, view, inline);\n    if (!spec || !spec.dom)\n      { spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline)); }\n    return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom)\n  };\n\n  MarkViewDesc.prototype.parseRule = function parseRule () { return {mark: this.mark.type.name, attrs: this.mark.attrs, contentElement: this.contentDOM} };\n\n  MarkViewDesc.prototype.matchesMark = function matchesMark (mark) { return this.dirty != NODE_DIRTY && this.mark.eq(mark) };\n\n  MarkViewDesc.prototype.markDirty = function markDirty (from, to) {\n    ViewDesc.prototype.markDirty.call(this, from, to);\n    // Move dirty info to nearest node view\n    if (this.dirty != NOT_DIRTY) {\n      var parent = this.parent;\n      while (!parent.node) { parent = parent.parent; }\n      if (parent.dirty < this.dirty) { parent.dirty = this.dirty; }\n      this.dirty = NOT_DIRTY;\n    }\n  };\n\n  MarkViewDesc.prototype.slice = function slice (from, to, view) {\n    var copy = MarkViewDesc.create(this.parent, this.mark, true, view);\n    var nodes = this.children, size = this.size;\n    if (to < size) { nodes = replaceNodes(nodes, to, size, view); }\n    if (from > 0) { nodes = replaceNodes(nodes, 0, from, view); }\n    for (var i = 0; i < nodes.length; i++) { nodes[i].parent = copy; }\n    copy.children = nodes;\n    return copy\n  };\n\n  return MarkViewDesc;\n}(ViewDesc));\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.\nvar NodeViewDesc = /*@__PURE__*/(function (ViewDesc) {\n  function NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {\n    ViewDesc.call(this, parent, node.isLeaf ? nothing : [], dom, contentDOM);\n    this.nodeDOM = nodeDOM;\n    this.node = node;\n    this.outerDeco = outerDeco;\n    this.innerDeco = innerDeco;\n    if (contentDOM) { this.updateChildren(view, pos); }\n  }\n\n  if ( ViewDesc ) NodeViewDesc.__proto__ = ViewDesc;\n  NodeViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n  NodeViewDesc.prototype.constructor = NodeViewDesc;\n\n  var prototypeAccessors$3 = { size: { configurable: true },border: { configurable: true },domAtom: { configurable: true } };\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  NodeViewDesc.create = function create (parent, node, outerDeco, innerDeco, view, pos) {\n    var assign;\n\n    var custom = view.nodeViews[node.type.name], descObj;\n    var spec = custom && custom(node, view, function () {\n      // (This is a function that allows the custom view to find its\n      // own position)\n      if (!descObj) { return pos }\n      if (descObj.parent) { return descObj.parent.posBeforeChild(descObj) }\n    }, outerDeco, innerDeco);\n\n    var dom = spec && spec.dom, contentDOM = spec && spec.contentDOM;\n    if (node.isText) {\n      if (!dom) { dom = document.createTextNode(node.text); }\n      else if (dom.nodeType != 3) { throw new RangeError(\"Text must be rendered as a DOM text node\") }\n    } else if (!dom) {\n((assign = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node)), dom = assign.dom, contentDOM = assign.contentDOM));\n    }\n    if (!contentDOM && !node.isText && dom.nodeName != \"BR\") { // Chrome gets confused by <br contenteditable=false>\n      if (!dom.hasAttribute(\"contenteditable\")) { dom.contentEditable = false; }\n      if (node.type.spec.draggable) { dom.draggable = true; }\n    }\n\n    var nodeDOM = dom;\n    dom = applyOuterDeco(dom, outerDeco, node);\n\n    if (spec)\n      { return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM,\n                                              spec, view, pos + 1) }\n    else if (node.isText)\n      { return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) }\n    else\n      { return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos + 1) }\n  };\n\n  NodeViewDesc.prototype.parseRule = function parseRule () {\n    var this$1 = this;\n\n    // Experimental kludge to allow opt-in re-parsing of nodes\n    if (this.node.type.spec.reparseInView) { 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    var rule = {node: this.node.type.name, attrs: this.node.attrs};\n    if (this.node.type.spec.code) { rule.preserveWhitespace = \"full\"; }\n    if (this.contentDOM && !this.contentLost) { rule.contentElement = this.contentDOM; }\n    else { rule.getContent = function () { return this$1.contentDOM ? Fragment.empty : this$1.node.content; }; }\n    return rule\n  };\n\n  NodeViewDesc.prototype.matchesNode = function 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\n  prototypeAccessors$3.size.get = function () { return this.node.nodeSize };\n\n  prototypeAccessors$3.border.get = function () { return this.node.isLeaf ? 0 : 1 };\n\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  NodeViewDesc.prototype.updateChildren = function updateChildren (view, pos) {\n    var this$1 = this;\n\n    var inline = this.node.inlineContent, off = pos;\n    var composition = view.composing && this.localCompositionInfo(view, pos);\n    var localComposition = composition && composition.pos > -1 ? composition : null;\n    var compositionInChild = composition && composition.pos < 0;\n    var updater = new ViewTreeUpdater(this, localComposition && localComposition.node);\n    iterDeco(this.node, this.innerDeco, function (widget, i, insideNode) {\n      if (widget.spec.marks)\n        { updater.syncToMarks(widget.spec.marks, inline, view); }\n      else if (widget.type.side >= 0 && !insideNode)\n        { updater.syncToMarks(i == this$1.node.childCount ? Mark.none : this$1.node.child(i).marks, inline, view); }\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    }, function (child, outerDeco, innerDeco, i) {\n      // Make sure the wrapping mark descs match the node's marks.\n      updater.syncToMarks(child.marks, inline, view);\n      // Try several strategies for drawing this node\n      var compIndex;\n      if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) ; 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)) ; else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i)) ; else {\n        // Add it as a new view\n        updater.addNode(child, outerDeco, innerDeco, view, off);\n      }\n      off += child.nodeSize;\n    });\n    // Drop all remaining descs after the current position.\n    updater.syncToMarks(nothing, inline, view);\n    if (this.node.isTextblock) { updater.addTextblockHacks(); }\n    updater.destroyRest();\n\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) { this.protectLocalComposition(view, localComposition); }\n      renderDescs(this.contentDOM, this.children, view);\n      if (result.ios) { iosHacks(this.dom); }\n    }\n  };\n\n  NodeViewDesc.prototype.localCompositionInfo = function localCompositionInfo (view, pos) {\n    // Only do something if both the selection and a focused text node\n    // are inside of this node\n    var ref = view.state.selection;\n    var from = ref.from;\n    var to = ref.to;\n    if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size) { return }\n    var sel = view.root.getSelection();\n    var textNode = nearbyTextNode(sel.focusNode, sel.focusOffset);\n    if (!textNode || !this.dom.contains(textNode.parentNode)) { return }\n\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      var text = textNode.nodeValue;\n      var textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);\n      return textPos < 0 ? null : {node: textNode, pos: textPos, text: text}\n    } else {\n      return {node: textNode, pos: -1}\n    }\n  };\n\n  NodeViewDesc.prototype.protectLocalComposition = function protectLocalComposition (view, ref) {\n    var node = ref.node;\n    var pos = ref.pos;\n    var text = ref.text;\n\n    // The node is already part of a local view desc, leave it there\n    if (this.getDesc(node)) { return }\n\n    // Create a composition view for the orphaned nodes\n    var topNode = node;\n    for (;; topNode = topNode.parentNode) {\n      if (topNode.parentNode == this.contentDOM) { break }\n      while (topNode.previousSibling) { topNode.parentNode.removeChild(topNode.previousSibling); }\n      while (topNode.nextSibling) { topNode.parentNode.removeChild(topNode.nextSibling); }\n      if (topNode.pmViewDesc) { topNode.pmViewDesc = null; }\n    }\n    var desc = new CompositionViewDesc(this, topNode, node, text);\n    view.compositionNodes.push(desc);\n\n    // Patch up this.children to contain the composition view\n    this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);\n  };\n\n  // : (Node, [Decoration], DecorationSource, EditorView) → bool\n  // If this desc be updated to match the given node decoration,\n  // do so and return true.\n  NodeViewDesc.prototype.update = function update (node, outerDeco, innerDeco, view) {\n    if (this.dirty == NODE_DIRTY ||\n        !node.sameMarkup(this.node)) { return false }\n    this.updateInner(node, outerDeco, innerDeco, view);\n    return true\n  };\n\n  NodeViewDesc.prototype.updateInner = function updateInner (node, outerDeco, innerDeco, view) {\n    this.updateOuterDeco(outerDeco);\n    this.node = node;\n    this.innerDeco = innerDeco;\n    if (this.contentDOM) { this.updateChildren(view, this.posAtStart); }\n    this.dirty = NOT_DIRTY;\n  };\n\n  NodeViewDesc.prototype.updateOuterDeco = function updateOuterDeco (outerDeco) {\n    if (sameOuterDeco(outerDeco, this.outerDeco)) { return }\n    var needsWrap = this.nodeDOM.nodeType != 1;\n    var oldDOM = this.dom;\n    this.dom = patchOuterDeco(this.dom, this.nodeDOM,\n                              computeOuterDeco(this.outerDeco, this.node, needsWrap),\n                              computeOuterDeco(outerDeco, this.node, needsWrap));\n    if (this.dom != oldDOM) {\n      oldDOM.pmViewDesc = null;\n      this.dom.pmViewDesc = this;\n    }\n    this.outerDeco = outerDeco;\n  };\n\n  // Mark this node as being the selected node.\n  NodeViewDesc.prototype.selectNode = function selectNode () {\n    this.nodeDOM.classList.add(\"ProseMirror-selectednode\");\n    if (this.contentDOM || !this.node.type.spec.draggable) { this.dom.draggable = true; }\n  };\n\n  // Remove selected node marking from this node.\n  NodeViewDesc.prototype.deselectNode = function deselectNode () {\n    this.nodeDOM.classList.remove(\"ProseMirror-selectednode\");\n    if (this.contentDOM || !this.node.type.spec.draggable) { this.dom.removeAttribute(\"draggable\"); }\n  };\n\n  prototypeAccessors$3.domAtom.get = function () { return this.node.isAtom };\n\n  Object.defineProperties( NodeViewDesc.prototype, prototypeAccessors$3 );\n\n  return NodeViewDesc;\n}(ViewDesc));\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  return new NodeViewDesc(null, doc, outerDeco, innerDeco, dom, dom, dom, view, 0)\n}\n\nvar TextViewDesc = /*@__PURE__*/(function (NodeViewDesc) {\n  function TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {\n    NodeViewDesc.call(this, parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view);\n  }\n\n  if ( NodeViewDesc ) TextViewDesc.__proto__ = NodeViewDesc;\n  TextViewDesc.prototype = Object.create( NodeViewDesc && NodeViewDesc.prototype );\n  TextViewDesc.prototype.constructor = TextViewDesc;\n\n  var prototypeAccessors$4 = { domAtom: { configurable: true } };\n\n  TextViewDesc.prototype.parseRule = function parseRule () {\n    var skip = this.nodeDOM.parentNode;\n    while (skip && skip != this.dom && !skip.pmIsDeco) { skip = skip.parentNode; }\n    return {skip: skip || true}\n  };\n\n  TextViewDesc.prototype.update = function update (node, outerDeco, _, view) {\n    if (this.dirty == NODE_DIRTY || (this.dirty != NOT_DIRTY && !this.inParent()) ||\n        !node.sameMarkup(this.node)) { 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) { view.trackWrites = null; }\n    }\n    this.node = node;\n    this.dirty = NOT_DIRTY;\n    return true\n  };\n\n  TextViewDesc.prototype.inParent = function inParent () {\n    var parentDOM = this.parent.contentDOM;\n    for (var n = this.nodeDOM; n; n = n.parentNode) { if (n == parentDOM) { return true } }\n    return false\n  };\n\n  TextViewDesc.prototype.domFromPos = function domFromPos (pos) {\n    return {node: this.nodeDOM, offset: pos}\n  };\n\n  TextViewDesc.prototype.localPosFromDOM = function localPosFromDOM (dom, offset, bias) {\n    if (dom == this.nodeDOM) { return this.posAtStart + Math.min(offset, this.node.text.length) }\n    return NodeViewDesc.prototype.localPosFromDOM.call(this, dom, offset, bias)\n  };\n\n  TextViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n    return mutation.type != \"characterData\" && mutation.type != \"selection\"\n  };\n\n  TextViewDesc.prototype.slice = function slice (from, to, view) {\n    var node = this.node.cut(from, to), dom = document.createTextNode(node.text);\n    return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view)\n  };\n\n  TextViewDesc.prototype.markDirty = function markDirty (from, to) {\n    NodeViewDesc.prototype.markDirty.call(this, from, to);\n    if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length))\n      { this.dirty = NODE_DIRTY; }\n  };\n\n  prototypeAccessors$4.domAtom.get = function () { return false };\n\n  Object.defineProperties( TextViewDesc.prototype, prototypeAccessors$4 );\n\n  return TextViewDesc;\n}(NodeViewDesc));\n\n// A dummy desc used to tag trailing BR or IMG nodes created to work\n// around contentEditable terribleness.\nvar TrailingHackViewDesc = /*@__PURE__*/(function (ViewDesc) {\n  function TrailingHackViewDesc () {\n    ViewDesc.apply(this, arguments);\n  }\n\n  if ( ViewDesc ) TrailingHackViewDesc.__proto__ = ViewDesc;\n  TrailingHackViewDesc.prototype = Object.create( ViewDesc && ViewDesc.prototype );\n  TrailingHackViewDesc.prototype.constructor = TrailingHackViewDesc;\n\n  var prototypeAccessors$5 = { domAtom: { configurable: true },ignoreForCoords: { configurable: true } };\n\n  TrailingHackViewDesc.prototype.parseRule = function parseRule () { return {ignore: true} };\n  TrailingHackViewDesc.prototype.matchesHack = function matchesHack (nodeName) { return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName };\n  prototypeAccessors$5.domAtom.get = function () { return true };\n  prototypeAccessors$5.ignoreForCoords.get = function () { return this.dom.nodeName == \"IMG\" };\n\n  Object.defineProperties( TrailingHackViewDesc.prototype, prototypeAccessors$5 );\n\n  return TrailingHackViewDesc;\n}(ViewDesc));\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.\nvar CustomNodeViewDesc = /*@__PURE__*/(function (NodeViewDesc) {\n  function CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {\n    NodeViewDesc.call(this, parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);\n    this.spec = spec;\n  }\n\n  if ( NodeViewDesc ) CustomNodeViewDesc.__proto__ = NodeViewDesc;\n  CustomNodeViewDesc.prototype = Object.create( NodeViewDesc && NodeViewDesc.prototype );\n  CustomNodeViewDesc.prototype.constructor = CustomNodeViewDesc;\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  CustomNodeViewDesc.prototype.update = function update (node, outerDeco, innerDeco, view) {\n    if (this.dirty == NODE_DIRTY) { return false }\n    if (this.spec.update) {\n      var result = this.spec.update(node, outerDeco, innerDeco);\n      if (result) { this.updateInner(node, outerDeco, innerDeco, view); }\n      return result\n    } else if (!this.contentDOM && !node.isLeaf) {\n      return false\n    } else {\n      return NodeViewDesc.prototype.update.call(this, node, outerDeco, innerDeco, view)\n    }\n  };\n\n  CustomNodeViewDesc.prototype.selectNode = function selectNode () {\n    this.spec.selectNode ? this.spec.selectNode() : NodeViewDesc.prototype.selectNode.call(this);\n  };\n\n  CustomNodeViewDesc.prototype.deselectNode = function deselectNode () {\n    this.spec.deselectNode ? this.spec.deselectNode() : NodeViewDesc.prototype.deselectNode.call(this);\n  };\n\n  CustomNodeViewDesc.prototype.setSelection = function setSelection (anchor, head, root, force) {\n    this.spec.setSelection ? this.spec.setSelection(anchor, head, root)\n      : NodeViewDesc.prototype.setSelection.call(this, anchor, head, root, force);\n  };\n\n  CustomNodeViewDesc.prototype.destroy = function destroy () {\n    if (this.spec.destroy) { this.spec.destroy(); }\n    NodeViewDesc.prototype.destroy.call(this);\n  };\n\n  CustomNodeViewDesc.prototype.stopEvent = function stopEvent (event) {\n    return this.spec.stopEvent ? this.spec.stopEvent(event) : false\n  };\n\n  CustomNodeViewDesc.prototype.ignoreMutation = function ignoreMutation (mutation) {\n    return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : NodeViewDesc.prototype.ignoreMutation.call(this, mutation)\n  };\n\n  return CustomNodeViewDesc;\n}(NodeViewDesc));\n\n// : (dom.Node, [ViewDesc])\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  var dom = parentDOM.firstChild, written = false;\n  for (var i = 0; i < descs.length; i++) {\n    var desc = descs[i], childDOM = desc.dom;\n    if (childDOM.parentNode == parentDOM) {\n      while (childDOM != dom) { dom = rm(dom); written = true; }\n      dom = dom.nextSibling;\n    } else {\n      written = true;\n      parentDOM.insertBefore(childDOM, dom);\n    }\n    if (desc instanceof MarkViewDesc) {\n      var 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) { dom = rm(dom); written = true; }\n  if (written && view.trackWrites == parentDOM) { view.trackWrites = null; }\n}\n\nfunction OuterDecoLevel(nodeName) {\n  if (nodeName) { this.nodeName = nodeName; }\n}\nOuterDecoLevel.prototype = Object.create(null);\n\nvar noDeco = [new OuterDecoLevel];\n\nfunction computeOuterDeco(outerDeco, node, needsWrap) {\n  if (outerDeco.length == 0) { return noDeco }\n\n  var top = needsWrap ? noDeco[0] : new OuterDecoLevel, result = [top];\n\n  for (var i = 0; i < outerDeco.length; i++) {\n    var attrs = outerDeco[i].type.attrs;\n    if (!attrs) { continue }\n    if (attrs.nodeName)\n      { result.push(top = new OuterDecoLevel(attrs.nodeName)); }\n\n    for (var name in attrs) {\n      var val = attrs[name];\n      if (val == null) { continue }\n      if (needsWrap && result.length == 1)\n        { result.push(top = new OuterDecoLevel(node.isInline ? \"span\" : \"div\")); }\n      if (name == \"class\") { top.class = (top.class ? top.class + \" \" : \"\") + val; }\n      else if (name == \"style\") { top.style = (top.style ? top.style + \";\" : \"\") + val; }\n      else if (name != \"nodeName\") { top[name] = val; }\n    }\n  }\n\n  return result\n}\n\nfunction patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {\n  // Shortcut for trivial case\n  if (prevComputed == noDeco && curComputed == noDeco) { return nodeDOM }\n\n  var curDOM = nodeDOM;\n  for (var i = 0; i < curComputed.length; i++) {\n    var deco = curComputed[i], prev = prevComputed[i];\n    if (i) {\n      var parent = (void 0);\n      if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM &&\n          (parent = curDOM.parentNode) && parent.tagName.toLowerCase() == deco.nodeName) {\n        curDOM = parent;\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}\n\nfunction patchAttributes(dom, prev, cur) {\n  for (var name in prev)\n    { if (name != \"class\" && name != \"style\" && name != \"nodeName\" && !(name in cur))\n      { dom.removeAttribute(name); } }\n  for (var name$1 in cur)\n    { if (name$1 != \"class\" && name$1 != \"style\" && name$1 != \"nodeName\" && cur[name$1] != prev[name$1])\n      { dom.setAttribute(name$1, cur[name$1]); } }\n  if (prev.class != cur.class) {\n    var prevList = prev.class ? prev.class.split(\" \").filter(Boolean) : nothing;\n    var curList = cur.class ? cur.class.split(\" \").filter(Boolean) : nothing;\n    for (var i = 0; i < prevList.length; i++) { if (curList.indexOf(prevList[i]) == -1)\n      { dom.classList.remove(prevList[i]); } }\n    for (var i$1 = 0; i$1 < curList.length; i$1++) { if (prevList.indexOf(curList[i$1]) == -1)\n      { dom.classList.add(curList[i$1]); } }\n  }\n  if (prev.style != cur.style) {\n    if (prev.style) {\n      var 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}\n\nfunction applyOuterDeco(dom, deco, node) {\n  return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1))\n}\n\n// : ([Decoration], [Decoration]) → bool\nfunction sameOuterDeco(a, b) {\n  if (a.length != b.length) { return false }\n  for (var i = 0; i < a.length; i++) { if (!a[i].type.eq(b[i].type)) { return false } }\n  return true\n}\n\n// Remove a DOM node and return its next sibling.\nfunction rm(dom) {\n  var next = dom.nextSibling;\n  dom.parentNode.removeChild(dom);\n  return next\n}\n\n// Helper class for incrementally updating a tree of mark descs and\n// the widget and node descs inside of them.\nvar ViewTreeUpdater = function ViewTreeUpdater(top, lockedNode) {\n  this.top = top;\n  this.lock = lockedNode;\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\n  this.preMatch = preMatch(top.node.content, top.children);\n};\n\n// Destroy and remove the children between the given indices in\n// `this.top`.\nViewTreeUpdater.prototype.destroyBetween = function destroyBetween (start, end) {\n  if (start == end) { return }\n  for (var i = start; i < end; i++) { this.top.children[i].destroy(); }\n  this.top.children.splice(start, end - start);\n  this.changed = true;\n};\n\n// Destroy all remaining children in `this.top`.\nViewTreeUpdater.prototype.destroyRest = function destroyRest () {\n  this.destroyBetween(this.index, this.top.children.length);\n};\n\n// : ([Mark], EditorView)\n// Sync the current stack of mark descs with the given array of\n// marks, reusing existing mark descs when possible.\nViewTreeUpdater.prototype.syncToMarks = function syncToMarks (marks, inline, view) {\n  var keep = 0, depth = this.stack.length >> 1;\n  var maxKeep = Math.min(depth, marks.length);\n  while (keep < maxKeep &&\n         (keep == depth - 1 ? this.top : this.stack[(keep + 1) << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false)\n    { keep++; }\n\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    var found = -1;\n    for (var i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {\n      if (this.top.children[i].matchesMark(marks[depth])) { found = i; break }\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    } else {\n      var 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\n// : (Node, [Decoration], DecorationSource) → bool\n// Try to find a node desc matching the given data. Skip over it and\n// return true when successful.\nViewTreeUpdater.prototype.findNodeMatch = function findNodeMatch (node, outerDeco, innerDeco, index) {\n  var children = this.top.children, found = -1;\n  if (index >= this.preMatch.index) {\n    for (var i = this.index; i < children.length; i++) { if (children[i].matchesNode(node, outerDeco, innerDeco)) {\n      found = i;\n      break\n    } }\n  } else {\n    for (var i$1 = this.index, e = Math.min(children.length, i$1 + 1); i$1 < e; i$1++) {\n      var child = children[i$1];\n      if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {\n        found = i$1;\n        break\n      }\n    }\n  }\n  if (found < 0) { return false }\n  this.destroyBetween(this.index, found);\n  this.index++;\n  return true\n};\n\nViewTreeUpdater.prototype.updateNodeAt = function updateNodeAt (node, outerDeco, innerDeco, index, view) {\n  var child = this.top.children[index];\n  if (!child.update(node, outerDeco, innerDeco, view)) { return false }\n  this.destroyBetween(this.index, index);\n  this.index = index + 1;\n  return true\n};\n\nViewTreeUpdater.prototype.findIndexWithChild = function findIndexWithChild (domNode) {\n  for (;;) {\n    var parent = domNode.parentNode;\n    if (!parent) { return -1 }\n    if (parent == this.top.contentDOM) {\n      var desc = domNode.pmViewDesc;\n      if (desc) { for (var i = this.index; i < this.top.children.length; i++) {\n        if (this.top.children[i] == desc) { return i }\n      } }\n      return -1\n    }\n    domNode = parent;\n  }\n};\n\n// : (Node, [Decoration], DecorationSource, EditorView, Fragment, number) → bool\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.\nViewTreeUpdater.prototype.updateNextNode = function updateNextNode (node, outerDeco, innerDeco, view, index) {\n  for (var i = this.index; i < this.top.children.length; i++) {\n    var next = this.top.children[i];\n    if (next instanceof NodeViewDesc) {\n      var preMatch = this.preMatch.matched.get(next);\n      if (preMatch != null && preMatch != index) { return false }\n      var nextDOM = next.dom;\n\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      var locked = this.lock && (nextDOM == this.lock || nextDOM.nodeType == 1 && nextDOM.contains(this.lock.parentNode)) &&\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) { this.changed = true; }\n        this.index++;\n        return true\n      }\n      break\n    }\n  }\n  return false\n};\n\n// : (Node, [Decoration], DecorationSource, EditorView)\n// Insert the node as a newly created node desc.\nViewTreeUpdater.prototype.addNode = function addNode (node, outerDeco, innerDeco, view, pos) {\n  this.top.children.splice(this.index++, 0, NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos));\n  this.changed = true;\n};\n\nViewTreeUpdater.prototype.placeWidget = function placeWidget (widget, view, pos) {\n  var next = this.index < this.top.children.length ? this.top.children[this.index] : null;\n  if (next && next.matchesWidget(widget) && (widget == next.widget || !next.widget.type.toDOM.parentNode)) {\n    this.index++;\n  } else {\n    var desc = new WidgetViewDesc(this.top, widget, view, pos);\n    this.top.children.splice(this.index++, 0, desc);\n    this.changed = true;\n  }\n};\n\n// Make sure a textblock looks and behaves correctly in\n// contentEditable.\nViewTreeUpdater.prototype.addTextblockHacks = function addTextblockHacks () {\n  var lastChild = this.top.children[this.index - 1];\n  while (lastChild instanceof MarkViewDesc) { lastChild = lastChild.children[lastChild.children.length - 1]; }\n\n  if (!lastChild || // Empty textblock\n      !(lastChild instanceof TextViewDesc) ||\n      /\\n$/.test(lastChild.node.text)) {\n    // Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)\n    if ((result.safari || result.chrome) && lastChild && lastChild.dom.contentEditable == \"false\")\n      { this.addHackNode(\"IMG\"); }\n    this.addHackNode(\"BR\");\n  }\n};\n\nViewTreeUpdater.prototype.addHackNode = function addHackNode (nodeName) {\n  if (this.index < this.top.children.length && this.top.children[this.index].matchesHack(nodeName)) {\n    this.index++;\n  } else {\n    var dom = document.createElement(nodeName);\n    if (nodeName == \"IMG\") { dom.className = \"ProseMirror-separator\"; }\n    this.top.children.splice(this.index++, 0, new TrailingHackViewDesc(this.top, nothing, dom, null));\n    this.changed = true;\n  }\n};\n\n// : (Fragment, [ViewDesc]) → {index: number, matched: Map<ViewDesc, number>}\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. Returns the fragment index of the first node that\n// is part of the sequence of matched nodes at the end of the\n// fragment.\nfunction preMatch(frag, descs) {\n  var fI = frag.childCount, dI = descs.length, matched = new Map;\n  for (; fI > 0 && dI > 0; dI--) {\n    var desc = descs[dI - 1], node = desc.node;\n    if (!node) { continue }\n    if (node != frag.child(fI - 1)) { break }\n    --fI;\n    matched.set(desc, fI);\n  }\n  return {index: fI, matched: matched}\n}\n\nfunction compareSide(a, b) { return a.type.side - b.type.side }\n\n// : (ViewDesc, DecorationSource, (Decoration, number), (Node, [Decoration], DecorationSource, number))\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  var locals = deco.locals(parent), offset = 0;\n  // Simple, cheap variant for when there are no local decorations\n  if (locals.length == 0) {\n    for (var i = 0; i < parent.childCount; i++) {\n      var child = parent.child(i);\n      onNode(child, locals, deco.forChild(offset, child), i);\n      offset += child.nodeSize;\n    }\n    return\n  }\n\n  var decoIndex = 0, active = [], restNode = null;\n  for (var parentIndex = 0;;) {\n    if (decoIndex < locals.length && locals[decoIndex].to == offset) {\n      var widget = locals[decoIndex++], widgets = (void 0);\n      while (decoIndex < locals.length && locals[decoIndex].to == offset)\n        { (widgets || (widgets = [widget])).push(locals[decoIndex++]); }\n      if (widgets) {\n        widgets.sort(compareSide);\n        for (var i$1 = 0; i$1 < widgets.length; i$1++) { onWidget(widgets[i$1], parentIndex, !!restNode); }\n      } else {\n        onWidget(widget, parentIndex, !!restNode);\n      }\n    }\n\n    var child$1 = (void 0), index = (void 0);\n    if (restNode) {\n      index = -1;\n      child$1 = restNode;\n      restNode = null;\n    } else if (parentIndex < parent.childCount) {\n      index = parentIndex;\n      child$1 = parent.child(parentIndex++);\n    } else {\n      break\n    }\n\n    for (var i$2 = 0; i$2 < active.length; i$2++) { if (active[i$2].to <= offset) { active.splice(i$2--, 1); } }\n    while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset)\n      { active.push(locals[decoIndex++]); }\n\n    var end = offset + child$1.nodeSize;\n    if (child$1.isText) {\n      var cutAt = end;\n      if (decoIndex < locals.length && locals[decoIndex].from < cutAt) { cutAt = locals[decoIndex].from; }\n      for (var i$3 = 0; i$3 < active.length; i$3++) { if (active[i$3].to < cutAt) { cutAt = active[i$3].to; } }\n      if (cutAt < end) {\n        restNode = child$1.cut(cutAt - offset);\n        child$1 = child$1.cut(0, cutAt - offset);\n        end = cutAt;\n        index = -1;\n      }\n    }\n\n    var outerDeco = !active.length ? nothing\n        : child$1.isInline && !child$1.isLeaf ? active.filter(function (d) { return !d.inline; })\n        : active.slice();\n    onNode(child$1, outerDeco, deco.forChild(offset, child$1), index);\n    offset = end;\n  }\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    var 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\nfunction nearbyTextNode(node, offset) {\n  for (;;) {\n    if (node.nodeType == 3) { return node }\n    if (node.nodeType == 1 && offset > 0) {\n      if (node.childNodes.length > offset && node.childNodes[offset].nodeType == 3)\n        { return node.childNodes[offset] }\n      node = node.childNodes[offset - 1];\n      offset = nodeSize(node);\n    } else if (node.nodeType == 1 && offset < node.childNodes.length) {\n      node = node.childNodes[offset];\n      offset = 0;\n    } else {\n      return null\n    }\n  }\n}\n\n// Find a piece of text in an inline fragment, overlapping from-to\nfunction findTextInFragment(frag, text, from, to) {\n  for (var i = 0, pos = 0; i < frag.childCount && pos <= to;) {\n    var child = frag.child(i++), childStart = pos;\n    pos += child.nodeSize;\n    if (!child.isText) { continue }\n    var str = child.text;\n    while (i < frag.childCount) {\n      var next = frag.child(i++);\n      pos += next.nodeSize;\n      if (!next.isText) { break }\n      str += next.text;\n    }\n    if (pos >= from) {\n      var found = str.lastIndexOf(text, to - childStart);\n      if (found >= 0 && found + text.length + childStart >= from)\n        { return childStart + found }\n    }\n  }\n  return -1\n}\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  var result = [];\n  for (var i = 0, off = 0; i < nodes.length; i++) {\n    var child = nodes[i], start = off, end = off += child.size;\n    if (start >= to || end <= from) {\n      result.push(child);\n    } else {\n      if (start < from) { result.push(child.slice(0, from - start, view)); }\n      if (replacement) {\n        result.push(replacement);\n        replacement = null;\n      }\n      if (end > to) { result.push(child.slice(to - start, child.size, view)); }\n    }\n  }\n  return result\n}\n\nfunction selectionFromDOM(view, origin) {\n  var domSel = view.root.getSelection(), doc = view.state.doc;\n  if (!domSel.focusNode) { return null }\n  var nearestDesc = view.docView.nearestDesc(domSel.focusNode), inWidget = nearestDesc && nearestDesc.size == 0;\n  var head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset);\n  if (head < 0) { return null }\n  var $head = doc.resolve(head), $anchor, selection;\n  if (selectionCollapsed(domSel)) {\n    $anchor = $head;\n    while (nearestDesc && !nearestDesc.node) { nearestDesc = nearestDesc.parent; }\n    if (nearestDesc && nearestDesc.node.isAtom && NodeSelection.isSelectable(nearestDesc.node) && nearestDesc.parent\n        && !(nearestDesc.node.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {\n      var pos = nearestDesc.posBefore;\n      selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));\n    }\n  } else {\n    var anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset);\n    if (anchor < 0) { return null }\n    $anchor = doc.resolve(anchor);\n  }\n\n  if (!selection) {\n    var bias = origin == \"pointer\" || (view.state.selection.head < $head.pos && !inWidget) ? 1 : -1;\n    selection = selectionBetween(view, $anchor, $head, bias);\n  }\n  return selection\n}\n\nfunction editorOwnsSelection(view) {\n  return view.editable ? view.hasFocus() :\n    hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom)\n}\n\nfunction selectionToDOM(view, force) {\n  var sel = view.state.selection;\n  syncNodeSelection(view, sel);\n\n  if (!editorOwnsSelection(view)) { return }\n\n  if (!force && view.mouseDown && view.mouseDown.allowDefault) {\n    view.mouseDown.delayedSelectionSync = true;\n    view.domObserver.setCurSelection();\n    return\n  }\n\n  view.domObserver.disconnectSelection();\n\n  if (view.cursorWrapper) {\n    selectCursorWrapper(view);\n  } else {\n    var anchor = sel.anchor;\n    var head = sel.head;\n    var 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.root, force);\n    if (brokenSelectBetweenUneditable) {\n      if (resetEditableFrom) { resetEditable(resetEditableFrom); }\n      if (resetEditableTo) { resetEditable(resetEditableTo); }\n    }\n    if (sel.visible) {\n      view.dom.classList.remove(\"ProseMirror-hideselection\");\n    } else {\n      view.dom.classList.add(\"ProseMirror-hideselection\");\n      if (\"onselectionchange\" in document) { removeClassOnSelectionChange(view); }\n    }\n  }\n\n  view.domObserver.setCurSelection();\n  view.domObserver.connectSelection();\n}\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.\n\nvar brokenSelectBetweenUneditable = result.safari || result.chrome && result.chrome_version < 63;\n\nfunction temporarilyEditableNear(view, pos) {\n  var ref = view.docView.domFromPos(pos, 0);\n  var node = ref.node;\n  var offset = ref.offset;\n  var after = offset < node.childNodes.length ? node.childNodes[offset] : null;\n  var before = offset ? node.childNodes[offset - 1] : null;\n  if (result.safari && after && after.contentEditable == \"false\") { return setEditable(after) }\n  if ((!after || after.contentEditable == \"false\") && (!before || before.contentEditable == \"false\")) {\n    if (after) { return setEditable(after) }\n    else if (before) { return setEditable(before) }\n  }\n}\n\nfunction setEditable(element) {\n  element.contentEditable = \"true\";\n  if (result.safari && element.draggable) { element.draggable = false; element.wasDraggable = true; }\n  return element\n}\n\nfunction resetEditable(element) {\n  element.contentEditable = \"false\";\n  if (element.wasDraggable) { element.draggable = true; element.wasDraggable = null; }\n}\n\nfunction removeClassOnSelectionChange(view) {\n  var doc = view.dom.ownerDocument;\n  doc.removeEventListener(\"selectionchange\", view.hideSelectionGuard);\n  var domSel = view.root.getSelection();\n  var node = domSel.anchorNode, offset = domSel.anchorOffset;\n  doc.addEventListener(\"selectionchange\", view.hideSelectionGuard = function () {\n    if (domSel.anchorNode != node || domSel.anchorOffset != offset) {\n      doc.removeEventListener(\"selectionchange\", view.hideSelectionGuard);\n      setTimeout(function () {\n        if (!editorOwnsSelection(view) || view.state.selection.visible)\n          { view.dom.classList.remove(\"ProseMirror-hideselection\"); }\n      }, 20);\n    }\n  });\n}\n\nfunction selectCursorWrapper(view) {\n  var domSel = view.root.getSelection(), range = document.createRange();\n  var node = view.cursorWrapper.dom, img = node.nodeName == \"IMG\";\n  if (img) { range.setEnd(node.parentNode, domIndex(node) + 1); }\n  else { range.setEnd(node, 0); }\n  range.collapse(false);\n  domSel.removeAllRanges();\n  domSel.addRange(range);\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 && result.ie && result.ie_version <= 11) {\n    node.disabled = true;\n    node.disabled = false;\n  }\n}\n\nfunction syncNodeSelection(view, sel) {\n  if (sel instanceof NodeSelection) {\n    var desc = view.docView.descAt(sel.from);\n    if (desc != view.lastSelectedViewDesc) {\n      clearNodeSelection(view);\n      if (desc) { desc.selectNode(); }\n      view.lastSelectedViewDesc = desc;\n    }\n  } else {\n    clearNodeSelection(view);\n  }\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 = null;\n  }\n}\n\nfunction selectionBetween(view, $anchor, $head, bias) {\n  return view.someProp(\"createSelectionBetween\", function (f) { return f(view, $anchor, $head); })\n    || TextSelection.between($anchor, $head, bias)\n}\n\nfunction hasFocusAndSelection(view) {\n  if (view.editable && view.root.activeElement != view.dom) { return false }\n  return hasSelection(view)\n}\n\nfunction hasSelection(view) {\n  var sel = view.root.getSelection();\n  if (!sel.anchorNode) { 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 view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) &&\n      (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode))\n  } catch(_) {\n    return false\n  }\n}\n\nfunction anchorInRightPlace(view) {\n  var anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0);\n  var domSel = view.root.getSelection();\n  return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset)\n}\n\nfunction moveSelectionBlock(state, dir) {\n  var ref = state.selection;\n  var $anchor = ref.$anchor;\n  var $head = ref.$head;\n  var $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);\n  var $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}\n\nfunction apply(view, sel) {\n  view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());\n  return true\n}\n\nfunction selectHorizontally(view, dir, mods) {\n  var sel = view.state.selection;\n  if (sel instanceof TextSelection) {\n    if (!sel.empty || mods.indexOf(\"s\") > -1) {\n      return false\n    } else if (view.endOfTextblock(dir > 0 ? \"right\" : \"left\")) {\n      var next = moveSelectionBlock(view.state, dir);\n      if (next && (next instanceof NodeSelection)) { return apply(view, next) }\n      return false\n    } else if (!(result.mac && mods.indexOf(\"m\") > -1)) {\n      var $head = sel.$head, node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter, desc;\n      if (!node || node.isText) { return false }\n      var nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;\n      if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) { 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      } else if (result.webkit) {\n        // Chrome and Safari will introduce extra pointless cursor\n        // positions around inline uneditable nodes, so we have to\n        // take over and move the cursor past them (#937)\n        return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)))\n      } else {\n        return false\n      }\n    }\n  } else if (sel instanceof NodeSelection && sel.node.isInline) {\n    return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from))\n  } else {\n    var next$1 = moveSelectionBlock(view.state, dir);\n    if (next$1) { return apply(view, next$1) }\n    return false\n  }\n}\n\nfunction nodeLen(node) {\n  return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length\n}\n\nfunction isIgnorable(dom) {\n  var desc = dom.pmViewDesc;\n  return desc && desc.size == 0 && (dom.nextSibling || dom.nodeName != \"BR\")\n}\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 skipIgnoredNodesLeft(view) {\n  var sel = view.root.getSelection();\n  var node = sel.focusNode, offset = sel.focusOffset;\n  if (!node) { return }\n  var 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 (result.gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset])) { force = true; }\n  for (;;) {\n    if (offset > 0) {\n      if (node.nodeType != 1) {\n        break\n      } else {\n        var before = node.childNodes[offset - 1];\n        if (isIgnorable(before)) {\n          moveNode = node;\n          moveOffset = --offset;\n        } else if (before.nodeType == 3) {\n          node = before;\n          offset = node.nodeValue.length;\n        } else { break }\n      }\n    } else if (isBlockNode(node)) {\n      break\n    } else {\n      var prev = node.previousSibling;\n      while (prev && isIgnorable(prev)) {\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) { break }\n        offset = 0;\n      } else {\n        node = prev;\n        offset = nodeLen(node);\n      }\n    }\n  }\n  if (force) { setSelFocus(view, sel, node, offset); }\n  else if (moveNode) { setSelFocus(view, sel, moveNode, moveOffset); }\n}\n\n// Make sure the cursor isn't directly before one or more ignored\n// nodes.\nfunction skipIgnoredNodesRight(view) {\n  var sel = view.root.getSelection();\n  var node = sel.focusNode, offset = sel.focusOffset;\n  if (!node) { return }\n  var len = nodeLen(node);\n  var moveNode, moveOffset;\n  for (;;) {\n    if (offset < len) {\n      if (node.nodeType != 1) { break }\n      var after = node.childNodes[offset];\n      if (isIgnorable(after)) {\n        moveNode = node;\n        moveOffset = ++offset;\n      }\n      else { break }\n    } else if (isBlockNode(node)) {\n      break\n    } else {\n      var next = node.nextSibling;\n      while (next && isIgnorable(next)) {\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) { break }\n        offset = len = 0;\n      } else {\n        node = next;\n        offset = 0;\n        len = nodeLen(node);\n      }\n    }\n  }\n  if (moveNode) { setSelFocus(view, sel, moveNode, moveOffset); }\n}\n\nfunction isBlockNode(dom) {\n  var desc = dom.pmViewDesc;\n  return desc && desc.node && desc.node.isBlock\n}\n\nfunction setSelFocus(view, sel, node, offset) {\n  if (selectionCollapsed(sel)) {\n    var range = document.createRange();\n    range.setEnd(node, offset);\n    range.setStart(node, offset);\n    sel.removeAllRanges();\n    sel.addRange(range);\n  } else if (sel.extend) {\n    sel.extend(node, offset);\n  }\n  view.domObserver.setCurSelection();\n  var state = view.state;\n  // If no state update ends up happening, reset the selection.\n  setTimeout(function () {\n    if (view.state == state) { selectionToDOM(view); }\n  }, 50);\n}\n\n// : (EditorState, number)\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  var sel = view.state.selection;\n  if (sel instanceof TextSelection && !sel.empty || mods.indexOf(\"s\") > -1) { return false }\n  if (result.mac && mods.indexOf(\"m\") > -1) { return false }\n  var $from = sel.$from;\n  var $to = sel.$to;\n\n  if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? \"up\" : \"down\")) {\n    var next = moveSelectionBlock(view.state, dir);\n    if (next && (next instanceof NodeSelection))\n      { return apply(view, next) }\n  }\n  if (!$from.parent.inlineContent) {\n    var side = dir < 0 ? $from : $to;\n    var beyond = sel instanceof AllSelection ? Selection.near(side, dir) : Selection.findFrom(side, dir);\n    return beyond ? apply(view, beyond) : false\n  }\n  return false\n}\n\nfunction stopNativeHorizontalDelete(view, dir) {\n  if (!(view.state.selection instanceof TextSelection)) { return true }\n  var ref = view.state.selection;\n  var $head = ref.$head;\n  var $anchor = ref.$anchor;\n  var empty = ref.empty;\n  if (!$head.sameParent($anchor)) { return true }\n  if (!empty) { return false }\n  if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) { return true }\n  var nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);\n  if (nextNode && !nextNode.isText) {\n    var tr = view.state.tr;\n    if (dir < 0) { tr.delete($head.pos - nextNode.nodeSize, $head.pos); }\n    else { tr.delete($head.pos, $head.pos + nextNode.nodeSize); }\n    view.dispatch(tr);\n    return true\n  }\n  return false\n}\n\nfunction switchEditable(view, node, state) {\n  view.domObserver.stop();\n  node.contentEditable = state;\n  view.domObserver.start();\n}\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 (!result.safari || view.state.selection.$head.parentOffset > 0) { return }\n  var ref = view.root.getSelection();\n  var focusNode = ref.focusNode;\n  var focusOffset = ref.focusOffset;\n  if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 &&\n      focusNode.firstChild && focusNode.firstChild.contentEditable == \"false\") {\n    var child = focusNode.firstChild;\n    switchEditable(view, child, true);\n    setTimeout(function () { return switchEditable(view, child, false); }, 20);\n  }\n}\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.\n\nfunction getMods(event) {\n  var result = \"\";\n  if (event.ctrlKey) { result += \"c\"; }\n  if (event.metaKey) { result += \"m\"; }\n  if (event.altKey) { result += \"a\"; }\n  if (event.shiftKey) { result += \"s\"; }\n  return result\n}\n\nfunction captureKeyDown(view, event) {\n  var code = event.keyCode, mods = getMods(event);\n  if (code == 8 || (result.mac && code == 72 && mods == \"c\")) { // Backspace, Ctrl-h on Mac\n    return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodesLeft(view)\n  } else if (code == 46 || (result.mac && code == 68 && mods == \"c\")) { // Delete, Ctrl-d on Mac\n    return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodesRight(view)\n  } else if (code == 13 || code == 27) { // Enter, Esc\n    return true\n  } else if (code == 37) { // Left arrow\n    return selectHorizontally(view, -1, mods) || skipIgnoredNodesLeft(view)\n  } else if (code == 39) { // Right arrow\n    return selectHorizontally(view, 1, mods) || skipIgnoredNodesRight(view)\n  } else if (code == 38) { // Up arrow\n    return selectVertically(view, -1, mods) || skipIgnoredNodesLeft(view)\n  } else if (code == 40) { // Down arrow\n    return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodesRight(view)\n  } else if (mods == (result.mac ? \"m\" : \"c\") &&\n             (code == 66 || code == 73 || code == 89 || code == 90)) { // Mod-[biyz]\n    return true\n  }\n  return false\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.\n\nfunction parseBetween(view, from_, to_) {\n  var ref = view.docView.parseRange(from_, to_);\n  var parent = ref.node;\n  var fromOffset = ref.fromOffset;\n  var toOffset = ref.toOffset;\n  var from = ref.from;\n  var to = ref.to;\n\n  var domSel = view.root.getSelection(), find = null, anchor = domSel.anchorNode;\n  if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {\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 (result.chrome && view.lastKeyCode === 8) {\n    for (var off = toOffset; off > fromOffset; off--) {\n      var node = parent.childNodes[off - 1], desc = node.pmViewDesc;\n      if (node.nodeName == \"BR\" && !desc) { toOffset = off; break }\n      if (!desc || desc.size) { break }\n    }\n  }\n  var startDoc = view.state.doc;\n  var parser = view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n  var $from = startDoc.resolve(from);\n\n  var 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.spec.code ? \"full\" : true,\n    editableContent: true,\n    findPositions: find,\n    ruleFromNode: ruleFromNode,\n    context: $from\n  });\n  if (find && find[0].pos != null) {\n    var anchor$1 = find[0].pos, head = find[1] && find[1].pos;\n    if (head == null) { head = anchor$1; }\n    sel = {anchor: anchor$1 + from, head: head + from};\n  }\n  return {doc: doc, sel: sel, from: from, to: to}\n}\n\nfunction ruleFromNode(dom) {\n  var desc = dom.pmViewDesc;\n  if (desc) {\n    return desc.parseRule()\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 (result.safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {\n      var skip = document.createElement(\"div\");\n      skip.appendChild(document.createElement(\"li\"));\n      return {skip: skip}\n    } else if (dom.parentNode.lastChild == dom || result.safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) {\n      return {ignore: true}\n    }\n  } else if (dom.nodeName == \"IMG\" && dom.getAttribute(\"mark-placeholder\")) {\n    return {ignore: true}\n  }\n}\n\nfunction readDOMChange(view, from, to, typeOver, addedNodes) {\n  if (from < 0) {\n    var origin = view.lastSelectionTime > Date.now() - 50 ? view.lastSelectionOrigin : null;\n    var newSel = selectionFromDOM(view, origin);\n    if (newSel && !view.state.selection.eq(newSel)) {\n      var tr$1 = view.state.tr.setSelection(newSel);\n      if (origin == \"pointer\") { tr$1.setMeta(\"pointer\", true); }\n      else if (origin == \"key\") { tr$1.scrollIntoView(); }\n      view.dispatch(tr$1);\n    }\n    return\n  }\n\n  var $before = view.state.doc.resolve(from);\n  var shared = $before.sharedDepth(to);\n  from = $before.before(shared + 1);\n  to = view.state.doc.resolve(to).after(shared + 1);\n\n  var sel = view.state.selection;\n  var parse = parseBetween(view, from, to);\n  // Chrome sometimes leaves the cursor before the inserted text when\n  // composing after a cursor wrapper. This moves it forward.\n  if (result.chrome && view.cursorWrapper && parse.sel && parse.sel.anchor == view.cursorWrapper.deco.from) {\n    var text = view.cursorWrapper.deco.type.toDOM.nextSibling;\n    var size = text && text.nodeValue ? text.nodeValue.length : 1;\n    parse.sel = {anchor: parse.sel.anchor + size, head: parse.sel.anchor + size};\n  }\n\n  var doc = view.state.doc, compare = doc.slice(parse.from, parse.to);\n  var preferredPos, preferredSide;\n  // Prefer anchoring to end when Backspace is pressed\n  if (view.lastKeyCode === 8 && Date.now() - 100 < view.lastKeyCodeTime) {\n    preferredPos = view.state.selection.to;\n    preferredSide = \"end\";\n  } else {\n    preferredPos = view.state.selection.from;\n    preferredSide = \"start\";\n  }\n  view.lastKeyCode = null;\n\n  var change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);\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    } else if ((result.ios && view.lastIOSEnter > Date.now() - 225 || result.android) &&\n               addedNodes.some(function (n) { return n.nodeName == \"DIV\" || n.nodeName == \"P\"; }) &&\n               view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); })) {\n      view.lastIOSEnter = 0;\n      return\n    } else {\n      if (parse.sel) {\n        var sel$1 = resolveSelection(view, view.state.doc, parse.sel);\n        if (sel$1 && !sel$1.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel$1)); }\n      }\n      return\n    }\n  }\n  view.domChangeCount++;\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      change.start = view.state.selection.from;\n    } else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2) {\n      change.endB += (view.state.selection.to - change.endA);\n      change.endA = view.state.selection.to;\n    }\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 (result.ie && result.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\n  var $from = parse.doc.resolveNoCache(change.start - parse.from);\n  var $to = parse.doc.resolveNoCache(change.endB - parse.from);\n  var inlineChange = $from.sameParent($to) && $from.parent.inlineContent;\n  var nextSel;\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 (((result.ios && view.lastIOSEnter > Date.now() - 225 &&\n        (!inlineChange || addedNodes.some(function (n) { return n.nodeName == \"DIV\" || n.nodeName == \"P\"; }))) ||\n       (!inlineChange && $from.pos < parse.doc.content.size &&\n        (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) &&\n        nextSel.head == $to.pos)) &&\n      view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); })) {\n    view.lastIOSEnter = 0;\n    return\n  }\n  // Same for backspace\n  if (view.state.selection.anchor > change.start &&\n      looksLikeJoin(doc, change.start, change.endA, $from, $to) &&\n      view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(8, \"Backspace\")); })) {\n    if (result.android && result.chrome) { view.domObserver.suppressSelectionUpdates(); } // #820\n    return\n  }\n\n  // Chrome Android 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 (result.chrome && result.android && change.toB == change.from)\n    { view.lastAndroidDelete = Date.now(); }\n\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 (result.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(function () {\n      view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); });\n    }, 20);\n  }\n\n  var chFrom = change.start, chTo = change.endA;\n\n  var tr, storedMarks, markChange, $from1;\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 (result.ie && result.ie_version <= 11 && $from.parentOffset == 0) {\n        view.domObserver.suppressSelectionUpdates();\n        setTimeout(function () { return selectionToDOM(view); }, 20);\n      }\n      tr = view.state.tr.delete(chFrom, chTo);\n      storedMarks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));\n    } else if ( // Adding or removing a mark\n      change.endA == change.endB && ($from1 = doc.resolve(change.start)) &&\n      (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset),\n                                 $from1.parent.content.cut($from1.parentOffset, change.endA - $from1.start())))\n    ) {\n      tr = view.state.tr;\n      if (markChange.type == \"add\") { tr.addMark(chFrom, chTo, markChange.mark); }\n      else { tr.removeMark(chFrom, chTo, markChange.mark); }\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      var text$1 = $from.parent.textBetween($from.parentOffset, $to.parentOffset);\n      if (view.someProp(\"handleTextInput\", function (f) { return f(view, chFrom, chTo, text$1); })) { return }\n      tr = view.state.tr.insertText(text$1, chFrom, chTo);\n    }\n  }\n\n  if (!tr)\n    { tr = view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from)); }\n  if (parse.sel) {\n    var sel$2 = resolveSelection(view, tr.doc, parse.sel);\n    // Chrome Android 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$2 && !(result.chrome && result.android && view.composing && sel$2.empty &&\n                 (change.start != change.endB || view.lastAndroidDelete < Date.now() - 100) &&\n                 (sel$2.head == chFrom || sel$2.head == tr.mapping.map(chTo) - 1) ||\n                 result.ie && sel$2.empty && sel$2.head == chFrom))\n      { tr.setSelection(sel$2); }\n  }\n  if (storedMarks) { tr.ensureMarks(storedMarks); }\n  view.dispatch(tr.scrollIntoView());\n}\n\nfunction resolveSelection(view, doc, parsedSel) {\n  if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) { return null }\n  return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head))\n}\n\n// : (Fragment, Fragment) → ?{mark: Mark, type: string}\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  var curMarks = cur.firstChild.marks, prevMarks = prev.firstChild.marks;\n  var added = curMarks, removed = prevMarks, type, mark, update;\n  for (var i = 0; i < prevMarks.length; i++) { added = prevMarks[i].removeFromSet(added); }\n  for (var i$1 = 0; i$1 < curMarks.length; i$1++) { removed = curMarks[i$1].removeFromSet(removed); }\n  if (added.length == 1 && removed.length == 0) {\n    mark = added[0];\n    type = \"add\";\n    update = function (node) { return node.mark(mark.addToSet(node.marks)); };\n  } else if (added.length == 0 && removed.length == 1) {\n    mark = removed[0];\n    type = \"remove\";\n    update = function (node) { return node.mark(mark.removeFromSet(node.marks)); };\n  } else {\n    return null\n  }\n  var updated = [];\n  for (var i$2 = 0; i$2 < prev.childCount; i$2++) { updated.push(update(prev.child(i$2))); }\n  if (Fragment.from(updated).eq(cur)) { return {mark: mark, type: type} }\n}\n\nfunction looksLikeJoin(old, start, end, $newStart, $newEnd) {\n  if (!$newStart.parent.isTextblock ||\n      // 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\n  var $start = old.resolve(start);\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  var $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\n  // The fragments after the join point must match\n  return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content)\n}\n\nfunction skipClosingAndOpening($pos, fromEnd, mayOpen) {\n  var 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    var 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}\n\nfunction findDiff(a, b, pos, preferredPos, preferredSide) {\n  var start = a.findDiffStart(b, pos);\n  if (start == null) { return null }\n  var ref = a.findDiffEnd(b, pos + a.size, pos + b.size);\n  var endA = ref.a;\n  var endB = ref.b;\n  if (preferredSide == \"end\") {\n    var adjust = Math.max(0, start - Math.min(endA, endB));\n    preferredPos -= endA + adjust - start;\n  }\n  if (endA < start && a.size < b.size) {\n    var move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;\n    start -= move;\n    endB = start + (endB - endA);\n    endA = start;\n  } else if (endB < start) {\n    var move$1 = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;\n    start -= move$1;\n    endA = start + (endA - endB);\n    endB = start;\n  }\n  return {start: start, endA: endA, endB: endB}\n}\n\nfunction serializeForClipboard(view, slice) {\n  var context = [];\n  var content = slice.content;\n  var openStart = slice.openStart;\n  var openEnd = slice.openEnd;\n  while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {\n    openStart--;\n    openEnd--;\n    var node = content.firstChild;\n    context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);\n    content = node.content;\n  }\n\n  var serializer = view.someProp(\"clipboardSerializer\") || DOMSerializer.fromSchema(view.state.schema);\n  var doc = detachedDoc(), wrap = doc.createElement(\"div\");\n  wrap.appendChild(serializer.serializeFragment(content, {document: doc}));\n\n  var firstChild = wrap.firstChild, needsWrap;\n  while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {\n    for (var i = needsWrap.length - 1; i >= 0; i--) {\n      var wrapper = doc.createElement(needsWrap[i]);\n      while (wrap.firstChild) { wrapper.appendChild(wrap.firstChild); }\n      wrap.appendChild(wrapper);\n      if (needsWrap[i] != \"tbody\") {\n        openStart++;\n        openEnd++;\n      }\n    }\n    firstChild = wrap.firstChild;\n  }\n\n  if (firstChild && firstChild.nodeType == 1)\n    { firstChild.setAttribute(\"data-pm-slice\", (openStart + \" \" + openEnd + \" \" + (JSON.stringify(context)))); }\n\n  var text = view.someProp(\"clipboardTextSerializer\", function (f) { return f(slice); }) ||\n      slice.content.textBetween(0, slice.content.size, \"\\n\\n\");\n\n  return {dom: wrap, text: text}\n}\n\n// : (EditorView, string, string, ?bool, ResolvedPos) → ?Slice\n// Read a slice of content from the clipboard (or drop data).\nfunction parseFromClipboard(view, text, html, plainText, $context) {\n  var dom, inCode = $context.parent.type.spec.code, slice;\n  if (!html && !text) { return null }\n  var asText = text && (plainText || inCode || !html);\n  if (asText) {\n    view.someProp(\"transformPastedText\", function (f) { text = f(text, inCode || plainText); });\n    if (inCode) { return new Slice(Fragment.from(view.state.schema.text(text.replace(/\\r\\n?/g, \"\\n\"))), 0, 0) }\n    var parsed = view.someProp(\"clipboardTextParser\", function (f) { return f(text, $context, plainText); });\n    if (parsed) {\n      slice = parsed;\n    } else {\n      var marks = $context.marks();\n      var ref = view.state;\n      var schema = ref.schema;\n      var serializer = DOMSerializer.fromSchema(schema);\n      dom = document.createElement(\"div\");\n      text.trim().split(/(?:\\r\\n?|\\n)+/).forEach(function (block) {\n        dom.appendChild(document.createElement(\"p\")).appendChild(serializer.serializeNode(schema.text(block, marks)));\n      });\n    }\n  } else {\n    view.someProp(\"transformPastedHTML\", function (f) { html = f(html); });\n    dom = readHTML(html);\n    if (result.webkit) { restoreReplacedSpaces(dom); }\n  }\n\n  var contextNode = dom && dom.querySelector(\"[data-pm-slice]\");\n  var sliceData = contextNode && /^(\\d+) (\\d+) (.*)/.exec(contextNode.getAttribute(\"data-pm-slice\"));\n  if (!slice) {\n    var parser = view.someProp(\"clipboardParser\") || view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n    slice = parser.parseSlice(dom, {preserveWhitespace: !!(asText || sliceData), context: $context});\n  }\n  if (sliceData)\n    { slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[3]); }\n  else // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent\n    { slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), false); }\n\n  view.someProp(\"transformPasted\", function (f) { slice = f(slice); });\n  return slice\n}\n\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) { return fragment }\n  var loop = function ( d ) {\n    var parent = $context.node(d);\n    var match = parent.contentMatchAt($context.index(d));\n    var lastWrap = (void 0), result = [];\n    fragment.forEach(function (node) {\n      if (!result) { return }\n      var wrap = match.findWrapping(node.type), inLast;\n      if (!wrap) { 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      } else {\n        if (result.length) { result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length); }\n        var wrapped = withWrappers(node, wrap);\n        result.push(wrapped);\n        match = match.matchType(wrapped.type, wrapped.attrs);\n        lastWrap = wrap;\n      }\n    });\n    if (result) { return { v: Fragment.from(result) } }\n  };\n\n  for (var d = $context.depth; d >= 0; d--) {\n    var returned = loop( d );\n\n    if ( returned ) return returned.v;\n  }\n  return fragment\n}\n\nfunction withWrappers(node, wrap, from) {\n  if ( from === void 0 ) from = 0;\n\n  for (var i = wrap.length - 1; i >= from; i--)\n    { node = wrap[i].create(null, Fragment.from(node)); }\n  return node\n}\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    var inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);\n    if (inner) { return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner)) }\n    var 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}\n\nfunction closeRight(node, depth) {\n  if (depth == 0) { return node }\n  var fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));\n  var fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);\n  return node.copy(fragment.append(fill))\n}\n\nfunction closeRange(fragment, side, from, to, depth, openEnd) {\n  var node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;\n  if (depth < to - 1) { inner = closeRange(inner, side, from, to, depth + 1, openEnd); }\n  if (depth >= from)\n    { inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, fragment.childCount > 1 || 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}\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\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.\nvar 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};\n\nvar _detachedDoc = null;\nfunction detachedDoc() {\n  return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument(\"title\"))\n}\n\nfunction readHTML(html) {\n  var metas = /^(\\s*<meta [^>]*>)*/.exec(html);\n  if (metas) { html = html.slice(metas[0].length); }\n  var elt = detachedDoc().createElement(\"div\");\n  var firstTag = /<([a-z][^>\\s]+)/i.exec(html), wrap;\n  if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()])\n    { html = wrap.map(function (n) { return \"<\" + n + \">\"; }).join(\"\") + html + wrap.map(function (n) { return \"</\" + n + \">\"; }).reverse().join(\"\"); }\n  elt.innerHTML = html;\n  if (wrap) { for (var i = 0; i < wrap.length; i++) { elt = elt.querySelector(wrap[i]) || elt; } }\n  return elt\n}\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  var nodes = dom.querySelectorAll(result.chrome ? \"span:not([class]):not([style])\" : \"span.Apple-converted-space\");\n  for (var i = 0; i < nodes.length; i++) {\n    var node = nodes[i];\n    if (node.childNodes.length == 1 && node.textContent == \"\\u00a0\" && node.parentNode)\n      { node.parentNode.replaceChild(dom.ownerDocument.createTextNode(\" \"), node); }\n  }\n}\n\nfunction addContext(slice, context) {\n  if (!slice.size) { return slice }\n  var schema = slice.content.firstChild.type.schema, array;\n  try { array = JSON.parse(context); }\n  catch(e) { return slice }\n  var content = slice.content;\n  var openStart = slice.openStart;\n  var openEnd = slice.openEnd;\n  for (var i = array.length - 2; i >= 0; i -= 2) {\n    var type = schema.nodes[array[i]];\n    if (!type || type.hasRequiredAttrs()) { break }\n    content = Fragment.from(type.create(array[i + 1], content));\n    openStart++; openEnd++;\n  }\n  return new Slice(content, openStart, openEnd)\n}\n\nvar 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\nvar useCharData = result.ie && result.ie_version <= 11;\n\nvar SelectionState = function SelectionState() {\n  this.anchorNode = this.anchorOffset = this.focusNode = this.focusOffset = null;\n};\n\nSelectionState.prototype.set = function set (sel) {\n  this.anchorNode = sel.anchorNode; this.anchorOffset = sel.anchorOffset;\n  this.focusNode = sel.focusNode; this.focusOffset = sel.focusOffset;\n};\n\nSelectionState.prototype.eq = function eq (sel) {\n  return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset &&\n    sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset\n};\n\nvar DOMObserver = function DOMObserver(view, handleDOMChange) {\n  var this$1 = this;\n\n  this.view = view;\n  this.handleDOMChange = handleDOMChange;\n  this.queue = [];\n  this.flushingSoon = -1;\n  this.observer = window.MutationObserver &&\n    new window.MutationObserver(function (mutations) {\n      for (var i = 0; i < mutations.length; i++) { this$1.queue.push(mutations[i]); }\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      if (result.ie && result.ie_version <= 11 && mutations.some(\n        function (m) { return m.type == \"childList\" && m.removedNodes.length ||\n             m.type == \"characterData\" && m.oldValue.length > m.target.nodeValue.length; }))\n        { this$1.flushSoon(); }\n      else\n        { this$1.flush(); }\n    });\n  this.currentSelection = new SelectionState;\n  if (useCharData) {\n    this.onCharData = function (e) {\n      this$1.queue.push({target: e.target, type: \"characterData\", oldValue: e.prevValue});\n      this$1.flushSoon();\n    };\n  }\n  this.onSelectionChange = this.onSelectionChange.bind(this);\n  this.suppressingSelectionUpdates = false;\n};\n\nDOMObserver.prototype.flushSoon = function flushSoon () {\n    var this$1 = this;\n\n  if (this.flushingSoon < 0)\n    { this.flushingSoon = window.setTimeout(function () { this$1.flushingSoon = -1; this$1.flush(); }, 20); }\n};\n\nDOMObserver.prototype.forceFlush = function forceFlush () {\n  if (this.flushingSoon > -1) {\n    window.clearTimeout(this.flushingSoon);\n    this.flushingSoon = -1;\n    this.flush();\n  }\n};\n\nDOMObserver.prototype.start = function start () {\n  if (this.observer)\n    { this.observer.observe(this.view.dom, observeOptions); }\n  if (useCharData)\n    { this.view.dom.addEventListener(\"DOMCharacterDataModified\", this.onCharData); }\n  this.connectSelection();\n};\n\nDOMObserver.prototype.stop = function stop () {\n    var this$1 = this;\n\n  if (this.observer) {\n    var take = this.observer.takeRecords();\n    if (take.length) {\n      for (var i = 0; i < take.length; i++) { this.queue.push(take[i]); }\n      window.setTimeout(function () { return this$1.flush(); }, 20);\n    }\n    this.observer.disconnect();\n  }\n  if (useCharData) { this.view.dom.removeEventListener(\"DOMCharacterDataModified\", this.onCharData); }\n  this.disconnectSelection();\n};\n\nDOMObserver.prototype.connectSelection = function connectSelection () {\n  this.view.dom.ownerDocument.addEventListener(\"selectionchange\", this.onSelectionChange);\n};\n\nDOMObserver.prototype.disconnectSelection = function disconnectSelection () {\n  this.view.dom.ownerDocument.removeEventListener(\"selectionchange\", this.onSelectionChange);\n};\n\nDOMObserver.prototype.suppressSelectionUpdates = function suppressSelectionUpdates () {\n    var this$1 = this;\n\n  this.suppressingSelectionUpdates = true;\n  setTimeout(function () { return this$1.suppressingSelectionUpdates = false; }, 50);\n};\n\nDOMObserver.prototype.onSelectionChange = function onSelectionChange () {\n  if (!hasFocusAndSelection(this.view)) { return }\n  if (this.suppressingSelectionUpdates) { 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 (result.ie && result.ie_version <= 11 && !this.view.state.selection.empty) {\n    var sel = this.view.root.getSelection();\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\nDOMObserver.prototype.setCurSelection = function setCurSelection () {\n  this.currentSelection.set(this.view.root.getSelection());\n};\n\nDOMObserver.prototype.ignoreSelectionChange = function ignoreSelectionChange (sel) {\n  if (sel.rangeCount == 0) { return true }\n  var container = sel.getRangeAt(0).commonAncestorContainer;\n  var desc = this.view.docView.nearestDesc(container);\n  if (desc && desc.ignoreMutation({type: \"selection\", target: container.nodeType == 3 ? container.parentNode : container})) {\n    this.setCurSelection();\n    return true\n  }\n};\n\nDOMObserver.prototype.flush = function flush () {\n  if (!this.view.docView || this.flushingSoon > -1) { return }\n  var mutations = this.observer ? this.observer.takeRecords() : [];\n  if (this.queue.length) {\n    mutations = this.queue.concat(mutations);\n    this.queue.length = 0;\n  }\n\n  var sel = this.view.root.getSelection();\n  var newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasSelection(this.view) && !this.ignoreSelectionChange(sel);\n\n  var from = -1, to = -1, typeOver = false, added = [];\n  if (this.view.editable) {\n    for (var i = 0; i < mutations.length; i++) {\n      var result$1 = this.registerMutation(mutations[i], added);\n      if (result$1) {\n        from = from < 0 ? result$1.from : Math.min(result$1.from, from);\n        to = to < 0 ? result$1.to : Math.max(result$1.to, to);\n        if (result$1.typeOver) { typeOver = true; }\n      }\n    }\n  }\n\n  if (result.gecko && added.length > 1) {\n    var brs = added.filter(function (n) { return n.nodeName == \"BR\"; });\n    if (brs.length == 2) {\n      var a = brs[0];\n        var b = brs[1];\n      if (a.parentNode && a.parentNode.parentNode == b.parentNode) { b.remove(); }\n      else { a.remove(); }\n    }\n  }\n\n  if (from > -1 || newSel) {\n    if (from > -1) {\n      this.view.docView.markDirty(from, to);\n      checkCSS(this.view);\n    }\n    this.handleDOMChange(from, to, typeOver, added);\n    if (this.view.docView.dirty) { this.view.updateState(this.view.state); }\n    else if (!this.currentSelection.eq(sel)) { selectionToDOM(this.view); }\n    this.currentSelection.set(sel);\n  }\n};\n\nDOMObserver.prototype.registerMutation = function registerMutation (mut, added) {\n  // Ignore mutations inside nodes that were already noted as inserted\n  if (added.indexOf(mut.target) > -1) { return null }\n  var 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)) { return null }\n\n  if (mut.type == \"childList\") {\n    for (var i = 0; i < mut.addedNodes.length; i++) { added.push(mut.addedNodes[i]); }\n    if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target))\n      { return {from: desc.posBefore, to: desc.posAfter} }\n    var prev = mut.previousSibling, next = mut.nextSibling;\n    if (result.ie && result.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 (var i$1 = 0; i$1 < mut.addedNodes.length; i$1++) {\n        var ref = mut.addedNodes[i$1];\n          var previousSibling = ref.previousSibling;\n          var nextSibling = ref.nextSibling;\n        if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0) { prev = previousSibling; }\n        if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0) { next = nextSibling; }\n      }\n    }\n    var fromOffset = prev && prev.parentNode == mut.target\n        ? domIndex(prev) + 1 : 0;\n    var from = desc.localPosFromDOM(mut.target, fromOffset, -1);\n    var toOffset = next && next.parentNode == mut.target\n        ? domIndex(next) : mut.target.childNodes.length;\n    var to = desc.localPosFromDOM(mut.target, toOffset, 1);\n    return {from: from, to: to}\n  } else if (mut.type == \"attributes\") {\n    return {from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border}\n  } else { // \"characterData\"\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\nvar cssChecked = false;\n\nfunction checkCSS(view) {\n  if (cssChecked) { return }\n  cssChecked = true;\n  if (getComputedStyle(view.dom).whiteSpace == \"normal\")\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}\n\n// A collection of DOM events that occur within the editor, and callback functions\n// to invoke when the event fires.\nvar handlers = {}, editHandlers = {};\n\nfunction initInput(view) {\n  view.shiftKey = false;\n  view.mouseDown = null;\n  view.lastKeyCode = null;\n  view.lastKeyCodeTime = 0;\n  view.lastClick = {time: 0, x: 0, y: 0, type: \"\"};\n  view.lastSelectionOrigin = null;\n  view.lastSelectionTime = 0;\n\n  view.lastIOSEnter = 0;\n  view.lastIOSEnterFallbackTimeout = null;\n  view.lastAndroidDelete = 0;\n\n  view.composing = false;\n  view.composingTimeout = null;\n  view.compositionNodes = [];\n  view.compositionEndedAt = -2e8;\n\n  view.domObserver = new DOMObserver(view, function (from, to, typeOver, added) { return readDOMChange(view, from, to, typeOver, added); });\n  view.domObserver.start();\n  // Used by hacks like the beforeinput handler to check whether anything happened in the DOM\n  view.domChangeCount = 0;\n\n  view.eventHandlers = Object.create(null);\n  var loop = function ( event ) {\n    var handler = handlers[event];\n    view.dom.addEventListener(event, view.eventHandlers[event] = function (event) {\n      if (eventBelongsToView(view, event) && !runCustomHandler(view, event) &&\n          (view.editable || !(event.type in editHandlers)))\n        { handler(view, event); }\n    });\n  };\n\n  for (var event in handlers) loop( event );\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 (result.safari) { view.dom.addEventListener(\"input\", function () { return null; }); }\n\n  ensureListeners(view);\n}\n\nfunction setSelectionOrigin(view, origin) {\n  view.lastSelectionOrigin = origin;\n  view.lastSelectionTime = Date.now();\n}\n\nfunction destroyInput(view) {\n  view.domObserver.stop();\n  for (var type in view.eventHandlers)\n    { view.dom.removeEventListener(type, view.eventHandlers[type]); }\n  clearTimeout(view.composingTimeout);\n  clearTimeout(view.lastIOSEnterFallbackTimeout);\n}\n\nfunction ensureListeners(view) {\n  view.someProp(\"handleDOMEvents\", function (currentHandlers) {\n    for (var type in currentHandlers) { if (!view.eventHandlers[type])\n      { view.dom.addEventListener(type, view.eventHandlers[type] = function (event) { return runCustomHandler(view, event); }); } }\n  });\n}\n\nfunction runCustomHandler(view, event) {\n  return view.someProp(\"handleDOMEvents\", function (handlers) {\n    var handler = handlers[event.type];\n    return handler ? handler(view, event) || event.defaultPrevented : false\n  })\n}\n\nfunction eventBelongsToView(view, event) {\n  if (!event.bubbles) { return true }\n  if (event.defaultPrevented) { return false }\n  for (var 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}\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}\n\neditHandlers.keydown = function (view, event) {\n  view.shiftKey = event.keyCode == 16 || event.shiftKey;\n  if (inOrNearComposition(view, event)) { return }\n  if (event.keyCode != 229) { view.domObserver.forceFlush(); }\n  view.lastKeyCode = event.keyCode;\n  view.lastKeyCodeTime = Date.now();\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 (result.ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {\n    var now = Date.now();\n    view.lastIOSEnter = now;\n    view.lastIOSEnterFallbackTimeout = setTimeout(function () {\n      if (view.lastIOSEnter == now) {\n        view.someProp(\"handleKeyDown\", function (f) { return f(view, keyEvent(13, \"Enter\")); });\n        view.lastIOSEnter = 0;\n      }\n    }, 200);\n  } else if (view.someProp(\"handleKeyDown\", function (f) { return f(view, event); }) || captureKeyDown(view, event)) {\n    event.preventDefault();\n  } else {\n    setSelectionOrigin(view, \"key\");\n  }\n};\n\neditHandlers.keyup = function (view, e) {\n  if (e.keyCode == 16) { view.shiftKey = false; }\n};\n\neditHandlers.keypress = function (view, event) {\n  if (inOrNearComposition(view, event) || !event.charCode ||\n      event.ctrlKey && !event.altKey || result.mac && event.metaKey) { return }\n\n  if (view.someProp(\"handleKeyPress\", function (f) { return f(view, event); })) {\n    event.preventDefault();\n    return\n  }\n\n  var sel = view.state.selection;\n  if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {\n    var text = String.fromCharCode(event.charCode);\n    if (!view.someProp(\"handleTextInput\", function (f) { return f(view, sel.$from.pos, sel.$to.pos, text); }))\n      { view.dispatch(view.state.tr.insertText(text).scrollIntoView()); }\n    event.preventDefault();\n  }\n};\n\nfunction eventCoords(event) { return {left: event.clientX, top: event.clientY} }\n\nfunction isNear(event, click) {\n  var dx = click.x - event.clientX, dy = click.y - event.clientY;\n  return dx * dx + dy * dy < 100\n}\n\nfunction runHandlerOnContext(view, propName, pos, inside, event) {\n  if (inside == -1) { return false }\n  var $pos = view.state.doc.resolve(inside);\n  var loop = function ( i ) {\n    if (view.someProp(propName, function (f) { return 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 { v: true } }\n  };\n\n  for (var i = $pos.depth + 1; i > 0; i--) {\n    var returned = loop( i );\n\n    if ( returned ) return returned.v;\n  }\n  return false\n}\n\nfunction updateSelection(view, selection, origin) {\n  if (!view.focused) { view.focus(); }\n  var tr = view.state.tr.setSelection(selection);\n  if (origin == \"pointer\") { tr.setMeta(\"pointer\", true); }\n  view.dispatch(tr);\n}\n\nfunction selectClickedLeaf(view, inside) {\n  if (inside == -1) { return false }\n  var $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;\n  if (node && node.isAtom && NodeSelection.isSelectable(node)) {\n    updateSelection(view, new NodeSelection($pos), \"pointer\");\n    return true\n  }\n  return false\n}\n\nfunction selectClickedNode(view, inside) {\n  if (inside == -1) { return false }\n  var sel = view.state.selection, selectedNode, selectAt;\n  if (sel instanceof NodeSelection) { selectedNode = sel.node; }\n\n  var $pos = view.state.doc.resolve(inside);\n  for (var i = $pos.depth + 1; i > 0; i--) {\n    var 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\n  if (selectAt != null) {\n    updateSelection(view, NodeSelection.create(view.state.doc, selectAt), \"pointer\");\n    return true\n  } else {\n    return false\n  }\n}\n\nfunction handleSingleClick(view, pos, inside, event, selectNode) {\n  return runHandlerOnContext(view, \"handleClickOn\", pos, inside, event) ||\n    view.someProp(\"handleClick\", function (f) { return f(view, pos, event); }) ||\n    (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside))\n}\n\nfunction handleDoubleClick(view, pos, inside, event) {\n  return runHandlerOnContext(view, \"handleDoubleClickOn\", pos, inside, event) ||\n    view.someProp(\"handleDoubleClick\", function (f) { return f(view, pos, event); })\n}\n\nfunction handleTripleClick(view, pos, inside, event) {\n  return runHandlerOnContext(view, \"handleTripleClickOn\", pos, inside, event) ||\n    view.someProp(\"handleTripleClick\", function (f) { return f(view, pos, event); }) ||\n    defaultTripleClick(view, inside, event)\n}\n\nfunction defaultTripleClick(view, inside, event) {\n  if (event.button != 0) { return false }\n  var doc = view.state.doc;\n  if (inside == -1) {\n    if (doc.inlineContent) {\n      updateSelection(view, TextSelection.create(doc, 0, doc.content.size), \"pointer\");\n      return true\n    }\n    return false\n  }\n\n  var $pos = doc.resolve(inside);\n  for (var i = $pos.depth + 1; i > 0; i--) {\n    var node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n    var nodePos = $pos.before(i);\n    if (node.inlineContent)\n      { updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), \"pointer\"); }\n    else if (NodeSelection.isSelectable(node))\n      { updateSelection(view, NodeSelection.create(doc, nodePos), \"pointer\"); }\n    else\n      { continue }\n    return true\n  }\n}\n\nfunction forceDOMFlush(view) {\n  return endComposition(view)\n}\n\nvar selectNodeModifier = result.mac ? \"metaKey\" : \"ctrlKey\";\n\nhandlers.mousedown = function (view, event) {\n  view.shiftKey = event.shiftKey;\n  var flushed = forceDOMFlush(view);\n  var now = Date.now(), type = \"singleClick\";\n  if (now - view.lastClick.time < 500 && isNear(event, view.lastClick) && !event[selectNodeModifier]) {\n    if (view.lastClick.type == \"singleClick\") { type = \"doubleClick\"; }\n    else if (view.lastClick.type == \"doubleClick\") { type = \"tripleClick\"; }\n  }\n  view.lastClick = {time: now, x: event.clientX, y: event.clientY, type: type};\n\n  var pos = view.posAtCoords(eventCoords(event));\n  if (!pos) { return }\n\n  if (type == \"singleClick\") {\n    if (view.mouseDown) { view.mouseDown.done(); }\n    view.mouseDown = new MouseDown(view, pos, event, flushed);\n  } else if ((type == \"doubleClick\" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {\n    event.preventDefault();\n  } else {\n    setSelectionOrigin(view, \"pointer\");\n  }\n};\n\nvar MouseDown = function MouseDown(view, pos, event, flushed) {\n  var this$1 = this;\n\n  this.view = view;\n  this.startDoc = view.state.doc;\n  this.pos = pos;\n  this.event = event;\n  this.flushed = flushed;\n  this.selectNode = event[selectNodeModifier];\n  this.allowDefault = event.shiftKey;\n  this.delayedSelectionSync = false;\n\n  var targetNode, targetPos;\n  if (pos.inside > -1) {\n    targetNode = view.state.doc.nodeAt(pos.inside);\n    targetPos = pos.inside;\n  } else {\n    var $pos = view.state.doc.resolve(pos.pos);\n    targetNode = $pos.parent;\n    targetPos = $pos.depth ? $pos.before() : 0;\n  }\n\n  this.mightDrag = null;\n\n  var target = flushed ? null : event.target;\n  var targetDesc = target ? view.docView.nearestDesc(target, true) : null;\n  this.target = targetDesc ? targetDesc.dom : null;\n\n  var ref = view.state;\n  var selection = ref.selection;\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 = {node: targetNode,\n                      pos: targetPos,\n                      addAttr: this.target && !this.target.draggable,\n                      setUneditable: this.target && result.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) { this.target.draggable = true; }\n    if (this.mightDrag.setUneditable)\n      { setTimeout(function () {\n        if (this$1.view.mouseDown == this$1) { this$1.target.setAttribute(\"contentEditable\", \"false\"); }\n      }, 20); }\n    this.view.domObserver.start();\n  }\n\n  view.root.addEventListener(\"mouseup\", this.up = this.up.bind(this));\n  view.root.addEventListener(\"mousemove\", this.move = this.move.bind(this));\n  setSelectionOrigin(view, \"pointer\");\n};\n\nMouseDown.prototype.done = function done () {\n    var this$1 = this;\n\n  this.view.root.removeEventListener(\"mouseup\", this.up);\n  this.view.root.removeEventListener(\"mousemove\", this.move);\n  if (this.mightDrag && this.target) {\n    this.view.domObserver.stop();\n    if (this.mightDrag.addAttr) { this.target.removeAttribute(\"draggable\"); }\n    if (this.mightDrag.setUneditable) { this.target.removeAttribute(\"contentEditable\"); }\n    this.view.domObserver.start();\n  }\n  if (this.delayedSelectionSync) { setTimeout(function () { return selectionToDOM(this$1.view); }); }\n  this.view.mouseDown = null;\n};\n\nMouseDown.prototype.up = function up (event) {\n  this.done();\n\n  if (!this.view.dom.contains(event.target.nodeType == 3 ? event.target.parentNode : event.target))\n    { return }\n\n  var pos = this.pos;\n  if (this.view.state.doc != this.startDoc) { pos = this.view.posAtCoords(eventCoords(event)); }\n\n  if (this.allowDefault || !pos) {\n    setSelectionOrigin(this.view, \"pointer\");\n  } else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) {\n    event.preventDefault();\n  } else if (event.button == 0 &&\n             (this.flushed ||\n              // Safari ignores clicks on draggable elements\n              (result.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              (result.chrome && !(this.view.state.selection instanceof TextSelection) &&\n               Math.min(Math.abs(pos.pos - this.view.state.selection.from),\n                        Math.abs(pos.pos - this.view.state.selection.to)) <= 2))) {\n    updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), \"pointer\");\n    event.preventDefault();\n  } else {\n    setSelectionOrigin(this.view, \"pointer\");\n  }\n};\n\nMouseDown.prototype.move = function move (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  setSelectionOrigin(this.view, \"pointer\");\n  if (event.buttons == 0) { this.done(); }\n};\n\nhandlers.touchdown = function (view) {\n  forceDOMFlush(view);\n  setSelectionOrigin(view, \"pointer\");\n};\n\nhandlers.contextmenu = function (view) { return forceDOMFlush(view); };\n\nfunction inOrNearComposition(view, event) {\n  if (view.composing) { 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 (result.safari && Math.abs(event.timeStamp - view.compositionEndedAt) < 500) {\n    view.compositionEndedAt = -2e8;\n    return true\n  }\n  return false\n}\n\n// Drop active composition after 5 seconds of inactivity on Android\nvar timeoutComposition = result.android ? 5000 : -1;\n\neditHandlers.compositionstart = editHandlers.compositionupdate = function (view) {\n  if (!view.composing) {\n    view.domObserver.flush();\n    var state = view.state;\n    var $pos = state.selection.$from;\n    if (state.selection.empty &&\n        (state.storedMarks ||\n         (!$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(function (m) { return m.type.spec.inclusive === false; })))) {\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    } else {\n      endComposition(view);\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 (result.gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {\n        var sel = view.root.getSelection();\n        for (var node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {\n          var before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];\n          if (!before) { break }\n          if (before.nodeType == 3) {\n            sel.collapse(before, before.nodeValue.length);\n            break\n          } else {\n            node = before;\n            offset = -1;\n          }\n        }\n      }\n    }\n    view.composing = true;\n  }\n  scheduleComposeEnd(view, timeoutComposition);\n};\n\neditHandlers.compositionend = function (view, event) {\n  if (view.composing) {\n    view.composing = false;\n    view.compositionEndedAt = event.timeStamp;\n    scheduleComposeEnd(view, 20);\n  }\n};\n\nfunction scheduleComposeEnd(view, delay) {\n  clearTimeout(view.composingTimeout);\n  if (delay > -1) { view.composingTimeout = setTimeout(function () { return endComposition(view); }, delay); }\n}\n\nfunction clearComposition(view) {\n  if (view.composing) {\n    view.composing = false;\n    view.compositionEndedAt = timestampFromCustomEvent();\n  }\n  while (view.compositionNodes.length > 0) { view.compositionNodes.pop().markParentsDirty(); }\n}\n\nfunction timestampFromCustomEvent() {\n  var event = document.createEvent(\"Event\");\n  event.initEvent(\"event\", true, true);\n  return event.timeStamp\n}\n\nfunction endComposition(view, forceUpdate) {\n  view.domObserver.forceFlush();\n  clearComposition(view);\n  if (forceUpdate || view.docView.dirty) {\n    var sel = selectionFromDOM(view);\n    if (sel && !sel.eq(view.state.selection)) { view.dispatch(view.state.tr.setSelection(sel)); }\n    else { view.updateState(view.state); }\n    return true\n  }\n  return false\n}\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) { return }\n  var wrap = view.dom.parentNode.appendChild(document.createElement(\"div\"));\n  wrap.appendChild(dom);\n  wrap.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n  var 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(function () {\n    if (wrap.parentNode) { wrap.parentNode.removeChild(wrap); }\n    view.focus();\n  }, 50);\n}\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.\nvar brokenClipboardAPI = (result.ie && result.ie_version < 15) ||\n      (result.ios && result.webkit_version < 604);\n\nhandlers.copy = editHandlers.cut = function (view, e) {\n  var sel = view.state.selection, cut = e.type == \"cut\";\n  if (sel.empty) { return }\n\n  // IE and Edge's clipboard interface is completely broken\n  var data = brokenClipboardAPI ? null : e.clipboardData;\n  var slice = sel.content();\n  var ref = serializeForClipboard(view, slice);\n  var dom = ref.dom;\n  var text = ref.text;\n  if (data) {\n    e.preventDefault();\n    data.clearData();\n    data.setData(\"text/html\", dom.innerHTML);\n    data.setData(\"text/plain\", text);\n  } else {\n    captureCopy(view, dom);\n  }\n  if (cut) { view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta(\"uiEvent\", \"cut\")); }\n};\n\nfunction sliceSingleNode(slice) {\n  return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null\n}\n\nfunction capturePaste(view, e) {\n  if (!view.dom.parentNode) { return }\n  var plainText = view.shiftKey || view.state.selection.$from.parent.type.spec.code;\n  var target = view.dom.parentNode.appendChild(document.createElement(plainText ? \"textarea\" : \"div\"));\n  if (!plainText) { target.contentEditable = \"true\"; }\n  target.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n  target.focus();\n  setTimeout(function () {\n    view.focus();\n    if (target.parentNode) { target.parentNode.removeChild(target); }\n    if (plainText) { doPaste(view, target.value, null, e); }\n    else { doPaste(view, target.textContent, target.innerHTML, e); }\n  }, 50);\n}\n\nfunction doPaste(view, text, html, e) {\n  var slice = parseFromClipboard(view, text, html, view.shiftKey, view.state.selection.$from);\n  if (view.someProp(\"handlePaste\", function (f) { return f(view, e, slice || Slice.empty); })) { return true }\n  if (!slice) { return false }\n\n  var singleNode = sliceSingleNode(slice);\n  var tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, view.shiftKey) : view.state.tr.replaceSelection(slice);\n  view.dispatch(tr.scrollIntoView().setMeta(\"paste\", true).setMeta(\"uiEvent\", \"paste\"));\n  return true\n}\n\neditHandlers.paste = function (view, e) {\n  var data = brokenClipboardAPI ? null : e.clipboardData;\n  if (data && doPaste(view, data.getData(\"text/plain\"), data.getData(\"text/html\"), e)) { e.preventDefault(); }\n  else { capturePaste(view, e); }\n};\n\nvar Dragging = function Dragging(slice, move) {\n  this.slice = slice;\n  this.move = move;\n};\n\nvar dragCopyModifier = result.mac ? \"altKey\" : \"ctrlKey\";\n\nhandlers.dragstart = function (view, e) {\n  var mouseDown = view.mouseDown;\n  if (mouseDown) { mouseDown.done(); }\n  if (!e.dataTransfer) { return }\n\n  var sel = view.state.selection;\n  var pos = sel.empty ? null : view.posAtCoords(eventCoords(e));\n  if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1: sel.to)) ; else if (mouseDown && mouseDown.mightDrag) {\n    view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos)));\n  } else if (e.target && e.target.nodeType == 1) {\n    var desc = view.docView.nearestDesc(e.target, true);\n    if (desc && desc.node.type.spec.draggable && desc != view.docView)\n      { view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, desc.posBefore))); }\n  }\n  var slice = view.state.selection.content();\n  var ref = serializeForClipboard(view, slice);\n  var dom = ref.dom;\n  var text = ref.text;\n  e.dataTransfer.clearData();\n  e.dataTransfer.setData(brokenClipboardAPI ? \"Text\" : \"text/html\", dom.innerHTML);\n  // See https://github.com/ProseMirror/prosemirror/issues/1156\n  e.dataTransfer.effectAllowed = \"copyMove\";\n  if (!brokenClipboardAPI) { e.dataTransfer.setData(\"text/plain\", text); }\n  view.dragging = new Dragging(slice, !e[dragCopyModifier]);\n};\n\nhandlers.dragend = function (view) {\n  var dragging = view.dragging;\n  window.setTimeout(function () {\n    if (view.dragging == dragging)  { view.dragging = null; }\n  }, 50);\n};\n\neditHandlers.dragover = editHandlers.dragenter = function (_, e) { return e.preventDefault(); };\n\neditHandlers.drop = function (view, e) {\n  var dragging = view.dragging;\n  view.dragging = null;\n\n  if (!e.dataTransfer) { return }\n\n  var eventPos = view.posAtCoords(eventCoords(e));\n  if (!eventPos) { return }\n  var $mouse = view.state.doc.resolve(eventPos.pos);\n  if (!$mouse) { return }\n  var slice = dragging && dragging.slice;\n  if (slice) {\n    view.someProp(\"transformPasted\", function (f) { slice = f(slice); });\n  } else {\n    slice = parseFromClipboard(view, e.dataTransfer.getData(brokenClipboardAPI ? \"Text\" : \"text/plain\"),\n                               brokenClipboardAPI ? null : e.dataTransfer.getData(\"text/html\"), false, $mouse);\n  }\n  var move = dragging && !e[dragCopyModifier];\n  if (view.someProp(\"handleDrop\", function (f) { return f(view, e, slice || Slice.empty, move); })) {\n    e.preventDefault();\n    return\n  }\n  if (!slice) { return }\n\n  e.preventDefault();\n  var insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;\n  if (insertPos == null) { insertPos = $mouse.pos; }\n\n  var tr = view.state.tr;\n  if (move) { tr.deleteSelection(); }\n\n  var pos = tr.mapping.map(insertPos);\n  var isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;\n  var 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)) { return }\n\n  var $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  } else {\n    var end = tr.mapping.map(insertPos);\n    tr.mapping.maps[tr.mapping.maps.length - 1].forEach(function (_from, _to, _newFrom, newTo) { return end = newTo; });\n    tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));\n  }\n  view.focus();\n  view.dispatch(tr.setMeta(\"uiEvent\", \"drop\"));\n};\n\nhandlers.focus = function (view) {\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(function () {\n      if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.root.getSelection()))\n        { selectionToDOM(view); }\n    }, 20);\n  }\n};\n\nhandlers.blur = function (view, e) {\n  if (view.focused) {\n    view.domObserver.stop();\n    view.dom.classList.remove(\"ProseMirror-focused\");\n    view.domObserver.start();\n    if (e.relatedTarget && view.dom.contains(e.relatedTarget))\n      { view.domObserver.currentSelection.set({}); }\n    view.focused = false;\n  }\n};\n\nhandlers.beforeinput = function (view, 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\n  // Very specific hack to deal with backspace sometimes failing on\n  // Chrome Android when after an uneditable node.\n  if (result.chrome && result.android && event.inputType == \"deleteContentBackward\") {\n    var domChangeCount = view.domChangeCount;\n    setTimeout(function () {\n      if (view.domChangeCount != domChangeCount) { 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\", function (f) { return f(view, keyEvent(8, \"Backspace\")); })) { return }\n      var ref = view.state.selection;\n      var $cursor = ref.$cursor;\n      // Crude approximation of backspace behavior when no command handled it\n      if ($cursor && $cursor.pos > 0) { view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView()); }\n    }, 50);\n  }\n};\n\n// Make sure all handlers get registered\nfor (var prop in editHandlers) { handlers[prop] = editHandlers[prop]; }\n\nfunction compareObjs(a, b) {\n  if (a == b) { return true }\n  for (var p in a) { if (a[p] !== b[p]) { return false } }\n  for (var p$1 in b) { if (!(p$1 in a)) { return false } }\n  return true\n}\n\nvar WidgetType = function WidgetType(toDOM, spec) {\n  this.spec = spec || noSpec;\n  this.side = this.spec.side || 0;\n  this.toDOM = toDOM;\n};\n\nWidgetType.prototype.map = function map (mapping, span, offset, oldOffset) {\n  var ref = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);\n    var pos = ref.pos;\n    var deleted = ref.deleted;\n  return deleted ? null : new Decoration(pos - offset, pos - offset, this)\n};\n\nWidgetType.prototype.valid = function valid () { return true };\n\nWidgetType.prototype.eq = function 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\nvar InlineType = function InlineType(attrs, spec) {\n  this.spec = spec || noSpec;\n  this.attrs = attrs;\n};\n\nInlineType.prototype.map = function map (mapping, span, offset, oldOffset) {\n  var from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;\n  var to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;\n  return from >= to ? null : new Decoration(from, to, this)\n};\n\nInlineType.prototype.valid = function valid (_, span) { return span.from < span.to };\n\nInlineType.prototype.eq = function eq (other) {\n  return this == other ||\n    (other instanceof InlineType && compareObjs(this.attrs, other.attrs) &&\n     compareObjs(this.spec, other.spec))\n};\n\nInlineType.is = function is (span) { return span.type instanceof InlineType };\n\nvar NodeType = function NodeType(attrs, spec) {\n  this.spec = spec || noSpec;\n  this.attrs = attrs;\n};\n\nNodeType.prototype.map = function map (mapping, span, offset, oldOffset) {\n  var from = mapping.mapResult(span.from + oldOffset, 1);\n  if (from.deleted) { return null }\n  var to = mapping.mapResult(span.to + oldOffset, -1);\n  if (to.deleted || to.pos <= from.pos) { return null }\n  return new Decoration(from.pos - offset, to.pos - offset, this)\n};\n\nNodeType.prototype.valid = function valid (node, span) {\n  var ref = node.content.findIndex(span.from);\n    var index = ref.index;\n    var offset = ref.offset;\n    var child;\n  return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to\n};\n\nNodeType.prototype.eq = function eq (other) {\n  return this == other ||\n    (other instanceof NodeType && compareObjs(this.attrs, other.attrs) &&\n     compareObjs(this.spec, other.spec))\n};\n\n// ::- Decoration objects can be provided to the view through the\n// [`decorations` prop](#view.EditorProps.decorations). They come in\n// several variants—see the static members of this class for details.\nvar Decoration = function Decoration(from, to, type) {\n  // :: number\n  // The start position of the decoration.\n  this.from = from;\n  // :: number\n  // The end position. Will be the same as `from` for [widget\n  // decorations](#view.Decoration^widget).\n  this.to = to;\n  this.type = type;\n};\n\nvar prototypeAccessors$1 = { spec: { configurable: true },inline: { configurable: true } };\n\nDecoration.prototype.copy = function copy (from, to) {\n  return new Decoration(from, to, this.type)\n};\n\nDecoration.prototype.eq = function eq (other, offset) {\n    if ( offset === void 0 ) offset = 0;\n\n  return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to\n};\n\nDecoration.prototype.map = function map (mapping, offset, oldOffset) {\n  return this.type.map(mapping, this, offset, oldOffset)\n};\n\n// :: (number, union<(view: EditorView, getPos: () → number) → dom.Node, dom.Node>, ?Object) → Decoration\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// spec::- These options are supported:\n//\n//   side:: ?number\n//   Controls which side of the document position this widget is\n//   associated with. When negative, it is drawn before a cursor\n//   at its position, and content inserted at that position ends\n//   up after the widget. When zero (the default) or positive, the\n//   widget is drawn after the cursor and content inserted there\n//   ends up before the widget.\n//\n//   When there are multiple widgets at a given position, their\n//   `side` values determine the order in which they appear. Those\n//   with lower values appear first. The ordering of widgets with\n//   the same `side` value is unspecified.\n//\n//   When `marks` is null, `side` also determines the marks that\n//   the widget is wrapped in—those of the node before when\n//   negative, those of the node after when positive.\n//\n//   marks:: ?[Mark]\n//   The precise set of marks to draw around the widget.\n//\n//   stopEvent:: ?(event: dom.Event) → bool\n//   Can be used to control which DOM events, when they bubble out\n//   of this widget, the editor view should ignore.\n//\n//   ignoreSelection:: ?bool\n//   When set (defaults to false), selection changes inside the\n//   widget are ignored, and don't cause ProseMirror to try and\n//   re-sync the selection with its selection state.\n//\n//   key:: ?string\n//   When comparing decorations of this type (in order to decide\n//   whether it needs to be redrawn), ProseMirror will by default\n//   compare the widget DOM node by identity. If you pass a key,\n//   that key will be compared instead, which can be useful when\n//   you generate decorations on the fly and don't want to store\n//   and reuse DOM nodes. Make sure that any widgets with the same\n//   key are interchangeable—if widgets differ in, for example,\n//   the behavior of some event handler, they should get\n//   different keys.\nDecoration.widget = function widget (pos, toDOM, spec) {\n  return new Decoration(pos, pos, new WidgetType(toDOM, spec))\n};\n\n// :: (number, number, DecorationAttrs, ?Object) → Decoration\n// Creates an inline decoration, which adds the given attributes to\n// each inline node between `from` and `to`.\n//\n// spec::- These options are recognized:\n//\n//   inclusiveStart:: ?bool\n//   Determines how the left side of the decoration is\n//   [mapped](#transform.Position_Mapping) when content is\n//   inserted directly at that position. By default, the decoration\n//   won't include the new content, but you can set this to `true`\n//   to make it inclusive.\n//\n//   inclusiveEnd:: ?bool\n//   Determines how the right side of the decoration is mapped.\n//   See\n//   [`inclusiveStart`](#view.Decoration^inline^spec.inclusiveStart).\nDecoration.inline = function inline (from, to, attrs, spec) {\n  return new Decoration(from, to, new InlineType(attrs, spec))\n};\n\n// :: (number, number, DecorationAttrs, ?Object) → Decoration\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// spec::-\n//\n// Optional information to store with the decoration. It\n// is also used when comparing decorators for equality.\nDecoration.node = function node (from, to, attrs, spec) {\n  return new Decoration(from, to, new NodeType(attrs, spec))\n};\n\n// :: Object\n// The spec provided when creating this decoration. Can be useful\n// if you've stored extra information in that object.\nprototypeAccessors$1.spec.get = function () { return this.type.spec };\n\nprototypeAccessors$1.inline.get = function () { return this.type instanceof InlineType };\n\nObject.defineProperties( Decoration.prototype, prototypeAccessors$1 );\n\n// DecorationAttrs:: interface\n// A set of attributes to add to a decorated node. Most properties\n// simply directly correspond to DOM attributes of the same name,\n// which will be set to the property's value. These are exceptions:\n//\n//   class:: ?string\n//   A CSS class name or a space-separated set of class names to be\n//   _added_ to the classes that the node already had.\n//\n//   style:: ?string\n//   A string of CSS to be _added_ to the node's existing `style` property.\n//\n//   nodeName:: ?string\n//   When non-null, the target node is wrapped in a DOM element of\n//   this type (and the other attributes are applied to this element).\n\nvar none = [], noSpec = {};\n\n// :: class extends DecorationSource\n// A collection of [decorations](#view.Decoration), organized in\n// such a way that the drawing algorithm can efficiently use and\n// compare them. This is a persistent data structure—it is not\n// modified, updates create a new value.\nvar DecorationSet = function DecorationSet(local, children) {\n  this.local = local && local.length ? local : none;\n  this.children = children && children.length ? children : none;\n};\n\n// :: (Node, [Decoration]) → DecorationSet\n// Create a set of decorations, using the structure of the given\n// document.\nDecorationSet.create = function create (doc, decorations) {\n  return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty\n};\n\n// :: (?number, ?number, ?(spec: Object) → bool) → [Decoration]\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.\nDecorationSet.prototype.find = function find (start, end, predicate) {\n  var result = [];\n  this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);\n  return result\n};\n\nDecorationSet.prototype.findInner = function findInner (start, end, result, offset, predicate) {\n  for (var i = 0; i < this.local.length; i++) {\n    var 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 (var i$1 = 0; i$1 < this.children.length; i$1 += 3) {\n    if (this.children[i$1] < end && this.children[i$1 + 1] > start) {\n      var childOff = this.children[i$1] + 1;\n      this.children[i$1 + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);\n    }\n  }\n};\n\n// :: (Mapping, Node, ?Object) → DecorationSet\n// Map the set of decorations in response to a change in the\n// document.\n//\n// options::- An optional set of options.\n//\n//   onRemove:: ?(decorationSpec: Object)\n//   When given, this function will be called for each decoration\n//   that gets dropped as a result of the mapping, passing the\n//   spec of that decoration.\nDecorationSet.prototype.map = function map (mapping, doc, options) {\n  if (this == empty || mapping.maps.length == 0) { return this }\n  return this.mapInner(mapping, doc, 0, 0, options || noSpec)\n};\n\nDecorationSet.prototype.mapInner = function mapInner (mapping, node, offset, oldOffset, options) {\n  var newLocal;\n  for (var i = 0; i < this.local.length; i++) {\n    var mapped = this.local[i].map(mapping, offset, oldOffset);\n    if (mapped && mapped.type.valid(node, mapped)) { (newLocal || (newLocal = [])).push(mapped); }\n    else if (options.onRemove) { options.onRemove(this.local[i].spec); }\n  }\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)) : empty }\n};\n\n// :: (Node, [Decoration]) → DecorationSet\n// Add the given array of decorations to the ones in the set,\n// producing a new set. Needs access to the current document to\n// create the appropriate tree structure.\nDecorationSet.prototype.add = function add (doc, decorations) {\n  if (!decorations.length) { return this }\n  if (this == empty) { return DecorationSet.create(doc, decorations) }\n  return this.addInner(doc, decorations, 0)\n};\n\nDecorationSet.prototype.addInner = function addInner (doc, decorations, offset) {\n    var this$1 = this;\n\n  var children, childIndex = 0;\n  doc.forEach(function (childNode, childOffset) {\n    var baseOffset = childOffset + offset, found;\n    if (!(found = takeSpansForNode(decorations, childNode, baseOffset))) { return }\n\n    if (!children) { children = this$1.children.slice(); }\n    while (childIndex < children.length && children[childIndex] < childOffset) { 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\n  var local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);\n  for (var i = 0; i < local.length; i++) { if (!local[i].type.valid(doc, local[i])) { local.splice(i--, 1); } }\n\n  return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local,\n                           children || this.children)\n};\n\n// :: ([Decoration]) → DecorationSet\n// Create a new set that contains the decorations in this set, minus\n// the ones in the given array.\nDecorationSet.prototype.remove = function remove (decorations) {\n  if (decorations.length == 0 || this == empty) { return this }\n  return this.removeInner(decorations, 0)\n};\n\nDecorationSet.prototype.removeInner = function removeInner (decorations, offset) {\n  var children = this.children, local = this.local;\n  for (var i = 0; i < children.length; i += 3) {\n    var found = (void 0), from = children[i] + offset, to = children[i + 1] + offset;\n    for (var j = 0, span = (void 0); j < decorations.length; j++) { 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) { continue }\n    if (children == this.children) { children = this.children.slice(); }\n    var removed = children[i + 2].removeInner(found, from + 1);\n    if (removed != empty) {\n      children[i + 2] = removed;\n    } else {\n      children.splice(i, 3);\n      i -= 3;\n    }\n  }\n  if (local.length) { for (var i$1 = 0, span$1 = (void 0); i$1 < decorations.length; i$1++) { if (span$1 = decorations[i$1]) {\n    for (var j$1 = 0; j$1 < local.length; j$1++) { if (local[j$1].eq(span$1, offset)) {\n      if (local == this.local) { local = this.local.slice(); }\n      local.splice(j$1--, 1);\n    } }\n  } } }\n  if (children == this.children && local == this.local) { return this }\n  return local.length || children.length ? new DecorationSet(local, children) : empty\n};\n\nDecorationSet.prototype.forChild = function forChild (offset, node) {\n  if (this == empty) { return this }\n  if (node.isLeaf) { return DecorationSet.empty }\n\n  var child, local;\n  for (var i = 0; i < this.children.length; i += 3) { if (this.children[i] >= offset) {\n    if (this.children[i] == offset) { child = this.children[i + 2]; }\n    break\n  } }\n  var start = offset + 1, end = start + node.content.size;\n  for (var i$1 = 0; i$1 < this.local.length; i$1++) {\n    var dec = this.local[i$1];\n    if (dec.from < end && dec.to > start && (dec.type instanceof InlineType)) {\n      var from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;\n      if (from < to) { (local || (local = [])).push(dec.copy(from, to)); }\n    }\n  }\n  if (local) {\n    var localSet = new DecorationSet(local.sort(byPos));\n    return child ? new DecorationGroup([localSet, child]) : localSet\n  }\n  return child || empty\n};\n\nDecorationSet.prototype.eq = function eq (other) {\n  if (this == other) { return true }\n  if (!(other instanceof DecorationSet) ||\n      this.local.length != other.local.length ||\n      this.children.length != other.children.length) { return false }\n  for (var i = 0; i < this.local.length; i++)\n    { if (!this.local[i].eq(other.local[i])) { return false } }\n  for (var i$1 = 0; i$1 < this.children.length; i$1 += 3)\n    { if (this.children[i$1] != other.children[i$1] ||\n        this.children[i$1 + 1] != other.children[i$1 + 1] ||\n        !this.children[i$1 + 2].eq(other.children[i$1 + 2])) { return false } }\n  return true\n};\n\nDecorationSet.prototype.locals = function locals (node) {\n  return removeOverlap(this.localsInner(node))\n};\n\nDecorationSet.prototype.localsInner = function localsInner (node) {\n  if (this == empty) { return none }\n  if (node.inlineContent || !this.local.some(InlineType.is)) { return this.local }\n  var result = [];\n  for (var 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\n// DecorationSource:: interface\n// An object that can [provide](#view.EditorProps.decorations)\n// decorations. Implemented by [`DecorationSet`](#view.DecorationSet),\n// and passed to [node views](#view.EditorProps.nodeViews).\n//\n//   map:: (Mapping, Node) → DecorationSource\n//   Map the set of decorations in response to a change in the\n//   document.\n\nvar empty = new DecorationSet();\n\n// :: DecorationSet\n// The empty set of decorations.\nDecorationSet.empty = empty;\n\nDecorationSet.removeOverlap = removeOverlap;\n\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.\nvar DecorationGroup = function DecorationGroup(members) {\n  this.members = members;\n};\n\nDecorationGroup.prototype.map = function map (mapping, doc) {\n  var mappedDecos = this.members.map(\n    function (member) { return member.map(mapping, doc, noSpec); }\n  );\n  return DecorationGroup.from(mappedDecos)\n};\n\nDecorationGroup.prototype.forChild = function forChild (offset, child) {\n  if (child.isLeaf) { return DecorationSet.empty }\n  var found = [];\n  for (var i = 0; i < this.members.length; i++) {\n    var result = this.members[i].forChild(offset, child);\n    if (result == empty) { continue }\n    if (result instanceof DecorationGroup) { found = found.concat(result.members); }\n    else { found.push(result); }\n  }\n  return DecorationGroup.from(found)\n};\n\nDecorationGroup.prototype.eq = function eq (other) {\n  if (!(other instanceof DecorationGroup) ||\n      other.members.length != this.members.length) { return false }\n  for (var i = 0; i < this.members.length; i++)\n    { if (!this.members[i].eq(other.members[i])) { return false } }\n  return true\n};\n\nDecorationGroup.prototype.locals = function locals (node) {\n  var result, sorted = true;\n  for (var i = 0; i < this.members.length; i++) {\n    var locals = this.members[i].localsInner(node);\n    if (!locals.length) { continue }\n    if (!result) {\n      result = locals;\n    } else {\n      if (sorted) {\n        result = result.slice();\n        sorted = false;\n      }\n      for (var j = 0; j < locals.length; j++) { result.push(locals[j]); }\n    }\n  }\n  return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none\n};\n\n// : ([DecorationSet]) → union<DecorationSet, DecorationGroup>\n// Create a group for the given array of decoration sets, or return\n// a single set when possible.\nDecorationGroup.from = function from (members) {\n  switch (members.length) {\n    case 0: return empty\n    case 1: return members[0]\n    default: return new DecorationGroup(members)\n  }\n};\n\nfunction mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {\n  var children = oldChildren.slice();\n\n  // Mark the children that are directly touched by changes, and\n  // move those that are after the changes.\n  var shift = function (oldStart, oldEnd, newStart, newEnd) {\n    for (var i = 0; i < children.length; i += 3) {\n      var end = children[i + 1], dSize = (void 0);\n      if (end == -1 || oldStart > end + oldOffset) { continue }\n      if (oldEnd >= children[i] + oldOffset) {\n        children[i + 1] = -1;\n      } else if (newStart >= offset && (dSize = (newEnd - newStart) - (oldEnd - oldStart))) {\n        children[i] += dSize;\n        children[i + 1] += dSize;\n      }\n    }\n  };\n  for (var i = 0; i < mapping.maps.length; i++) { mapping.maps[i].forEach(shift); }\n\n  // Find the child nodes that still correspond to a single node,\n  // recursively call mapInner on them and update their positions.\n  var mustRebuild = false;\n  for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] == -1) { // Touched nodes\n    var from = mapping.map(oldChildren[i$1] + 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    var to = mapping.map(oldChildren[i$1 + 1] + oldOffset, -1), toLocal = to - offset;\n    var ref = node.content.findIndex(fromLocal);\n    var index = ref.index;\n    var childOffset = ref.offset;\n    var childNode = node.maybeChild(index);\n    if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {\n      var mapped = children[i$1 + 2].mapInner(mapping, childNode, from + 1, oldChildren[i$1] + oldOffset + 1, options);\n      if (mapped != empty) {\n        children[i$1] = fromLocal;\n        children[i$1 + 1] = toLocal;\n        children[i$1 + 2] = mapped;\n      } else {\n        children[i$1 + 1] = -2;\n        mustRebuild = true;\n      }\n    } else {\n      mustRebuild = true;\n    }\n  } }\n\n  // Remaining children must be collected and rebuilt into the appropriate structure\n  if (mustRebuild) {\n    var decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal || [], mapping,\n                                                       offset, oldOffset, options);\n    var built = buildTree(decorations, node, 0, options);\n    newLocal = built.local;\n    for (var i$2 = 0; i$2 < children.length; i$2 += 3) { if (children[i$2 + 1] < 0) {\n      children.splice(i$2, 3);\n      i$2 -= 3;\n    } }\n    for (var i$3 = 0, j = 0; i$3 < built.children.length; i$3 += 3) {\n      var from$1 = built.children[i$3];\n      while (j < children.length && children[j] < from$1) { j += 3; }\n      children.splice(j, 0, built.children[i$3], built.children[i$3 + 1], built.children[i$3 + 2]);\n    }\n  }\n\n  return new DecorationSet(newLocal && newLocal.sort(byPos), children)\n}\n\nfunction moveSpans(spans, offset) {\n  if (!offset || !spans.length) { return spans }\n  var result = [];\n  for (var i = 0; i < spans.length; i++) {\n    var span = spans[i];\n    result.push(new Decoration(span.from + offset, span.to + offset, span.type));\n  }\n  return result\n}\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 (var i = 0; i < set.local.length; i++) {\n      var mapped = set.local[i].map(mapping, offset, oldOffset);\n      if (mapped) { decorations.push(mapped); }\n      else if (options.onRemove) { options.onRemove(set.local[i].spec); }\n    }\n    for (var i$1 = 0; i$1 < set.children.length; i$1 += 3)\n      { gather(set.children[i$1 + 2], set.children[i$1] + oldOffset + 1); }\n  }\n  for (var i = 0; i < children.length; i += 3) { if (children[i + 1] == -1)\n    { gather(children[i + 2], oldChildren[i] + oldOffset + 1); } }\n\n  return decorations\n}\n\nfunction takeSpansForNode(spans, node, offset) {\n  if (node.isLeaf) { return null }\n  var end = offset + node.nodeSize, found = null;\n  for (var i = 0, span = (void 0); 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}\n\nfunction withoutNulls(array) {\n  var result = [];\n  for (var i = 0; i < array.length; i++)\n    { if (array[i] != null) { result.push(array[i]); } }\n  return result\n}\n\n// : ([Decoration], Node, number) → DecorationSet\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  var children = [], hasNulls = false;\n  node.forEach(function (childNode, localStart) {\n    var found = takeSpansForNode(spans, childNode, localStart + offset);\n    if (found) {\n      hasNulls = true;\n      var subtree = buildTree(found, childNode, offset + localStart + 1, options);\n      if (subtree != empty)\n        { children.push(localStart, localStart + childNode.nodeSize, subtree); }\n    }\n  });\n  var locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);\n  for (var i = 0; i < locals.length; i++) { if (!locals[i].type.valid(node, locals[i])) {\n    if (options.onRemove) { options.onRemove(locals[i].spec); }\n    locals.splice(i--, 1);\n  } }\n  return locals.length || children.length ? new DecorationSet(locals, children) : empty\n}\n\n// : (Decoration, Decoration) → number\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\n// : ([Decoration]) → [Decoration]\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  var working = spans;\n  for (var i = 0; i < working.length - 1; i++) {\n    var span = working[i];\n    if (span.from != span.to) { for (var j = i + 1; j < working.length; j++) {\n      var next = working[j];\n      if (next.from == span.from) {\n        if (next.to != span.to) {\n          if (working == spans) { 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      } else {\n        if (next.from < span.to) {\n          if (working == spans) { 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}\n\nfunction insertAhead(array, i, deco) {\n  while (i < array.length && byPos(deco, array[i]) > 0) { i++; }\n  array.splice(i, 0, deco);\n}\n\n// : (EditorView) → union<DecorationSet, DecorationGroup>\n// Get the decorations associated with the current props of a view.\nfunction viewDecorations(view) {\n  var found = [];\n  view.someProp(\"decorations\", function (f) {\n    var result = f(view.state);\n    if (result && result != empty) { 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\n// ::- An editor view manages the DOM structure that represents an\n// editable document. Its state and behavior are determined by its\n// [props](#view.DirectEditorProps).\nvar EditorView = function EditorView(place, props) {\n  this._props = props;\n  // :: EditorState\n  // The view's current [state](#state.EditorState).\n  this.state = props.state;\n\n  this.directPlugins = props.plugins || [];\n  this.directPlugins.forEach(checkStateComponent);\n\n  this.dispatch = this.dispatch.bind(this);\n\n  this._root = null;\n  this.focused = false;\n  // Kludge used to work around a Chrome bug\n  this.trackWrites = null;\n\n  // :: dom.Element\n  // An editable DOM node containing the document. (You probably\n  // should not directly interfere with its content.)\n  this.dom = (place && place.mount) || document.createElement(\"div\");\n  if (place) {\n    if (place.appendChild) { place.appendChild(this.dom); }\n    else if (place.apply) { place(this.dom); }\n    else if (place.mount) { this.mounted = true; }\n  }\n\n  // :: bool\n  // Indicates whether the editor is currently [editable](#view.EditorProps.editable).\n  this.editable = getEditable(this);\n  this.markCursor = null;\n  this.cursorWrapper = null;\n  updateCursorWrapper(this);\n  this.nodeViews = buildNodeViews(this);\n  this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);\n\n  this.lastSelectedViewDesc = null;\n  // :: ?{slice: Slice, move: bool}\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  this.dragging = null;\n\n  initInput(this);\n\n  this.prevDirectPlugins = [];\n  this.pluginViews = [];\n  this.updatePluginViews();\n};\n\nvar prototypeAccessors$2 = { props: { configurable: true },root: { configurable: true } };\n\n// composing:: boolean\n// Holds `true` when a\n// [composition](https://developer.mozilla.org/en-US/docs/Mozilla/IME_handling_guide)\n// is active.\n\n// :: DirectEditorProps\n// The view's current [props](#view.EditorProps).\nprototypeAccessors$2.props.get = function () {\n  if (this._props.state != this.state) {\n    var prev = this._props;\n    this._props = {};\n    for (var name in prev) { this._props[name] = prev[name]; }\n    this._props.state = this.state;\n  }\n  return this._props\n};\n\n// :: (DirectEditorProps)\n// Update the view's props. Will immediately cause an update to\n// the DOM.\nEditorView.prototype.update = function update (props) {\n  if (props.handleDOMEvents != this._props.handleDOMEvents) { ensureListeners(this); }\n  this._props = props;\n  if (props.plugins) {\n    props.plugins.forEach(checkStateComponent);\n    this.directPlugins = props.plugins;\n  }\n  this.updateStateInner(props.state, true);\n};\n\n// :: (DirectEditorProps)\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))`.\nEditorView.prototype.setProps = function setProps (props) {\n  var updated = {};\n  for (var name in this._props) { updated[name] = this._props[name]; }\n  updated.state = this.state;\n  for (var name$1 in props) { updated[name$1] = props[name$1]; }\n  this.update(updated);\n};\n\n// :: (EditorState)\n// Update the editor's `state` prop, without touching any of the\n// other props.\nEditorView.prototype.updateState = function updateState (state) {\n  this.updateStateInner(state, this.state.plugins != state.plugins);\n};\n\nEditorView.prototype.updateStateInner = function updateStateInner (state, reconfigured) {\n    var this$1 = this;\n\n  var 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  if (reconfigured) {\n    var nodeViews = buildNodeViews(this);\n    if (changedNodeViews(nodeViews, this.nodeViews)) {\n      this.nodeViews = nodeViews;\n      redraw = true;\n    }\n    ensureListeners(this);\n  }\n\n  this.editable = getEditable(this);\n  updateCursorWrapper(this);\n  var innerDeco = viewDecorations(this), outerDeco = computeDocDeco(this);\n\n  var scroll = reconfigured ? \"reset\"\n      : state.scrollToSelection > prev.scrollToSelection ? \"to selection\" : \"preserve\";\n  var updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);\n  if (updateDoc || !state.selection.eq(prev.selection)) { updateSel = true; }\n  var oldScrollPos = scroll == \"preserve\" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);\n\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    var forceSelUpdate = updateDoc && (result.ie || result.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      var chromeKludge = result.chrome ? (this.trackWrites = this.root.getSelection().focusNode) : null;\n      if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {\n        this.docView.updateOuterDeco([]);\n        this.docView.destroy();\n        this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);\n      }\n      if (chromeKludge && !this.trackWrites) { 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    if (forceSelUpdate ||\n        !(this.mouseDown && this.domObserver.currentSelection.eq(this.root.getSelection()) && anchorInRightPlace(this))) {\n      selectionToDOM(this, forceSelUpdate);\n    } else {\n      syncNodeSelection(this, state.selection);\n      this.domObserver.setCurSelection();\n    }\n    this.domObserver.start();\n  }\n\n  this.updatePluginViews(prev);\n\n  if (scroll == \"reset\") {\n    this.dom.scrollTop = 0;\n  } else if (scroll == \"to selection\") {\n    var startDOM = this.root.getSelection().focusNode;\n    if (this.someProp(\"handleScrollToSelection\", function (f) { return f(this$1); }))\n      ; // Handled\n    else if (state.selection instanceof NodeSelection)\n      { scrollRectIntoView(this, this.docView.domAfterPos(state.selection.from).getBoundingClientRect(), startDOM); }\n    else\n      { scrollRectIntoView(this, this.coordsAtPos(state.selection.head, 1), startDOM); }\n  } else if (oldScrollPos) {\n    resetScrollPos(oldScrollPos);\n  }\n};\n\nEditorView.prototype.destroyPluginViews = function destroyPluginViews () {\n  var view;\n  while (view = this.pluginViews.pop()) { if (view.destroy) { view.destroy(); } }\n};\n\nEditorView.prototype.updatePluginViews = function updatePluginViews (prevState) {\n  if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {\n    this.prevDirectPlugins = this.directPlugins;\n    this.destroyPluginViews();\n    for (var i = 0; i < this.directPlugins.length; i++) {\n      var plugin = this.directPlugins[i];\n      if (plugin.spec.view) { this.pluginViews.push(plugin.spec.view(this)); }\n    }\n    for (var i$1 = 0; i$1 < this.state.plugins.length; i$1++) {\n      var plugin$1 = this.state.plugins[i$1];\n      if (plugin$1.spec.view) { this.pluginViews.push(plugin$1.spec.view(this)); }\n    }\n  } else {\n    for (var i$2 = 0; i$2 < this.pluginViews.length; i$2++) {\n      var pluginView = this.pluginViews[i$2];\n      if (pluginView.update) { pluginView.update(this, prevState); }\n    }\n  }\n};\n\n// :: (string, ?(prop: *) → *) → *\n// Goes over the values of a prop, first those provided directly,\n// then those from plugins given to the view, then from plugins in\n// the state (in order), and calls `f` every time a non-undefined\n// value is found. When `f` returns a truthy value, that is\n// immediately returned. When `f` isn't provided, it is treated as\n// the identity function (the prop value is returned directly).\nEditorView.prototype.someProp = function someProp (propName, f) {\n  var prop = this._props && this._props[propName], value;\n  if (prop != null && (value = f ? f(prop) : prop)) { return value }\n  for (var i = 0; i < this.directPlugins.length; i++) {\n    var prop$1 = this.directPlugins[i].props[propName];\n    if (prop$1 != null && (value = f ? f(prop$1) : prop$1)) { return value }\n  }\n  var plugins = this.state.plugins;\n  if (plugins) { for (var i$1 = 0; i$1 < plugins.length; i$1++) {\n    var prop$2 = plugins[i$1].props[propName];\n    if (prop$2 != null && (value = f ? f(prop$2) : prop$2)) { return value }\n  } }\n};\n\n// :: () → bool\n// Query whether the view has focus.\nEditorView.prototype.hasFocus = function hasFocus () {\n  return this.root.activeElement == this.dom\n};\n\n// :: ()\n// Focus the editor.\nEditorView.prototype.focus = function focus () {\n  this.domObserver.stop();\n  if (this.editable) { focusPreventScroll(this.dom); }\n  selectionToDOM(this);\n  this.domObserver.start();\n};\n\n// :: union<dom.Document, dom.DocumentFragment>\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.\nprototypeAccessors$2.root.get = function () {\n  var cached = this._root;\n  if (cached == null) { for (var search = this.dom.parentNode; search; search = search.parentNode) {\n    if (search.nodeType == 9 || (search.nodeType == 11 && search.host)) {\n      if (!search.getSelection) { Object.getPrototypeOf(search).getSelection = function () { return document.getSelection(); }; }\n      return this._root = search\n    }\n  } }\n  return cached || document\n};\n\n// :: ({left: number, top: number}) → ?{pos: number, inside: number}\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.\nEditorView.prototype.posAtCoords = function posAtCoords$1 (coords) {\n  return posAtCoords(this, coords)\n};\n\n// :: (number, number) → {left: number, right: number, top: number, bottom: number}\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 is\n// used. When < 0, the element before the position is used,\n// otherwise the element after.\nEditorView.prototype.coordsAtPos = function coordsAtPos$1 (pos, side) {\n    if ( side === void 0 ) side = 1;\n\n  return coordsAtPos(this, pos, side)\n};\n\n// :: (number, number) → {node: dom.Node, offset: number}\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).\nEditorView.prototype.domAtPos = function domAtPos (pos, side) {\n    if ( side === void 0 ) side = 0;\n\n  return this.docView.domFromPos(pos, side)\n};\n\n// :: (number) → ?dom.Node\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.\nEditorView.prototype.nodeDOM = function nodeDOM (pos) {\n  var desc = this.docView.descAt(pos);\n  return desc ? desc.nodeDOM : null\n};\n\n// :: (dom.Node, number, ?number) → number\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.\nEditorView.prototype.posAtDOM = function posAtDOM (node, offset, bias) {\n    if ( bias === void 0 ) bias = -1;\n\n  var pos = this.docView.posFromDOM(node, offset, bias);\n  if (pos == null) { throw new RangeError(\"DOM position not inside the editor\") }\n  return pos\n};\n\n// :: (union<\"up\", \"down\", \"left\", \"right\", \"forward\", \"backward\">, ?EditorState) → bool\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.\nEditorView.prototype.endOfTextblock = function endOfTextblock$1 (dir, state) {\n  return endOfTextblock(this, state || this.state, dir)\n};\n\n// :: ()\n// Removes the editor from the DOM and destroys all [node\n// views](#view.NodeView).\nEditorView.prototype.destroy = function destroy () {\n  if (!this.docView) { 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  } else if (this.dom.parentNode) {\n    this.dom.parentNode.removeChild(this.dom);\n  }\n  this.docView.destroy();\n  this.docView = null;\n};\n\n// Used for testing.\nEditorView.prototype.dispatchEvent = function dispatchEvent$1 (event) {\n  return dispatchEvent(this, event)\n};\n\n// :: (Transaction)\n// Dispatch a transaction. Will call\n// [`dispatchTransaction`](#view.DirectEditorProps.dispatchTransaction)\n// when given, and otherwise defaults to applying the transaction to\n// the current state and calling\n// [`updateState`](#view.EditorView.updateState) with the result.\n// This method is bound to the view instance, so that it can be\n// easily passed around.\nEditorView.prototype.dispatch = function dispatch (tr) {\n  var dispatchTransaction = this._props.dispatchTransaction;\n  if (dispatchTransaction) { dispatchTransaction.call(this, tr); }\n  else { this.updateState(this.state.apply(tr)); }\n};\n\nObject.defineProperties( EditorView.prototype, prototypeAccessors$2 );\n\nfunction computeDocDeco(view) {\n  var attrs = Object.create(null);\n  attrs.class = \"ProseMirror\";\n  attrs.contenteditable = String(view.editable);\n  attrs.translate = \"no\";\n\n  view.someProp(\"attributes\", function (value) {\n    if (typeof value == \"function\") { value = value(view.state); }\n    if (value) { for (var attr in value) {\n      if (attr == \"class\")\n        { attrs.class += \" \" + value[attr]; }\n      else if (!attrs[attr] && attr != \"contenteditable\" && attr != \"nodeName\")\n        { attrs[attr] = String(value[attr]); }\n    } }\n  });\n\n  return [Decoration.node(0, view.state.doc.content.size, attrs)]\n}\n\nfunction updateCursorWrapper(view) {\n  if (view.markCursor) {\n    var dom = document.createElement(\"img\");\n    dom.className = \"ProseMirror-separator\";\n    dom.setAttribute(\"mark-placeholder\", \"true\");\n    view.cursorWrapper = {dom: dom, deco: Decoration.widget(view.state.selection.head, dom, {raw: true, marks: view.markCursor})};\n  } else {\n    view.cursorWrapper = null;\n  }\n}\n\nfunction getEditable(view) {\n  return !view.someProp(\"editable\", function (value) { return value(view.state) === false; })\n}\n\nfunction selectionContextChanged(sel1, sel2) {\n  var depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));\n  return sel1.$anchor.start(depth) != sel2.$anchor.start(depth)\n}\n\nfunction buildNodeViews(view) {\n  var result = {};\n  view.someProp(\"nodeViews\", function (obj) {\n    for (var prop in obj) { if (!Object.prototype.hasOwnProperty.call(result, prop))\n      { result[prop] = obj[prop]; } }\n  });\n  return result\n}\n\nfunction changedNodeViews(a, b) {\n  var nA = 0, nB = 0;\n  for (var prop in a) {\n    if (a[prop] != b[prop]) { return true }\n    nA++;\n  }\n  for (var _ in b) { nB++; }\n  return nA != nB\n}\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\n// EditorProps:: interface\n//\n// Props are configuration values that can be passed to an editor view\n// or included in a plugin. This interface lists the supported props.\n//\n// The various event-handling functions may all return `true` to\n// indicate that they handled the given event. The view will then take\n// care to call `preventDefault` on the event, except with\n// `handleDOMEvents`, where the handler itself is responsible for that.\n//\n// How a prop is resolved depends on the prop. Handler functions are\n// called one at a time, starting with the base props and then\n// searching through the plugins (in order of appearance) until one of\n// them returns true. For some props, the first plugin that yields a\n// value gets precedence.\n//\n//   handleDOMEvents:: ?Object<(view: EditorView, event: dom.Event) → bool>\n//   Can be an object mapping DOM event type names to functions that\n//   handle them. Such functions will be called before any handling\n//   ProseMirror does of events fired on the editable DOM element.\n//   Contrary to the other event handling props, when returning true\n//   from such a function, you are responsible for calling\n//   `preventDefault` yourself (or not, if you want to allow the\n//   default behavior).\n//\n//   handleKeyDown:: ?(view: EditorView, event: dom.KeyboardEvent) → bool\n//   Called when the editor receives a `keydown` event.\n//\n//   handleKeyPress:: ?(view: EditorView, event: dom.KeyboardEvent) → bool\n//   Handler for `keypress` events.\n//\n//   handleTextInput:: ?(view: EditorView, from: number, to: number, text: string) → bool\n//   Whenever the user directly input text, this handler is called\n//   before the input is applied. If it returns `true`, the default\n//   behavior of actually inserting the text is suppressed.\n//\n//   handleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n//   Called for each node around a click, from the inside out. The\n//   `direct` flag will be true for the inner node.\n//\n//   handleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n//   Called when the editor is clicked, after `handleClickOn` handlers\n//   have been called.\n//\n//   handleDoubleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n//   Called for each node around a double click.\n//\n//   handleDoubleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n//   Called when the editor is double-clicked, after `handleDoubleClickOn`.\n//\n//   handleTripleClickOn:: ?(view: EditorView, pos: number, node: Node, nodePos: number, event: dom.MouseEvent, direct: bool) → bool\n//   Called for each node around a triple click.\n//\n//   handleTripleClick:: ?(view: EditorView, pos: number, event: dom.MouseEvent) → bool\n//   Called when the editor is triple-clicked, after `handleTripleClickOn`.\n//\n//   handlePaste:: ?(view: EditorView, event: dom.ClipboardEvent, slice: Slice) → bool\n//   Can be used to override the behavior of pasting. `slice` is the\n//   pasted content parsed by the editor, but you can directly access\n//   the event to get at the raw content.\n//\n//   handleDrop:: ?(view: EditorView, event: dom.Event, slice: Slice, moved: bool) → bool\n//   Called when something is dropped on the editor. `moved` will be\n//   true if this drop moves from the current selection (which should\n//   thus be deleted).\n//\n//   handleScrollToSelection:: ?(view: EditorView) → bool\n//   Called when the view, after updating its state, tries to scroll\n//   the selection into view. A handler function may return false to\n//   indicate that it did not handle the scrolling and further\n//   handlers or the default behavior should be tried.\n//\n//   createSelectionBetween:: ?(view: EditorView, anchor: ResolvedPos, head: ResolvedPos) → ?Selection\n//   Can be used to override the way a selection is created when\n//   reading a DOM selection between the given anchor and head.\n//\n//   domParser:: ?DOMParser\n//   The [parser](#model.DOMParser) to use when reading editor changes\n//   from the DOM. Defaults to calling\n//   [`DOMParser.fromSchema`](#model.DOMParser^fromSchema) on the\n//   editor's schema.\n//\n//   transformPastedHTML:: ?(html: string) → string\n//   Can be used to transform pasted HTML text, _before_ it is parsed,\n//   for example to clean it up.\n//\n//   clipboardParser:: ?DOMParser\n//   The [parser](#model.DOMParser) to use when reading content from\n//   the clipboard. When not given, the value of the\n//   [`domParser`](#view.EditorProps.domParser) prop is used.\n//\n//   transformPastedText:: ?(text: string, plain: bool) → string\n//   Transform pasted plain text. The `plain` flag will be true when\n//   the text is pasted as plain text.\n//\n//   clipboardTextParser:: ?(text: string, $context: ResolvedPos, plain: bool) → Slice\n//   A function to parse text from the clipboard into a document\n//   slice. Called after\n//   [`transformPastedText`](#view.EditorProps.transformPastedText).\n//   The default behavior is to split the text into lines, wrap them\n//   in `<p>` tags, and call\n//   [`clipboardParser`](#view.EditorProps.clipboardParser) on it.\n//   The `plain` flag will be true when the text is pasted as plain text.\n//\n//   transformPasted:: ?(Slice) → Slice\n//   Can be used to transform pasted content before it is applied to\n//   the document.\n//\n//   nodeViews:: ?Object<(node: Node, view: EditorView, getPos: () → number, decorations: [Decoration], innerDecorations: DecorationSource) → NodeView>\n//   Allows you to pass custom rendering and behavior logic for nodes\n//   and marks. Should map node and mark names to constructor\n//   functions that produce a [`NodeView`](#view.NodeView) object\n//   implementing the node's display behavior. For nodes, the third\n//   argument `getPos` is a function that can be called to get the\n//   node's current position, which can be useful when creating\n//   transactions to update it. For marks, the third argument is a\n//   boolean that indicates whether the mark's content is inline.\n//\n//   `decorations` is an array of node or inline decorations that are\n//   active around the node. They are automatically drawn in the\n//   normal way, and you will usually just want to ignore this, but\n//   they can also be used as a way to provide context information to\n//   the node view without adding it to the document itself.\n//\n//   `innerDecorations` holds the decorations for the node's content.\n//   You can safely ignore this if your view has no content or a\n//   `contentDOM` property, since the editor will draw the decorations\n//   on the content. But if you, for example, want to create a nested\n//   editor with the content, it may make sense to provide it with the\n//   inner decorations.\n//\n//   clipboardSerializer:: ?DOMSerializer\n//   The DOM serializer to use when putting content onto the\n//   clipboard. If not given, the result of\n//   [`DOMSerializer.fromSchema`](#model.DOMSerializer^fromSchema)\n//   will be used.\n//\n//   clipboardTextSerializer:: ?(Slice) → string\n//   A function that will be called to get the text for the current\n//   selection when copying text to the clipboard. By default, the\n//   editor will use [`textBetween`](#model.Node.textBetween) on the\n//   selected range.\n//\n//   decorations:: ?(state: EditorState) → ?DecorationSource\n//   A set of [document decorations](#view.Decoration) to show in the\n//   view.\n//\n//   editable:: ?(state: EditorState) → bool\n//   When this returns false, the content of the view is not directly\n//   editable.\n//\n//   attributes:: ?union<Object<string>, (EditorState) → ?Object<string>>\n//   Control the DOM attributes of the editable element. May be either\n//   an object or a function going from an editor state to an object.\n//   By default, the element will get a class `\"ProseMirror\"`, and\n//   will have its `contentEditable` attribute determined by the\n//   [`editable` prop](#view.EditorProps.editable). Additional classes\n//   provided here will be added to the class. For other attributes,\n//   the value provided first (as in\n//   [`someProp`](#view.EditorView.someProp)) will be used.\n//\n//   scrollThreshold:: ?union<number, {top: number, right: number, bottom: number, left: number}>\n//   Determines the distance (in pixels) between the cursor and the\n//   end of the visible viewport at which point, when scrolling the\n//   cursor into view, scrolling takes place. Defaults to 0.\n//\n//   scrollMargin:: ?union<number, {top: number, right: number, bottom: number, left: number}>\n//   Determines the extra space (in pixels) that is left above or\n//   below the cursor when it is scrolled into view. Defaults to 5.\n\n// DirectEditorProps:: interface extends EditorProps\n//\n// The props object given directly to the editor view supports two\n// fields that can't be used in plugins:\n//\n//   state:: EditorState\n//   The current state of the editor.\n//\n//   plugins:: [Plugin]\n//   A set of plugins to use in the view, applying their [plugin\n//   view](#state.PluginSpec.view) and\n//   [props](#state.PluginSpec.props). Passing plugins with a state\n//   component (a [state field](#state.PluginSpec.state) field or a\n//   [transaction)[#state.PluginSpec.filterTransaction] filter or\n//   appender) will result in an error, since such plugins must be\n//   present in the state to work.\n//\n//   dispatchTransaction:: ?(tr: Transaction)\n//   The callback over which to send transactions (state updates)\n//   produced by the view. If you specify this, you probably want to\n//   make sure this ends up calling the view's\n//   [`updateState`](#view.EditorView.updateState) method with a new\n//   state that has the transaction\n//   [applied](#state.EditorState.apply). The callback will be bound to have\n//   the view instance as its `this` binding.\n\nexport { Decoration, DecorationSet, EditorView, endComposition as __endComposition, parseFromClipboard as __parseFromClipboard, serializeForClipboard as __serializeForClipboard };\n//# sourceMappingURL=index.es.js.map\n"],"sourceRoot":""}